From 3147786e6a66d0f856281f19141facd460e1a1c5 Mon Sep 17 00:00:00 2001 From: pengda Date: Thu, 24 Mar 2022 09:55:46 +0800 Subject: [PATCH 01/16] =?UTF-8?q?CHART-23227=20=E9=92=BB=E5=8F=96=E7=82=B9?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE&=E9=92=BB=E5=8F=96=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E5=88=87=E6=8D=A2=E7=B1=BB=E5=9E=8B=EF=BC=8C?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E6=97=A0=E6=B3=95=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/chart/ChartEditPane.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java index 6b75dff693..6064ef89d0 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java @@ -29,6 +29,7 @@ import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.custom.VanChartCustomPlot; import com.fr.plugin.chart.vanchart.VanChart; +import com.fr.van.chart.drillmap.designer.data.VanChartDrillMapDataPane; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -148,7 +149,12 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare ChartInfoCollector.getInstance().updateChartPropertyTime(collection.getSelectedChartProvider(ChartProvider.class)); selectedPane.update(collection); - + for (int i = 0; i < paneList.size(); i++) { + if (paneList.get(i) instanceof VanChartDrillMapDataPane && i != tabsHeaderIconPane.getSelectedIndex()) { + paneList.get(i).populateBean(collection); + break; + } + } if (!ComparatorUtils.equals(collection, lastCollection)) { VanChart vanChart = collection.getSelectedChartProvider(VanChart.class); if (vanChart != null) { From f8c08500c4130110a206e09cd3c59b42cc4bbb20 Mon Sep 17 00:00:00 2001 From: pengda Date: Thu, 24 Mar 2022 13:49:17 +0800 Subject: [PATCH 02/16] =?UTF-8?q?CHART-22972=20HyperlinkProvider=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=AF=B9=E5=9B=BE=E8=A1=A8=E8=B6=85=E9=93=BE=E4=B8=8D?= =?UTF-8?q?=E8=B5=B7=E4=BD=9C=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartHyperLinkPane.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java index b5efad3b66..f3a19a41e3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java @@ -150,17 +150,19 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane { //安装平台内打开插件时,添加相应按钮 Set providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG); - for (HyperlinkProvider provider : providers) { - NameableCreator nc = provider.createHyperlinkCreator(); - paneMap.put(nc.getHyperlink(), nc.getUpdatePane()); - } - java.util.List list = refreshList(paneMap); - NameObjectCreator[] creators = new NameObjectCreator[list.size()]; - for (int i = 0; list != null && i < list.size(); i++) { + int size = list.size(); + NameObjectCreator[] creators = new NameObjectCreator[size + providers.size()]; + for (int i = 0; i < size; i++) { UIMenuNameableCreator uiMenuNameableCreator = list.get(i); creators[i] = new NameObjectCreator(uiMenuNameableCreator.getName(), uiMenuNameableCreator.getObj().getClass(), uiMenuNameableCreator.getPaneClazz()); - + } + for (HyperlinkProvider provider : providers) { + NameableCreator creator = provider.createHyperlinkCreator(); + if (creator != null) { + creators[size] = new NameObjectCreator(creator.menuName(), creator.getHyperlink(), creator.getUpdatePane()); + size++; + } } refreshNameableCreator(creators); From c1cff83604c104472061e8e49cd1e77b652ed00d Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 24 Mar 2022 14:49:45 +0800 Subject: [PATCH 03/16] =?UTF-8?q?REPORT-68062=20=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E6=95=B0=E6=8D=AE=E5=88=97=E9=AB=98=E7=BA=A7=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE-=E6=A0=BC=E5=BC=8F=E8=AE=BE=E7=BD=AE=E4=B8=8D?= =?UTF-8?q?=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 DSColumnAdvancedPane.FormatAttrPane, 未继承AbstractAttrNoScrollPane,缺少了一些监听导致。 原有代码在合并时丢失,需要重新补充下 【改动思路】 无 【review建议】 --- .../design/dscolumn/DSColumnAdvancedPane.java | 63 ++++++++++++++++--- 1 file changed, 54 insertions(+), 9 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java index 32818de9f7..91c8fa292c 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java @@ -1,16 +1,14 @@ package com.fr.design.dscolumn; import com.fr.base.BaseFormula; -import com.fr.data.util.SortOrder; import com.fr.design.border.UITitledBorder; -import com.fr.design.constants.LayoutConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.formula.CustomVariableResolver; import com.fr.design.formula.FormulaFactory; -import com.fr.design.formula.SortFormulaPane; import com.fr.design.formula.UIFormula; +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; @@ -30,11 +28,19 @@ import com.fr.report.cell.cellattr.CellExpandAttr; import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.cellattr.core.group.SelectCount; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.Arrays; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.BOTTOM; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.SPECIFY; @@ -512,11 +518,12 @@ public class DSColumnAdvancedPane extends BasicPane { } } - public static class FormatAttrPane extends TextFormatPane { + + public static class ReLayoutTextFormatPane extends TextFormatPane { protected void initLayout() { - JComponent[][] components = new JComponent[][]{{typeComboBox, textField, roundingBox}}; - double[] rowSize = new double[]{TableLayout.FILL}; + JComponent[][] components = new JComponent[][] { {typeComboBox, textField, roundingBox} }; + double[] rowSize = new double[] { TableLayout.FILL }; double[] columnSize = {TableLayout.PREFERRED, 200, TableLayout.PREFERRED}; JPanel settingPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 4, 0); @@ -542,6 +549,44 @@ public class DSColumnAdvancedPane extends BasicPane { } } + public static class FormatAttrPane extends AbstractAttrNoScrollPane { + private TextFormatPane formatPane; + + @Override + protected JPanel createContentPane() { + this.formatPane = new ReLayoutTextFormatPane(); + return this.formatPane; + } + + @Override + public Dimension getPreferredSize() { + if (formatPane == null) { + return super.getPreferredSize(); + } + return formatPane.getPreferredSize(); + } + + protected void initContentPane() { + leftContentPane = createContentPane(); + if (leftContentPane != null) { + leftContentPane.setBorder(BorderFactory.createEmptyBorder()); + this.add(leftContentPane, BorderLayout.CENTER); + } + } + + public void populate(CellElement cellElement) { + if (cellElement != null && formatPane != null) { + formatPane.populateBean(cellElement.getStyle()); + } + } + + public void update(CellElement cellElement) { + if (cellElement != null && formatPane != null) { + cellElement.setStyle(formatPane.update(cellElement.getStyle())); + } + } + } + private void checkButtonEnabled() { if (useMultiplyNumCheckBox.isSelected()) { multiNumSpinner.setEnabled(true); From 71cd9c679ea40fc7c43373a830ec8a83710ecb74 Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 24 Mar 2022 15:11:02 +0800 Subject: [PATCH 04/16] =?UTF-8?q?REPORT-68127=20=E3=80=90=E4=B8=93?= =?UTF-8?q?=E9=A2=98=E3=80=91jdk11=E7=9A=84=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E7=94=A8bat=E8=84=9A=E6=9C=AC=E5=90=AF=E5=8A=A8=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=EF=BC=8Cexe=E5=90=AF=E5=8A=A8=E6=AD=A3=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 Reflect.on方法会抛出异常,需要主动catch 【改动思路】 无 【review建议】 --- .../Install4jStartupNotificationProvider.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java b/designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java index 5402032f94..b239698897 100644 --- a/designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java +++ b/designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java @@ -22,14 +22,22 @@ public class Install4jStartupNotificationProvider implements FineStartupNotifica @Override public void registerStartupListener(Listener listener) { - Class StartupNotificationListenerClass = Reflect.on("com.install4j.api.launcher.StartupNotification$Listener").type(); + Class StartupNotificationListenerClass = null; + try { + StartupNotificationListenerClass = Reflect.on("com.install4j.api.launcher.StartupNotification$Listener").type(); + } catch (Exception ignored) { + } + if (StartupNotificationListenerClass == null) { return; } ListenerHandler mHandler = new ListenerHandler(listener); Object listenerCallbackInstance = Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] { StartupNotificationListenerClass }, mHandler); - Reflect.on("com.install4j.api.launcher.StartupNotification").call("registerStartupListener", listenerCallbackInstance); + try { + Reflect.on("com.install4j.api.launcher.StartupNotification").call("registerStartupListener", listenerCallbackInstance); + } catch (Exception ignored) { + } } private static class ListenerHandler implements InvocationHandler { @@ -48,4 +56,13 @@ public class Install4jStartupNotificationProvider implements FineStartupNotifica return null; } } + + public static void main(String[] args) { + Install4jStartupNotificationProvider.getInstance().registerStartupListener(new Listener() { + @Override + public void startupPerformed(String parameters) { + + } + }); + } } From a0f83145e890362ffd320dacc16c7466d4bd1a4e Mon Sep 17 00:00:00 2001 From: lucian Date: Thu, 24 Mar 2022 15:31:15 +0800 Subject: [PATCH 05/16] =?UTF-8?q?REPORT-68161=20=E5=A1=AB=E6=8A=A5-?= =?UTF-8?q?=E6=A8=A1=E6=9D=BFweb=E5=B1=9E=E6=80=A7-=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=97=B6=EF=BC=8C=E7=BC=96=E8=BE=91=E8=A1=8C?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E8=AE=BE=E7=BD=AE=E7=9A=84=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E7=A1=AE=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/webattr/WriteToolBarPane.java | 1 + .../main/java/com/fr/design/webattr/WriteWebSettingPane.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java index 06b1671675..a2e0c53c2f 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WriteToolBarPane.java @@ -161,6 +161,7 @@ public class WriteToolBarPane extends AbstractEditToolBarPane { colorButton.setColor(webWrite.getSelectedColor()); } else { colorBox.setSelected(false); + colorButton.setEnabled(false); } if (webWrite.getSheetPosition() == Constants.TOP) { diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WriteWebSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WriteWebSettingPane.java index 3db3da6d7f..527acb4c49 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WriteWebSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WriteWebSettingPane.java @@ -109,6 +109,7 @@ public class WriteWebSettingPane extends WebSettingPane { protected void setDefault() { super.setDefault(); colorBox.setSelected(false); + colorButton.setEnabled(false); bottomRadioButton.setSelected(true); leftRadioButton.setSelected(true); unloadCheck.setSelected(true); @@ -126,6 +127,7 @@ public class WriteWebSettingPane extends WebSettingPane { colorButton.setColor(webWrite.getSelectedColor()); } else { colorBox.setSelected(false); + colorButton.setEnabled(false); } if (webWrite.getSheetPosition() == Constants.TOP) { From 155264458b41737dadeba6d405e82b5c2193fe4b Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 24 Mar 2022 15:52:55 +0800 Subject: [PATCH 06/16] =?UTF-8?q?REPORT-68061=20=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E5=85=83=E7=B4=A0-=E6=95=B0=E6=8D=AE=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE-=E8=87=AA=E5=AE=9A=E4=B9=89=E5=88=86=E7=BB=84?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=97=A0=E6=B3=95=E7=82=B9=E5=87=BB=E7=A1=AE?= =?UTF-8?q?=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cellquick/CellDSColumnEditor.java | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index 23015e9d09..4864921619 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -282,7 +282,7 @@ public class CellDSColumnEditor extends CellQuickEditor { private void initComponents(){ dataPane = new SelectedDataColumnPane(true, true); groupPane = new ResultSetGroupDockingPane(); - + initListener(); double[] rowSize = {P}, columnSize = {60, F}; UILabel uiLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Report_Filter_Conditions")); condition = new DSColumnConditionAction(); @@ -299,6 +299,35 @@ public class CellDSColumnEditor extends CellQuickEditor { conditionPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP); this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); } + + + private void initListener() { + dataPane.setListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + dataPane.update(cellElement); + fireTargetModified(); + } + } + }); + groupPane.setListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e == null) { + //分组-高级-自定义点确定的时候传进来null的e,但是这时候应该触发保存 + groupPane.update(); + fireTargetModified(); + return; + } + if (e.getStateChange() == ItemEvent.DESELECTED) { + groupPane.update(); + fireTargetModified(); + } + } + }); + } + @Override protected AttributeChangeListener getAttributeChangeListener() { return new AttributeChangeListener() { From e4d80627cf97cf66520876334ee2348729c12179 Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 24 Mar 2022 16:32:12 +0800 Subject: [PATCH 07/16] =?UTF-8?q?CHART-21969=20fix:=20fvs.cpt=E5=B1=8F?= =?UTF-8?q?=E8=94=BD=E5=9C=BA=E6=99=AF=E5=9C=B0=E5=9B=BE=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 2 ++ .../com/fr/design/chart/ChartTypePane.java | 7 +++++++ .../mainframe/chart/gui/ChartTypePane.java | 21 ++++++++++++------- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java index 2d54fc8189..b7c9c474e4 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -111,6 +111,8 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr public static final String TYPE_PANE_DEFAULT_TITLE = "DEFAULT_NAME"; + public static final String GEO_LAND_CHART_ID = "UGeoLandChart"; + public synchronized static ChartTypeInterfaceManager getInstance() { return classManager; diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java index 1408b6a770..c34fcce653 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java @@ -8,11 +8,13 @@ import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chartx.attr.ChartProvider; import com.fr.design.ChartTypeInterfaceManager; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; +import com.fr.stable.ArrayUtils; import com.fr.van.chart.config.DefaultStyleHelper4Van; import javax.swing.BorderFactory; @@ -45,6 +47,11 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven DefaultListModel defaultListModel = new DefaultListModel(); mainTypeList = new JList(defaultListModel); + if (DesignModeContext.isDuchampMode() + && ArrayUtils.contains(chartIDs, ChartTypeInterfaceManager.GEO_LAND_CHART_ID)) { + chartIDs = ArrayUtils.removeElement(chartIDs, ChartTypeInterfaceManager.GEO_LAND_CHART_ID); + } + for (int i = 0; i < chartIDs.length; i++) { defaultListModel.insertElementAt(ChartTypeInterfaceManager.getInstance().getName(chartIDs[i]), i); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java index 2eea49f16d..bd94ff561a 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java @@ -19,7 +19,6 @@ import com.fr.design.mainframe.chart.gui.item.FlexibleComboBox; import com.fr.design.mainframe.chart.gui.item.ItemEventType; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.mode.ChartEditContext; -import com.fr.design.mainframe.chart.mode.ChartEditMode; import com.fr.design.module.DesignModuleFactory; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; @@ -27,11 +26,6 @@ import com.fr.stable.AssistUtils; import com.fr.stable.StringUtils; import javax.swing.JPanel; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.event.ActionEvent; @@ -40,6 +34,11 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; /** * 图表 属性表, 类型选择 界面. @@ -55,6 +54,7 @@ public class ChartTypePane extends AbstractChartAttrPane { private ActionListener autoButtonListener; private boolean inForm; + @Override protected JPanel createContentPane() { initButtonListener(); @@ -291,13 +291,20 @@ public class ChartTypePane extends AbstractChartAttrPane { String plotID = entry.getKey(); if (ignore || ChartTypeManager.enabledChart(plotID)) { if (ChartTypeManager.getInstance().isShowInDesigner(plotID)) { - cards.add(entry.getValue()); + if (notGeoLandInDuchampCPT(plotID)) { + cards.add(entry.getValue()); + } } } } } + public boolean notGeoLandInDuchampCPT(String plotID) { + return !(DesignModeContext.isDuchampMode() + && ChartTypeInterfaceManager.GEO_LAND_CHART_ID.equals(plotID)); + } + private void addOnePlotIDCards(int priority, String plotID) { cards.add(allChartTypePane.get(priority).get(plotID)); } From 42dcfbfb3272aa8004732e8d500df43db50f6d2d Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 24 Mar 2022 14:49:45 +0800 Subject: [PATCH 08/16] =?UTF-8?q?REPORT-68062=20=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E6=95=B0=E6=8D=AE=E5=88=97=E9=AB=98=E7=BA=A7=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE-=E6=A0=BC=E5=BC=8F=E8=AE=BE=E7=BD=AE=E4=B8=8D?= =?UTF-8?q?=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 DSColumnAdvancedPane.FormatAttrPane, 未继承AbstractAttrNoScrollPane,缺少了一些监听导致。 原有代码在合并时丢失,需要重新补充下 【改动思路】 无 【review建议】 --- .../design/dscolumn/DSColumnAdvancedPane.java | 63 ++++++++++++++++--- 1 file changed, 54 insertions(+), 9 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java index 32818de9f7..91c8fa292c 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java @@ -1,16 +1,14 @@ package com.fr.design.dscolumn; import com.fr.base.BaseFormula; -import com.fr.data.util.SortOrder; import com.fr.design.border.UITitledBorder; -import com.fr.design.constants.LayoutConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.formula.CustomVariableResolver; import com.fr.design.formula.FormulaFactory; -import com.fr.design.formula.SortFormulaPane; import com.fr.design.formula.UIFormula; +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; @@ -30,11 +28,19 @@ import com.fr.report.cell.cellattr.CellExpandAttr; import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.cellattr.core.group.SelectCount; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.Arrays; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.BOTTOM; import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.SPECIFY; @@ -512,11 +518,12 @@ public class DSColumnAdvancedPane extends BasicPane { } } - public static class FormatAttrPane extends TextFormatPane { + + public static class ReLayoutTextFormatPane extends TextFormatPane { protected void initLayout() { - JComponent[][] components = new JComponent[][]{{typeComboBox, textField, roundingBox}}; - double[] rowSize = new double[]{TableLayout.FILL}; + JComponent[][] components = new JComponent[][] { {typeComboBox, textField, roundingBox} }; + double[] rowSize = new double[] { TableLayout.FILL }; double[] columnSize = {TableLayout.PREFERRED, 200, TableLayout.PREFERRED}; JPanel settingPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 4, 0); @@ -542,6 +549,44 @@ public class DSColumnAdvancedPane extends BasicPane { } } + public static class FormatAttrPane extends AbstractAttrNoScrollPane { + private TextFormatPane formatPane; + + @Override + protected JPanel createContentPane() { + this.formatPane = new ReLayoutTextFormatPane(); + return this.formatPane; + } + + @Override + public Dimension getPreferredSize() { + if (formatPane == null) { + return super.getPreferredSize(); + } + return formatPane.getPreferredSize(); + } + + protected void initContentPane() { + leftContentPane = createContentPane(); + if (leftContentPane != null) { + leftContentPane.setBorder(BorderFactory.createEmptyBorder()); + this.add(leftContentPane, BorderLayout.CENTER); + } + } + + public void populate(CellElement cellElement) { + if (cellElement != null && formatPane != null) { + formatPane.populateBean(cellElement.getStyle()); + } + } + + public void update(CellElement cellElement) { + if (cellElement != null && formatPane != null) { + cellElement.setStyle(formatPane.update(cellElement.getStyle())); + } + } + } + private void checkButtonEnabled() { if (useMultiplyNumCheckBox.isSelected()) { multiNumSpinner.setEnabled(true); From bcf191fadb93968c98279c7d084ee298adfed1d5 Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 24 Mar 2022 15:11:02 +0800 Subject: [PATCH 09/16] =?UTF-8?q?REPORT-68127=20=E3=80=90=E4=B8=93?= =?UTF-8?q?=E9=A2=98=E3=80=91jdk11=E7=9A=84=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E7=94=A8bat=E8=84=9A=E6=9C=AC=E5=90=AF=E5=8A=A8=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=EF=BC=8Cexe=E5=90=AF=E5=8A=A8=E6=AD=A3=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 Reflect.on方法会抛出异常,需要主动catch 【改动思路】 无 【review建议】 --- .../Install4jStartupNotificationProvider.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java b/designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java index 5402032f94..b239698897 100644 --- a/designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java +++ b/designer-base/src/main/java/com/fr/design/startup/Install4jStartupNotificationProvider.java @@ -22,14 +22,22 @@ public class Install4jStartupNotificationProvider implements FineStartupNotifica @Override public void registerStartupListener(Listener listener) { - Class StartupNotificationListenerClass = Reflect.on("com.install4j.api.launcher.StartupNotification$Listener").type(); + Class StartupNotificationListenerClass = null; + try { + StartupNotificationListenerClass = Reflect.on("com.install4j.api.launcher.StartupNotification$Listener").type(); + } catch (Exception ignored) { + } + if (StartupNotificationListenerClass == null) { return; } ListenerHandler mHandler = new ListenerHandler(listener); Object listenerCallbackInstance = Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] { StartupNotificationListenerClass }, mHandler); - Reflect.on("com.install4j.api.launcher.StartupNotification").call("registerStartupListener", listenerCallbackInstance); + try { + Reflect.on("com.install4j.api.launcher.StartupNotification").call("registerStartupListener", listenerCallbackInstance); + } catch (Exception ignored) { + } } private static class ListenerHandler implements InvocationHandler { @@ -48,4 +56,13 @@ public class Install4jStartupNotificationProvider implements FineStartupNotifica return null; } } + + public static void main(String[] args) { + Install4jStartupNotificationProvider.getInstance().registerStartupListener(new Listener() { + @Override + public void startupPerformed(String parameters) { + + } + }); + } } From f9ad77b8ed72c6ff780bbc05d3ec008c5d155dc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 25 Mar 2022 09:47:02 +0800 Subject: [PATCH 10/16] =?UTF-8?q?REPORT-68175=20release=E5=90=88=E5=B9=B6f?= =?UTF-8?q?inal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beans/adapters/layout/FRAbsoluteLayoutAdapter.java | 6 +++++- .../main/java/com/fr/design/mainframe/FormDesignerUI.java | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java index 5bdfe3c298..5fb1025f30 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java @@ -4,6 +4,7 @@ import com.fr.design.beans.GroupModel; import com.fr.design.designer.beans.ConstraintsGroupModel; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.models.DraggingModel; +import com.fr.design.designer.beans.models.StateModel; import com.fr.design.designer.beans.painters.FRAbsoluteLayoutPainter; import com.fr.design.designer.creator.*; import com.fr.design.designer.properties.BoundsGroupModel; @@ -353,7 +354,10 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter { public void dragging(DraggingModel model) { FormDesigner designer = model.getDesigner(); MouseEvent dragEvent = model.getCurrentDragEvent(); - designer.getStateModel().dragging(dragEvent); + StateModel stateModel = designer.getStateModel(); + if (stateModel.dragable()) { + stateModel.dragging(dragEvent); + } } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java index 8307e945f6..1f3a7caf53 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java @@ -224,6 +224,9 @@ public class FormDesignerUI extends ComponentUI { } XCreator creator = draggingModel.getCreator(); + if (!creator.isSupportDrag()) { + return false; + } int leftTopX = draggingModel.getCreatorLeftTopX(); int leftTopY = draggingModel.getCreatorLeftTopY(); From 2608f171b655672114d746c3057186ceac8879d7 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 25 Mar 2022 16:16:22 +0800 Subject: [PATCH 11/16] =?UTF-8?q?REPORT-65854=20=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E9=87=8A=E6=94=BE=E6=B2=A1=E6=9C=89=E5=9C=A8finally=20?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=AE=B5=E4=B8=AD=E8=BF=9B=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/design/RestartHelper.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/RestartHelper.java b/designer-base/src/main/java/com/fr/design/RestartHelper.java index 64fdda7baa..9c14fd4157 100644 --- a/designer-base/src/main/java/com/fr/design/RestartHelper.java +++ b/designer-base/src/main/java/com/fr/design/RestartHelper.java @@ -57,10 +57,8 @@ public class RestartHelper { properties.setProperty((i + size) + "", files[i]); } } - try { - FileOutputStream file2DeleteOutputStream = new FileOutputStream(file); + try (FileOutputStream file2DeleteOutputStream = new FileOutputStream(file)) { properties.store(file2DeleteOutputStream, "save"); - file2DeleteOutputStream.close(); } catch (IOException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } From 39ba85cdacec5e170a2ec266bbe65d5a7b414389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 28 Mar 2022 16:09:48 +0800 Subject: [PATCH 12/16] =?UTF-8?q?REPORT-68555=20=E3=80=90=E8=A7=86?= =?UTF-8?q?=E8=A7=89=E9=AA=8C=E6=94=B6=E3=80=91=E6=96=B0=E5=BB=BA=E7=94=BB?= =?UTF-8?q?=E5=B8=83/=E5=8A=A0=E8=BD=BD=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/iprogressbar/ProgressDialog.java | 40 ++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java index 3106ebff70..2c1e6abf56 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java +++ b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java @@ -5,7 +5,6 @@ import com.fr.design.dialog.UIDialog; import com.fr.design.gui.ilable.UILabel; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.utils.DesignUtils; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSSupportCenter; @@ -23,9 +22,15 @@ import java.awt.Frame; * 加载进度弹窗 */ public class ProgressDialog extends UIDialog { - private JProgressBar progressBar; + protected static final FRFont font = DesignUtils + .getDefaultGUIFont() + .applySize(14) + .applyForeground(new ColorUIResource(333334)); + + protected JProgressBar progressBar; private JDialog centerDialog; - private JLabel text; + protected JLabel text; + protected JPanel progressPanel; public ProgressDialog(Frame parent) { super(parent); @@ -42,30 +47,37 @@ public class ProgressDialog extends UIDialog { } private void initComponent(Frame parent) { + initProgressBar(); + initProgressPanel(); + initCenterDialog(parent); + } + protected void initCenterDialog(Frame parent) { centerDialog = new JDialog(this); centerDialog.setSize(new Dimension(482, 124)); centerDialog.setUndecorated(true); centerDialog.setLocationRelativeTo(parent); - JPanel panel = new JPanel(); - panel.setBorder(new UIProgressBorder(3, UIConstants.DEFAULT_BG_RULER, 14, 46, 47, 37, 47)); - panel.setLayout(new BorderLayout(4, 15)); + centerDialog.getContentPane().add(progressPanel); + } + + protected void initProgressBar() { progressBar = new JProgressBar(); progressBar.setUI(new ModernUIProgressBarUI()); progressBar.setBorderPainted(false); progressBar.setOpaque(false); progressBar.setBorder(null); progressBar.setMaximum(1000); - panel.add(progressBar, BorderLayout.CENTER); + } + + protected void initProgressPanel() { + progressPanel = new JPanel(); + progressPanel.setBorder(new UIProgressBorder(3, UIConstants.DEFAULT_BG_RULER, 14, 46, 47, 37, 47)); + progressPanel.setLayout(new BorderLayout(4, 15)); + progressPanel.add(progressBar, BorderLayout.CENTER); text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Project"), JLabel.CENTER); - FRFont font = DesignUtils - .getDefaultGUIFont() - .applySize(14) - .applyForeground(new ColorUIResource(333334)); text.setFont(font); - panel.add(text, BorderLayout.SOUTH); - panel.setVisible(true); - centerDialog.getContentPane().add(panel); + progressPanel.add(text, BorderLayout.SOUTH); + progressPanel.setVisible(true); } @Override From 98040cf2a0c6613340289a1276846fffa2a8e6f4 Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 29 Mar 2022 20:43:48 +0800 Subject: [PATCH 13/16] =?UTF-8?q?REPORT-68062=20=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E6=95=B0=E6=8D=AE=E5=88=97=E9=AB=98=E7=BA=A7=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE-=E6=A0=BC=E5=BC=8F=E8=AE=BE=E7=BD=AE=E4=B8=8D?= =?UTF-8?q?=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 文本格式需要通过重新设置样式才能更新到被编辑的单元格中, 否则文本格式样式无法设置 【改动思路】 更新样式到被编辑的单元格中 【review建议】 --- designer-realize/src/main/java/com/fr/grid/Grid.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-realize/src/main/java/com/fr/grid/Grid.java b/designer-realize/src/main/java/com/fr/grid/Grid.java index d1f3881389..fb18ac07fd 100644 --- a/designer-realize/src/main/java/com/fr/grid/Grid.java +++ b/designer-realize/src/main/java/com/fr/grid/Grid.java @@ -1095,6 +1095,7 @@ public class Grid extends BaseGridComponent { TemplateCellElement cellElement = (TemplateCellElement) newValue; editingCellElement.setValue(cellElement.getValue()); editingCellElement.setCellExpandAttr(cellElement.getCellExpandAttr()); + editingCellElement.setStyle(cellElement.getStyle()); return true; } else if (newValue instanceof CellImage) { CellImage cellImage = (CellImage) newValue; From ef7c26006294f5af826e19b68ddb7d32667fe41f Mon Sep 17 00:00:00 2001 From: Starryi Date: Tue, 29 Mar 2022 20:43:48 +0800 Subject: [PATCH 14/16] =?UTF-8?q?REPORT-68062=20=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E6=95=B0=E6=8D=AE=E5=88=97=E9=AB=98=E7=BA=A7=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE-=E6=A0=BC=E5=BC=8F=E8=AE=BE=E7=BD=AE=E4=B8=8D?= =?UTF-8?q?=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 文本格式需要通过重新设置样式才能更新到被编辑的单元格中, 否则文本格式样式无法设置 【改动思路】 更新样式到被编辑的单元格中 【review建议】 --- designer-realize/src/main/java/com/fr/grid/Grid.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-realize/src/main/java/com/fr/grid/Grid.java b/designer-realize/src/main/java/com/fr/grid/Grid.java index d1f3881389..fb18ac07fd 100644 --- a/designer-realize/src/main/java/com/fr/grid/Grid.java +++ b/designer-realize/src/main/java/com/fr/grid/Grid.java @@ -1095,6 +1095,7 @@ public class Grid extends BaseGridComponent { TemplateCellElement cellElement = (TemplateCellElement) newValue; editingCellElement.setValue(cellElement.getValue()); editingCellElement.setCellExpandAttr(cellElement.getCellExpandAttr()); + editingCellElement.setStyle(cellElement.getStyle()); return true; } else if (newValue instanceof CellImage) { CellImage cellImage = (CellImage) newValue; From 35defc43b3098d2e8e427f77fcc49957153625e3 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 31 Mar 2022 15:04:23 +0800 Subject: [PATCH 15/16] =?UTF-8?q?REPORT-68780=20BeforeSwicth=E8=A6=81?= =?UTF-8?q?=E7=AD=89stash=E5=81=9A=E5=AE=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/file/HistoryTemplateListCache.java | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 443a55671d..d6b12efa62 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -24,7 +24,6 @@ import com.fr.stable.CoreConstants; import com.fr.stable.StringUtils; import com.fr.third.org.apache.commons.io.FilenameUtils; -import javax.swing.SwingWorker; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -44,7 +43,6 @@ public class HistoryTemplateListCache implements CallbackEvent { private static final int DEAD_LINE = DesignerEnvManager.getEnvManager().getCachingTemplateLimit(); private List> historyList; private JTemplate editingTemplate; - private SwingWorker stashWorker; public static HistoryTemplateListCache getInstance() { return Holder.INSTANCE; @@ -342,14 +340,7 @@ public class HistoryTemplateListCache implements CallbackEvent { * @see HistoryTemplateListCache#load() */ public void stash() { - stashWorker = new SwingWorker() { - @Override - protected Boolean doInBackground() throws Exception { - _stash(); - return true; - } - }; - stashWorker.execute(); + _stash(); } private void _stash() { @@ -370,16 +361,6 @@ public class HistoryTemplateListCache implements CallbackEvent { FineLoggerFactory.getLogger().info("Env Change Template Stashed."); } - - private boolean checkStash() { - try { - return stashWorker.get(); - } catch (Exception e) { - FineLoggerFactory.getLogger().debug(e.getMessage(), e); - return false; - } - } - /** * 切换环境前将正在编辑的模板暂存起来后,在新环境重新读取一遍 *

@@ -388,9 +369,6 @@ public class HistoryTemplateListCache implements CallbackEvent { * @see HistoryTemplateListCache#stash() */ public void load() { - if (!checkStash()) { - return; - } FineLoggerFactory.getLogger().info("Env Change Template Loading..."); if (stashFILEMap != null && stashFILEMap.size() != 0) { int size = historyList.size(); From 8beb5b7c88dff3096052ea17cdeeaa9331b4ccd2 Mon Sep 17 00:00:00 2001 From: rinoux Date: Sat, 2 Apr 2022 10:52:53 +0800 Subject: [PATCH 16/16] =?UTF-8?q?REPORT-68607=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E5=85=A8=E9=87=8F=E4=BF=9D=E5=AD=98=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=A2=9E=E9=87=8F=E4=BF=9D=E5=AD=98=2011?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/data/MapCompareUtils.java | 53 +++++++++++++ .../datapane/connect/ConnectionListPane.java | 75 +++++++++++++------ .../fr/design/data/MapCompareUtilsTest.java | 57 ++++++++++++++ 3 files changed, 161 insertions(+), 24 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/data/MapCompareUtils.java create mode 100644 designer-base/src/test/java/com/fr/design/data/MapCompareUtilsTest.java diff --git a/designer-base/src/main/java/com/fr/design/data/MapCompareUtils.java b/designer-base/src/main/java/com/fr/design/data/MapCompareUtils.java new file mode 100644 index 0000000000..f7492aefcc --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/data/MapCompareUtils.java @@ -0,0 +1,53 @@ +package com.fr.design.data; + +import org.jetbrains.annotations.NotNull; + +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * @author rinoux + * @version 10.0 + * Created by rinoux on 2022/3/28 + */ +public final class MapCompareUtils { + + + /** + * 对比两个map 查找出相比orig,other中有哪些是新增的、删除的或者被修改的,并分别进行处理 + * + * @param orig 原始map + * @param other 参考的新map + * @param eventHandler 有区别时的事件处理器 + * @param K + * @param V + */ + public static void contrastMapEntries(@NotNull Map orig, @NotNull Map other, @NotNull EventHandler eventHandler) { + + Map copiedOrig = new LinkedHashMap<>(orig); + + other.forEach((k, v) -> { + V existedV = copiedOrig.remove(k); + if (existedV != null) { + if (!v.equals(existedV)) { + eventHandler.on(EntryEventKind.UPDATED, k, v); + } + } else { + eventHandler.on(EntryEventKind.ADDED, k, v); + } + }); + + copiedOrig.forEach((k, v) -> eventHandler.on(EntryEventKind.REMOVED, k, v)); + } + + + public interface EventHandler { + void on(EntryEventKind entryEventKind, K k, V v); + } + + public enum EntryEventKind { + ADDED, + REMOVED, + UPDATED; + } +} diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index 1566395edb..12c62b4350 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -6,6 +6,7 @@ import com.fr.data.impl.ConnectionBean; import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JNDIDatabaseConnection; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.data.MapCompareUtils; import com.fr.design.dialog.BasicDialog; import com.fr.design.fun.ConnectionProvider; import com.fr.design.gui.controlpane.JListControlPane; @@ -16,21 +17,21 @@ import com.fr.design.i18n.Toolkit; import com.fr.event.EventDispatcher; import com.fr.file.ConnectionConfig; import com.fr.file.ConnectionOperator; -import com.fr.file.ConnectionOperatorImpl; import com.fr.general.NameObject; import com.fr.log.FineLoggerFactory; -import com.fr.rpc.ExceptionHandler; -import com.fr.rpc.RPCInvokerExceptionInfo; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; import com.fr.stable.StringUtils; import com.fr.stable.core.PropertyChangeAdapter; -import com.fr.third.org.apache.commons.collections4.MapUtils; +import com.fr.transaction.Configurations; +import com.fr.transaction.WorkerFacade; import com.fr.workspace.WorkContext; import java.awt.Window; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; @@ -42,7 +43,8 @@ import java.util.UUID; public class ConnectionListPane extends JListControlPane implements ConnectionShowPane { public static final String TITLE_NAME = Toolkit.i18nText("Fine-Design_Basic_Server_Define_Data_Connection"); private boolean isNamePermitted = true; - private HashMap renameMap = new HashMap(); + private final HashMap renameMap = new HashMap<>(); + private final Map populatedConnectionsSnapshot = new LinkedHashMap<>(); public ConnectionListPane() { renameMap.clear(); @@ -149,11 +151,16 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh */ public void populate(ConnectionConfig connectionConfig) { List nameObjectList = new ArrayList(); + populatedConnectionsSnapshot.clear(); for (Map.Entry entry : connectionConfig.getConnections().entrySet()) { nameObjectList.add(new NameObject(entry.getKey(), entry.getValue())); + try { + populatedConnectionsSnapshot.put(entry.getKey(), (Connection) entry.getValue().clone()); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } } this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); - } /** @@ -162,23 +169,36 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh public void update(ConnectionConfig connectionConfig) { // Nameable[]居然不能强转成NameObject[],一定要这么写... Nameable[] res = this.update(); - List connectionBeans = new ArrayList<>(); - Map map = MapUtils.invertMap(getRenameMap()); - for (int i = 0; i < res.length; i++) { - NameObject nameObject = (NameObject) res[i]; - String oldName = map.get(nameObject.getName()); - if (oldName == null) { - oldName = StringUtils.EMPTY; + Map updatedMap = new LinkedHashMap<>(); + Arrays.stream(res).map(n -> (NameObject) n).forEach(no -> updatedMap.put(no.getName(), (Connection) no.getObject())); + + List removedConnNames = new ArrayList<>(); + List addedOrUpdatedConnections = new ArrayList<>(); + + MapCompareUtils.contrastMapEntries(populatedConnectionsSnapshot, updatedMap, (entryEventKind, s, connection) -> { + switch (entryEventKind) { + case REMOVED: + removedConnNames.add(s); + break; + case ADDED: + case UPDATED: + addedOrUpdatedConnections.add(new ConnectionBean(s, StringUtils.EMPTY, connection)); + default: + break; } - connectionBeans.add(new ConnectionBean(nameObject.getName(), oldName, (Connection) nameObject.getObject())); - } + }); + + + this.alterConnections(removedConnNames, addedOrUpdatedConnections); + } + + private void alterConnections(List removedConnNames, List addedOrUpdatedConnections) { + try { - WorkContext.getCurrent().get(ConnectionOperator.class, new ExceptionHandler() { - @Override - public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) { - return saveByOldWay(connectionBeans); - } - }).saveConnection(new ArrayList<>(connectionConfig.getConnections().keySet()), connectionBeans); + WorkContext.getCurrent().get(ConnectionOperator.class, exceptionInfo -> saveByOldWay(removedConnNames, addedOrUpdatedConnections)) + .saveConnection(removedConnNames, addedOrUpdatedConnections); + + // hades:远程环境时,由于时直接RPC调用远程修改,因此设计器本地配置需要失效 if (!WorkContext.getCurrent().isLocal()) { EventDispatcher.fire(RemoteConfigEvent.EDIT, ConnectionConfig.getInstance().getNameSpace()); } @@ -187,13 +207,20 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh } } - private boolean saveByOldWay(List connectionBeans) { + private boolean saveByOldWay(List removedConnNames, List addedOrUpdatedConnections) { try { - return ConnectionOperatorImpl.getInstance().saveConnection(connectionBeans); + return Configurations.modify(new WorkerFacade(ConnectionConfig.class) { + @Override + public void run() { + removedConnNames.forEach(n -> ConnectionConfig.getInstance().removeConnection(n)); + addedOrUpdatedConnections.forEach(cb -> ConnectionConfig.getInstance().addConnection(cb.getName(), cb.getConnection())); + } + }); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - return false; } + + return false; } public static void showDialog(Window parent) { diff --git a/designer-base/src/test/java/com/fr/design/data/MapCompareUtilsTest.java b/designer-base/src/test/java/com/fr/design/data/MapCompareUtilsTest.java new file mode 100644 index 0000000000..1f1e60e2be --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/data/MapCompareUtilsTest.java @@ -0,0 +1,57 @@ +package com.fr.design.data; + +import org.junit.Assert; +import org.junit.Test; + +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * @author rinoux + * @version 10.0 + * Created by rinoux on 2022/3/28 + */ +public class MapCompareUtilsTest { + + @Test + public void contrastMapEntries() { + + + Map orig = new LinkedHashMap<>(); + + orig.put("aaa", "aaa"); + orig.put("bbb", "bbb"); + orig.put("ccc", "ccc"); + orig.put("ddd", "ddd"); + + + Map other = new LinkedHashMap<>(); + + other.put("aaa", "111"); + other.put("bbb", "bbb"); + other.put("ccc", "ccc"); + other.put("eee", "eee"); + + + MapCompareUtils.contrastMapEntries(orig, other, new MapCompareUtils.EventHandler() { + @Override + public void on(MapCompareUtils.EntryEventKind entryEventKind, String s, String s2) { + switch (entryEventKind) { + case UPDATED: + Assert.assertEquals(s, "aaa"); + Assert.assertEquals(s2, "111"); + break; + case REMOVED: + Assert.assertEquals(s, "ddd"); + break; + case ADDED: + Assert.assertEquals(s, "eee"); + Assert.assertEquals(s2, "eee"); + break; + default: + Assert.fail(); + } + } + }); + } +} \ No newline at end of file