Browse Source

CHART-3044 新增构造器,初始化自定义颜色

final/10.0
Wim.Zhai 6 years ago
parent
commit
ceea3afd28
  1. 113
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java
  2. 16
      designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java

113
designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java

@ -6,7 +6,6 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.color.NewColorSelectPane;
import com.fr.general.Background;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
@ -18,18 +17,24 @@ import java.awt.Color;
*/
public class ColorBackgroundQuickPane extends BackgroundQuickPane {
private NewColorSelectPane detailColorSelectPane;
private boolean isBackGroundColor;
private NewColorSelectPane detailColorSelectPane;
private boolean isBackGroundColor;
public ColorBackgroundQuickPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
detailColorSelectPane = new NewColorSelectPane();
this.add(detailColorSelectPane, BorderLayout.NORTH);
}
public ColorBackgroundQuickPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
public ColorBackgroundQuickPane(Color color) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
detailColorSelectPane = new NewColorSelectPane(color);
this.add(detailColorSelectPane, BorderLayout.NORTH);
}
detailColorSelectPane = new NewColorSelectPane();
this.add(detailColorSelectPane, BorderLayout.NORTH);
}
public void populateBean(Background background) {
ColorBackground colorBackgroud = (ColorBackground) background;
public void populateBean(Background background) {
ColorBackground colorBackgroud = (ColorBackground) background;
populateColor(colorBackgroud.getColor());
}
@ -47,48 +52,48 @@ public class ColorBackgroundQuickPane extends BackgroundQuickPane {
return this.detailColorSelectPane.getNotNoneColor();
}
public boolean isBackGroundColor(){
return isBackGroundColor;
}
/**
* 给组件登记一个观察者监听事件
*
* @param listener 观察者监听事件
*/
public void registerChangeListener(final UIObserverListener listener) {
detailColorSelectPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
isBackGroundColor = true;
listener.doChange();
isBackGroundColor = false;
}
});
}
@Override
/**
* 是否为ColorBackground 类型
*
* @param background 背景
* @return 同上
*
*/
public boolean accept(Background background) {
return background instanceof ColorBackground;
}
@Override
/**
* 窗口名称
* @return 同上
*/
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Color");
}
@Override
public void reset() {
this.detailColorSelectPane.setColor(null);
}
public boolean isBackGroundColor() {
return isBackGroundColor;
}
/**
* 给组件登记一个观察者监听事件
*
* @param listener 观察者监听事件
*/
public void registerChangeListener(final UIObserverListener listener) {
detailColorSelectPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
isBackGroundColor = true;
listener.doChange();
isBackGroundColor = false;
}
});
}
@Override
/**
* 是否为ColorBackground 类型
*
* @param background 背景
* @return 同上
*
*/
public boolean accept(Background background) {
return background instanceof ColorBackground;
}
@Override
/**
* 窗口名称
* @return 同上
*/
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Color");
}
@Override
public void reset() {
this.detailColorSelectPane.setColor(null);
}
}

16
designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java

@ -8,11 +8,16 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@ -49,6 +54,11 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
this(false);
}
public NewColorSelectPane(Color color) {
this(false);
this.setColor(color);
}
/**
* Constructor.
*/

Loading…
Cancel
Save