From 9810eb255a72d4589acefc1cebc943e443056e28 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 27 Aug 2021 19:51:03 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-58225=E3=80=90=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E3=80=91=E9=99=A4=E5=9B=BE=E8=A1=A8=E5=A4=96?= =?UTF-8?q?=E6=89=80=E6=9C=89=E6=B8=90=E5=8F=98=E8=89=B2=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E6=89=93=E5=BC=80=E9=A2=9C=E8=89=B2=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=8D=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/detail/ColorFillStylePane.java | 8 +-- .../edit/chart/ChartSeriesStylePane.java | 6 +-- .../gradient/FixedGradientBarNoTheme.java | 39 ++++++++++++++ .../gradient/FixedGradientBarWithPopMenu.java | 53 ------------------- .../background/gradient/GradientBar.java | 45 ++++++++++------ 5 files changed, 74 insertions(+), 77 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/style/background/gradient/FixedGradientBarNoTheme.java delete mode 100644 designer-base/src/main/java/com/fr/design/style/background/gradient/FixedGradientBarWithPopMenu.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ColorFillStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ColorFillStylePane.java index 9e2a0d5ef..823dd6ff3 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ColorFillStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ColorFillStylePane.java @@ -15,7 +15,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.style.background.gradient.FixedGradientBar; +import com.fr.design.style.background.gradient.FixedGradientBarNoTheme; import com.fr.design.style.color.ColorAdjustPane; import com.fr.stable.StringUtils; @@ -40,7 +40,7 @@ public class ColorFillStylePane extends BasicBeanPane { private ColorSchemeComboBox styleSelectBox; private JPanel customPane; private JPanel changeColorSetPane; - private FixedGradientBar colorGradient; + private FixedGradientBarNoTheme colorGradient; private CardLayout cardLayout; @@ -69,8 +69,8 @@ public class ColorFillStylePane extends BasicBeanPane { }; changeColorSetPane = new JPanel(cardLayout = new CardLayout()); - changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient"); - gradientColors = new Color[]{Color.WHITE, FixedGradientBar.NEW_CHARACTER}; + changeColorSetPane.add(colorGradient = new FixedGradientBarNoTheme(4, 130), "gradient"); + gradientColors = new Color[]{Color.WHITE, FixedGradientBarNoTheme.NEW_CHARACTER}; changeColorSetPane.add(colorAdjustPane = new ColorAdjustPane(), "acc"); accColors = ColorAdjustPane.DEFAULT_COLORS; cardLayout.show(changeColorSetPane, "acc"); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartSeriesStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartSeriesStylePane.java index c451117bd..fbb8f6489 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartSeriesStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartSeriesStylePane.java @@ -5,7 +5,7 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.theme.dialog.TemplateThemeProfileDialog; -import com.fr.design.style.background.gradient.FixedGradientBarWithPopMenu; +import com.fr.design.style.background.gradient.FixedGradientBar; import java.util.List; import java.awt.Color; @@ -22,12 +22,12 @@ import java.awt.event.ActionListener; public class ChartSeriesStylePane extends AbstractChartStylePane { private UIButtonGroup colorTypeButton; - private FixedGradientBarWithPopMenu gradientBar; + private FixedGradientBar gradientBar; protected void initComponents() { colorTypeButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Custom_Color"), Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual")}); - gradientBar = new FixedGradientBarWithPopMenu(4, 130); + gradientBar = new FixedGradientBar(4, 130); initListener(); } diff --git a/designer-base/src/main/java/com/fr/design/style/background/gradient/FixedGradientBarNoTheme.java b/designer-base/src/main/java/com/fr/design/style/background/gradient/FixedGradientBarNoTheme.java new file mode 100644 index 000000000..f3393366d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/style/background/gradient/FixedGradientBarNoTheme.java @@ -0,0 +1,39 @@ +package com.fr.design.style.background.gradient; + +import com.fr.design.DesignerEnvManager; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.style.color.ColorSelectDetailPane; +import com.fr.design.style.color.ColorSelectDialog; + +import javax.swing.JPanel; +import java.awt.Color; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2021-08-19 + */ +public class FixedGradientBarNoTheme extends FixedGradientBar { + + + public FixedGradientBarNoTheme(int minvalue, int maxvalue) { + super(minvalue, maxvalue); + } + + protected void clickButton(int select) { + ColorSelectDetailPane pane = new ColorSelectDetailPane(Color.WHITE); + Color selectColor = getList().get(select).getColorInner() == null ? Color.WHITE : getList().get(select).getColorInner(); + ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, selectColor, FixedGradientBarNoTheme.this); + Color color = FixedGradientBarNoTheme.this.getColor(); + if (color != null) { + DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color); + getList().get(select).setColorInner(color); + stateChanged(); + FixedGradientBarNoTheme.this.repaint(); + } + } + + public JPanel initWindowPane(double preWidth) { + return null; + } +} diff --git a/designer-base/src/main/java/com/fr/design/style/background/gradient/FixedGradientBarWithPopMenu.java b/designer-base/src/main/java/com/fr/design/style/background/gradient/FixedGradientBarWithPopMenu.java deleted file mode 100644 index aeff7f06c..000000000 --- a/designer-base/src/main/java/com/fr/design/style/background/gradient/FixedGradientBarWithPopMenu.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.fr.design.style.background.gradient; - -import com.fr.base.background.ColorBackground; -import com.fr.design.style.color.NewColorSelectPane; - -import javax.swing.JPanel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -/** - * @author Bjorn - * @version 10.0 - * Created by Bjorn on 2021-08-19 - */ -public class FixedGradientBarWithPopMenu extends FixedGradientBar { - - private NewColorSelectPane colorPane; - - public FixedGradientBarWithPopMenu(int minvalue, int maxvalue) { - super(minvalue, maxvalue); - } - - protected void clickButton(int select) { - setIndex(select); - showPopupMenu(); - } - - public JPanel initWindowPane(double preferredWidth) { - // 下拉的时候重新生成面板,刷新最近使用颜色 - colorPane = new NewColorSelectPane(false) { - @Override - public void setVisible(boolean b) { - super.setVisible(b); - } - - @Override - protected boolean selectRealTime() { - return false; - } - }; - colorPane.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - hidePopupMenu(); - setColor(((NewColorSelectPane) e.getSource()).getColor()); - getList().get(getIndex()).setColorInner(getColor()); - fireDisplayComponent(ColorBackground.getInstance(getColor())); - FixedGradientBarWithPopMenu.this.stateChanged(); - } - }); - return colorPane; - } - -} diff --git a/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java b/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java index e6c2e4dbd..aac5c837a 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java +++ b/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java @@ -1,14 +1,12 @@ package com.fr.design.style.background.gradient; -import com.fr.design.DesignerEnvManager; +import com.fr.base.background.ColorBackground; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.itextfield.UINumberField; -import com.fr.design.mainframe.DesignerContext; import com.fr.design.style.color.ColorCell; -import com.fr.design.style.color.ColorSelectDetailPane; -import com.fr.design.style.color.ColorSelectDialog; import com.fr.design.style.color.ColorSelectable; +import com.fr.design.style.color.NewColorSelectPane; import com.fr.stable.AssistUtils; import com.fr.stable.os.OperatingSystem; @@ -34,7 +32,7 @@ import java.awt.geom.Point2D; * TODO:面板缩放的功能没有考虑(就是尾值过大,导致超过界面显示的情况),原来的那个实现完全是个BUG。要缩放的情况也比较少,就干脆以后弄吧 */ public class GradientBar extends AbstractComponentPopBox implements UIObserver, ColorSelectable { - + private NewColorSelectPane colorPane; /** * */ @@ -131,20 +129,33 @@ public class GradientBar extends AbstractComponentPopBox implements UIObserver, } protected void clickButton(int select) { - ColorSelectDetailPane pane = new ColorSelectDetailPane(Color.WHITE); - Color selectColor = list.get(select).getColorInner() == null ? Color.WHITE : list.get(select).getColorInner(); - ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, selectColor, GradientBar.this); - Color color = GradientBar.this.getColor(); - if (color != null) { - DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color); - list.get(select).setColorInner(color); - stateChanged(); - GradientBar.this.repaint(); - } + setIndex(select); + showPopupMenu(); } - public JPanel initWindowPane(double preWidth) { - return null; + public JPanel initWindowPane(double preferredWidth) { + // 下拉的时候重新生成面板,刷新最近使用颜色 + colorPane = new NewColorSelectPane(false) { + @Override + public void setVisible(boolean b) { + super.setVisible(b); + } + + @Override + protected boolean selectRealTime() { + return false; + } + }; + colorPane.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + hidePopupMenu(); + setColor(((NewColorSelectPane) e.getSource()).getColor()); + getList().get(getIndex()).setColorInner(getColor()); + fireDisplayComponent(ColorBackground.getInstance(getColor())); + GradientBar.this.stateChanged(); + } + }); + return colorPane; } protected void addMouseDragListener() { From e08a30471164eeb45871a4a07b4e2b9cc033023b Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 27 Aug 2021 20:03:04 +0800 Subject: [PATCH 2/2] =?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/color/ColorControlWindowWithAuto.java | 5 +---- .../chart/gui/ColorSelectPaneWithOutTransparent.java | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) 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 b12d95e4e..4d6f45a67 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 @@ -115,10 +115,7 @@ public abstract class ColorControlWindowWithAuto extends ColorControlWindow { } public Dimension getPreferredSize() { - if (isSupportTransparent()) { - return new Dimension(super.getPreferredSize().width, TRANSPARENT_WINDOW_HEIGHT + BUTTON_HEIGHT); - } - return new Dimension(super.getPreferredSize().width, WINDOW_HEIGHT + BUTTON_HEIGHT); + return super.getPreferredSize(); } } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java index 81c31661f..73c9d7339 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java @@ -24,8 +24,6 @@ public class ColorSelectPaneWithOutTransparent extends NewColorSelectPane { menuColorPane.setLayout(new GridLayout(0, 8, 1, 1)); menuColorPane.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8)); - menuColorPane.setPreferredSize(new Dimension(205, 62)); - return menuColorPane; } }