From 212cd97557c45987e71e149e059a02f667eca0fe Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 1 Sep 2021 19:56:23 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-58395=E3=80=90=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E3=80=91frm=E4=B8=BB=E9=A2=98=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=BB=84=E4=BB=B6=E6=A0=87=E9=A2=98=E5=9B=BE=E6=A1=88?= =?UTF-8?q?=E4=BB=A5=E5=90=8E=EF=BC=8C=E5=B7=A6=E4=BE=A7=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E5=9B=BE=E4=B8=8D=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/style/AbstractSelectBox.java | 1 - .../background/BackgroundJComponent.java | 32 ++++++++++--- .../style/color/NewColorSelectPane.java | 46 ++++++++++++------- 3 files changed, 54 insertions(+), 25 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java b/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java index 1d66094f1..cd2b8e47a 100644 --- a/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java +++ b/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java @@ -40,7 +40,6 @@ public abstract class AbstractSelectBox extends AbstractPopBox implements Mou displayComponent = new BackgroundJComponent(); displayComponent.setEmptyBackground(); - displayComponent.setBorder(new TriggleLineBorder()); triggleButton = new UIButton(UIConstants.ARROW_DOWN_ICON) { public boolean shouldResponseChangeListener() { return false; diff --git a/designer-base/src/main/java/com/fr/design/style/background/BackgroundJComponent.java b/designer-base/src/main/java/com/fr/design/style/background/BackgroundJComponent.java index 9d3c31bd4..377da330c 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/BackgroundJComponent.java +++ b/designer-base/src/main/java/com/fr/design/style/background/BackgroundJComponent.java @@ -1,10 +1,12 @@ package com.fr.design.style.background; +import java.awt.Color; import java.awt.Graphics; +import java.awt.Insets; import java.awt.geom.Rectangle2D; import javax.swing.JComponent; - +import com.fr.design.border.UIRoundedBorder; import com.fr.general.Background; /** @@ -18,7 +20,7 @@ public class BackgroundJComponent extends JComponent { protected Background background ; public BackgroundJComponent() { - + this.setBorder(new UIRoundedBorder(Color.decode("#999999"), 2, 2)); } public BackgroundJComponent(Background background) { @@ -29,16 +31,32 @@ public class BackgroundJComponent extends JComponent { super.paint(g); if(background != null && this.getSize().getWidth() > 0 && this.getSize().getHeight() > 0) { - background.paint(g, new Rectangle2D.Double(1, 1, this.getSize().getWidth() - 2, - this.getSize().getHeight() - 2)); - } + background.paint(g, new Rectangle2D.Double(2, 2, this.getSize().getWidth() - 4, + this.getSize().getHeight() - 4)); + } + } - - public void setEmptyBackground() { + + @Override + protected void paintBorder(Graphics g) { +// Color oldColor = g.getColor(); +// Border border = getBorder(); +// if (border != null) { +// border.paintBorder(this, g, 0, 0, getWidth(), getHeight()); +// } + super.paintBorder(g); + } + + public void setEmptyBackground() { this.background = null; } public void setSelfBackground(Background background) { this.background = background; } + + @Override + public Insets getInsets() { + return new Insets(0,0,0,0); + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java index 8abab768a..7cf7a4708 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java @@ -39,6 +39,8 @@ 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 static final int WIDTH = 197; + private static final int HEIGHT = 250; private FineColor color = null; // color // color setting action. @@ -49,9 +51,6 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { private boolean isSupportThemeColor; - public final static int TRANSPARENT_WINDOW_HEIGHT = 165; - public final static int WINDOW_HEIGHT = 150; - // 最近使用颜色 private final NewUsedColorPane usedColorPane; private final JPanel menuColorPane; @@ -84,10 +83,12 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { this.add(centerPane, BorderLayout.CENTER); menuColorPane = getMenuColorPane(); - centerPane.add(menuColorPane); + if(isSupportThemeColor){ - initThemeColorPane(); + JPanel themePane = initThemeColorPane(); + centerPane.add(themePane); }else { + centerPane.add(menuColorPane); initMenuColorPane(); } @@ -138,8 +139,14 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { return jPanel; } - private void initThemeColorPane(){ + private JPanel initThemeColorPane(){ menuColorPane.removeAll(); + JPanel themeColorPane = new JPanel(new BorderLayout(0, 5)); + themeColorPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + themeColorPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Theme_Color")), BorderLayout.CENTER); + + themeColorPane.add(menuColorPane, BorderLayout.SOUTH); + menuColorPane.setLayout(new BorderLayout(0, 10)); JPanel northPane = new JPanel(new GridLayout(1, 8, 3, 0)); JPanel centerPane = new JPanel(new GridLayout(1, 8, 3, 0)); @@ -147,10 +154,6 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { menuColorPane.add(centerPane, BorderLayout.CENTER); Color[] colorArray = new Color[] { - // 2列灰度色 - Color.decode("#B3B3B3"), - Color.decode("#808080"), - // 8列主题色 Color.decode("#FFFFFF"), Color.decode("#CCCCCC"), @@ -160,13 +163,17 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { Color.decode("#CCCCCC"), Color.decode("#FFFFFF"), Color.decode("#CCCCCC"), + + // 2列灰度色 + Color.decode("#808080"), + Color.decode("#B3B3B3"), }; if (themeColorCellGrid == null) { themeColorCellGrid = new ColorCell[colorArray.length][5]; for (int i = 0; i < colorArray.length; i++) { ColorCell[] colorCellColumn = new ColorCell[5]; - boolean isDefaultColor = (i == 0 || i == 1); + boolean isDefaultColor = (i == colorArray.length - 1 || i == colorArray.length - 2); Color color = colorArray[i]; colorCellColumn[0] = createFineColorCell(color, isDefaultColor, i, 2); colorCellColumn[2] = createFineColorCell(color = saturationDown(color, isDefaultColor, true), isDefaultColor, i, 1); @@ -191,6 +198,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { } refreshThemeMenuColorPane(); + return themeColorPane; } private void refreshThemeMenuColorPane() { @@ -210,14 +218,14 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { return; } - for (int i = 2; i < themeColorCellGrid.length; i++) { - Color color = standardColors.get(i - 2); + for (int i = 0; i < themeColorCellGrid.length - 2; i++) { + Color color = standardColors.get(i); themeColorCellGrid[i][0].setColor(color); themeColorCellGrid[i][2].setColor(color = saturationDown(color, false, true)); themeColorCellGrid[i][1].setColor(saturationDown(color, false, true)); - color = standardColors.get(i - 2); + color = standardColors.get(i); themeColorCellGrid[i][3].setColor(color = saturationDown(color, false, false)); themeColorCellGrid[i][4].setColor(saturationDown(color, false, false)); } @@ -225,7 +233,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { private FineColorCell createFineColorCell(Color color, boolean isDefaultColor, int x, int y) { - return isDefaultColor ? new FineColorCell(color, this) : new FineColorCell(color, this, x - 2, y); + return isDefaultColor ? new FineColorCell(color, this) : new FineColorCell(color, this, x, y); } /** @@ -375,10 +383,14 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { @Override public Dimension getPreferredSize() { + int height = HEIGHT; if (isSupportTransparent) { - return new Dimension(197, 265); + height += 15; + } + if (isSupportThemeColor) { + height += 25; } - return new Dimension(197, 250); + return new Dimension(WIDTH, height); } /** From a4350ad4baab9b28b09939795391537184d56ea8 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 2 Sep 2021 17:49:33 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-58543=E3=80=90=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E3=80=91=E5=AD=97=E7=AC=A6=E9=A2=9C=E8=89=B2?= =?UTF-8?q?=E7=9A=84=E4=B8=BB=E9=A2=98=E8=89=B2=E6=8E=A7=E4=BB=B6=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E8=89=B2=E5=9D=97=E6=B2=A1=E6=9C=89=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/ibutton/UIColorButton.java | 1 + .../theme/preview/ComponentPreviewPane.java | 40 +++++++- .../ecpreview/cell/AbstractPreviewCell.java | 7 +- .../style/color/ColorControlWindow.java | 4 + .../color/ColorControlWindowWithAuto.java | 5 + .../style/color/NewColorSelectPane.java | 92 ++++++++----------- 6 files changed, 89 insertions(+), 60 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java index 8171f31cb..31a6d963d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java @@ -136,6 +136,7 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G } popupWin = this.getColorControlWindow(); + popupWin.setColor(color); GUICoreUtils.showPopupMenu(popupWin, this, POPUP_MENU_SHIFT, this.getSize().height); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java index da7f7bac5..d7bdfadfd 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java @@ -6,7 +6,6 @@ import com.fr.base.background.ImageBackground; import com.fr.base.theme.FormTheme; import com.fr.base.theme.settings.ThemedComponentStyle; import com.fr.design.border.UIRoundedBorder; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.form.ui.Label; import com.fr.form.ui.LayoutBorderStyle; @@ -20,15 +19,20 @@ import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.border.Border; +import javax.swing.border.LineBorder; import java.awt.AlphaComposite; +import java.awt.BasicStroke; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Component; import java.awt.Composite; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; +import java.awt.RenderingHints; import java.awt.Shape; +import java.awt.Stroke; import java.awt.geom.Rectangle2D; import java.awt.geom.RoundRectangle2D; @@ -67,7 +71,11 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th ThemedComponentStyle componentStyle = theme.getComponentStyle(); style = componentStyle.getStyle(); - setBorder(new UIRoundedBorder(style.getBorder(), style.getColor(), style.getBorderRadius())); + if (style.getBorder() == 0) { + setBorder(null); + } else { + setBorder(new UIRoundedBorder(style.getBorder(), style.getColor(), style.getBorderRadius())); + } int paddingTop = componentStyle.getPaddingTop(); int paddingBottom = componentStyle.getPaddingBottom(); @@ -116,8 +124,10 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th data.setInsetImagePadding(titlePacker.getInsetImagePadding()); data.setInsetRelativeTextLeft(titlePacker.isInsetRelativeTextLeft()); data.setInsetRelativeTextRight(titlePacker.isInsetRelativeTextRight()); + this.setBorder(new BottomLineBorder(componentStyle.getStyle().getColor(), componentStyle.getStyle().getBorder())); } + @Override public void paintComponent(Graphics g) { super.paintComponent(g); @@ -145,6 +155,32 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th } + public static class BottomLineBorder extends LineBorder { + + private BottomLineBorder(Color color, int thickness) { + super(color, thickness); + } + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { + Graphics2D g2d = (Graphics2D) g; + + Color oldColor = g2d.getColor(); + Stroke oldStroke = g2d.getStroke(); + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + g2d.setColor(getLineColor()); + g2d.setStroke(new BasicStroke(getThickness() * 2)); + g2d.drawLine(0, height, width, height); + + g2d.setStroke(oldStroke); + g2d.setColor(oldColor); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); + } + } + + private static class Utils { private static void paintBackground(Graphics2D g2d, Background background, Shape shape, float opacity) { if (background != null) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/cell/AbstractPreviewCell.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/cell/AbstractPreviewCell.java index 9c7c335de..a8a5f1892 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/cell/AbstractPreviewCell.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/cell/AbstractPreviewCell.java @@ -1,8 +1,6 @@ package com.fr.design.mainframe.theme.preview.ecpreview.cell; -import com.fr.base.ScreenResolution; import com.fr.base.Style; - import javax.swing.JComponent; import java.awt.Dimension; import java.awt.Graphics; @@ -10,6 +8,8 @@ import java.awt.Graphics2D; public abstract class AbstractPreviewCell extends JComponent { protected Style style = Style.DEFAULT_STYLE; + private static final int NO_SCALE_RESOLUTION = 100; + public void refresh(Style style) { this.style = style; @@ -17,9 +17,8 @@ public abstract class AbstractPreviewCell extends JComponent { public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; - int resolution = ScreenResolution.getScreenResolution(); Style.paintBackground(g2d, style, getWidth(), getHeight()); - paintContent(g2d, resolution); + paintContent(g2d, NO_SCALE_RESOLUTION); Style.paintBorder(g2d, style, getWidth(), getHeight()); } diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java index 43f994a65..7fccbfde2 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java @@ -38,6 +38,10 @@ public abstract class ColorControlWindow extends JPopupMenu { return selectionPopupPane.getColor(); } + public void setColor(Color color) { + selectionPopupPane.setColor(color); + } + public PopupHider getPopupHider() { return popupHider; } diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java index dc4eb9571..01351bfed 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java @@ -39,6 +39,11 @@ public abstract class ColorControlWindowWithAuto extends ColorControlWindow { return selectionPopupPaneWithAuto.getColor(); } + public void setColor(Color color) { + selectionPopupPaneWithAuto.setColor(color); + } + + protected void initSelectionPopupPane(boolean isSupportTransparent) { selectionPopupPaneWithAuto = new ColorSelectionPopupPaneWithAuto(isSupportTransparent); this.add(selectionPopupPaneWithAuto, BorderLayout.CENTER); diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java index 7cf7a4708..1b7af375f 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java @@ -1,6 +1,7 @@ package com.fr.design.style.color; import com.fr.base.FineColor; +import com.fr.base.theme.FineColorDeriveState; import com.fr.base.theme.TemplateTheme; import com.fr.design.DesignerEnvManager; import com.fr.design.border.UIRoundedBorder; @@ -37,10 +38,11 @@ import java.util.List; */ 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 static final int WIDTH = 197; private static final int HEIGHT = 250; + //颜色衍生的数量 + private static final int DEFAULT_DERIVE_COUNT = 5; private FineColor color = null; // color // color setting action. @@ -56,7 +58,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { private final JPanel menuColorPane; private ColorCell[][] themeColorCellGrid; - public static NewColorSelectPane createColorSelectPaneWithTheme(boolean supportTheme){ + public static NewColorSelectPane createColorSelectPaneWithTheme(boolean supportTheme) { return new NewColorSelectPane(true, supportTheme); } @@ -79,15 +81,15 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { initSelectButton(isSupportTransparent); // center JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); - centerPane.setBorder(BorderFactory.createEmptyBorder(10, 4, 0 ,4)); + centerPane.setBorder(BorderFactory.createEmptyBorder(10, 4, 0, 4)); this.add(centerPane, BorderLayout.CENTER); menuColorPane = getMenuColorPane(); - if(isSupportThemeColor){ + if (isSupportThemeColor) { JPanel themePane = initThemeColorPane(); centerPane.add(themePane); - }else { + } else { centerPane.add(menuColorPane); initMenuColorPane(); } @@ -130,7 +132,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { centerPane.add(centerPane1); } - private JPanel createStandardColorPane(){ + private JPanel createStandardColorPane() { JPanel jPanel = new JPanel(new GridLayout(1, 10, 3, 0)); Color[] colorArray = ColorFactory.STANDARD_COLORS; for (int i = 0; i < colorArray.length; i++) { @@ -139,7 +141,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { return jPanel; } - private JPanel initThemeColorPane(){ + private JPanel initThemeColorPane() { menuColorPane.removeAll(); JPanel themeColorPane = new JPanel(new BorderLayout(0, 5)); themeColorPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); @@ -153,7 +155,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { menuColorPane.add(northPane, BorderLayout.NORTH); menuColorPane.add(centerPane, BorderLayout.CENTER); - Color[] colorArray = new Color[] { + Color[] colorArray = new Color[]{ // 8列主题色 Color.decode("#FFFFFF"), Color.decode("#CCCCCC"), @@ -165,22 +167,20 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { Color.decode("#CCCCCC"), // 2列灰度色 - Color.decode("#808080"), - Color.decode("#B3B3B3"), + Color.decode("#333333"), + Color.decode("#FFFFFF"), }; if (themeColorCellGrid == null) { - themeColorCellGrid = new ColorCell[colorArray.length][5]; + themeColorCellGrid = new ColorCell[colorArray.length][DEFAULT_DERIVE_COUNT]; for (int i = 0; i < colorArray.length; i++) { - ColorCell[] colorCellColumn = new ColorCell[5]; + ColorCell[] colorCellColumn = new ColorCell[DEFAULT_DERIVE_COUNT]; boolean isDefaultColor = (i == colorArray.length - 1 || i == colorArray.length - 2); Color color = colorArray[i]; - colorCellColumn[0] = createFineColorCell(color, isDefaultColor, i, 2); - colorCellColumn[2] = createFineColorCell(color = saturationDown(color, isDefaultColor, true), isDefaultColor, i, 1); - colorCellColumn[1] = createFineColorCell(saturationDown(color, isDefaultColor, true), isDefaultColor, i, 0); - color = colorArray[i]; - colorCellColumn[3] = createFineColorCell(color = saturationDown(color, isDefaultColor, false), isDefaultColor, i, 3); - colorCellColumn[4] = createFineColorCell(saturationDown(color, isDefaultColor, false), isDefaultColor, i, 4); + Color[] deriveColorArr = FineColorDeriveState.getDeriveColorArr(color, isDefaultColor, DEFAULT_DERIVE_COUNT); + for (int j = 0; j < deriveColorArr.length; j++) { + colorCellColumn[j] = createFineColorCell(deriveColorArr[j], isDefaultColor, i, j); + } themeColorCellGrid[i] = colorCellColumn; } } @@ -189,11 +189,10 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { northPane.add(themeColorCellGrid[i][0]); } for (int i = 0; i < colorArray.length; i++) { - JPanel columnPane = new JPanel(new GridLayout(4, 1, 0, 3)); - columnPane.add(themeColorCellGrid[i][1]); - columnPane.add(themeColorCellGrid[i][2]); - columnPane.add(themeColorCellGrid[i][3]); - columnPane.add(themeColorCellGrid[i][4]); + JPanel columnPane = new JPanel(new GridLayout(DEFAULT_DERIVE_COUNT - 1, 1, 0, 3)); + for (int j = 1; j < DEFAULT_DERIVE_COUNT; j++) { + columnPane.add(themeColorCellGrid[i][j]); + } centerPane.add(columnPane); } @@ -206,7 +205,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { if (TemplateThemeProfileDialog.isEditingTheme()) { standardColors = TemplateThemeProfileDialog.getEditingColorScheme(); } else { - JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); if (template != null) { TemplateTheme theme = template.getTemplateTheme(); if (theme != null) { @@ -220,14 +219,10 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { for (int i = 0; i < themeColorCellGrid.length - 2; i++) { Color color = standardColors.get(i); - - themeColorCellGrid[i][0].setColor(color); - themeColorCellGrid[i][2].setColor(color = saturationDown(color, false, true)); - themeColorCellGrid[i][1].setColor(saturationDown(color, false, true)); - - color = standardColors.get(i); - themeColorCellGrid[i][3].setColor(color = saturationDown(color, false, false)); - themeColorCellGrid[i][4].setColor(saturationDown(color, false, false)); + Color[] deriveColorArr = FineColorDeriveState.getDeriveColorArr(color, false, DEFAULT_DERIVE_COUNT); + for (int j = 0; j < deriveColorArr.length; j++) { + themeColorCellGrid[i][j].setColor(deriveColorArr[j]); + } } } @@ -236,21 +231,6 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { return isDefaultColor ? new FineColorCell(color, this) : new FineColorCell(color, this, x, y); } - /** - * 调整明度和纯度,默认色只调整明度 - * @param color - * @param isDefaultColor - * @return - */ - public static Color saturationDown(Color color, boolean isDefaultColor, boolean isLight) { - float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), new float[3]); - if (!isDefaultColor) { - hsb[1] = isLight ? Math.max(0, hsb[1] - PURITY_VALUE) : Math.min(1, hsb[1] + PURITY_VALUE); - } - hsb[2] = isLight ? Math.min(1, hsb[2] + BRIGHTNESS_VALUE) : Math.max(0, hsb[2] - BRIGHTNESS_VALUE); - Color color1 = Color.getHSBColor(hsb[0], hsb[1], hsb[2]); - return color1; - } private void initMenuColorPane() { menuColorPane.setLayout(new GridLayout(5, 8, 3, 3)); @@ -274,7 +254,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { return true; } - protected void initSelectButton(boolean isSupportTransparent){ + protected void initSelectButton(boolean isSupportTransparent) { this.isSupportTransparent = isSupportTransparent; this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setBorder(new UIRoundedBorder(UIConstants.TOOLBAR_BORDER_COLOR, 1, 5)); @@ -288,6 +268,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { /** * 添加监听 + * * @param changeListener 监听 */ public void addChangeListener(ChangeListener changeListener) { @@ -340,7 +321,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { setFineColor(fineColor); } - private void setFineColor(FineColor fineColor){ + private void setFineColor(FineColor fineColor) { this.color = fineColor; // fire color change. @@ -351,7 +332,9 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { changeListener.stateChanged(evt); } } - DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color); + if (color != null) { + DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color.getColor()); + } this.repaint(); } @@ -412,12 +395,12 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { private boolean setColorRealTime; - public JPanel getPane(){ + public JPanel getPane() { return this.pane; } - public NewUsedColorPane(int columns, ColorSelectable selectable, boolean setColorRealTime){ + public NewUsedColorPane(int columns, ColorSelectable selectable, boolean setColorRealTime) { this.columns = columns; this.selectable = selectable; this.setColorRealTime = setColorRealTime; @@ -448,7 +431,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { * 更新最近使用颜色 */ public void updateUsedColor() { - int total = columns ; + int total = columns; Color[] colors = DesignerEnvManager.getEnvManager().getColorConfigManager().getColors(); int size = colors.length; for (int i = 0; i < total; i++) { @@ -464,4 +447,5 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { } } + } From 523b763e21e4ddea9b936fb4fe40d568e592e59f Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 2 Sep 2021 17:50:28 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/style/background/BackgroundJComponent.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/style/background/BackgroundJComponent.java b/designer-base/src/main/java/com/fr/design/style/background/BackgroundJComponent.java index 377da330c..611953a20 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/BackgroundJComponent.java +++ b/designer-base/src/main/java/com/fr/design/style/background/BackgroundJComponent.java @@ -37,15 +37,6 @@ public class BackgroundJComponent extends JComponent { } - @Override - protected void paintBorder(Graphics g) { -// Color oldColor = g.getColor(); -// Border border = getBorder(); -// if (border != null) { -// border.paintBorder(this, g, 0, 0, getWidth(), getHeight()); -// } - super.paintBorder(g); - } public void setEmptyBackground() { this.background = null;