Browse Source

REPORT-56548 主题切换-主题色

research/11.0
kerry 3 years ago
parent
commit
6f38809306
  1. 5
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 12
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java
  3. 36
      designer-base/src/main/java/com/fr/design/gui/ibutton/UINoThemeColorButton.java
  4. 17
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  5. 5
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java
  6. 53
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ColorDetailPane.java
  7. 2
      designer-base/src/main/java/com/fr/design/report/WatermarkPane.java
  8. 6
      designer-base/src/main/java/com/fr/design/style/CustomSelectBox.java
  9. 7
      designer-base/src/main/java/com/fr/design/style/background/BackgroundPane.java
  10. 6
      designer-base/src/main/java/com/fr/design/style/background/impl/ColorBackgroundPane.java
  11. 10
      designer-base/src/main/java/com/fr/design/style/background/impl/ColorNoThemeBackgroundPane.java
  12. 7
      designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java
  13. 10
      designer-base/src/main/java/com/fr/design/style/color/ColorButton.java
  14. 12
      designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java
  15. 2
      designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java
  16. 12
      designer-base/src/main/java/com/fr/design/style/color/ColorSelectBox.java
  17. 14
      designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java
  18. 1
      designer-base/src/main/java/com/fr/design/style/color/ColorSelectDialog.java
  19. 1
      designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java
  20. 10
      designer-base/src/main/java/com/fr/design/style/color/DetailColorSelectPane.java
  21. 24
      designer-base/src/main/java/com/fr/design/style/color/FineColorCell.java
  22. 4
      designer-base/src/main/java/com/fr/design/style/color/NewColorSelectBox.java
  23. 237
      designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java
  24. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ColorSelectBoxWithOutTransparent.java
  25. 16
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java
  26. 22
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane4Map.java
  27. 12
      designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java
  28. 3
      designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java

5
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -12,6 +12,7 @@ import com.fr.design.editor.editor.IntegerEditor;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UINoThemeColorButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIDictionaryComboBox;
@ -457,10 +458,10 @@ public class PreferencePane extends BasicPane {
JPanel colorSettingPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Setting_Colors"));
generalPane.add(colorSettingPane);
gridLineColorTBButton = new UIColorButton(IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png"));
gridLineColorTBButton = new UINoThemeColorButton(IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png"));
gridLineColorTBButton.setEnabled(this.isEnabled());
paginationLineColorTBButton = new UIColorButton(IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png"));
paginationLineColorTBButton = new UINoThemeColorButton(IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png"));
paginationLineColorTBButton.setEnabled(this.isEnabled());
JPanel leftPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();

12
designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java

@ -154,7 +154,14 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G
protected ColorControlWindow getColorControlWindow() {
//find parant.
if (this.popupWin == null) {
this.popupWin = new ColorControlWindow(UIColorButton.this) {
this.popupWin = initColorControlWindow();
}
return popupWin;
}
protected ColorControlWindow initColorControlWindow(){
return new ColorControlWindow(UIColorButton.this) {
@Override
protected void colorChanged() {
UIColorButton.this.setColor(this.getColor());
@ -163,9 +170,6 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G
};
}
return popupWin;
}
/**
* 添加监听
*

36
designer-base/src/main/java/com/fr/design/gui/ibutton/UINoThemeColorButton.java

@ -0,0 +1,36 @@
package com.fr.design.gui.ibutton;
import com.fr.design.gui.ipoppane.PopupHider;
import com.fr.design.style.color.ColorControlWindow;
import javax.swing.Icon;
public class UINoThemeColorButton extends UIColorButton{
public UINoThemeColorButton(Icon icon) {
super(icon);
}
protected ColorControlWindow initColorControlWindow(){
return new NoThemeColorControlWindow(this);
}
private class NoThemeColorControlWindow extends ColorControlWindow{
public NoThemeColorControlWindow(PopupHider popupHider) {
super(popupHider);
}
protected boolean supportThemeColor(){
return false;
}
@Override
protected void colorChanged() {
UINoThemeColorButton.this.setColor(this.getColor());
}
}
}

17
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -177,6 +177,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
//用于判断设计器是否打开了
private boolean designerOpened = false;
private boolean serverConfig = false;
private int contentWidth = (int) (java.awt.Toolkit.getDefaultToolkit().getScreenSize().getWidth());
private int contentHeight = (int) (java.awt.Toolkit.getDefaultToolkit().getScreenSize().getHeight());
@ -1339,4 +1341,19 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
return designerOpened;
}
/**
* 判断是否正在进行服务器配置
* @return boolean
*/
public boolean isServerConfig() {
return serverConfig;
}
/**
* 设置是否正在进行服务器配置
* @param serverConfig
*/
public void setServerConfig(boolean serverConfig) {
this.serverConfig = serverConfig;
}
}

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

@ -6,9 +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;
import java.awt.Color;
@ -23,7 +20,7 @@ public class ColorBackgroundQuickPane extends BackgroundQuickPane {
public ColorBackgroundQuickPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
detailColorSelectPane = new NewColorSelectPane();
detailColorSelectPane = new NewColorSelectPane(false);
this.add(detailColorSelectPane, BorderLayout.NORTH);
}

53
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/background/ColorDetailPane.java

@ -3,20 +3,10 @@ package com.fr.design.mainframe.predefined.ui.detail.background;
import com.fr.base.background.ColorBackground;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.ColorSelectPane;
import com.fr.design.style.color.NewColorSelectPane;
import com.fr.general.Background;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
/**
* Created by kerry on 2020-08-31
@ -50,48 +40,9 @@ public class ColorDetailPane extends AbstractBackgroundDetailPane<ColorBackgroun
return background instanceof ColorBackground;
}
class ColorBackgroundSelectPane extends ColorSelectPane implements UIObserver {
class ColorBackgroundSelectPane extends NewColorSelectPane implements UIObserver {
protected UIObserverListener uiObserverListener;
protected void initialCompents(boolean isSupportTransparent) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder());
if (isSupportTransparent) {
this.add(createNorthPane(), BorderLayout.NORTH);
}
JPanel centerPane = createCenterPane();
this.add(centerPane, BorderLayout.CENTER);
this.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (uiObserverListener != null) {
uiObserverListener.doChange();
}
}
});
}
private JPanel createNorthPane() {
// UIButton transpanrentBtn = createTranspanrentButton();
UIButton transpanrentBtn = new UIButton();
transpanrentBtn.setPreferredSize(new Dimension(160, 20));
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Color")),
transpanrentBtn}}, TableLayoutHelper.FILL_NONE, 33, 5);
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 10));
return jPanel;
}
protected JPanel createCenterPane() {
// JPanel centerPane = super.createCenterPane();
JPanel centerPane = new JPanel();
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{new UILabel(" "), centerPane}}, TableLayoutHelper.FILL_NONE, 33, 5);
jPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 10));
return jPanel;
}
@Override
public void registerChangeListener(UIObserverListener listener) {
this.uiObserverListener = listener;

2
designer-base/src/main/java/com/fr/design/report/WatermarkPane.java

@ -163,7 +163,7 @@ public class WatermarkPane extends BasicPane {
tipsJp.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical"), SwingConstants.CENTER));
watermarkGapTipsPane.add(tipsJp, BorderLayout.CENTER);
colorPane = new NewColorSelectPane();
colorPane = new NewColorSelectPane(false);
JPanel colorLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
colorLabelPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Text_Color")), BorderLayout.NORTH);

6
designer-base/src/main/java/com/fr/design/style/CustomSelectBox.java

@ -11,7 +11,7 @@ import javax.swing.event.ChangeListener;
import com.fr.base.background.ColorBackground;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.BackgroundCustomJComponent;
import com.fr.design.style.color.ColorSelectPane;
import com.fr.design.style.color.NewColorSelectPane;
/**
@ -40,11 +40,11 @@ public class CustomSelectBox extends AbstractPopBox {
@Override
public JPanel initWindowPane(double preferredWidth) {
ColorSelectPane colorPane = new ColorSelectPane();
NewColorSelectPane colorPane = new NewColorSelectPane();
colorPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
ColorSelectPane source = (ColorSelectPane)e.getSource();
NewColorSelectPane source = (NewColorSelectPane)e.getSource();
setSelectObject(source.getColor());
hidePopupMenu();
}

7
designer-base/src/main/java/com/fr/design/style/background/BackgroundPane.java

@ -8,6 +8,7 @@ import java.awt.Dimension;
import java.util.HashMap;
import java.util.Map;
import com.fr.base.background.ColorBackground;
import com.fr.design.gui.frpane.UITabbedPane;
import javax.swing.event.ChangeEvent;
@ -16,6 +17,9 @@ import javax.swing.event.EventListenerList;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.style.background.impl.ColorBackgroundPane;
import com.fr.design.style.background.impl.ColorNoThemeBackgroundPane;
import com.fr.general.Background;
import com.fr.log.FineLoggerFactory;
@ -30,11 +34,12 @@ public class BackgroundPane extends BasicPane {
//需求说: 如果是浏览器背景, 隐藏掉几个button
public BackgroundPane() {
BackgroundFactory.getWrapper(ColorBackground.class).setType(
DesignerContext.getDesignerFrame().isServerConfig() ? ColorNoThemeBackgroundPane.class : ColorBackgroundPane.class);
this.initComponents();
this.setPreferredSize(new Dimension(400, 300));
}
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());

6
designer-base/src/main/java/com/fr/design/style/background/impl/ColorBackgroundPane.java

@ -19,10 +19,14 @@ public class ColorBackgroundPane extends BackgroundDetailPane {
public ColorBackgroundPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
detailColorSelectPane = new DetailColorSelectPane();
detailColorSelectPane = createColorSelectPane();
this.add(detailColorSelectPane, BorderLayout.CENTER);
}
protected DetailColorSelectPane createColorSelectPane(){
return new DetailColorSelectPane();
}
public void populate(Background background) {
if (background instanceof ColorBackground) {
ColorBackground colorBackgroud = (ColorBackground) background;

10
designer-base/src/main/java/com/fr/design/style/background/impl/ColorNoThemeBackgroundPane.java

@ -0,0 +1,10 @@
package com.fr.design.style.background.impl;
import com.fr.design.style.color.DetailColorSelectPane;
public class ColorNoThemeBackgroundPane extends ColorBackgroundPane{
protected DetailColorSelectPane createColorSelectPane(){
return new DetailColorSelectPane(false);
}
}

7
designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java

@ -202,10 +202,7 @@ public class ColorAdjustPane extends JPanel implements UIObserver {
public JPanel initWindowPane(double preferredWidth) {
// 下拉的时候重新生成面板,刷新最近使用颜色
ColorSelectPane colorPane = new ColorSelectPane(false) {
public void setVisible(boolean b) {
super.setVisible(b);
}
NewColorSelectPane colorPane = new NewColorSelectPane(false) {
protected boolean selectRealTime() {
return false;
@ -214,7 +211,7 @@ public class ColorAdjustPane extends JPanel implements UIObserver {
colorPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
hidePopupMenu();
Color color = ((ColorSelectPane) e.getSource()).getColor();
Color color = ((NewColorSelectPane) e.getSource()).getColor();
fireDisplayComponent(ColorBackground.getInstance(color));
if(colorButtons.size() < MAX_BUTTON) {
colorButtons.add(createColorButton(color));

10
designer-base/src/main/java/com/fr/design/style/color/ColorButton.java

@ -34,7 +34,7 @@ public class ColorButton extends AbstractSelectBox<Color> {
private boolean isMoveOn = false;
private ColorSelectPane colorPane;
private NewColorSelectPane colorPane;
private boolean lastButton;
@ -121,11 +121,7 @@ public class ColorButton extends AbstractSelectBox<Color> {
public JPanel initWindowPane(double preferredWidth) {
// 下拉的时候重新生成面板,刷新最近使用颜色
colorPane = new ColorSelectPane(false) {
@Override
public void setVisible(boolean b) {
super.setVisible(b);
}
colorPane = new NewColorSelectPane(false) {
@Override
protected boolean selectRealTime() {
@ -135,7 +131,7 @@ public class ColorButton extends AbstractSelectBox<Color> {
colorPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
hidePopupMenu();
color = ((ColorSelectPane) e.getSource()).getColor();
color = ((NewColorSelectPane) e.getSource()).getColor();
fireDisplayComponent(ColorBackground.getInstance(color));
ColorButton.this.stateChanged();
}

12
designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java

@ -58,15 +58,19 @@ public abstract class ColorControlWindow extends JPopupMenu {
}
protected void initSelectionPopupPane(boolean isSupportTransparent) {
selectionPopupPane = new ColorSelectionPopupPane(isSupportTransparent);
selectionPopupPane = new ColorSelectionPopupPane(isSupportTransparent, supportThemeColor());
this.add(selectionPopupPane, BorderLayout.CENTER);
}
protected boolean supportThemeColor(){
return true;
}
class ColorSelectionPopupPane extends NewColorSelectPane {
private static final long serialVersionUID = 7822856562329146354L;
public ColorSelectionPopupPane(boolean isSupportTransparent) {
super(isSupportTransparent);
public ColorSelectionPopupPane(boolean isSupportTransparent, boolean isSupportThemeColor) {
super(isSupportTransparent, isSupportThemeColor);
this.addChangeListener(new ChangeListener() {
@Override
@ -77,7 +81,7 @@ public abstract class ColorControlWindow extends JPopupMenu {
}
@Override
protected void doTransparent() {
public void doTransparent() {
popupHider.hidePopupMenu();
super.doTransparent();
}

2
designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java

@ -61,7 +61,7 @@ public abstract class ColorControlWindowWithAuto extends ColorControlWindow {
});
}
protected void doTransparent() {
public void doTransparent() {
getPopupHider().hidePopupMenu();
setColor(null);
}

12
designer-base/src/main/java/com/fr/design/style/color/ColorSelectBox.java

@ -17,7 +17,7 @@ public class ColorSelectBox extends AbstractSelectBox<Color> implements UIObserv
private static final long serialVersionUID = 2782150678943960557L;
private Color color;
private ColorSelectPane colorPane;
private NewColorSelectPane colorPane;
private UIObserverListener uiObserverListener;
public ColorSelectBox(int preferredWidth) {
@ -40,12 +40,8 @@ public class ColorSelectBox extends AbstractSelectBox<Color> implements UIObserv
}
}
protected ColorSelectPane getColorSelectPane(){
return new ColorSelectPane() {
public void setVisible(boolean b) {
super.setVisible(b);
}
};
protected NewColorSelectPane getColorSelectPane(){
return new NewColorSelectPane();
}
/**
@ -59,7 +55,7 @@ public class ColorSelectBox extends AbstractSelectBox<Color> implements UIObserv
colorPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
hidePopupMenu();
color = ((ColorSelectPane) e.getSource()).getColor();
color = ((NewColorSelectPane) e.getSource()).getColor();
fireDisplayComponent(ColorBackground.getInstance(color));
}
});

14
designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java

@ -36,6 +36,10 @@ public class ColorSelectDetailPane extends BasicPane {
return selectedPanel;
}
private SwatchChooserPanel swatchChooserPanel;
private CustomChooserPanel customChooserPanel;
public void setSelectedPanel(JColorChooser selectedPanel) {
this.selectedPanel = selectedPanel;
}
@ -69,9 +73,9 @@ public class ColorSelectDetailPane extends BasicPane {
selectedPanel.setPreferredSize(new Dimension(selectedPanel.getWidth(), SELECT_PANEL_HEIGHT));
selectedPanel.setPreviewPanel(new JPanel());
AbstractColorChooserPanel swatchChooserPanel = new SwatchChooserPanel();
AbstractColorChooserPanel customChooserPanel = new CustomChooserPanel();
selectedPanel.setChooserPanels(new AbstractColorChooserPanel[]{swatchChooserPanel, customChooserPanel});
swatchChooserPanel = new SwatchChooserPanel();
customChooserPanel = new CustomChooserPanel();
selectedPanel.setChooserPanels(new AbstractColorChooserPanel[]{customChooserPanel, swatchChooserPanel});
this.add(selectedPanel, BorderLayout.NORTH);
// 最近使用面板
@ -98,4 +102,8 @@ public class ColorSelectDetailPane extends BasicPane {
previewPanel.add(colorChooserPreview);
this.add(previewPanel, BorderLayout.SOUTH);
}
public void populate(Color color){
customChooserPanel.setColor(color);
}
}

1
designer-base/src/main/java/com/fr/design/style/color/ColorSelectDialog.java

@ -77,6 +77,7 @@ public class ColorSelectDialog extends MiddleChartDialog{
this.okListener = (ColorTracker) okListener;
this.seletePane = seletePane;
initComponent();
this.pane.populate(initialColor);
}
private void initComponent() {

1
designer-base/src/main/java/com/fr/design/style/color/ColorSelectPane.java

@ -30,6 +30,7 @@ import java.awt.event.MouseEvent;
/**
* The pane used to select color
*/
@Deprecated
public class ColorSelectPane extends TransparentPane implements ColorSelectable {
private static final long serialVersionUID = -8634152305687249392L;

10
designer-base/src/main/java/com/fr/design/style/color/DetailColorSelectPane.java

@ -29,10 +29,14 @@ import com.fr.design.dialog.BasicPane;
* Often used for foreground selection.
*/
public class DetailColorSelectPane extends BasicPane {
private ColorSelectPane colorSelectPane;
private NewColorSelectPane colorSelectPane;
private UILabel colorPreviewLabel;
public DetailColorSelectPane() {
public DetailColorSelectPane(){
this(true);
}
public DetailColorSelectPane(boolean supportTheme) {
this.setBorder(BorderFactory.createEmptyBorder(4, 4, 0, 4));
this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -44,7 +48,7 @@ public class DetailColorSelectPane extends BasicPane {
defaultPane.add(Box.createHorizontalStrut(4));
JPanel colorSelectContainPane =FRGUIPaneFactory.createBorderLayout_L_Pane();
defaultPane.add(colorSelectContainPane);
colorSelectPane = new ColorSelectPane();
colorSelectPane = NewColorSelectPane.createColorSelectPaneWithTheme(supportTheme);
colorSelectContainPane.add(colorSelectPane, BorderLayout.NORTH);
defaultPane.add(Box.createHorizontalStrut(8));

24
designer-base/src/main/java/com/fr/design/style/color/FineColorCell.java

@ -0,0 +1,24 @@
package com.fr.design.style.color;
import com.fr.base.FineColor;
import java.awt.Color;
public class FineColorCell extends ColorCell {
private final int x;
private final int y;
public FineColorCell(Color color, ColorSelectable colorSelectable, int x, int y) {
super(color, colorSelectable);
this.x = x;
this.y = y;
}
public Color getColor() {
Color color = super.getColor();
FineColor fineColor = new FineColor(x, y, color);
return fineColor;
}
}

4
designer-base/src/main/java/com/fr/design/style/color/NewColorSelectBox.java

@ -20,7 +20,7 @@ public class NewColorSelectBox extends AbstractSelectBox<Color> implements UIObs
private static final long serialVersionUID = 2782150678943960557L;
private Color color;
private NewColorSelectPane colorPane = new NewColorSelectPane();
private NewColorSelectPane colorPane = new NewColorSelectPane(false);
private UIObserverListener uiObserverListener;
private String newColorSelectBoxName = "";
private GlobalNameListener globalNameListener = null;
@ -58,7 +58,7 @@ public class NewColorSelectBox extends AbstractSelectBox<Color> implements UIObs
*/
public JPanel initWindowPane(double preferredWidth) {
// 下拉的时候重新生成面板,以刷新最近使用颜色
colorPane = new NewColorSelectPane();
colorPane = new NewColorSelectPane(false);
colorPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
hidePopupMenu();

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

@ -1,16 +1,18 @@
package com.fr.design.style.color;
import com.fr.base.FineColor;
import com.fr.design.DesignerEnvManager;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@ -19,8 +21,6 @@ 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;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
@ -32,57 +32,67 @@ import java.util.ArrayList;
*/
public class NewColorSelectPane extends BasicPane implements ColorSelectable {
private static final long serialVersionUID = -8634152305687249392L;
private static final float BRIGHTNESS_VALUE = 0.15F;
private static final float PURITY_VALUE = 0.1F;
private Color color = null; // color
private FineColor color = null; // color
// color setting action.
private ArrayList<ChangeListener> colorChangeListenerList = new ArrayList<ChangeListener>();
private final ArrayList<ChangeListener> colorChangeListenerList = new ArrayList<>();
// 是否支持透明
private boolean isSupportTransparent;
private boolean isSupportThemeColor;
public final static int TRANSPARENT_WINDOW_HEIGHT = 165;
public final static int WINDOW_HEIGHT = 150;
// 最近使用颜色
private UsedColorPane usedColorPane;
private final NewUsedColorPane usedColorPane;
public static NewColorSelectPane createColorSelectPaneWithTheme(boolean supportTheme){
return new NewColorSelectPane(true, supportTheme);
}
/**
* Constructor.
*/
public NewColorSelectPane() {
this(false);
this(true);
}
public NewColorSelectPane(boolean isSupportTransparent) {
this(isSupportTransparent, true);
}
/**
* Constructor.
*/
NewColorSelectPane(boolean isSupportTransparent) {
public NewColorSelectPane(boolean isSupportTransparent, boolean isSupportThemeColor) {
this.isSupportThemeColor = isSupportThemeColor;
initSelectButton(isSupportTransparent);
// center
JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
centerPane.setBorder(BorderFactory.createEmptyBorder(10, 4, 0 ,4));
this.add(centerPane, BorderLayout.CENTER);
// 第一行
JPanel row1Pane = new JPanel(FRGUIPaneFactory.createBorderLayout());
row1Pane.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 0));
row1Pane.setPreferredSize(new Dimension(135, 16)); // 宽度为 16 * 8 + 7
centerPane.add(row1Pane);
// 最近使用
usedColorPane = new UsedColorPane(1, 8, 1, this, true, false);
usedColorPane.getPane().setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 8));
row1Pane.add(usedColorPane.getPane());
JPanel menuColorPane1 = new JPanel();
JPanel menuColorPane1 = getMenuColorPane();
centerPane.add(menuColorPane1);
menuColorPane1.setLayout(new GridLayout(5, 8, 1, 1));
menuColorPane1.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8));
for (int i = 0; i < ColorFactory.MenuColors.length; i++) {
menuColorPane1.add(new ColorCell(ColorFactory.MenuColors[i], this));
if(isSupportThemeColor){
initThemeColorPane(menuColorPane1);
}else {
initMenuColorPane(menuColorPane1);
}
centerPane.add(Box.createVerticalStrut(1));
// 增加最近使用 pane
JPanel row1Pane = new JPanel(new BorderLayout(0, 5));
row1Pane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
row1Pane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Used")), BorderLayout.NORTH);
centerPane.add(row1Pane);
// 最近使用
usedColorPane = new NewUsedColorPane(8, this, selectRealTime());
usedColorPane.setPreferredSize(new Dimension(168, 16));
row1Pane.add(usedColorPane.getPane(), BorderLayout.CENTER);
// mod by anchore 16/11/16
final UIButton customButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_More_Color"));
@ -99,12 +109,58 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
});
customButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
JPanel centerPane1 = FRGUIPaneFactory.createBorderLayout_S_Pane();
centerPane1.setBorder(BorderFactory.createEmptyBorder(2, 8, 0, 8));
centerPane1.add(customButton, BorderLayout.NORTH);
JPanel centerPane1 = new JPanel(new BorderLayout(0, 0));
centerPane1.setBorder(BorderFactory.createEmptyBorder(9, 0, 11, 0));
centerPane1.add(customButton, BorderLayout.CENTER);
customButton.setPreferredSize(new Dimension(197, 20));
centerPane.add(centerPane1);
}
private void initThemeColorPane(JPanel menuColorPane){
menuColorPane.setLayout(new GridLayout(1, 8, 3, 0));
//todo 暂时先写死,后续对接的时候从主体里面拿主题配色
Color[] colorArray = new Color[]{Color.decode("#FFFFFF"), Color.decode("#CCCCCC"),
Color.decode("#E6A48A"), Color.decode("#E68A8A"), Color.gray, Color.green, Color.DARK_GRAY, Color.CYAN, Color.YELLOW, Color.lightGray};
for (int i = 0; i < colorArray.length; i++) {
Color color = colorArray[i];
boolean isDefaultColor = (i == 0 || i ==1);
JPanel jPanel = new JPanel(new GridLayout(5, 1, 0, 3));
jPanel.add(new FineColorCell(color, this, i, 0));
jPanel.add(new FineColorCell(color = saturationDown(color, isDefaultColor), this, i, 1));
jPanel.add(new FineColorCell(color = saturationDown(color, isDefaultColor), this, i, 2));
jPanel.add(new FineColorCell(color = saturationDown(color, isDefaultColor), this, i, 3));
jPanel.add(new FineColorCell(saturationDown(color, isDefaultColor), this, i, 4));
menuColorPane.add(jPanel);
}
}
/**
* 调整明度和纯度默认色只调整明度
* @param color
* @param isDefaultColor
* @return
*/
public static Color saturationDown(Color color, boolean isDefaultColor) {
float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), new float[3]);
if (!isDefaultColor) {
hsb[1] += PURITY_VALUE;
}
hsb[2] -= BRIGHTNESS_VALUE;
return Color.getHSBColor(hsb[0], hsb[1], hsb[2]);
}
private void initMenuColorPane(JPanel menuColorPane){
menuColorPane.setLayout(new GridLayout(5, 8, 1, 1));
menuColorPane.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8));
Color[] colorArray = this.getColorArray();
for (int i = 0; i < colorArray.length; i++) {
Color color = colorArray[i] == null ? UsedColorPane.DEFAULT_COLOR : colorArray[i];
menuColorPane.add(new ColorCell(color, this));
}
}
public boolean isSupportTransparent() {
return isSupportTransparent;
}
@ -113,6 +169,10 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
isSupportTransparent = supportTransparent;
}
protected boolean selectRealTime() {
return true;
}
protected void initSelectButton(boolean isSupportTransparent){
this.isSupportTransparent = isSupportTransparent;
this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -120,21 +180,14 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
if (isSupportTransparent) {
UIButton transparentButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency"));
this.add(transparentButton, BorderLayout.NORTH);
transparentButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
doTransparent();
}
});
transparentButton.addActionListener(e -> doTransparent());
}
}
/**
* 添加监听
*
* @param 监听列表 Add change listener.
* @param changeListener 监听
*/
public void addChangeListener(ChangeListener changeListener) {
this.colorChangeListenerList.add(changeListener);
@ -151,7 +204,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
* @return 颜色
* Return the color.
*/
public Color getColor() {
public FineColor getColor() {
return color;
}
@ -163,7 +216,6 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
public Color getNotNoneColor() {
if (color == null) {
setColor(Color.WHITE);
return Color.WHITE;
}
return color;
}
@ -175,27 +227,33 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
*/
@Override
public void setColor(Color color) {
this.color = color;
FineColor fineColor;
if (color == null) {
fineColor = null;
} else {
fineColor = color instanceof FineColor ? (FineColor) color : new FineColor(color);
}
setFineColor(fineColor);
}
private void setFineColor(FineColor fineColor){
this.color = fineColor;
// fire color change.
if (!colorChangeListenerList.isEmpty()) {
ChangeEvent evt = new ChangeEvent(this);
for (int i = 0; i < colorChangeListenerList.size(); i++) {
this.colorChangeListenerList.get(i).stateChanged(evt);
for (ChangeListener changeListener : colorChangeListenerList) {
changeListener.stateChanged(evt);
}
}
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
this.repaint();
}
/**
* 设置颜色
*
* @param 颜色位置
*/
@Override
public void colorSetted(ColorCell colorCell) {
this.updateUsedColor();
colorCell.repaint();
}
@ -203,18 +261,28 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
setColor(null);
}
protected Color[] getColorArray() {
return ColorFactory.MenuColors;
}
protected JPanel getMenuColorPane() {
return new JPanel();
}
protected void customButtonPressed() {
// 颜色选择器
ColorSelectDetailPane pane = new ColorSelectDetailPane(Color.WHITE);
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, this);
Color color = getColor() == null ? Color.WHITE : getColor().getColor();
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, color, this);
}
@Override
public Dimension getPreferredSize() {
if (isSupportTransparent) {
return new Dimension(super.getPreferredSize().width, TRANSPARENT_WINDOW_HEIGHT);
return new Dimension(197, 207);
}
return new Dimension(super.getPreferredSize().width, WINDOW_HEIGHT);
return new Dimension(197, 192);
}
/**
@ -224,5 +292,72 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
usedColorPane.updateUsedColor();
}
class NewUsedColorPane extends BasicPane {
// 最近使用面板列数
private int columns;
// 最近使用面板
private JPanel pane;
private ColorSelectable selectable;
private boolean setColorRealTime;
public JPanel getPane(){
return this.pane;
}
public NewUsedColorPane(int columns, ColorSelectable selectable, boolean setColorRealTime){
this.columns = columns;
this.selectable = selectable;
this.setColorRealTime = setColorRealTime;
initialComponents();
}
private void initialComponents() {
int total = columns;
JPanel panel = new JPanel();
panel.setLayout(new GridLayout(1, columns + 2, 3, 3));
panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
//最近使用颜色
Color[] colors = DesignerEnvManager.getEnvManager().getColorConfigManager().getColors();
int size = colors.length;
for (int i = 0; i < total; i++) {
Color color = i < size ? colors[size - i - 1] :
UsedColorPane.DEFAULT_COLOR;
panel.add(new ColorCell(color == null ? UsedColorPane.DEFAULT_COLOR : color, selectable));
}
// 取色按钮
JButton pickColorButton = PickColorButtonFactory.getPickColorButton(selectable, PickColorButtonFactory.IconType.ICON16, setColorRealTime);
panel.add(pickColorButton);
ColorCell cc = new ColorCell(UsedColorPane.DEFAULT_COLOR, selectable);
cc.setVisible(false);
panel.add(cc);
this.pane = panel;
}
/**
* 更新最近使用颜色
*/
public void updateUsedColor() {
int total = columns ;
Color[] colors = DesignerEnvManager.getEnvManager().getColorConfigManager().getColors();
int size = colors.length;
for (int i = 0; i < total; i++) {
ColorCell cell = (ColorCell) this.pane.getComponent(i);
Color color = i < size ? colors[size - i - 1] : UsedColorPane.DEFAULT_COLOR;
cell.setColor(color == null ? UsedColorPane.DEFAULT_COLOR : color);
}
}
@Override
protected String title4PopupWindow() {
return null;
}
}
}

4
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ColorSelectBoxWithOutTransparent.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.chart.gui;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.style.color.ColorSelectPane;
import com.fr.design.style.color.NewColorSelectPane;
/**
* Created by Fangjie on 2016/4/8.
@ -14,7 +14,7 @@ public class ColorSelectBoxWithOutTransparent extends ColorSelectBox {
@Override
protected ColorSelectPane getColorSelectPane(){
protected NewColorSelectPane getColorSelectPane(){
return new ColorSelectPaneWithOutTransparent();
}
}

16
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java

@ -1,8 +1,7 @@
package com.fr.design.mainframe.chart.gui;
import com.fr.chart.base.ChartConstants;
import com.fr.design.style.color.ColorCell;
import com.fr.design.style.color.ColorSelectPane;
import com.fr.design.style.color.NewColorSelectPane;
import javax.swing.*;
import java.awt.*;
@ -10,23 +9,12 @@ import java.awt.*;
/**
* Created by Fangjie on 2016/4/8.
*/
public class ColorSelectPaneWithOutTransparent extends ColorSelectPane {
public class ColorSelectPaneWithOutTransparent extends NewColorSelectPane {
public ColorSelectPaneWithOutTransparent(){
super(false);
}
public void initCenterPaneChildren(JPanel centerPane) {
JPanel menuColorPane1 = new JPanel();
centerPane.add(menuColorPane1);
menuColorPane1.setLayout(new GridLayout(3, 8, 5, 5));
for (int i = 0; i < ChartConstants.MAP_COLOR_ARRAY.length; i++) {
menuColorPane1.add(new ColorCell(ChartConstants.MAP_COLOR_ARRAY[i], this));
}
centerPane.add(Box.createVerticalStrut(5));
centerPane.add(new JSeparator());
}
protected Color[] getColorArray(){
return ChartConstants.MAP_COLOR_ARRAY;
}

22
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane4Map.java

@ -2,15 +2,10 @@ package com.fr.design.mainframe.chart.gui.style.series;
import com.fr.chart.base.ChartConstants;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.style.color.ColorCell;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.style.color.ColorSelectPane;
import com.fr.design.style.color.NewColorSelectPane;
import javax.swing.Box;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import java.awt.Color;
import java.awt.GridLayout;
/**
* Created by IntelliJ IDEA.
@ -27,23 +22,12 @@ public class UIColorPickerPane4Map extends UIColorPickerPane {
return new ColorSelectBox4Map(100);
}
private class ColorSelectPane4Map extends ColorSelectPane {
private class ColorSelectPane4Map extends NewColorSelectPane {
public ColorSelectPane4Map(){
super(false);
}
public void initCenterPaneChildren(JPanel centerPane) {
JPanel menuColorPane1 = new JPanel();
centerPane.add(menuColorPane1);
menuColorPane1.setLayout(new GridLayout(5, 8, 5, 5));
for (int i = 0; i < ChartConstants.MAP_COLOR_ARRAY.length; i++) {
menuColorPane1.add(new ColorCell(ChartConstants.MAP_COLOR_ARRAY[i], this));
}
centerPane.add(Box.createVerticalStrut(5));
centerPane.add(new JSeparator());
}
protected Color[] getColorArray(){
return ChartConstants.MAP_COLOR_ARRAY;
}
@ -54,7 +38,7 @@ public class UIColorPickerPane4Map extends UIColorPickerPane {
super(preferredWidth);
}
protected ColorSelectPane getColorSelectPane(){
protected NewColorSelectPane getColorSelectPane(){
return new ColorSelectPane4Map();
}
}

12
designer-realize/src/main/java/com/fr/design/actions/server/ServerConfigManagerAction.java

@ -3,7 +3,6 @@
*/
package com.fr.design.actions.server;
import com.fr.base.svg.IconUtils;
import com.fr.config.Configuration;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.actions.UpdateAction;
@ -20,6 +19,8 @@ import com.fr.web.attr.ReportWebAttr;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
/**
* Server Config Manager
@ -41,6 +42,7 @@ public class ServerConfigManagerAction extends UpdateAction {
* @param e 事件
*/
public void actionPerformed(ActionEvent e) {
DesignerContext.getDesignerFrame().setServerConfig(true);
final ServerPreferenceConfig config = ServerPreferenceConfig.getInstance();
final EditReportServerParameterPane editReportServerParameterPane = new EditReportServerParameterPane() {
@Override
@ -69,7 +71,13 @@ public class ServerConfigManagerAction extends UpdateAction {
return new Class[]{ReportWebAttr.class, ServerPreferenceConfig.class};
}
});
}
});
editReportServerParameterDialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
super.windowClosed(e);
DesignerContext.getDesignerFrame().setServerConfig(false);
}
});
editReportServerParameterDialog.setVisible(true);

3
designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java

@ -9,6 +9,7 @@ import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.core.WidgetOption;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UINoThemeColorButton;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
@ -76,7 +77,7 @@ public class WriteToolBarPane extends AbstractEditToolBarPane {
colorBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Face_Write_Current_Edit_Row_Background") + ":");
colorBox.setSelected(false);
colorBox.addActionListener(colorListener);
colorButton = new UIColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/background.png"));
colorButton = new UINoThemeColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/background.png"));
northPane.add(GUICoreUtils.createFlowPane(new Component[]{colorBox, colorButton}, FlowLayout.LEFT));
unloadCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unload_Check"));

Loading…
Cancel
Save