From 833c4b58725725af873ff7252ae249a93507e599 Mon Sep 17 00:00:00 2001 From: shine Date: Fri, 15 Apr 2022 15:20:53 +0800 Subject: [PATCH 1/6] =?UTF-8?q?REPORT-68638=20fix:=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=89=80=E6=9C=89=E5=9B=BE=E8=A1=A8=E9=85=8D=E8=89=B2=20?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E8=AF=BBfvs.cpt.chart=E4=BC=9A=E8=A2=AB?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=88=90=E8=B7=9F=E9=9A=8F=E4=B8=BB=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../van/chart/config/DefaultStyleHelper4Van.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java index a6ce45a534..356fbe8541 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java +++ b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java @@ -27,6 +27,7 @@ import com.fr.plugin.chart.type.GaugeStyle; import com.fr.plugin.chart.vanchart.VanChart; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; /** @@ -166,8 +167,8 @@ public class DefaultStyleHelper4Van { private static void dealChartColor(VanChartPlot vanChartPlot) { ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance(); Object preStyle = manager.getPreStyle(DefaultStyleConstants.COLORS); + ColorFillStyle colorFillStyle = new ColorFillStyle(); if (preStyle instanceof ChartColorMatching) { - ColorFillStyle colorFillStyle = new ColorFillStyle(); //default是默认的意思,为服务器默认配色方案 //acc为多个颜色组合 //gradient为渐变颜色 @@ -181,7 +182,20 @@ public class DefaultStyleHelper4Van { vanChartPlot.setPlotFillStyle(plotFillStyle); } plotFillStyle.setColorFillStyle(colorFillStyle); + } else { + //服务器上没有图表配色 + //需要指定配色属性为自定义组合色,否则会被兼容成跟随主题 + // com.fr.plugin.chart.attr.plot.VanChartPlot.compatibleFillStyle + colorFillStyle.setColorStyle(ChartConstants.COLOR_ACC); + colorFillStyle.setColorList(Arrays.asList(ChartConstants.NEW_FEATURES)); + } + + AttrFillStyle plotFillStyle = vanChartPlot.getPlotFillStyle(); + if (plotFillStyle == null) { + plotFillStyle = new AttrFillStyle(); + vanChartPlot.setPlotFillStyle(plotFillStyle); } + plotFillStyle.setColorFillStyle(colorFillStyle); } private static void dealBorder(VanChartPlot vanChartPlot) { From 4a7146db1fdc5411b1aceb8f682875df408ba232 Mon Sep 17 00:00:00 2001 From: shine Date: Fri, 15 Apr 2022 15:23:38 +0800 Subject: [PATCH 2/6] update --- .../com/fr/van/chart/config/DefaultStyleHelper4Van.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java index 356fbe8541..b3bfca329c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java +++ b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java @@ -175,13 +175,6 @@ public class DefaultStyleHelper4Van { colorFillStyle.setColorStyle(ChartConstants.COLOR_ACC); colorFillStyle.setFillStyleName(DefaultStyleConstants.COLORS); colorFillStyle.setColorList(((ChartColorMatching) preStyle).getColorList()); - - AttrFillStyle plotFillStyle = vanChartPlot.getPlotFillStyle(); - if (plotFillStyle == null) { - plotFillStyle = new AttrFillStyle(); - vanChartPlot.setPlotFillStyle(plotFillStyle); - } - plotFillStyle.setColorFillStyle(colorFillStyle); } else { //服务器上没有图表配色 //需要指定配色属性为自定义组合色,否则会被兼容成跟随主题 From 2534fffebd90bef2533416b2aaece153fd2355af Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 15 Apr 2022 17:01:03 +0800 Subject: [PATCH 3/6] =?UTF-8?q?REPORT-69842=20=E4=BF=AE=E6=94=B9=E8=BE=B9?= =?UTF-8?q?=E6=A1=86=E9=A2=9C=E8=89=B2=E5=8D=95=E5=85=83=E6=A0=BC=E8=83=8C?= =?UTF-8?q?=E6=99=AF=E9=A2=9C=E8=89=B2=E4=BC=9A=E5=8F=98=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 错误的逻辑是 使用单元格样式面板的updateBean方法,获取单元格样式面板的所有配置,并将其设置 到指定单元格上。这个逻辑会导致在选中多个单元格时,用户没有修改的样式配置项也 被覆盖掉.(单元格样式面板的配置项并不可靠,在某些情况下比如单元格多选时,不能 反应实际的单元格样式) 正确的逻辑 用户在编辑自定义单元格样式时,仅修改发生了更改的配置,其余保持不变,也就是将原 有的单元格样式配置,与用户修改的部分配置进行merge,得到新的样式,并设置到指定 单元格上。 注意:这里的样式配置更改存在的情况有三种: 1. 单于昂样式跟随主题切换到自定义样式。样式细节未发生变动,但不再跟随主题了,代码逻辑中对应 switchCellStylesToCustom,样式对象类型从NameStyle变为Style 2. 在跟随主题样式面板,切换主题单元格样式。全量更新,放弃单元格所有原来样式,因此需要使用updateBean. 3. 在自定义样式面板,修改部分配置项。增量更新,保持其他配置项不变,因此需要使用mergeBean. 【改动思路】 同上 【review建议】 --- .../design/mainframe/cell/settingpane/CellStylePane.java | 2 +- .../mainframe/cell/settingpane/style/StylePane.java | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java index 3bdd034c68..8e57415a7e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java @@ -118,7 +118,7 @@ public class CellStylePane extends AbstractCellAttrPane { elementCase.addCellElement(cellElement); } Format format = cellElement.getStyle().getFormat(); - Style style = stylePane.updateBean(); + Style style = stylePane.mergeBean(cellElement.getStyle()); // 格式不能通过样式面板中的配置项修改,因此需要保留 style = style.deriveFormat(format); cellElement.setStyle(style); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java index 7f382ed44a..9c9523e132 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java @@ -251,6 +251,14 @@ public class StylePane extends BasicPane implements UIObserver { followingThemePane.setVisible(AdjustWorkBookDefaultStyleUtils.supportTheme()); } + public Style mergeBean(Style style) { + if (isFollowingTheme()) { + return updateBean(); + } else { + return customStylePane.updateStyle(style); + } + } + private void fireStateChanged() { for (UIObserverListener listener: observerListeners) { listener.doChange(); From 7bd8d5b6137cf270eb32c3bc99cb6a30f67c8c43 Mon Sep 17 00:00:00 2001 From: lucian Date: Mon, 18 Apr 2022 11:44:39 +0800 Subject: [PATCH 4/6] =?UTF-8?q?REPORT-68949=20=E6=8E=A7=E4=BB=B6-=E9=A2=84?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=8E=A7=E4=BB=B6-=E9=A2=84=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=8E=A7=E4=BB=B6=E6=96=B0=E5=BB=BA=E5=90=8E=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E5=88=97=E8=A1=A8=E4=B8=AD=E6=B2=A1=E6=9C=89=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E5=87=BA=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/widget/WidgetPane.java | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java b/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java index d746c4066b..6bbc84ad35 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java @@ -22,6 +22,8 @@ import com.fr.general.ComparatorUtils; import com.fr.stable.ArrayUtils; import javax.swing.*; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; @@ -198,6 +200,7 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener } }); this.setPreferredSize(new Dimension(100, 20)); + this.initPopupMenuListener(userDefined); } public void setSelectedItemByWidgetClass(Class clazz) { @@ -218,7 +221,7 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener super.setSelectedItem(anObject); } - private Vector getWidgetsName(boolean userDefined) { + private Vector getWidgetsName(boolean userDefined) { WidgetOption[] reportWidgetInstance = getWidgetOptions(); Vector items = new Vector(); @@ -262,7 +265,30 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener } private WidgetOption[] getWidgetOptions() { - return (WidgetOption[]) ArrayUtils.addAll(WidgetOption.getReportWidgetInstance(), ExtraDesignClassManager.getInstance().getCellWidgetOptions()); + return ArrayUtils.addAll(WidgetOption.getReportWidgetInstance(), ExtraDesignClassManager.getInstance().getCellWidgetOptions()); + } + + private void initPopupMenuListener(boolean userDefined) { + this.addPopupMenuListener(new PopupMenuListener() { + + @Override + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + // 下拉刷新下列表 + Object selectedItem = getSelectedItem(); + setModel(new DefaultComboBoxModel(getWidgetsName(userDefined))); + setSelectedItem(selectedItem); + } + + @Override + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + + } + + @Override + public void popupMenuCanceled(PopupMenuEvent e) { + + } + }); } } From cf19dcee7aa4313d30847a05ccb40720f398ea20 Mon Sep 17 00:00:00 2001 From: lucian Date: Mon, 18 Apr 2022 13:39:38 +0800 Subject: [PATCH 5/6] =?UTF-8?q?REPORT-68949=20=E6=8E=A7=E4=BB=B6-=E9=A2=84?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=8E=A7=E4=BB=B6-=E9=A2=84=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=8E=A7=E4=BB=B6=E6=96=B0=E5=BB=BA=E5=90=8E=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E5=88=97=E8=A1=A8=E4=B8=AD=E6=B2=A1=E6=9C=89=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E5=87=BA=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/widget/WidgetPane.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java b/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java index 6bbc84ad35..1777237f91 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java @@ -20,6 +20,7 @@ import com.fr.form.ui.*; import com.fr.general.ComparatorUtils; import com.fr.stable.ArrayUtils; +import com.fr.stable.AssistUtils; import javax.swing.*; import javax.swing.event.PopupMenuEvent; @@ -274,9 +275,12 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { // 下拉刷新下列表 - Object selectedItem = getSelectedItem(); - setModel(new DefaultComboBoxModel(getWidgetsName(userDefined))); - setSelectedItem(selectedItem); + Vector widgetsName = getWidgetsName(userDefined); + if (modelChanged(widgetsName)) { + Object selectedItem = getSelectedItem(); + setModel(new DefaultComboBoxModel<>(widgetsName)); + setSelectedItem(selectedItem); + } } @Override @@ -290,6 +294,20 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener } }); } + + private boolean modelChanged(Vector widgetsName) { + DefaultComboBoxModel model = (DefaultComboBoxModel) getModel(); + int modelSize = model.getSize(); + if (modelSize != widgetsName.size()) { + return true; + } + for (int i = 0; i < modelSize; i++) { + if (!AssistUtils.equals(model.getElementAt(i), widgetsName.elementAt(i))) { + return true; + } + } + return false; + } } /** From 7baae38c8582d1953805bb3a97e733ff86a28eb4 Mon Sep 17 00:00:00 2001 From: lucian Date: Mon, 18 Apr 2022 13:47:06 +0800 Subject: [PATCH 6/6] =?UTF-8?q?REPORT-68949=20=E6=8E=A7=E4=BB=B6-=E9=A2=84?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=8E=A7=E4=BB=B6-=E9=A2=84=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=8E=A7=E4=BB=B6=E6=96=B0=E5=BB=BA=E5=90=8E=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E5=88=97=E8=A1=A8=E4=B8=AD=E6=B2=A1=E6=9C=89=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E5=87=BA=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/widget/WidgetPane.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java b/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java index 1777237f91..3a50c38705 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java @@ -277,9 +277,7 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener // 下拉刷新下列表 Vector widgetsName = getWidgetsName(userDefined); if (modelChanged(widgetsName)) { - Object selectedItem = getSelectedItem(); - setModel(new DefaultComboBoxModel<>(widgetsName)); - setSelectedItem(selectedItem); + refreshBoxItems(widgetsName); } }