From 9c52e84c6c7ba3e3777a6d302d609a5b088f170e Mon Sep 17 00:00:00 2001 From: xiqiu Date: Fri, 20 Aug 2021 10:45:57 +0800 Subject: [PATCH 01/32] =?UTF-8?q?REPORT-57643=20=20=20=E8=B0=83=E6=95=B4co?= =?UTF-8?q?mbobox=E7=9A=84=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/connect/JDBCDefPane.java | 24 ++++++++++++- .../fr/design/gui/icombobox/UIComboBoxUI.java | 34 +++++++++++++++++-- .../design/gui/icontainer/UIScrollPane.java | 13 +++++-- 3 files changed, 65 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java index 3349581248..022323f194 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java @@ -7,6 +7,7 @@ import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.design.border.UITitledBorder; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.icombobox.UIComboBoxUI; import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ipasswordfield.UIPasswordFieldWithFixedLength; @@ -32,6 +33,8 @@ import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; +import javax.swing.plaf.ComboBoxUI; +import javax.swing.plaf.basic.ComboPopup; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -275,8 +278,9 @@ public class JDBCDefPane extends JPanel { } dbtypeComboBox.addActionListener(dbtypeActionListener); dbtypeComboBox.setMaximumRowCount(10); - driverLoaderBox = new UIComboBox(); + driverLoaderBox = new SpecialUIComboBox(); refreshDriverLoader(); + driverLoaderBox.setPreferredSize(new Dimension(200, driverLoaderBox.getPreferredSize().height)); driverLoaderBox.setEditable(false); driverManageBox = new UIComboBox(); refreshDriverManage(true); @@ -717,4 +721,22 @@ public class JDBCDefPane extends JPanel { private String driver; private String url; } + + private static class SpecialUIComboBox extends UIComboBox { + + @Override + public ComboBoxUI getUIComboBoxUI() { + return new SpecialUIComboBoxUI(); + } + } + + private static class SpecialUIComboBoxUI extends UIComboBoxUI { + + @Override + public ComboPopup createPopup() { + return createHorizontalNeverUIComboPopUp(); + } + + } + } diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxUI.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxUI.java index f15bbc52a0..d4de4e8501 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxUI.java @@ -10,12 +10,26 @@ import com.fr.stable.Constants; import com.fr.stable.StringUtils; import sun.swing.DefaultLookup; -import javax.swing.*; +import javax.swing.AbstractButton; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.ListCellRenderer; +import javax.swing.ScrollPaneConstants; +import javax.swing.UIManager; import javax.swing.plaf.ButtonUI; import javax.swing.plaf.basic.BasicComboBoxUI; import javax.swing.plaf.basic.BasicComboPopup; import javax.swing.plaf.basic.ComboPopup; -import java.awt.*; +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.RenderingHints; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; @@ -159,6 +173,10 @@ public class UIComboBoxUI extends BasicComboBoxUI implements MouseListener { return new UIComboPopup(comboBox); } + protected ComboPopup createHorizontalNeverUIComboPopUp() { + return new HorizontalNeverUIComboPopup(comboBox); + } + private void setRollover(boolean isRollover) { if (this.isRollover != isRollover) { this.isRollover = isRollover; @@ -270,4 +288,16 @@ public class UIComboBoxUI extends BasicComboBoxUI implements MouseListener { } } + + private class HorizontalNeverUIComboPopup extends UIComboPopup { + + public HorizontalNeverUIComboPopup(JComboBox comboBox) { + super(comboBox); + } + + @Override + protected JScrollPane createScroller() { + return new UIScrollPane(list, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + } + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIScrollPane.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIScrollPane.java index a14c10f3c4..55ba64b0e9 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIScrollPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIScrollPane.java @@ -3,8 +3,11 @@ package com.fr.design.gui.icontainer; import com.fr.design.constants.UIConstants; import com.fr.design.gui.iscrollbar.UIScrollBar; -import javax.swing.*; -import java.awt.*; +import javax.swing.JScrollBar; +import javax.swing.JScrollPane; +import javax.swing.ScrollPaneConstants; +import java.awt.Color; +import java.awt.Component; /** * @author zhou @@ -16,7 +19,11 @@ public class UIScrollPane extends JScrollPane { private static final int INCREAMENT = 30; public UIScrollPane(Component c) { - super(c, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + this(c, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + } + + public UIScrollPane(Component c, int vertical, int horizontal) { + super(c, vertical, horizontal); this.setHorizontalScrollBar(createHorizontalScrollBar()); this.getVerticalScrollBar().setUnitIncrement(INCREAMENT); this.getVerticalScrollBar().setBlockIncrement(INCREAMENT); From 8c01a5ed490f704e6e2765010d299aadcaebf70b Mon Sep 17 00:00:00 2001 From: xiqiu Date: Fri, 20 Aug 2021 14:00:09 +0800 Subject: [PATCH 02/32] =?UTF-8?q?REPORT-57643=20=20=E6=94=B9=E4=B8=AA?= =?UTF-8?q?=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/data/datapane/connect/JDBCDefPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java index 022323f194..aaa02f9af8 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java @@ -354,7 +354,7 @@ public class JDBCDefPane extends JPanel { odbcTipsPane.add(driverManageLabel); odbcTipsPane.add(odbcTipsLink); JPanel driverComboBoxAndTips = new JPanel(new BorderLayout()); - JPanel normalFlowInnerContainer_s_pane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + JPanel normalFlowInnerContainer_s_pane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(0, 5, 0); normalFlowInnerContainer_s_pane.add(driverManageBox); normalFlowInnerContainer_s_pane.add(driverComboBox); normalFlowInnerContainer_s_pane.add(driverLoaderBox); From 2e4770f9549b74a3c824a1b3ae4be8bf920c2bfb Mon Sep 17 00:00:00 2001 From: shine Date: Fri, 20 Aug 2021 14:06:46 +0800 Subject: [PATCH 03/32] =?UTF-8?q?CHART-20319=20fix:=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=9B=BE=E8=A1=A8=E6=B2=A1=E6=9C=89=E8=B6=85?= =?UTF-8?q?=E9=93=BE=E7=AD=89=E7=95=8C=E9=9D=A2=E5=BC=95=E8=B5=B7npe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/custom/other/VanChartCustomInteractivePane.java | 3 +++ .../van/chart/designer/other/VanChartInteractivePane.java | 7 ++++++- .../map/designer/other/VanChartMapInteractivePane.java | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomInteractivePane.java index 8aab51b3f8..82a62f02cd 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomInteractivePane.java @@ -44,6 +44,9 @@ public class VanChartCustomInteractivePane extends VanChartInteractivePane { @Override protected void updateHyperlink(Plot plot){ + if (hyperlinkPane == null) { + return; + } hyperlinkPane.updateBean(chart); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java index c97f3a8ec8..78be16ad55 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java @@ -685,7 +685,9 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { } protected void updateHyperlink(Plot plot) { - superLink.update(plot); + if (superLink != null) { + superLink.update(plot); + } } private void updateChartTools(VanChart chart) { @@ -734,6 +736,9 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { private void updateAutoRefresh(VanChart chart) { + if (autoRefreshPane == null) { + return; + } RefreshMoreLabel refreshMoreLabel = chart.getRefreshMoreLabel(); if (refreshMoreLabel == null) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java index a6ede0df7e..1d49fd8348 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java @@ -35,6 +35,9 @@ public class VanChartMapInteractivePane extends VanChartInteractivePaneWithMapZo @Override protected void updateHyperlink(Plot plot) { + if (hyperlinkPane == null) { + return; + } hyperlinkPane.updateBean(plot); } From c63d7efcc34a320d907d09507af633f6ceadfb3a Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 30 Aug 2021 11:38:02 +0800 Subject: [PATCH 04/32] =?UTF-8?q?CHART-20299=20fix:=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E9=87=8D=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrameFileDealerPane.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index fe25890282..2925e03a84 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.extension.FileExtension; import com.fr.base.vcs.DesignerMode; +import com.fr.chartx.TwoTuple; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; @@ -35,6 +36,8 @@ import com.fr.design.menu.ToolBarDef; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.event.Event; +import com.fr.event.EventDispatcher; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; @@ -78,6 +81,8 @@ import java.util.Set; import static javax.swing.JOptionPane.WARNING_MESSAGE; public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarStateChangeListener, ResponseDataSourceChange { + public static final Event> TEMPLATE_RENAME = new Event>() { + }; private static final String FILE = "file"; private static volatile DesignerFrameFileDealerPane THIS; @@ -690,6 +695,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt boolean success = selectedOperation.rename(fnf, path, newPath); if (success) { + EventDispatcher.fire(TEMPLATE_RENAME, new TwoTuple<>(path, newPath)); HistoryTemplateListCache.getInstance().rename(fnf, path, newPath); DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(fnf.isDirectory(), path, newPath); selectedOperation.refresh(); From 395eab56f7e73f1f50e43a214d561cac2280c56f Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 31 Aug 2021 10:27:02 +0800 Subject: [PATCH 05/32] =?UTF-8?q?REPORT-58394=20fix:=E4=B8=8D=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E6=97=A7=E7=89=88=E6=9C=AC=E5=9B=BE=E8=A1=A8=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=20=E5=8F=AA=E6=98=AF=E4=B8=8D=E8=83=BD=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=20=E5=9B=BE=E8=A1=A8=E9=85=8D=E7=BD=AE=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E4=B9=9F=E6=98=AF=E8=A6=81=E5=87=BA=E6=9D=A5=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/chart/gui/ChartTypePane.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 e93f0023bc..a668fa3b36 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 @@ -173,8 +173,7 @@ public class ChartTypePane extends AbstractChartAttrPane { Map>> allChartTypePane, ActionListener autoButtonListener) { - - String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDs(); + String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDsIncludeDisabled(); for (String id : chartIDs) { From 68a3d41504624b440001cc172a95f402a13366e8 Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 6 Sep 2021 10:30:17 +0800 Subject: [PATCH 06/32] =?UTF-8?q?POM-2302=20cpt=E7=BB=84=E4=BB=B6=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/itextfield/EditTextField.java | 7 ++- .../gui/AdjustWorkBookDefaultStyleUtils.java | 45 +++++++++++++++++++ .../com/fr/design/utils/gui/GUICoreUtils.java | 8 ++-- .../insert/flot/FormulaFloatAction.java | 6 +-- .../insert/flot/TextBoxFloatAction.java | 5 ++- .../mainframe/CellWidgetPropertyPane.java | 2 + .../mainframe/cell/CellElementEditPane.java | 16 +++++-- .../src/main/java/com/fr/grid/Grid.java | 3 ++ .../src/main/java/com/fr/grid/GridUI.java | 11 +++-- 9 files changed, 80 insertions(+), 23 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/EditTextField.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/EditTextField.java index 694c3e507e..5469483b2a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itextfield/EditTextField.java +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/EditTextField.java @@ -1,12 +1,11 @@ package com.fr.design.gui.itextfield; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Toolkit; - import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.PlainDocument; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Toolkit; /** diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java new file mode 100644 index 0000000000..8735b7f06e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java @@ -0,0 +1,45 @@ +package com.fr.design.utils.gui; + +import com.fr.base.Style; +import com.fr.base.background.ColorBackground; +import com.fr.design.base.mode.DesignModeContext; +import com.fr.report.cell.CellElement; +import com.fr.report.cell.FloatElement; + +import java.awt.Color; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2021/9/6 + */ +public class AdjustWorkBookDefaultStyleUtils { + + private static final Color TEMPLATE_BACKGROUND = new Color(16, 11, 43); + + public static void adjustCellElement(CellElement cellElement) { + if (DesignModeContext.isDuchampMode()) { + Style style = cellElement.getStyle(); + style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE)); + style = style.deriveBorder(0, Color.WHITE, + 0, Color.WHITE, + 0, Color.WHITE, + 0, Color.WHITE); + cellElement.setStyle(style); + } + } + + public static void adjustFloat(FloatElement floatElement) { + if (DesignModeContext.isDuchampMode()) { + Style style = floatElement.getStyle(); + style = style.deriveBackground(ColorBackground.getInstance(TEMPLATE_BACKGROUND)); + style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE)); + floatElement.setStyle(style); + } + } + + public static Color adjustBack(Color color) { + return DesignModeContext.isDuchampMode() ? TEMPLATE_BACKGROUND : color; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java index a89e367d64..ac75786314 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java @@ -38,7 +38,6 @@ import com.fr.stable.Constants; import com.fr.stable.OperatingSystem; import com.fr.stable.StringUtils; -import java.awt.Container; import javax.swing.AbstractButton; import javax.swing.Action; import javax.swing.BorderFactory; @@ -67,10 +66,13 @@ import javax.swing.tree.TreePath; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; +import java.awt.Container; import java.awt.Cursor; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; import java.awt.GridLayout; import java.awt.Image; import java.awt.Point; @@ -82,8 +84,6 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.image.BufferedImage; import java.awt.image.ImageObserver; -import java.awt.GraphicsDevice; -import java.awt.GraphicsEnvironment; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -176,7 +176,7 @@ public final class GUICoreUtils { if (style.getBackground() instanceof ColorBackground) { textField.setBackground(((ColorBackground) style.getBackground()).getColor()); } else { - textField.setBackground(Color.WHITE); + textField.setBackground(AdjustWorkBookDefaultStyleUtils.adjustBack(Color.WHITE)); } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java index 9cbd7e8760..10ccdb9ae3 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java @@ -5,7 +5,6 @@ package com.fr.design.actions.insert.flot; import com.fr.base.BaseFormula; import com.fr.base.DynamicUnitList; - import com.fr.design.actions.ElementCaseAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -15,7 +14,7 @@ import com.fr.design.formula.UIFormula; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; - +import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils; import com.fr.grid.Grid; import com.fr.grid.selection.FloatSelection; import com.fr.report.ReportHelper; @@ -23,7 +22,7 @@ import com.fr.report.cell.FloatElement; import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.unit.FU; -import javax.swing.*; +import javax.swing.KeyStroke; /** * Insert formula. @@ -100,6 +99,7 @@ public class FormulaFloatAction extends ElementCaseAction { reportPane.stopEditing(); final FloatElement floatElement = new FloatElement(); + AdjustWorkBookDefaultStyleUtils.adjustFloat(floatElement); final UIFormula formulaPane = FormulaFactory.createFormulaPane(); formulaPane.populate(BaseFormula.createFormulaBuilder().build()); diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java index 82aa17f2d9..2bf34f1719 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java @@ -7,7 +7,7 @@ import com.fr.base.DynamicUnitList; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; - +import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils; import com.fr.grid.Grid; import com.fr.grid.selection.FloatSelection; import com.fr.report.ReportHelper; @@ -15,7 +15,7 @@ import com.fr.report.cell.FloatElement; import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.unit.FU; -import javax.swing.*; +import javax.swing.KeyStroke; import java.awt.event.ActionEvent; /** @@ -60,6 +60,7 @@ public class TextBoxFloatAction extends AbstractShapeAction { return; } FloatElement floatElement = new FloatElement("Text"); + AdjustWorkBookDefaultStyleUtils.adjustFloat(floatElement); this.startDraw(floatElement); doWithDrawingFloatElement(); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java index 0ddfdd3d7d..120c2fe3bf 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe; import com.fr.design.actions.utils.ReportActionUtils; import com.fr.design.dialog.BasicPane; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils; import com.fr.design.widget.WidgetPane; import com.fr.form.ui.NoneWidget; import com.fr.form.ui.Widget; @@ -89,6 +90,7 @@ public class CellWidgetPropertyPane extends BasicPane { TemplateCellElement editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow()); if (editCellElement == null) { editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); + AdjustWorkBookDefaultStyleUtils.adjustCellElement(editCellElement); } this.cellElement = editCellElement; this.populate(editCellElement); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java index 487214a80e..1792cbe021 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java @@ -7,10 +7,14 @@ import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.itabpane.TitleChangeListener; import com.fr.design.mainframe.ElementCasePane; -import com.fr.design.mainframe.cell.settingpane.*; +import com.fr.design.mainframe.cell.settingpane.AbstractCellAttrPane; +import com.fr.design.mainframe.cell.settingpane.CellExpandAttrPane; +import com.fr.design.mainframe.cell.settingpane.CellOtherSetPane; +import com.fr.design.mainframe.cell.settingpane.CellPresentPane; +import com.fr.design.mainframe.cell.settingpane.CellStylePane; import com.fr.design.utils.DesignUtils; +import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils; import com.fr.general.ComparatorUtils; - import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.Selection; import com.fr.report.cell.CellElement; @@ -18,8 +22,11 @@ import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.TemplateCellElement; import com.fr.report.elementcase.TemplateElementCase; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Dimension; import java.util.ArrayList; import java.util.List; @@ -113,6 +120,7 @@ public class CellElementEditPane extends BasicPane { CellElement cellElement = elementCase.getCellElement(cs.getColumn(), cs.getRow()); if (cellElement == null) { cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); + AdjustWorkBookDefaultStyleUtils.adjustCellElement(cellElement); //默认选中的是A1单元格,所以若是A1单元格没有加到列表时要加上,否则在聚合报表时会出错 if (cs.isSelectedOneCell(elementCasePane) && (cs.getColumn() + cs.getRow() == 0)) { elementCase.addCellElement((TemplateCellElement) cellElement); 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 b55f60bb53..a333bd03c6 100644 --- a/designer-realize/src/main/java/com/fr/grid/Grid.java +++ b/designer-realize/src/main/java/com/fr/grid/Grid.java @@ -18,6 +18,7 @@ import com.fr.design.gui.itextfield.UITextField; import com.fr.design.mainframe.DesignOperationEvent; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.JTemplate; +import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.event.EventDispatcher; import com.fr.general.ComparatorUtils; @@ -871,6 +872,7 @@ public class Grid extends BaseGridComponent { // 必须保证editingCellElement不是null。 if (editingCellElement == null) { editingCellElement = new DefaultTemplateCellElement(column, row); + AdjustWorkBookDefaultStyleUtils.adjustCellElement(editingCellElement); } editorComponent = getCellEditingComp(); if (editorComponent == null) { @@ -1036,6 +1038,7 @@ public class Grid extends BaseGridComponent { if (editingCellElement == null) { editingCellElement = new DefaultTemplateCellElement(editingColumn, editingRow); tplEC.addCellElement(editingCellElement); + AdjustWorkBookDefaultStyleUtils.adjustCellElement(editingCellElement); } if (setValue4EditingElement(newValue)) { shrinkToFit(tplEC); diff --git a/designer-realize/src/main/java/com/fr/grid/GridUI.java b/designer-realize/src/main/java/com/fr/grid/GridUI.java index af640c94fc..d089631f41 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridUI.java @@ -10,15 +10,14 @@ import com.fr.base.background.ColorBackground; import com.fr.base.background.ImageFileBackground; import com.fr.base.iofile.attr.WatermarkAttr; import com.fr.base.vcs.DesignerMode; -import com.fr.design.DesignerEnvManager; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.constants.UIConstants; import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.fun.ReportLengthUNITProvider; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.JTemplate; import com.fr.design.roleAuthority.ReportAndFSManagePane; -import com.fr.design.unit.UnitConvertUtil; +import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils; import com.fr.general.Background; import com.fr.general.ComparatorUtils; import com.fr.grid.selection.CellSelection; @@ -46,11 +45,11 @@ import com.fr.report.stable.ReportConstants; import com.fr.report.stable.ReportSettings; import com.fr.report.worksheet.FormElementCase; import com.fr.report.worksheet.WorkSheet; +import com.fr.stable.AssistUtils; import com.fr.stable.ColumnRow; import com.fr.stable.Constants; import com.fr.stable.script.CalculatorUtils; import com.fr.stable.unit.FU; -import com.fr.stable.AssistUtils; import com.fr.stable.unit.UNIT; import com.fr.third.antlr.ANTLRException; import com.fr.third.guava.collect.HashMultimap; @@ -176,7 +175,7 @@ public class GridUI extends ComponentUI { // denny:画背景.Background Background background = reportSettings.getBackground(); - if (background != null) { + if (background != null && !DesignModeContext.isDuchampMode()) { // denny: except the ColorBackground and ImageBackground if (grid.isEnabled() && !(background instanceof ImageFileBackground)) { background.paint(g2d, this.back_or_selection_rect); @@ -189,7 +188,7 @@ public class GridUI extends ComponentUI { private void clearBackground(Graphics2D g2d, Grid grid) { if (grid.isEnabled()) { - g2d.setPaint(Color.WHITE); + g2d.setPaint(AdjustWorkBookDefaultStyleUtils.adjustBack(Color.WHITE)); } else { g2d.setPaint(UIManager.getColor("control")); } From 6a4d71e1367b1070f4df0fb151d57d5b4ed6f410 Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 6 Sep 2021 15:44:09 +0800 Subject: [PATCH 07/32] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E8=A7=86=E8=A7=89=E8=B0=83=E6=95=B4=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E8=BE=B9=E6=A1=86=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../utils/gui/AdjustWorkBookDefaultStyleUtils.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java index 8735b7f06e..a34108508a 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java @@ -16,15 +16,16 @@ import java.awt.Color; public class AdjustWorkBookDefaultStyleUtils { private static final Color TEMPLATE_BACKGROUND = new Color(16, 11, 43); + private static final Color CELL_ELEMENT_BORDER = new Color(110, 110, 110); public static void adjustCellElement(CellElement cellElement) { if (DesignModeContext.isDuchampMode()) { Style style = cellElement.getStyle(); style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE)); - style = style.deriveBorder(0, Color.WHITE, - 0, Color.WHITE, - 0, Color.WHITE, - 0, Color.WHITE); + style = style.deriveBorder(0, CELL_ELEMENT_BORDER, + 0, CELL_ELEMENT_BORDER, + 0, CELL_ELEMENT_BORDER, + 0, CELL_ELEMENT_BORDER); cellElement.setStyle(style); } } From b8317ff113641e4a50e21c05435db31ddbfa11cc Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 6 Sep 2021 15:46:49 +0800 Subject: [PATCH 08/32] ignore --- .../fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java | 2 +- .../com/fr/design/actions/insert/flot/FormulaFloatAction.java | 2 +- .../com/fr/design/actions/insert/flot/TextBoxFloatAction.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java index a34108508a..abae997e39 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java @@ -30,7 +30,7 @@ public class AdjustWorkBookDefaultStyleUtils { } } - public static void adjustFloat(FloatElement floatElement) { + public static void adjustFloatElement(FloatElement floatElement) { if (DesignModeContext.isDuchampMode()) { Style style = floatElement.getStyle(); style = style.deriveBackground(ColorBackground.getInstance(TEMPLATE_BACKGROUND)); diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java index 10ccdb9ae3..e61494581b 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java @@ -99,7 +99,7 @@ public class FormulaFloatAction extends ElementCaseAction { reportPane.stopEditing(); final FloatElement floatElement = new FloatElement(); - AdjustWorkBookDefaultStyleUtils.adjustFloat(floatElement); + AdjustWorkBookDefaultStyleUtils.adjustFloatElement(floatElement); final UIFormula formulaPane = FormulaFactory.createFormulaPane(); formulaPane.populate(BaseFormula.createFormulaBuilder().build()); diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java index 2bf34f1719..4496aeb251 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java @@ -60,7 +60,7 @@ public class TextBoxFloatAction extends AbstractShapeAction { return; } FloatElement floatElement = new FloatElement("Text"); - AdjustWorkBookDefaultStyleUtils.adjustFloat(floatElement); + AdjustWorkBookDefaultStyleUtils.adjustFloatElement(floatElement); this.startDraw(floatElement); doWithDrawingFloatElement(); } From febd687b9ed6007ff9f2f0244b6ec456cd64d098 Mon Sep 17 00:00:00 2001 From: eason Date: Thu, 9 Sep 2021 15:11:53 +0800 Subject: [PATCH 09/32] =?UTF-8?q?CHART-20402=20=E5=A2=9E=E5=8A=A0=E5=87=A0?= =?UTF-8?q?=E4=B8=AA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManager.java | 2 +- .../java/com/fr/design/ui/ModernUIPane.java | 28 +++++++ .../fr/design/ui/compatible/BuilderDiff.java | 2 + .../ui/compatible/ModernUIPaneFactory.java | 19 +++-- .../design/ui/compatible/NewModernUIPane.java | 36 ++++++++- .../mainframe/app/DesignerAppUtilsTest.java | 78 ------------------- 6 files changed, 79 insertions(+), 86 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 9c23dcc51a..91c2225973 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -1645,7 +1645,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { public boolean isOpenDebug() { - return openDebug; + return true; } public void setOpenDebug(boolean openDebug) { diff --git a/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java b/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java index 8c7ed5ac5a..b9e6d7330e 100644 --- a/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java +++ b/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java @@ -17,6 +17,7 @@ import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; import com.teamdev.jxbrowser.chromium.events.ScriptContextListener; import com.teamdev.jxbrowser.chromium.swing.BrowserView; +import com.teamdev.jxbrowser.event.Observer; import javax.swing.JDialog; import javax.swing.SwingUtilities; @@ -157,6 +158,27 @@ public class ModernUIPane extends BasicPane { return null; } + public void disposeBrowser() { + + if(browser != null) { + browser.dispose(); + browser = null; + } + + } + + public void clearCache() { + if (browser != null) { + browser.getCacheStorage().clearCache(); + } + } + + public void executeJavaScript(String javaScript) { + if (browser != null) { + browser.executeJavaScript(javaScript); + } + } + public static class Builder implements BuilderDiff { private ModernUIPane pane; @@ -293,6 +315,12 @@ public class ModernUIPane extends BasicPane { return this; } + @Override + public Builder prepareForV7(Class event, Observer listener) { + // do nothing + return this; + } + public ModernUIPane build() { return pane; } diff --git a/designer-base/src/main/java/com/fr/design/ui/compatible/BuilderDiff.java b/designer-base/src/main/java/com/fr/design/ui/compatible/BuilderDiff.java index 33c817c948..9e6168514f 100644 --- a/designer-base/src/main/java/com/fr/design/ui/compatible/BuilderDiff.java +++ b/designer-base/src/main/java/com/fr/design/ui/compatible/BuilderDiff.java @@ -4,6 +4,7 @@ import com.fr.design.ui.ModernUIPane; import com.teamdev.jxbrowser.browser.callback.InjectJsCallback; import com.teamdev.jxbrowser.chromium.events.LoadListener; import com.teamdev.jxbrowser.chromium.events.ScriptContextListener; +import com.teamdev.jxbrowser.event.Observer; /** * 封装jxbrwoser v6/v7的构建方式的差异 @@ -20,5 +21,6 @@ public interface BuilderDiff { ModernUIPane.Builder prepareForV7(InjectJsCallback callback); + ModernUIPane.Builder prepareForV7(Class event, Observer listener); } diff --git a/designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java b/designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java index 5ae56627e9..68b8950f7c 100644 --- a/designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java @@ -11,6 +11,17 @@ import com.fr.stable.os.OperatingSystem; public class ModernUIPaneFactory { public static ModernUIPane.Builder modernUIPaneBuilder() { + + if (isV7()) { + return new NewModernUIPane.Builder<>(); + } else { + return new ModernUIPane.Builder<>(); + } + + } + + public static boolean isV7() { + // 7.15的class不存在时 走老版本 boolean hasJxBrowserV7_15 = true; try { @@ -18,10 +29,8 @@ public class ModernUIPaneFactory { } catch (ClassNotFoundException e) { hasJxBrowserV7_15 = false; } - if (OperatingSystem.isWindows() && hasJxBrowserV7_15) { - return new NewModernUIPane.Builder<>(); - } else { - return new ModernUIPane.Builder<>(); - } + + return OperatingSystem.isWindows() && hasJxBrowserV7_15; + } } diff --git a/designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java b/designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java index 33747d3f15..107ba8cd95 100644 --- a/designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java +++ b/designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java @@ -15,6 +15,7 @@ import com.teamdev.jxbrowser.chromium.events.ScriptContextListener; import com.teamdev.jxbrowser.engine.Engine; import com.teamdev.jxbrowser.engine.EngineOptions; import com.teamdev.jxbrowser.engine.RenderingMode; +import com.teamdev.jxbrowser.event.Observer; import com.teamdev.jxbrowser.js.JsObject; import com.teamdev.jxbrowser.net.Scheme; import com.teamdev.jxbrowser.view.swing.BrowserView; @@ -100,7 +101,7 @@ public class NewModernUIPane extends ModernUIPane { EngineOptions options; if (scheme != null && requestCallback != null) { options = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").addScheme(scheme, requestCallback).build(); - } else { + } else { options = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").build(); } Engine engine = Engine.newInstance(options); @@ -161,6 +162,29 @@ public class NewModernUIPane extends ModernUIPane { return null; } + public void disposeBrowser() { + + if (browser != null) { + browser.close(); + browser = null; + } + + } + + public void clearCache() { + if (browser != null) { + browser.engine().httpCache().clear(); + } + } + + public void executeJavaScript(String javaScript) { + if (browser != null) { + browser.mainFrame().ifPresent(frame -> { + frame.executeJavaScript(javaScript); + }); + } + } + public static class Builder extends ModernUIPane.Builder { private NewModernUIPane pane = new NewModernUIPane<>(); @@ -191,7 +215,7 @@ public class NewModernUIPane extends ModernUIPane { @Override public NewModernUIPane.Builder withURL(final String url) { pane.scheme = Scheme.of("file"); - pane.requestCallback = new NxComplexInterceptRequestCallback(null); + pane.requestCallback = new NxComplexInterceptRequestCallback(null); pane.browser.navigation().loadUrl(url); return this; } @@ -301,6 +325,14 @@ public class NewModernUIPane extends ModernUIPane { return prepare(callback); } + @Override + public ModernUIPane.Builder prepareForV7(Class event, Observer listener) { + + pane.browser.navigation().on(event, listener); + + return this; + } + @Override public NewModernUIPane build() { return pane; diff --git a/designer-realize/src/test/java/com/fr/design/mainframe/app/DesignerAppUtilsTest.java b/designer-realize/src/test/java/com/fr/design/mainframe/app/DesignerAppUtilsTest.java index c2f7ef7695..62d0931b55 100644 --- a/designer-realize/src/test/java/com/fr/design/mainframe/app/DesignerAppUtilsTest.java +++ b/designer-realize/src/test/java/com/fr/design/mainframe/app/DesignerAppUtilsTest.java @@ -3,7 +3,6 @@ package com.fr.design.mainframe.app; import com.fr.invoke.Reflect; import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarkerAdapter; -import com.fr.plugin.engine.remote.PluginRemoteSync; import com.fr.stable.TemplateIOErrorContextHolder; import com.fr.third.guava.collect.Multimap; import org.easymock.EasyMock; @@ -24,83 +23,6 @@ import java.util.HashSet; * Created by vito on 2021/5/31 */ @RunWith(PowerMockRunner.class) -@PrepareForTest({PluginRemoteSync.class}) public class DesignerAppUtilsTest { - @Test - public void testDealWithErrorDetailMultiLineAndCache() { - TemplateIOErrorContextHolder.registerPluginNameMap(new HashMap() {{ - put("2", "好用的插件"); - }},new HashSet<>()); - TemplateIOErrorContextHolder.addNeedEnablePlugin(PluginMarkerAdapter.create("1", "1.0", "1插件")); - TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("2", "1.0")); - TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("3", "1.0")); - String log = DesignerAppUtils.dealWithErrorDetailMultiLineAndCache("template1"); - Assert.assertTrue(log.contains("1插件")); - Assert.assertTrue(log.contains("好用的插件")); - Assert.assertTrue(log.contains("3")); - Multimap map = DesignerAppUtils.popPluginInfoMap("template1"); - Assert.assertEquals(3, map.size()); - Assert.assertNull(DesignerAppUtils.popPluginInfoMap("template1")); - } - @Test - public void testInvalidatePlugins() { - TemplateIOErrorContextHolder.registerPluginNameMap(new HashMap() {{ - put("2", "好用的插件"); - }},new HashSet<>()); - TemplateIOErrorContextHolder.addNeedEnablePlugin(PluginMarkerAdapter.create("1", "1.0", "1插件")); - TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("2", "1.0")); - TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("3", "1.0")); - String log = DesignerAppUtils.dealWithErrorDetailMultiLineAndCache("template1"); - Assert.assertTrue(log.contains("1插件")); - Assert.assertTrue(log.contains("好用的插件")); - Assert.assertTrue(log.contains("3")); - DesignerAppUtils.invalidatePlugins("template1"); - Assert.assertNull(DesignerAppUtils.popPluginInfoMap("template1")); - } - - @Test - public void testRearrange(){ - // 远程插件模拟注册 - PluginRemoteSync pluginRemoteSync = EasyMock.createMock(PluginRemoteSync.class); - EasyMock.expect(pluginRemoteSync.getPluginRemoteStatusByIdIndex()).andReturn(new HashMap(){{ - put("com.fr.plugin1", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin1","1",true).get()); - put("com.fr.plugin2", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin2","1",true).get()); - put("com.fr.plugin3", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin3","1",false).get()); - put("com.fr.plugin4", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin4","1",false).get()); - }}).anyTimes(); - EasyMock.replay(pluginRemoteSync); - PowerMock.mockStaticPartial(PluginRemoteSync.class, "getInstance"); - EasyMock.expect(PluginRemoteSync.getInstance()).andReturn(pluginRemoteSync).anyTimes(); - PowerMock.replay(PluginRemoteSync.class); - - // 本地插件模拟检查 - TemplateIOErrorContextHolder.registerPluginNameMap(new HashMap() {{ - put("com.fr.plugin1", "好用的插件1"); - put("com.fr.plugin2", "好用的插件2"); - put("com.fr.plugin3", "好用的插件3"); - put("com.fr.plugin4", "好用的插件4"); - put("com.fr.plugin5", "好用的插件5"); - }},new HashSet<>()); - // unknown - TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("com.fr.plugin7", "1")); - // disable - TemplateIOErrorContextHolder.addNeedEnablePlugin(PluginMarkerAdapter.create("com.fr.plugin5", "1", "plugin5")); - TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("com.fr.plugin3", "1")); - // not install - TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("com.fr.plugin1", "1")); - TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("com.fr.plugin4", "1")); - - Multimap pendingPlugins = TemplateIOErrorContextHolder.getPendingPlugin(); - - Reflect.on(DesignerAppUtils.class).call("rearrange",pendingPlugins).get(); - Assert.assertEquals(1,pendingPlugins.get(TemplateIOErrorContextHolder.UNKNOWN_PLUGIN).size()); - Collection pluginMarkerAdapters = pendingPlugins.get(TemplateIOErrorContextHolder.DISABLE_PLUGIN); - Assert.assertEquals(2, pluginMarkerAdapters.size()); - pluginMarkerAdapters.contains(PluginMarker.create("com.fr.plugin3", "1")); - pluginMarkerAdapters.contains(PluginMarker.create("com.fr.plugin4", "1")); - Collection pluginMarkerAdapters1 = pendingPlugins.get(TemplateIOErrorContextHolder.NOT_INSTALLED_PLUGIN); - Assert.assertEquals(1, pluginMarkerAdapters1.size()); - pluginMarkerAdapters1.contains(PluginMarker.create("com.fr.plugin5","1")); - } } From 006ecfe883c8665a5f70080fe566ac1d1c5e5af4 Mon Sep 17 00:00:00 2001 From: eason Date: Thu, 9 Sep 2021 15:14:42 +0800 Subject: [PATCH 10/32] =?UTF-8?q?CHART-20402=20=E5=A2=9E=E5=8A=A0=E5=87=A0?= =?UTF-8?q?=E4=B8=AA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/app/DesignerAppUtilsTest.java | 80 ++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/test/java/com/fr/design/mainframe/app/DesignerAppUtilsTest.java b/designer-realize/src/test/java/com/fr/design/mainframe/app/DesignerAppUtilsTest.java index 62d0931b55..46aa574e90 100644 --- a/designer-realize/src/test/java/com/fr/design/mainframe/app/DesignerAppUtilsTest.java +++ b/designer-realize/src/test/java/com/fr/design/mainframe/app/DesignerAppUtilsTest.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.app; import com.fr.invoke.Reflect; import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarkerAdapter; +import com.fr.plugin.engine.remote.PluginRemoteSync; import com.fr.stable.TemplateIOErrorContextHolder; import com.fr.third.guava.collect.Multimap; import org.easymock.EasyMock; @@ -23,6 +24,83 @@ import java.util.HashSet; * Created by vito on 2021/5/31 */ @RunWith(PowerMockRunner.class) +@PrepareForTest({PluginRemoteSync.class}) public class DesignerAppUtilsTest { + @Test + public void testDealWithErrorDetailMultiLineAndCache() { + TemplateIOErrorContextHolder.registerPluginNameMap(new HashMap() {{ + put("2", "好用的插件"); + }},new HashSet<>()); + TemplateIOErrorContextHolder.addNeedEnablePlugin(PluginMarkerAdapter.create("1", "1.0", "1插件")); + TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("2", "1.0")); + TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("3", "1.0")); + String log = DesignerAppUtils.dealWithErrorDetailMultiLineAndCache("template1"); + Assert.assertTrue(log.contains("1插件")); + Assert.assertTrue(log.contains("好用的插件")); + Assert.assertTrue(log.contains("3")); + Multimap map = DesignerAppUtils.popPluginInfoMap("template1"); + Assert.assertEquals(3, map.size()); + Assert.assertNull(DesignerAppUtils.popPluginInfoMap("template1")); + } -} + @Test + public void testInvalidatePlugins() { + TemplateIOErrorContextHolder.registerPluginNameMap(new HashMap() {{ + put("2", "好用的插件"); + }},new HashSet<>()); + TemplateIOErrorContextHolder.addNeedEnablePlugin(PluginMarkerAdapter.create("1", "1.0", "1插件")); + TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("2", "1.0")); + TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("3", "1.0")); + String log = DesignerAppUtils.dealWithErrorDetailMultiLineAndCache("template1"); + Assert.assertTrue(log.contains("1插件")); + Assert.assertTrue(log.contains("好用的插件")); + Assert.assertTrue(log.contains("3")); + DesignerAppUtils.invalidatePlugins("template1"); + Assert.assertNull(DesignerAppUtils.popPluginInfoMap("template1")); + } + + @Test + public void testRearrange(){ + // 远程插件模拟注册 + PluginRemoteSync pluginRemoteSync = EasyMock.createMock(PluginRemoteSync.class); + EasyMock.expect(pluginRemoteSync.getPluginRemoteStatusByIdIndex()).andReturn(new HashMap(){{ + put("com.fr.plugin1", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin1","1",true).get()); + put("com.fr.plugin2", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin2","1",true).get()); + put("com.fr.plugin3", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin3","1",false).get()); + put("com.fr.plugin4", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin4","1",false).get()); + }}).anyTimes(); + EasyMock.replay(pluginRemoteSync); + PowerMock.mockStaticPartial(PluginRemoteSync.class, "getInstance"); + EasyMock.expect(PluginRemoteSync.getInstance()).andReturn(pluginRemoteSync).anyTimes(); + PowerMock.replay(PluginRemoteSync.class); + + // 本地插件模拟检查 + TemplateIOErrorContextHolder.registerPluginNameMap(new HashMap() {{ + put("com.fr.plugin1", "好用的插件1"); + put("com.fr.plugin2", "好用的插件2"); + put("com.fr.plugin3", "好用的插件3"); + put("com.fr.plugin4", "好用的插件4"); + put("com.fr.plugin5", "好用的插件5"); + }},new HashSet<>()); + // unknown + TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("com.fr.plugin7", "1")); + // disable + TemplateIOErrorContextHolder.addNeedEnablePlugin(PluginMarkerAdapter.create("com.fr.plugin5", "1", "plugin5")); + TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("com.fr.plugin3", "1")); + // not install + TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("com.fr.plugin1", "1")); + TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("com.fr.plugin4", "1")); + + Multimap pendingPlugins = TemplateIOErrorContextHolder.getPendingPlugin(); + + Reflect.on(DesignerAppUtils.class).call("rearrange",pendingPlugins).get(); + Assert.assertEquals(1,pendingPlugins.get(TemplateIOErrorContextHolder.UNKNOWN_PLUGIN).size()); + Collection pluginMarkerAdapters = pendingPlugins.get(TemplateIOErrorContextHolder.DISABLE_PLUGIN); + Assert.assertEquals(2, pluginMarkerAdapters.size()); + pluginMarkerAdapters.contains(PluginMarker.create("com.fr.plugin3", "1")); + pluginMarkerAdapters.contains(PluginMarker.create("com.fr.plugin4", "1")); + Collection pluginMarkerAdapters1 = pendingPlugins.get(TemplateIOErrorContextHolder.NOT_INSTALLED_PLUGIN); + Assert.assertEquals(1, pluginMarkerAdapters1.size()); + pluginMarkerAdapters1.contains(PluginMarker.create("com.fr.plugin5","1")); + } +} \ No newline at end of file From 20690cbd72b1484a0f40bf8e7b10c5918d581ca3 Mon Sep 17 00:00:00 2001 From: eason Date: Thu, 9 Sep 2021 15:15:35 +0800 Subject: [PATCH 11/32] =?UTF-8?q?CHART-20402=20=E5=A2=9E=E5=8A=A0=E5=87=A0?= =?UTF-8?q?=E4=B8=AA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/DesignerEnvManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 91c2225973..9c23dcc51a 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -1645,7 +1645,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { public boolean isOpenDebug() { - return true; + return openDebug; } public void setOpenDebug(boolean openDebug) { From ad415c8129939097763430884c5859397b680025 Mon Sep 17 00:00:00 2001 From: eason Date: Thu, 9 Sep 2021 17:52:15 +0800 Subject: [PATCH 12/32] =?UTF-8?q?=E6=96=B0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/ui/ModernUIPane.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java b/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java index b9e6d7330e..38ff6dbb64 100644 --- a/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java +++ b/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java @@ -11,6 +11,7 @@ import com.fr.web.struct.AssembleComponent; import com.teamdev.jxbrowser.browser.callback.InjectJsCallback; import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.BrowserType; +import com.teamdev.jxbrowser.chromium.JSObject; import com.teamdev.jxbrowser.chromium.JSValue; import com.teamdev.jxbrowser.chromium.events.LoadListener; import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; @@ -179,6 +180,15 @@ public class ModernUIPane extends BasicPane { } } + public JSObject getEmptyJSObjectV6() { + + if (browser != null) { + return browser.executeJavaScriptAndReturnValue("var __props__ = {};__props__").asObject(); + } + + return null; + } + public static class Builder implements BuilderDiff { private ModernUIPane pane; From 1248729a97b44d788b8f2b1408301793f7d43410 Mon Sep 17 00:00:00 2001 From: eason Date: Thu, 9 Sep 2021 17:54:34 +0800 Subject: [PATCH 13/32] =?UTF-8?q?=E6=96=B0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java b/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java index 38ff6dbb64..10732e9b0b 100644 --- a/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java +++ b/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java @@ -183,7 +183,7 @@ public class ModernUIPane extends BasicPane { public JSObject getEmptyJSObjectV6() { if (browser != null) { - return browser.executeJavaScriptAndReturnValue("var __props__ = {};__props__").asObject(); + return browser.executeJavaScriptAndReturnValue("var __empty_props__ = {};__empty_props__").asObject(); } return null; From 4e10ea8419005f6025eb2516cee0d265040c618e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Fri, 10 Sep 2021 14:20:27 +0800 Subject: [PATCH 14/32] =?UTF-8?q?CHART-20642=20=E5=9B=BE=E8=A1=A8=E9=A2=84?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E9=85=8D=E8=89=B2=E9=81=BF=E5=85=8D=E9=87=8D?= =?UTF-8?q?=E5=90=8D=E5=92=8C=E7=A9=BA=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/controlpane/JListControlPane.java | 4 +- .../com/fr/design/gui/ilist/JNameEdList.java | 23 ++++++----- .../design/module/ChartPreStyleListPane.java | 41 +++++++++++++++++++ 3 files changed, 56 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java index f119c55cd3..82cba758b7 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java @@ -23,12 +23,12 @@ import javax.swing.ListSelectionModel; import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import java.util.Collection; import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; -import java.util.Collection; public abstract class JListControlPane extends JControlPane implements ListControlPaneProvider { private static final String LIST_NAME = "JControl_List"; @@ -335,7 +335,7 @@ public abstract class JListControlPane extends JControlPane implements ListContr getHelper().checkButtonEnabled(); } - private class NameableListCellRenderer extends + protected class NameableListCellRenderer extends DefaultListCellRenderer { @Override public Component getListCellRendererComponent(JList list, Object value, diff --git a/designer-base/src/main/java/com/fr/design/gui/ilist/JNameEdList.java b/designer-base/src/main/java/com/fr/design/gui/ilist/JNameEdList.java index 0efa74cec7..4c530c0fcc 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ilist/JNameEdList.java +++ b/designer-base/src/main/java/com/fr/design/gui/ilist/JNameEdList.java @@ -1,25 +1,22 @@ package com.fr.design.gui.ilist; import com.fr.design.gui.NameInspector; +import com.fr.design.gui.itextfield.UITextField; import com.fr.general.GeneralUtils; import com.fr.general.NameObject; -import com.fr.base.Utils; -import com.fr.design.gui.itextfield.UITextField; - import com.fr.stable.Nameable; import com.fr.stable.StringUtils; import com.fr.stable.core.PropertyChangeAdapter; -import javax.swing.*; +import javax.swing.ListModel; import javax.swing.event.CellEditorListener; import javax.swing.event.ChangeEvent; -import java.awt.*; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.Vector; +import java.awt.Component; +import java.awt.Rectangle; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; public class JNameEdList extends UIList implements CellEditorListener { private static final int ICON_WIDTH = 20; @@ -38,6 +35,8 @@ public class JNameEdList extends UIList implements CellEditorListener { */ private String oldName; + private boolean replaceEmptyName = true; + public JNameEdList(ListModel dataModel) { super(dataModel); } @@ -70,6 +69,10 @@ public class JNameEdList extends UIList implements CellEditorListener { return this.editable; } + public void setReplaceEmptyName(boolean replaceEmptyName) { + this.replaceEmptyName = replaceEmptyName; + } + public void setNameShouldNumber(boolean isNameShouldNumber) { this.isNameShouldNumber = isNameShouldNumber; } @@ -301,7 +304,7 @@ public class JNameEdList extends UIList implements CellEditorListener { ListCellEditor editor = getCellEditor(); if (editor != null && editorComp != null) { Object value = editor.getCellEditorValue(); - String name = StringUtils.isBlank(value.toString()) ? oldName : value.toString(); + String name = StringUtils.isBlank(value.toString()) && replaceEmptyName ? oldName : value.toString(); setNameAt(name, editingIndex); removeComp(); doAfterStopEditing(); diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java index f2f5c3cf6f..73914a320f 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java @@ -4,19 +4,28 @@ import com.fr.base.ChartColorMatching; import com.fr.base.ChartPreStyleConfig; import com.fr.base.Utils; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.ShortCut4JControlPane; +import com.fr.design.gui.ilist.JNameEdList; import com.fr.design.gui.ilist.ModNameActionListener; +import com.fr.design.i18n.Toolkit; import com.fr.design.menu.ShortCut; +import com.fr.general.ComparatorUtils; import com.fr.general.NameObject; import com.fr.stable.Nameable; +import com.fr.stable.StringUtils; +import javax.swing.JOptionPane; +import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import java.util.ArrayList; +import java.util.Arrays; import java.util.Iterator; +import java.util.List; /** * @author Bjorn @@ -31,6 +40,38 @@ public class ChartPreStyleListPane extends JListControlPane { super(); this.chartPreStyleManagerPane = chartPreStyleManagerPane; initListener(); + addModNameActionListener((int index, String oldName, String newName) -> { + if (ComparatorUtils.equals(oldName, newName)) { + return; + } + String[] allNames = nameableList.getAllNames(); + allNames[index] = StringUtils.EMPTY; + if (StringUtils.isEmpty(newName)) { + showTipDialog(Toolkit.i18nText("Fine-Design_Chart_Fill_Style_Empty_Name_Tip")); + nameableList.setNameAt(oldName, index); + return; + } + if (isNameRepeated(new List[]{Arrays.asList(allNames)}, newName)) { + showTipDialog(Toolkit.i18nText("Fine-Design_Chart_Fill_Style_Exist_Name_Tip", newName)); + nameableList.setNameAt(oldName, index); + return; + } + populateSelectedValue(); + }); + } + + private void showTipDialog(String content) { + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ChartPreStyleListPane.this), + content, + Toolkit.i18nText("Fine-Design_Basic_Alert"), + JOptionPane.WARNING_MESSAGE); + } + + @Override + protected JNameEdList createJNameList() { + JNameEdList jNameList = super.createJNameList(); + jNameList.setReplaceEmptyName(false); + return jNameList; } /** From 0bef26216aa8c659dc4466f18fae13581080bf12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Fri, 10 Sep 2021 14:31:09 +0800 Subject: [PATCH 15/32] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/gui/controlpane/JListControlPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java index 82cba758b7..2955801f76 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java @@ -335,7 +335,7 @@ public abstract class JListControlPane extends JControlPane implements ListContr getHelper().checkButtonEnabled(); } - protected class NameableListCellRenderer extends + private class NameableListCellRenderer extends DefaultListCellRenderer { @Override public Component getListCellRendererComponent(JList list, Object value, From 9b079258ea6da65c01bf93fbd4ee79c840e2c987 Mon Sep 17 00:00:00 2001 From: eason Date: Fri, 10 Sep 2021 15:22:14 +0800 Subject: [PATCH 16/32] =?UTF-8?q?v7=E6=89=93=E5=BC=80=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/ui/compatible/NewModernUIPane.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java b/designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java index 107ba8cd95..d755d4e05f 100644 --- a/designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java +++ b/designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java @@ -81,30 +81,33 @@ public class NewModernUIPane extends ModernUIPane { private void showDebuggerDialog() { JDialog dialog = new JDialog(SwingUtilities.getWindowAncestor(this)); - Engine engine = Engine.newInstance( - EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED) - .addSwitch("--disable-google-traffic") - .remoteDebuggingPort(9222).build()); - Browser debugger = engine.newBrowser(); + + Browser debugger = browser.engine().newBrowser(); BrowserView debuggerView = BrowserView.newInstance(debugger); dialog.add(debuggerView, BorderLayout.CENTER); dialog.setSize(new Dimension(800, 400)); GUICoreUtils.centerWindow(dialog); dialog.setVisible(true); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + browser.devTools().remoteDebuggingUrl().ifPresent(url -> { debugger.navigation().loadUrl(url); }); } private void initializeBrowser() { - EngineOptions options; + EngineOptions.Builder builder; if (scheme != null && requestCallback != null) { - options = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").addScheme(scheme, requestCallback).build(); + builder = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").addScheme(scheme, requestCallback); } else { - options = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").build(); + builder = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic"); } - Engine engine = Engine.newInstance(options); + + if (DesignerEnvManager.getEnvManager().isOpenDebug()) { + builder.remoteDebuggingPort(9222); + } + + Engine engine = Engine.newInstance(builder.build()); browser = engine.newBrowser(); // 初始化的时候,就把命名空间对象初始化好,确保window.a.b.c("a.b.c"为命名空间)对象都是初始化过的 From 7768f39e0ded895efdcd066ab6a0d25e53dd8e4c Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 13 Sep 2021 13:51:48 +0800 Subject: [PATCH 17/32] =?UTF-8?q?CHART-19792=20=E5=A4=A7=E5=B1=8F=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E5=B1=8F=E8=94=BD=E5=85=A8=E5=B1=80=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/toolbar/ToolBarMenuDock.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index d8e5b4a57e..866c2fabea 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -40,6 +40,7 @@ import com.fr.design.actions.server.GlobalParameterAction; import com.fr.design.actions.server.GlobalTableDataAction; import com.fr.design.actions.server.PlatformManagerAction; import com.fr.design.actions.server.PluginManagerAction; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.file.NewTemplatePane; import com.fr.design.fun.MenuHandler; import com.fr.design.fun.OemProcessor; @@ -491,10 +492,12 @@ public abstract class ToolBarMenuDock { if (!DesignerMode.isAuthorityEditing()) { addPluginManagerAction(menuDef); - menuDef.addShortCut( - new FunctionManagerAction(), - new GlobalParameterAction() - ); + menuDef.addShortCut(new FunctionManagerAction()); + + if (!DesignModeContext.isDuchampMode()) { + menuDef.addShortCut(new GlobalParameterAction()); + } + } From 356dcefa6929e76cb16f5187f64cf5dd297ee41a Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 13 Sep 2021 14:04:08 +0800 Subject: [PATCH 18/32] =?UTF-8?q?CHART-20662=20fix:=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E5=AD=97=E6=AE=B5=E6=8B=96=E5=85=A5=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=20=E7=99=BD=E8=89=B2=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/present/ConditionAttributesGroupPane.java | 2 ++ .../main/java/com/fr/grid/dnd/ElementCasePaneDropTarget.java | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java b/designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java index ad0c57b51e..8aaeec449f 100644 --- a/designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java +++ b/designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java @@ -7,6 +7,7 @@ import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.UIListControlPane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils; import com.fr.general.NameObject; import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.Selection; @@ -83,6 +84,7 @@ public class ConditionAttributesGroupPane extends UIListControlPane { editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow()); if (editCellElement == null) { editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); + AdjustWorkBookDefaultStyleUtils.adjustCellElement(editCellElement); } SheetUtils.calculateDefaultParent(tplEC); // 不知道这行代码的作用,怕去掉之后会出问题,先放在这里 diff --git a/designer-realize/src/main/java/com/fr/grid/dnd/ElementCasePaneDropTarget.java b/designer-realize/src/main/java/com/fr/grid/dnd/ElementCasePaneDropTarget.java index 1c72b28e09..0083cbdb25 100644 --- a/designer-realize/src/main/java/com/fr/grid/dnd/ElementCasePaneDropTarget.java +++ b/designer-realize/src/main/java/com/fr/grid/dnd/ElementCasePaneDropTarget.java @@ -5,6 +5,7 @@ import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.data.TableDataColumn; import com.fr.grid.Grid; @@ -251,7 +252,7 @@ public class ElementCasePaneDropTarget extends DropTargetAdapter { cellExPandAttr.setDirection(Constants.TOP_TO_BOTTOM); if (curCellElement == null) { curCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow(), cs.getColumnSpan(), cs.getRowSpan(), newLinearDSColumn); - + AdjustWorkBookDefaultStyleUtils.adjustCellElement(curCellElement); report.addCellElement(curCellElement); } else { // marks:直接覆盖值 From 02716957ac525d73e6439c759637a88ccb45fd83 Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 14 Sep 2021 15:15:33 +0800 Subject: [PATCH 19/32] add executeJavaScriptAndReturnValue function --- .../src/main/java/com/fr/design/ui/ModernUIPane.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java b/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java index 10732e9b0b..90d6accf6b 100644 --- a/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java +++ b/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java @@ -11,7 +11,6 @@ import com.fr.web.struct.AssembleComponent; import com.teamdev.jxbrowser.browser.callback.InjectJsCallback; import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.BrowserType; -import com.teamdev.jxbrowser.chromium.JSObject; import com.teamdev.jxbrowser.chromium.JSValue; import com.teamdev.jxbrowser.chromium.events.LoadListener; import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; @@ -23,11 +22,11 @@ import com.teamdev.jxbrowser.event.Observer; import javax.swing.JDialog; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; -import java.util.Map; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.Map; /** * @author richie @@ -180,12 +179,10 @@ public class ModernUIPane extends BasicPane { } } - public JSObject getEmptyJSObjectV6() { - + public JSValue executeJavaScriptAndReturnValue(String javaScript) { if (browser != null) { - return browser.executeJavaScriptAndReturnValue("var __empty_props__ = {};__empty_props__").asObject(); + return browser.executeJavaScriptAndReturnValue(javaScript); } - return null; } From a63b2989ce65a5f993068c4d6bfc9c1b2ac0150a Mon Sep 17 00:00:00 2001 From: vito Date: Thu, 16 Sep 2021 11:22:52 +0800 Subject: [PATCH 20/32] =?UTF-8?q?REPORT-55377=20=E6=9B=B4=E6=96=B0Tomcat?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=88=B08.5.69?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a469ec9c27..da6b0daf88 100644 --- a/build.gradle +++ b/build.gradle @@ -68,7 +68,7 @@ allprojects { implementation 'org.swingexplorer:swexpl:2.0.1' implementation 'org.swingexplorer:swag:1.0' implementation 'net.java.dev.jna:jna:5.4.0' - implementation 'org.apache.tomcat:tomcat-catalina:8.5.57' + implementation 'org.apache.tomcat:tomcat-catalina:8.5.69' implementation 'io.socket:socket.io-client:0.7.0' implementation 'com.fr.third:fine-third:' + frVersion implementation 'com.fr.core:fine-core:' + frDevVersion From 5c372857cf74d3b85e2f093b4bdd2db2ec21c2e5 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 16 Sep 2021 14:56:31 +0800 Subject: [PATCH 21/32] =?UTF-8?q?REPORT-56220=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E8=B6=8A=E6=9D=83=E6=BC=8F=E6=B4=9E=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/JTemplate.java | 21 ++- .../authority/DSColumnAuthorityChecker.java | 16 ++ .../authority/ElementAuthorityChecker.java | 26 ++++ .../authority/FormulaAuthorityChecker.java | 27 ++++ .../authority/JTemplateAuthorityChecker.java | 147 ++++++++++++++++++ ...ameDatabaseConnectionAuthorityChecker.java | 17 ++ .../NameTableDataAuthorityChecker.java | 16 ++ 7 files changed, 262 insertions(+), 8 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/authority/DSColumnAuthorityChecker.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/authority/ElementAuthorityChecker.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/authority/FormulaAuthorityChecker.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/authority/NameDatabaseConnectionAuthorityChecker.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/authority/NameTableDataAuthorityChecker.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 70d1f3e0e2..aac3268be7 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -43,6 +43,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.authority.JTemplateAuthorityChecker; import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mainframe.check.CheckButton; import com.fr.design.mainframe.template.info.TemplateProcessInfo; @@ -247,6 +248,7 @@ public abstract class JTemplate> } } } + private void stopListenThemeConfig() { if (themeConfigChangeListener != null) { TemplateThemeConfig config = getUsingTemplateThemeConfig(); @@ -269,7 +271,7 @@ public abstract class JTemplate> public void fireTabChange() { // do nothing } - + protected void addPane(PropertyItemPaneProvider provider) { // do nothing } @@ -1404,7 +1406,7 @@ public abstract class JTemplate> * @return 按钮组 */ public UIButton[] createExtraButtons() { - UIButton[] uiButtons = new UIButton[] { + UIButton[] uiButtons = new UIButton[]{ (UIButton) new CompileAction().createToolBarComponent() }; Set providers = ExtraDesignClassManager.getInstance().getArray(DesignerFrameUpButtonProvider.XML_TAG); @@ -1549,13 +1551,16 @@ public abstract class JTemplate> } private boolean saveRealFile() throws Exception { - FILE editingFILE = this.getEditingFILE(); - if (editingFILE == null || editingFILE instanceof MemFILE) { - return false; + if (new JTemplateAuthorityChecker(this).isAuthority()) { + FILE editingFILE = this.getEditingFILE(); + if (editingFILE == null || editingFILE instanceof MemFILE) { + return false; + } + this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(editingFILE)); + this.editingFILE = editingFILE; + return true; } - this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(editingFILE)); - this.editingFILE = editingFILE; - return true; + return false; } private CallbackSaveWorker saveAs(boolean showLoc) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/DSColumnAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/DSColumnAuthorityChecker.java new file mode 100644 index 0000000000..b27418ebf0 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/DSColumnAuthorityChecker.java @@ -0,0 +1,16 @@ +package com.fr.design.mainframe.authority; + +import com.fr.report.cell.cellattr.core.group.DSColumn; +import java.util.Set; + +public class DSColumnAuthorityChecker extends ElementAuthorityChecker { + + @Override + String checkDatasetName(DSColumn dsColumn, Set authDatasetNames) { + if (!authDatasetNames.contains(dsColumn.getDSName())) { + return dsColumn.getDSName(); + } + return null; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/ElementAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/ElementAuthorityChecker.java new file mode 100644 index 0000000000..020dda4702 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/ElementAuthorityChecker.java @@ -0,0 +1,26 @@ +package com.fr.design.mainframe.authority; + +import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl; + +import java.lang.reflect.Type; +import java.util.Set; + + +public abstract class ElementAuthorityChecker { + //检查是否有越权的数据连接,如果有返回名称,没有返回null + String checkConnectionName(T t, Set authConnectionNames) { + return null; + } + + //检查是否有越权的服务器数据集,如果有返回名称,没有返回null + String checkDatasetName(T t, Set authDatasetNames) { + return null; + } + + //要检查对象的className + String getCheckClassName() { + ParameterizedTypeImpl parameterizedType = (ParameterizedTypeImpl) this.getClass().getGenericSuperclass(); + Type type = parameterizedType.getActualTypeArguments()[0]; + return type.getTypeName(); + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/FormulaAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/FormulaAuthorityChecker.java new file mode 100644 index 0000000000..7333678c2d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/FormulaAuthorityChecker.java @@ -0,0 +1,27 @@ +package com.fr.design.mainframe.authority; + +import com.fr.base.Formula; +import com.fr.parser.FunctionCall; +import com.fr.parser.StringLiteral; +import com.fr.script.Calculator; + +import java.lang.reflect.Field; +import java.util.Set; + +public class FormulaAuthorityChecker extends ElementAuthorityChecker { + @Override + public String checkConnectionName(Formula formula, Set authConnectionNames) { + String content = formula.getContent(); + try { + FunctionCall functionCall = (FunctionCall) Calculator.createCalculator().parse(content).getConditionalExpression(); + StringLiteral stringLiteral = (StringLiteral) functionCall.getArguments()[0]; + String connectionName = (String) Calculator.createCalculator().evalValue(stringLiteral); + if (!authConnectionNames.contains(connectionName)) { + return connectionName; + } + } catch (Exception ignore) { + + } + return null; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java new file mode 100644 index 0000000000..47ad2e215c --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java @@ -0,0 +1,147 @@ +package com.fr.design.mainframe.authority; + + +import com.fr.design.dialog.FineJOptionPane; + +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; +import com.fr.invoke.ClassHelper; + +import com.fr.log.FineLoggerFactory; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.authority.user.UserAuthority; + +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + + +import static javax.swing.JOptionPane.WARNING_MESSAGE; + + +public class JTemplateAuthorityChecker { + JTemplate jTemplate; + Set authConnectionNames; + Set authDatasetNames; + Map checkerMap = new HashMap<>(); + Set authFailConnectionNames = new HashSet<>(); + Set authFailDatasetNames = new HashSet<>(); + + + public JTemplateAuthorityChecker(JTemplate jTemplate) { + long s = System.currentTimeMillis(); + this.jTemplate = jTemplate; + this.initAuthNames(); + this.initChecker(); + FineLoggerFactory.getLogger().info("JTemplateAuthorityChecker init time consume:" + (System.currentTimeMillis() - s)); + } + + private void initAuthNames() { + UserAuthority templateAuthority = WorkContext.getCurrent().get(UserAuthority.class); + Map> allAuthNames = templateAuthority.getAuthServerDataSetAndConnectionNames(); + //有权限的数据连接名称 + authConnectionNames = allAuthNames.get(UserAuthority.AUTH_CONNECTION_NAMES); + //有权限的数据集名称(模板数据集和服务器数据集) + authDatasetNames = allAuthNames.get(UserAuthority.AUTH_SERVER_DATASET_NAMES); + Iterator iterator = jTemplate.getTarget().getTableDataNameIterator(); + while (iterator.hasNext()) { + String datasetName = iterator.next(); + authDatasetNames.add(datasetName); + } + } + + private void initChecker() { + registerChecker(new NameDatabaseConnectionAuthorityChecker()); + registerChecker(new DSColumnAuthorityChecker()); + registerChecker(new FormulaAuthorityChecker()); + registerChecker(new NameTableDataAuthorityChecker()); + } + + private void registerChecker(ElementAuthorityChecker checker) { + checkerMap.put(checker.getCheckClassName(), checker); + } + + + public boolean isAuthority() { + long s = System.currentTimeMillis(); + //遍历模板对象,根据checkerMap.keySet()把感兴趣的对象找出来 + Map> targetObjects = ClassHelper.searchObject(jTemplate.getTarget(), checkerMap.keySet()); + + //找到对应的checker,对对象进行检查 + for (String name : targetObjects.keySet()) { + ElementAuthorityChecker checker = checkerMap.get(name); + for (Object object : targetObjects.get(name)) { + String authFailName = checker.checkConnectionName(object, authConnectionNames); + if (authFailName != null) { + authFailConnectionNames.add(authFailName); + } + authFailName = checker.checkDatasetName(object, authDatasetNames); + if (authFailName != null) { + authFailDatasetNames.add(authFailName); + } + } + } + + FineLoggerFactory.getLogger().info("JTemplateAuthorityChecker check time consume:" + (System.currentTimeMillis() - s)); + if (authFailConnectionNames.size() == 0 && authFailDatasetNames.size() == 0) { + return true; + } else { + //如果存在越权的,弹出弹框,并返回false + authorityFailPrompt(); + return false; + } + } + + private void authorityFailPrompt() { + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append(Toolkit.i18nText("Fine-Design-Basic_Save_Failure")); + stringBuffer.append("\n"); + if (authFailDatasetNames.size() > 0) { + stringBuffer.append(Toolkit.i18nText("Fine-Design_Template_Authority_Check_Current_Operator_Miss")); + stringBuffer.append(authFailDatasetNames.size()); + stringBuffer.append(Toolkit.i18nText("Fine-Design_Report_Ge")); + stringBuffer.append(Toolkit.i18nText("Fine-Design_Template_Authority_Check_Server_Dataset_Authority")); + stringBuffer.append("\n"); + stringBuffer.append(getNoAuthNameSequence(authFailDatasetNames)); + } + + if (authFailConnectionNames.size() > 0) { + stringBuffer.append(Toolkit.i18nText("Fine-Design_Template_Authority_Check_Current_Operator_Miss")); + stringBuffer.append(authFailConnectionNames.size()); + stringBuffer.append(Toolkit.i18nText("Fine-Design_Report_Ge")); + stringBuffer.append(Toolkit.i18nText("Fine-Design_Template_Authority_Check_Data_Connection_Authority")); + stringBuffer.append("\n"); + stringBuffer.append(getNoAuthNameSequence(authFailConnectionNames)); + } + + FineJOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + stringBuffer.toString(), + Toolkit.i18nText("Fine-Design_Basic_Alert"), + WARNING_MESSAGE); + } + + private String getNoAuthNameSequence(Set names) { + StringBuffer stringBuffer = new StringBuffer(); + int showMaxCount = 3; + int count = 0; + for (String name : names) { + if (count == showMaxCount) { + stringBuffer.append(Toolkit.i18nText("Fine-Design_Template_Authority_Check_Etc")); + break; + } + stringBuffer.append(name); + if (count != names.size() - 1 && count != showMaxCount - 1) { + stringBuffer.append(";"); + } + count++; + } + stringBuffer.append("\n"); + return stringBuffer.toString(); + } +} + diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/NameDatabaseConnectionAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/NameDatabaseConnectionAuthorityChecker.java new file mode 100644 index 0000000000..fcb9757304 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/NameDatabaseConnectionAuthorityChecker.java @@ -0,0 +1,17 @@ +package com.fr.design.mainframe.authority; + +import com.fr.data.impl.NameDatabaseConnection; + +import java.util.Set; + +public class NameDatabaseConnectionAuthorityChecker extends ElementAuthorityChecker { + @Override + String checkConnectionName(NameDatabaseConnection nameDatabaseConnection, Set authConnectionNames) { + String name = nameDatabaseConnection.getName(); + if (!authConnectionNames.contains(name)) { + return name; + } + return null; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/NameTableDataAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/NameTableDataAuthorityChecker.java new file mode 100644 index 0000000000..d11cbc9584 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/NameTableDataAuthorityChecker.java @@ -0,0 +1,16 @@ +package com.fr.design.mainframe.authority; + +import com.fr.data.impl.NameTableData; + +import java.util.Set; + +public class NameTableDataAuthorityChecker extends ElementAuthorityChecker { + @Override + String checkDatasetName(NameTableData nameTableData, Set authDatasetNames) { + if (!authDatasetNames.contains(nameTableData.getName())) { + return nameTableData.getName(); + } + return null; + + } +} From 69d6de2bcd21f9010ad861facd3d8e13d8518e70 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 16 Sep 2021 20:35:50 +0800 Subject: [PATCH 22/32] =?UTF-8?q?REPORT-56220=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E8=B6=8A=E6=9D=83=E6=BC=8F=E6=B4=9E=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/JTemplate.java | 7 +- .../authority/DSColumnAuthorityChecker.java | 8 +- .../authority/ElementAuthorityChecker.java | 25 +++- .../authority/FormulaAuthorityChecker.java | 23 ++-- .../authority/JTemplateAuthorityChecker.java | 121 ++++++++++++------ ...ameDatabaseConnectionAuthorityChecker.java | 7 +- .../NameTableDataAuthorityChecker.java | 7 +- 7 files changed, 129 insertions(+), 69 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index aac3268be7..89bb1b7980 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -1551,7 +1551,8 @@ public abstract class JTemplate> } private boolean saveRealFile() throws Exception { - if (new JTemplateAuthorityChecker(this).isAuthority()) { + JTemplateAuthorityChecker jTemplateAuthorityChecker = new JTemplateAuthorityChecker(this); + if (jTemplateAuthorityChecker.isAuthority()) { FILE editingFILE = this.getEditingFILE(); if (editingFILE == null || editingFILE instanceof MemFILE) { return false; @@ -1559,8 +1560,10 @@ public abstract class JTemplate> this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(editingFILE)); this.editingFILE = editingFILE; return true; + } else { + jTemplateAuthorityChecker.showAuthorityFailPromptDialog(); + return false; } - return false; } private CallbackSaveWorker saveAs(boolean showLoc) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/DSColumnAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/DSColumnAuthorityChecker.java index b27418ebf0..7a4ae7ce77 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/DSColumnAuthorityChecker.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/DSColumnAuthorityChecker.java @@ -1,16 +1,18 @@ package com.fr.design.mainframe.authority; import com.fr.report.cell.cellattr.core.group.DSColumn; + +import java.util.Arrays; +import java.util.HashSet; import java.util.Set; public class DSColumnAuthorityChecker extends ElementAuthorityChecker { @Override - String checkDatasetName(DSColumn dsColumn, Set authDatasetNames) { + Set getNoAuthDatasetNames(DSColumn dsColumn, Set authDatasetNames) { if (!authDatasetNames.contains(dsColumn.getDSName())) { - return dsColumn.getDSName(); + return new HashSet<>(Arrays.asList(dsColumn.getDSName())); } return null; } - } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/ElementAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/ElementAuthorityChecker.java index 020dda4702..558643c047 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/ElementAuthorityChecker.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/ElementAuthorityChecker.java @@ -7,17 +7,34 @@ import java.util.Set; public abstract class ElementAuthorityChecker { - //检查是否有越权的数据连接,如果有返回名称,没有返回null - String checkConnectionName(T t, Set authConnectionNames) { + + + /** + * @Description 获取越权的数据连接 + * @param: t 待检查的对象 + * @param: authConnectionNames 有权限的数据连接名 + * @return 如果有返回名称,没有返回null + */ + Set getNoAuthConnectionNames(T t, Set authConnectionNames) { return null; } //检查是否有越权的服务器数据集,如果有返回名称,没有返回null - String checkDatasetName(T t, Set authDatasetNames) { + + /** + * @Description 获取越权的服务器数据集 + * @param: t 待检查的对象 + * @param: authDatasetNames 有权限的服务器数据集名 + * @return 如果有返回名称,没有返回null + */ + Set getNoAuthDatasetNames(T t, Set authDatasetNames) { return null; } - //要检查对象的className + /** + * @Description 要检查对象的className + * @return className + */ String getCheckClassName() { ParameterizedTypeImpl parameterizedType = (ParameterizedTypeImpl) this.getClass().getGenericSuperclass(); Type type = parameterizedType.getActualTypeArguments()[0]; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/FormulaAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/FormulaAuthorityChecker.java index 7333678c2d..73a3965a72 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/FormulaAuthorityChecker.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/FormulaAuthorityChecker.java @@ -1,26 +1,23 @@ package com.fr.design.mainframe.authority; import com.fr.base.Formula; -import com.fr.parser.FunctionCall; -import com.fr.parser.StringLiteral; -import com.fr.script.Calculator; -import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.HashSet; import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class FormulaAuthorityChecker extends ElementAuthorityChecker { @Override - public String checkConnectionName(Formula formula, Set authConnectionNames) { + public Set getNoAuthConnectionNames(Formula formula, Set authConnectionNames) { String content = formula.getContent(); - try { - FunctionCall functionCall = (FunctionCall) Calculator.createCalculator().parse(content).getConditionalExpression(); - StringLiteral stringLiteral = (StringLiteral) functionCall.getArguments()[0]; - String connectionName = (String) Calculator.createCalculator().evalValue(stringLiteral); - if (!authConnectionNames.contains(connectionName)) { - return connectionName; + Pattern pattern = Pattern.compile("^=SQL\\(\"(.+?)\","); + Matcher matcher = pattern.matcher(content); + if (matcher.find()) { + if (!authConnectionNames.contains(matcher.group(1))) { + return new HashSet<>(Arrays.asList(matcher.group(1))); } - } catch (Exception ignore) { - } return null; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java index 47ad2e215c..f8b2c8ce6b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java @@ -6,9 +6,13 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; +import com.fr.design.mod.ModClassFilter; import com.fr.invoke.ClassHelper; import com.fr.log.FineLoggerFactory; +import com.fr.rpc.ExceptionHandler; +import com.fr.rpc.RPCInvokerExceptionInfo; +import com.fr.stable.Filter; import com.fr.workspace.WorkContext; import com.fr.workspace.server.authority.user.UserAuthority; @@ -42,15 +46,17 @@ public class JTemplateAuthorityChecker { private void initAuthNames() { UserAuthority templateAuthority = WorkContext.getCurrent().get(UserAuthority.class); - Map> allAuthNames = templateAuthority.getAuthServerDataSetAndConnectionNames(); - //有权限的数据连接名称 - authConnectionNames = allAuthNames.get(UserAuthority.AUTH_CONNECTION_NAMES); - //有权限的数据集名称(模板数据集和服务器数据集) - authDatasetNames = allAuthNames.get(UserAuthority.AUTH_SERVER_DATASET_NAMES); - Iterator iterator = jTemplate.getTarget().getTableDataNameIterator(); - while (iterator.hasNext()) { - String datasetName = iterator.next(); - authDatasetNames.add(datasetName); + Map> authNamesMap = templateAuthority.getAuthServerDataSetAndConnectionNames(); + if (authNamesMap != null) { + //有权限的数据连接名称 + authConnectionNames = authNamesMap.get(UserAuthority.AUTH_CONNECTION_NAMES); + //有权限的数据集名称(模板数据集和服务器数据集) + authDatasetNames = authNamesMap.get(UserAuthority.AUTH_SERVER_DATASET_NAMES); + Iterator iterator = jTemplate.getTarget().getTableDataNameIterator(); + while (iterator.hasNext()) { + String datasetName = iterator.next(); + authDatasetNames.add(datasetName); + } } } @@ -69,55 +75,39 @@ public class JTemplateAuthorityChecker { public boolean isAuthority() { long s = System.currentTimeMillis(); //遍历模板对象,根据checkerMap.keySet()把感兴趣的对象找出来 - Map> targetObjects = ClassHelper.searchObject(jTemplate.getTarget(), checkerMap.keySet()); + Map> targetObjects = ClassHelper.searchObject(jTemplate.getTarget(), checkerMap.keySet(), ClassFilter.getInstance()); //找到对应的checker,对对象进行检查 for (String name : targetObjects.keySet()) { ElementAuthorityChecker checker = checkerMap.get(name); for (Object object : targetObjects.get(name)) { - String authFailName = checker.checkConnectionName(object, authConnectionNames); - if (authFailName != null) { - authFailConnectionNames.add(authFailName); + if (authConnectionNames != null) { + Set noAuthName = checker.getNoAuthConnectionNames(object, authConnectionNames); + if (noAuthName != null) { + authFailConnectionNames.addAll(noAuthName); + } } - authFailName = checker.checkDatasetName(object, authDatasetNames); - if (authFailName != null) { - authFailDatasetNames.add(authFailName); + if (authDatasetNames != null) { + Set noAuthName = checker.getNoAuthDatasetNames(object, authDatasetNames); + if (noAuthName != null) { + authFailDatasetNames.addAll(noAuthName); + } } } } FineLoggerFactory.getLogger().info("JTemplateAuthorityChecker check time consume:" + (System.currentTimeMillis() - s)); - if (authFailConnectionNames.size() == 0 && authFailDatasetNames.size() == 0) { - return true; - } else { - //如果存在越权的,弹出弹框,并返回false - authorityFailPrompt(); - return false; - } + return authFailConnectionNames.size() == 0 && authFailDatasetNames.size() == 0; } - private void authorityFailPrompt() { + public void showAuthorityFailPromptDialog() { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(Toolkit.i18nText("Fine-Design-Basic_Save_Failure")); stringBuffer.append("\n"); - if (authFailDatasetNames.size() > 0) { - stringBuffer.append(Toolkit.i18nText("Fine-Design_Template_Authority_Check_Current_Operator_Miss")); - stringBuffer.append(authFailDatasetNames.size()); - stringBuffer.append(Toolkit.i18nText("Fine-Design_Report_Ge")); - stringBuffer.append(Toolkit.i18nText("Fine-Design_Template_Authority_Check_Server_Dataset_Authority")); - stringBuffer.append("\n"); - stringBuffer.append(getNoAuthNameSequence(authFailDatasetNames)); - } - - if (authFailConnectionNames.size() > 0) { - stringBuffer.append(Toolkit.i18nText("Fine-Design_Template_Authority_Check_Current_Operator_Miss")); - stringBuffer.append(authFailConnectionNames.size()); - stringBuffer.append(Toolkit.i18nText("Fine-Design_Report_Ge")); - stringBuffer.append(Toolkit.i18nText("Fine-Design_Template_Authority_Check_Data_Connection_Authority")); - stringBuffer.append("\n"); - stringBuffer.append(getNoAuthNameSequence(authFailConnectionNames)); - } - + stringBuffer.append(getPromptInfo(authFailDatasetNames, + Toolkit.i18nText("Fine-Design_Template_Authority_Check_Server_Dataset_Authority"))); + stringBuffer.append(getPromptInfo(authFailConnectionNames, + Toolkit.i18nText("Fine-Design_Template_Authority_Check_Data_Connection_Authority"))); FineJOptionPane.showMessageDialog( DesignerContext.getDesignerFrame(), stringBuffer.toString(), @@ -125,6 +115,19 @@ public class JTemplateAuthorityChecker { WARNING_MESSAGE); } + private String getPromptInfo(Set authFailNames, String message) { + StringBuffer stringBuffer = new StringBuffer(); + if (authFailNames.size() > 0) { + stringBuffer.append(Toolkit.i18nText("Fine-Design_Template_Authority_Check_Current_Operator_Miss")); + stringBuffer.append(authFailNames.size()); + stringBuffer.append(Toolkit.i18nText("Fine-Design_Report_Ge")); + stringBuffer.append(message); + stringBuffer.append("\n"); + stringBuffer.append(getNoAuthNameSequence(authFailNames)); + } + return stringBuffer.toString(); + } + private String getNoAuthNameSequence(Set names) { StringBuffer stringBuffer = new StringBuffer(); int showMaxCount = 3; @@ -143,5 +146,39 @@ public class JTemplateAuthorityChecker { stringBuffer.append("\n"); return stringBuffer.toString(); } + + static class ClassFilter implements Filter { + + private static final Set FILTER_SET = new HashSet<>(); + private static final Set START_WITH_SET = new HashSet<>(); + private static final Filter INSTANCE = new ModClassFilter(); + + public static Filter getInstance() { + return INSTANCE; + } + + static { + FILTER_SET.add("java.awt.image.BufferedImage"); + FILTER_SET.add("sun.awt.AppContext"); + FILTER_SET.add("com.fr.poly.creator.ECBlockCreator"); + FILTER_SET.add("io.netty.channel.nio.SelectedSelectionKeySet"); + FILTER_SET.add("com.fr.form.ui.ElementCaseImage"); + FILTER_SET.add("this$0"); + START_WITH_SET.add("com.fr.design"); + } + + @Override + public boolean accept(String s) { + if (FILTER_SET.contains(s)) { + return true; + } + for (String start : START_WITH_SET) { + if (s.startsWith(start)) { + return true; + } + } + return false; + } + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/NameDatabaseConnectionAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/NameDatabaseConnectionAuthorityChecker.java index fcb9757304..4a7183f53d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/NameDatabaseConnectionAuthorityChecker.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/NameDatabaseConnectionAuthorityChecker.java @@ -2,14 +2,17 @@ package com.fr.design.mainframe.authority; import com.fr.data.impl.NameDatabaseConnection; +import java.util.Arrays; +import java.util.HashSet; import java.util.Set; +import java.util.stream.Collectors; public class NameDatabaseConnectionAuthorityChecker extends ElementAuthorityChecker { @Override - String checkConnectionName(NameDatabaseConnection nameDatabaseConnection, Set authConnectionNames) { + Set getNoAuthConnectionNames(NameDatabaseConnection nameDatabaseConnection, Set authConnectionNames) { String name = nameDatabaseConnection.getName(); if (!authConnectionNames.contains(name)) { - return name; + return new HashSet<>(Arrays.asList(name)); } return null; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/NameTableDataAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/NameTableDataAuthorityChecker.java index d11cbc9584..498c04af4d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/NameTableDataAuthorityChecker.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/NameTableDataAuthorityChecker.java @@ -2,15 +2,16 @@ package com.fr.design.mainframe.authority; import com.fr.data.impl.NameTableData; +import java.util.Arrays; +import java.util.HashSet; import java.util.Set; public class NameTableDataAuthorityChecker extends ElementAuthorityChecker { @Override - String checkDatasetName(NameTableData nameTableData, Set authDatasetNames) { + Set getNoAuthDatasetNames(NameTableData nameTableData, Set authDatasetNames) { if (!authDatasetNames.contains(nameTableData.getName())) { - return nameTableData.getName(); + return new HashSet<>(Arrays.asList(nameTableData.getName())); } return null; - } } From 19a83f8cb54d76215edc6a4c15509c36de091f41 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Thu, 16 Sep 2021 20:37:59 +0800 Subject: [PATCH 23/32] =?UTF-8?q?REPORT-56220=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E8=B6=8A=E6=9D=83=E6=BC=8F=E6=B4=9E=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/authority/ElementAuthorityChecker.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/ElementAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/ElementAuthorityChecker.java index 558643c047..3851406e73 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/ElementAuthorityChecker.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/ElementAuthorityChecker.java @@ -18,8 +18,7 @@ public abstract class ElementAuthorityChecker { Set getNoAuthConnectionNames(T t, Set authConnectionNames) { return null; } - - //检查是否有越权的服务器数据集,如果有返回名称,没有返回null + /** * @Description 获取越权的服务器数据集 From 83aa0647da69837fb1bf688599d99a0a840b2ef2 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Fri, 17 Sep 2021 09:43:18 +0800 Subject: [PATCH 24/32] =?UTF-8?q?REPORT-56220=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E8=B6=8A=E6=9D=83=E6=BC=8F=E6=B4=9E=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/authority/DSColumnAuthorityChecker.java | 2 ++ .../mainframe/authority/ElementAuthorityChecker.java | 5 ++++- .../mainframe/authority/FormulaAuthorityChecker.java | 7 +++++-- .../authority/NameDatabaseConnectionAuthorityChecker.java | 2 ++ .../mainframe/authority/NameTableDataAuthorityChecker.java | 2 ++ 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/DSColumnAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/DSColumnAuthorityChecker.java index 7a4ae7ce77..fdab6ea2a2 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/DSColumnAuthorityChecker.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/DSColumnAuthorityChecker.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.authority; import com.fr.report.cell.cellattr.core.group.DSColumn; +import org.jetbrains.annotations.Nullable; import java.util.Arrays; import java.util.HashSet; @@ -9,6 +10,7 @@ import java.util.Set; public class DSColumnAuthorityChecker extends ElementAuthorityChecker { @Override + @Nullable Set getNoAuthDatasetNames(DSColumn dsColumn, Set authDatasetNames) { if (!authDatasetNames.contains(dsColumn.getDSName())) { return new HashSet<>(Arrays.asList(dsColumn.getDSName())); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/ElementAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/ElementAuthorityChecker.java index 3851406e73..67d0f1da36 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/ElementAuthorityChecker.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/ElementAuthorityChecker.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.authority; +import org.jetbrains.annotations.Nullable; import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl; import java.lang.reflect.Type; @@ -15,10 +16,11 @@ public abstract class ElementAuthorityChecker { * @param: authConnectionNames 有权限的数据连接名 * @return 如果有返回名称,没有返回null */ + @Nullable Set getNoAuthConnectionNames(T t, Set authConnectionNames) { return null; } - + /** * @Description 获取越权的服务器数据集 @@ -26,6 +28,7 @@ public abstract class ElementAuthorityChecker { * @param: authDatasetNames 有权限的服务器数据集名 * @return 如果有返回名称,没有返回null */ + @Nullable Set getNoAuthDatasetNames(T t, Set authDatasetNames) { return null; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/FormulaAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/FormulaAuthorityChecker.java index 73a3965a72..d108c18d41 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/FormulaAuthorityChecker.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/FormulaAuthorityChecker.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.authority; import com.fr.base.Formula; +import org.jetbrains.annotations.Nullable; import java.util.Arrays; import java.util.HashSet; @@ -9,11 +10,13 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; public class FormulaAuthorityChecker extends ElementAuthorityChecker { + private static final Pattern FORMULA_PATTERN = Pattern.compile("^=SQL\\(\"(.+?)\","); + @Override + @Nullable public Set getNoAuthConnectionNames(Formula formula, Set authConnectionNames) { String content = formula.getContent(); - Pattern pattern = Pattern.compile("^=SQL\\(\"(.+?)\","); - Matcher matcher = pattern.matcher(content); + Matcher matcher = FORMULA_PATTERN.matcher(content); if (matcher.find()) { if (!authConnectionNames.contains(matcher.group(1))) { return new HashSet<>(Arrays.asList(matcher.group(1))); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/NameDatabaseConnectionAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/NameDatabaseConnectionAuthorityChecker.java index 4a7183f53d..96bc0b8c5d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/NameDatabaseConnectionAuthorityChecker.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/NameDatabaseConnectionAuthorityChecker.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.authority; import com.fr.data.impl.NameDatabaseConnection; +import org.jetbrains.annotations.Nullable; import java.util.Arrays; import java.util.HashSet; @@ -9,6 +10,7 @@ import java.util.stream.Collectors; public class NameDatabaseConnectionAuthorityChecker extends ElementAuthorityChecker { @Override + @Nullable Set getNoAuthConnectionNames(NameDatabaseConnection nameDatabaseConnection, Set authConnectionNames) { String name = nameDatabaseConnection.getName(); if (!authConnectionNames.contains(name)) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/authority/NameTableDataAuthorityChecker.java b/designer-base/src/main/java/com/fr/design/mainframe/authority/NameTableDataAuthorityChecker.java index 498c04af4d..13e7300856 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/authority/NameTableDataAuthorityChecker.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/authority/NameTableDataAuthorityChecker.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.authority; import com.fr.data.impl.NameTableData; +import org.jetbrains.annotations.Nullable; import java.util.Arrays; import java.util.HashSet; @@ -8,6 +9,7 @@ import java.util.Set; public class NameTableDataAuthorityChecker extends ElementAuthorityChecker { @Override + @Nullable Set getNoAuthDatasetNames(NameTableData nameTableData, Set authDatasetNames) { if (!authDatasetNames.contains(nameTableData.getName())) { return new HashSet<>(Arrays.asList(nameTableData.getName())); From debf13688c36fa55ee3ce300d50854d5b3fa7c17 Mon Sep 17 00:00:00 2001 From: vito Date: Fri, 17 Sep 2021 14:33:37 +0800 Subject: [PATCH 25/32] =?UTF-8?q?REPORT-55377=20=E5=8D=87=E7=BA=A7tomcat?= =?UTF-8?q?=E5=88=B08.5.69?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index d58f83f44b..ee9bc62782 100644 --- a/build.gradle +++ b/build.gradle @@ -36,7 +36,7 @@ allprojects { group 'com.fr.design' version frDevVersion sourceCompatibility = languageLevelSetting - targetCompatibility = languageLevelSetting + targetCompatibility = languageLevelSetting tasks.withType(JavaCompile) { options.encoding = "UTF-8" @@ -49,8 +49,8 @@ allprojects { idea { module { inheritOutputDirs = false - outputDir = file(outputPath +"/classes") - testOutputDir = file(outputPath +"/test-classes") + outputDir = file(outputPath + "/classes") + testOutputDir = file(outputPath + "/test-classes") languageLevel = new IdeaLanguageLevel(sourceCompatibility) targetBytecodeVersion = targetCompatibility } @@ -68,7 +68,7 @@ allprojects { implementation 'org.swingexplorer:swexpl:2.0.1' implementation 'org.swingexplorer:swag:1.0' implementation 'net.java.dev.jna:jna:5.4.0' - implementation 'org.apache.tomcat:tomcat-catalina:8.5.57' + implementation 'org.apache.tomcat:tomcat-catalina:8.5.69' implementation 'io.socket:socket.io-client:0.7.0' implementation 'com.fr.third:fine-third:' + frVersion implementation 'com.fr.core:fine-core:' + frDevVersion From faa69e6c42789dd6325e18efd83e645bf4882177 Mon Sep 17 00:00:00 2001 From: hades Date: Sat, 18 Sep 2021 11:24:45 +0800 Subject: [PATCH 26/32] =?UTF-8?q?REPORT-59719=20=E3=80=9010.0=E3=80=91?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E6=95=B0=E6=8D=AE=E6=BA=90=E7=9A=84=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E6=8C=89=E9=92=AE=EF=BC=8C=E6=95=B0=E6=8D=AE=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E4=BC=9A=E5=8F=98=E7=A9=BA=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/connect/ConnectionComboBoxPanel.java | 5 +++-- .../data/datapane/connect/ItemEditableComboBoxPanel.java | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java index 1ce37b4c51..5ed53cef40 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java @@ -87,12 +87,13 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { * 刷新ComboBox.items */ protected Iterator items() { - nameList = new ArrayList(); - ConnectionConfig mgr = ConnectionConfig.getInstance(); Iterator nameIt = mgr.getConnections().keySet().iterator(); Collection noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections(); + + nameList = new ArrayList<>(); + if (noAuthConnections == null) { return nameList.iterator(); } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java index 248d3318c9..748e70d6e9 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java @@ -91,6 +91,9 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { refreshWorker.cancel(true); } + // 记录原来选中的Item,重新加载后需要再次选中 + Object lastSelectedItem = itemComboBox.getSelectedItem(); + DefaultComboBoxModel model = ((DefaultComboBoxModel) itemComboBox.getModel()); model.removeAllElements(); @@ -98,6 +101,12 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { model.addElement(EMPTY); model.addElement(PENDING); + // 存在两种场景之前只考虑了填充场景 有populate会填充下 把这边的填充逻辑删了 所以没有问题 + // 如果是纯通过刷新按钮 没有populate 需要手动设置下上次选中的内容 + if (lastSelectedItem != null) { + model.setSelectedItem(lastSelectedItem); + } + refreshWorker = new SwingWorker, Void>() { @Override protected Iterator doInBackground() throws Exception { From 0f7eea4bc69f3a1c0afd680c4a0384736e11c2da Mon Sep 17 00:00:00 2001 From: hades Date: Sat, 18 Sep 2021 13:54:44 +0800 Subject: [PATCH 27/32] =?UTF-8?q?REPORT-59719=20=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=A1=86=E6=95=88=E6=9E=9C=E8=BF=98=E6=9C=89=E7=82=B9=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/connect/ItemEditableComboBoxPanel.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java index 748e70d6e9..45fadd26c6 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java @@ -104,7 +104,14 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { // 存在两种场景之前只考虑了填充场景 有populate会填充下 把这边的填充逻辑删了 所以没有问题 // 如果是纯通过刷新按钮 没有populate 需要手动设置下上次选中的内容 if (lastSelectedItem != null) { + ActionListener[] actionListeners = itemComboBox.getActionListeners(); + for (ActionListener actionListener : actionListeners) { + itemComboBox.removeActionListener(actionListener); + } model.setSelectedItem(lastSelectedItem); + for (ActionListener actionListener : actionListeners) { + itemComboBox.addActionListener(actionListener); + } } refreshWorker = new SwingWorker, Void>() { @@ -121,7 +128,9 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { while(itemIt.hasNext()) { model.addElement(itemIt.next()); } + // 重置下拉框高度 值一样时不会生效 所以先加再减下 itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() + 1); + itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() - 1); } catch (Exception e) { if (!(e instanceof CancellationException)) { FineLoggerFactory.getLogger().error(e.getMessage(), e); From 13944cc9344870d9778a7f44b6cf5f09aa9d2764 Mon Sep 17 00:00:00 2001 From: Starryi Date: Sat, 18 Sep 2021 15:25:22 +0800 Subject: [PATCH 28/32] =?UTF-8?q?REPORT-59770=20=E3=80=90=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E5=88=87=E6=8D=A2=E3=80=91=E7=BC=96=E8=BE=91=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E6=97=B6=EF=BC=8C=E4=B8=BB=E9=A2=98=E9=85=8D=E8=89=B2?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A5=E5=90=8E=EF=BC=8C=E7=BB=86=E8=8A=82?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=92=8C=E6=95=B4=E4=BD=93=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E9=87=8C=E7=9A=84=E9=A2=9C=E8=89=B2=E6=B2=A1=E6=9C=89=E7=9B=B8?= =?UTF-8?q?=E5=BA=94=E8=81=94=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 修复刷新界面时,触发fireChange导致数据改变的问题 【改动思路】 同上 --- .../design/mainframe/theme/TemplateThemeProfilePane.java | 2 +- .../fr/design/mainframe/theme/edit/ui/ColorListPane.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java index 7096d804cf..aef2959e35 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java @@ -111,7 +111,7 @@ public abstract class TemplateThemeProfilePane extends addAttributeChangeListener(new AttributeChangeListener() { @Override public void attributeChange() { - if (!isPopulating) { + if (!isPopulating && !refreshingThemedColor) { valueChangeAction(); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java index adeca3d7a5..5c282033f0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java @@ -40,6 +40,8 @@ public class ColorListPane extends JPanel implements UIObserver { private final EventListenerList colorChangeListenerList = new EventListenerList(); private UIObserverListener uiObserverListener; + private boolean isPopulating = false; + public ColorListPane() { this(DEFAULT_COLOR_COUNT, DEFAULT_COLOR_SIZE, DEFAULT_COLOR_GAP); } @@ -61,6 +63,9 @@ public class ColorListPane extends JPanel implements UIObserver { colorButton.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { + if (isPopulating) { + return; + } colorList.set(index, colorButton.getSelectObject()); fireColorStateChanged(); } @@ -88,6 +93,7 @@ public class ColorListPane extends JPanel implements UIObserver { } public void populate(List colors) { + isPopulating = true; colorList.clear(); for (int i = 0; i < colors.size(); i++) { Color color = colors.get(i); @@ -96,6 +102,7 @@ public class ColorListPane extends JPanel implements UIObserver { colorButtons.get(i).setSelectObject(color); } } + isPopulating = false; } public List update() { From 2609ac2aad49b91c79cc62dac47de9f1288d7429 Mon Sep 17 00:00:00 2001 From: hades Date: Sat, 18 Sep 2021 15:41:02 +0800 Subject: [PATCH 29/32] =?UTF-8?q?REPORT-59719=20=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=A1=86=E6=95=88=E6=9E=9C=E8=BF=98=E6=9C=89=E7=82=B9=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/connect/ItemEditableComboBoxPanel.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java index 45fadd26c6..2205a4f569 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java @@ -104,14 +104,7 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { // 存在两种场景之前只考虑了填充场景 有populate会填充下 把这边的填充逻辑删了 所以没有问题 // 如果是纯通过刷新按钮 没有populate 需要手动设置下上次选中的内容 if (lastSelectedItem != null) { - ActionListener[] actionListeners = itemComboBox.getActionListeners(); - for (ActionListener actionListener : actionListeners) { - itemComboBox.removeActionListener(actionListener); - } model.setSelectedItem(lastSelectedItem); - for (ActionListener actionListener : actionListeners) { - itemComboBox.addActionListener(actionListener); - } } refreshWorker = new SwingWorker, Void>() { From 54a51dcfd729221d59c6d23f288f2a77b297055e Mon Sep 17 00:00:00 2001 From: hades Date: Sat, 18 Sep 2021 16:14:11 +0800 Subject: [PATCH 30/32] =?UTF-8?q?REPORT-59719=20fix=E5=8A=A0=E4=B8=AA?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/connect/ItemEditableComboBoxPanel.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java index 2205a4f569..d0738e57b8 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java @@ -121,9 +121,12 @@ public abstract class ItemEditableComboBoxPanel extends JPanel { while(itemIt.hasNext()) { model.addElement(itemIt.next()); } - // 重置下拉框高度 值一样时不会生效 所以先加再减下 - itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() + 1); - itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() - 1); + // 如果加载成功 但是下拉框是可见的 下拉框高度是会固定为原始高度 不会因为填充了更多下拉项而变化 + // 需要重新设置下拉框高度 但值一样时相关事件不会生效 所以先加再减下 + if (itemComboBox.isPopupVisible()) { + itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() + 1); + itemComboBox.setMaximumRowCount(itemComboBox.getMaximumRowCount() - 1); + } } catch (Exception e) { if (!(e instanceof CancellationException)) { FineLoggerFactory.getLogger().error(e.getMessage(), e); From 633a29dc48a4d7f8b4f1baf171518910d45e95e8 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 22 Sep 2021 15:31:00 +0800 Subject: [PATCH 31/32] =?UTF-8?q?REPORT-57298=E3=80=90=E5=9B=9E=E5=BD=92?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E3=80=91=E6=8E=A7=E4=BB=B6=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E6=98=BE=E7=A4=BA=E5=AE=8C=E5=85=A8=EF=BC=8C=E4=BD=86?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E6=A8=AA=E5=90=91=E6=BB=9A=E5=8A=A8=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/controlpane/UIListGroupControlPane.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java index 6ec5f496a6..7c40235304 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java @@ -329,7 +329,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li width = Math.max(width, calculateUIListMaxCellWidth(uiList.getModel(), uiList.getFontMetrics(uiList.getFont()))); } iterator = nameEdListMap.entrySet().iterator(); - width += 40; + width += 30; while (iterator.hasNext()) { Map.Entry entry = iterator.next(); ListWrapperPane wrapperPane = entry.getValue(); @@ -349,7 +349,8 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li } else { text = element.toString(); } - width = Math.max(width, fontMetrics.stringWidth(text)); + //增加 10px 的左右间隔 + width = Math.max(width, fontMetrics.stringWidth(text) + 10); } } return width; @@ -539,7 +540,8 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li label.setBackground(Color.WHITE); label.setForeground(Color.decode("#333334")); label.setFont(label.getFont().deriveFont(11F)); - label.setPreferredSize(new Dimension(224, 26)); + //预留 10px 的纵向滚动条的宽度 + label.setPreferredSize(new Dimension(214, 26)); this.nameEdList = nameEdList; this.add(label, BorderLayout.NORTH); this.add(this.nameEdList, BorderLayout.CENTER); From 8ba459584771f729665f0246ec84c437a1cc9e40 Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 22 Sep 2021 18:00:38 +0800 Subject: [PATCH 32/32] =?UTF-8?q?REPORT-57551=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=98=BE=E7=A4=BA=EF=BC=8C=E8=87=AA=E9=80=82=E5=BA=94?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E4=B8=8Bbody=E8=83=8C=E6=99=AF=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=BB=A5=E5=90=8E=EF=BC=8C=E7=94=BB=E5=B8=83=E4=B8=AD?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=AE=9E=E6=97=B6=E6=98=BE=E7=A4=BA=E8=83=8C?= =?UTF-8?q?=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 10.0恢复原先删除的旧方法,避免插件失效 【改动思路】 同标题 --- .../creator/XBorderStyleWidgetCreator.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java index df84109463..0ff99f3a93 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java @@ -104,6 +104,15 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ refreshStylePreviewEffect(); } + /** + * @deprecated 该方法在样式数据模型发生变化,如主题更新/body布局类型切换等均会被调用,并不仅限于初始化, + * 因此原方法名称废弃,不应当被继续使用 + * @link {{@link #refreshStylePreviewEffect()}} + */ + protected void initStyle() { + refreshStylePreviewEffect(); + } + public void refreshStylePreviewEffect() { BorderPacker style = toData().getBorderStyle(); refreshBorderAndBackgroundStylePreviewEffect(); @@ -117,6 +126,15 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ reshuffleBorderAndBackgroundPaintingEffectIfTitleExists(); } + /** + * @deprecated 该方法在样式数据模型发生变化,如主题更新/图表默认开启标题等时均会被调用,并不仅限于初始化, + * 因此原方法名称废弃,不应当被继续使用 + * @link {{@link #refreshBorderAndBackgroundStylePreviewEffect()} ()}} + */ + protected void initBorderAndBackgroundStyle() { + refreshBorderAndBackgroundStylePreviewEffect(); + } + public void refreshBorderAndBackgroundStylePreviewEffect() { BorderPacker style = toData().getBorderStyle(); LineBorder DEFAULT_LINE_BORDER = (LineBorder) DEFALUTBORDER;