|
|
|
package com.fr.design.mainframe.backgroundpane;
|
|
|
|
|
|
|
|
import com.fr.base.background.ColorBackground;
|
|
|
|
import com.fr.design.event.UIObserverListener;
|
|
|
|
import com.fr.design.layout.FRGUIPaneFactory;
|
|
|
|
import com.fr.design.style.color.NewColorSelectBox;
|
|
|
|
import com.fr.general.Background;
|
|
|
|
import java.awt.BorderLayout;
|
|
|
|
import java.awt.Color;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author zhou
|
|
|
|
* @since 2012-5-29下午1:12:14
|
|
|
|
*/
|
|
|
|
public class ColorBackgroundQuickPane extends BackgroundQuickPane {
|
|
|
|
|
|
|
|
private NewColorSelectBox colorSelectBox;
|
|
|
|
|
|
|
|
public ColorBackgroundQuickPane(boolean supportTransparent) {
|
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout());
|
|
|
|
colorSelectBox = new NewColorSelectBox(100, supportTransparent) {
|
|
|
|
@Override
|
|
|
|
public boolean shouldResponseChangeListener() {
|
|
|
|
// ColorBackgroundQuickPane注册监听器ChangeListenerImpl的逻辑不能丢,因为里面有修改字段backgroundChange的逻辑.
|
|
|
|
// 所以在监听器重复注册以及UndoState重复生成时,应该保留ChangeListenerImpl, 而放弃NewColorSelectBox内部自己注册
|
|
|
|
// ChangeListener
|
|
|
|
// REPORT-63760 【主题切换】撤销以后,样式设置有问题
|
|
|
|
// REPORT-64006 【模板主题】单元格自定义样式背景色设置不生效
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
this.add(colorSelectBox, BorderLayout.NORTH);
|
|
|
|
}
|
|
|
|
|
|
|
|
public ColorBackgroundQuickPane() {
|
|
|
|
this(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void populateBean(Background background) {
|
|
|
|
ColorBackground colorBackgroud = (ColorBackground) background;
|
|
|
|
populateColor(colorBackgroud.getColor());
|
|
|
|
}
|
|
|
|
|
|
|
|
public Background updateBean() {
|
|
|
|
return ColorBackground.getInstance(updateColor());
|
|
|
|
}
|
|
|
|
|
|
|
|
public void populateColor(Color color) {
|
|
|
|
this.colorSelectBox.setSelectObject(color);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Color updateColor() {
|
|
|
|
return this.colorSelectBox.getSelectObject();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void registerChangeListener(final UIObserverListener listener) {
|
|
|
|
this.colorSelectBox.addSelectChangeListener(new ChangeListenerImpl(listener));
|
|
|
|
}
|
|
|
|
|
|
|
|
@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.colorSelectBox.setSelectObject(null);
|
|
|
|
}
|
|
|
|
}
|