From 9c52e84c6c7ba3e3777a6d302d609a5b088f170e Mon Sep 17 00:00:00 2001 From: xiqiu Date: Fri, 20 Aug 2021 10:45:57 +0800 Subject: [PATCH 01/38] =?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/38] =?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/38] =?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/38] =?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/38] =?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/38] =?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/38] =?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/38] 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/38] =?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/38] =?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/38] =?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/38] =?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/38] =?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/38] =?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/38] =?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/38] =?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/38] =?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/38] =?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/38] 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 443505c8131eca7502a8f15b15c8c999afeacd94 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Wed, 15 Sep 2021 10:52:11 +0800 Subject: [PATCH 20/38] =?UTF-8?q?REPORT-59166=20=E9=9F=A9=E6=96=87?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=AE=BE=E7=BD=AE=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=20=E6=9D=A1=E4=BB=B6=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E6=A1=86=E4=BD=93=E6=A0=87=E9=A2=98=E6=98=BE=E7=A4=BA=E4=B8=8D?= =?UTF-8?q?=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/gui/controlpane/UIControlPane.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java index 648cb03f33..f7229136f5 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java @@ -387,8 +387,6 @@ public abstract class UIControlPane extends JControlPane { contentPane.setBackground(originColor); contentPane.setLayout(new BorderLayout()); titleLabel = new UILabel(title); - Font font = new Font("SimSun", Font.PLAIN, 12); - titleLabel.setFont(font); contentPane.add(titleLabel, BorderLayout.WEST); contentPane.setBorder(new EmptyBorder(5, 14, 6, 0)); From 79dbdc48eba1d71d0fe4ebe90eb459ba7741eaa0 Mon Sep 17 00:00:00 2001 From: shine Date: Wed, 22 Sep 2021 15:37:41 +0800 Subject: [PATCH 21/38] =?UTF-8?q?CHART-20939=20design=20fix:=20=E4=B8=89?= =?UTF-8?q?=E7=BB=B4=E7=BB=84=E5=90=88=E5=9C=B0=E5=9B=BE=E6=9C=89=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/ChartTypeInterfaceManager.java | 2 +- .../main/java/com/fr/design/chart/ChartTypePane.java | 2 +- .../fr/design/mainframe/chart/gui/ChartTypePane.java | 11 ++++++++--- .../src/main/java/com/fr/poly/PolyComponentsBar.java | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java index 8600a8c149..2d54fc8189 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -149,7 +149,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr public static WidgetOption[] initWidgetOption() { - String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDs(); + String[] chartIDs = ChartTypeManager.getInstance().getChartIDs4Create(); ChartWidgetOption[] child = new ChartWidgetOption[chartIDs.length]; int index = 0; diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java index a5937c1d9d..d31cd32088 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java @@ -31,7 +31,7 @@ import java.awt.Component; public class ChartTypePane extends ChartCommonWizardPane implements CallbackEvent { private static final long serialVersionUID = -1175602484968520546L; - private String[] chartIDs = ChartTypeManager.getInstanceWithCheck().getAllChartIDs(); + private String[] chartIDs = ChartTypeManager.getInstanceWithCheck().getChartIDs4Create(); private JList mainTypeList = null; private JList iconViewList = null; 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 985ee28afa..5635c8b7b4 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 @@ -4,6 +4,7 @@ import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chartx.attr.ChartProvider; import com.fr.design.ChartTypeInterfaceManager; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.dialog.BasicScrollPane; import com.fr.design.dialog.DialogActionAdapter; @@ -173,7 +174,7 @@ public class ChartTypePane extends AbstractChartAttrPane { Map>> allChartTypePane, ActionListener autoButtonListener) { - String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDsIncludeDisabled(); + String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDs(); for (String id : chartIDs) { @@ -288,7 +289,9 @@ public class ChartTypePane extends AbstractChartAttrPane { Map.Entry> entry = iterator.next(); String plotID = entry.getKey(); if (ignore || ChartTypeManager.enabledChart(plotID)) { - cards.add(entry.getValue()); + if (ChartTypeManager.getInstance().isShowInDesigner(plotID)) { + cards.add(entry.getValue()); + } } } @@ -310,7 +313,9 @@ public class ChartTypePane extends AbstractChartAttrPane { //第一步就是重构cards cards.clear(); - if (enabledChart) { + if (DesignModeContext.isDuchampMode()) { + addOnePlotIDCards(priority, chartID); + } else if (enabledChart) { if (collection.getChartCount() == 1) { addAllCards(); } else { diff --git a/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java b/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java index e443909f20..f459281ba7 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java @@ -46,7 +46,7 @@ public class PolyComponentsBar extends JToolBar { setFloatable(false); setBackground(UIConstants.TOOLBARUI_BACKGROUND); setLayout(FRGUIPaneFactory.create1ColumnGridLayout()); - String[] iDs = ChartTypeManager.getInstance().getAllChartIDs(); + String[] iDs = ChartTypeManager.getInstance().getChartIDs4Create(); int typeLen = iDs.length < MAX_BAR_NUM ? iDs.length : MAX_BAR_NUM; serIcons = new SerIcon[typeLen + 1]; serIcons[0] = new SerIcon( From 0c327207bc40925213ee12bcb96724ba977ac8e0 Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 23 Sep 2021 14:14:28 +0800 Subject: [PATCH 22/38] =?UTF-8?q?CHART-21014=20=E5=A4=A7=E5=B1=8F=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E4=B8=AD=E7=9A=84cpt=E7=BB=84=E4=BB=B6=E9=87=8C?= =?UTF-8?q?=E9=9D=A2=E8=BF=98=E6=98=AF=E8=A6=81=E6=9C=89=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E7=B1=BB=E5=9E=8B=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, 2 insertions(+), 1 deletion(-) 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 5635c8b7b4..2eea49f16d 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java @@ -19,6 +19,7 @@ import com.fr.design.mainframe.chart.gui.item.FlexibleComboBox; import com.fr.design.mainframe.chart.gui.item.ItemEventType; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.mode.ChartEditContext; +import com.fr.design.mainframe.chart.mode.ChartEditMode; import com.fr.design.module.DesignModuleFactory; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; @@ -313,7 +314,7 @@ public class ChartTypePane extends AbstractChartAttrPane { //第一步就是重构cards cards.clear(); - if (DesignModeContext.isDuchampMode()) { + if (ChartEditContext.duchampMode()) { addOnePlotIDCards(priority, chartID); } else if (enabledChart) { if (collection.getChartCount() == 1) { From 026ecab6ad300ba414aa588294349e39ecf85ffa Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 23 Sep 2021 16:16:52 +0800 Subject: [PATCH 23/38] =?UTF-8?q?CHART-20850=20fix:=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E4=B8=AD=20=E8=AF=95=E7=AE=A1=E5=9E=8B?= =?UTF-8?q?=E4=BB=AA=E8=A1=A8=E7=9B=98=E5=88=87=E6=8D=A2=E4=B8=BA=E6=A8=AA?= =?UTF-8?q?=E5=90=91=E5=90=8E=20=E6=A0=87=E7=AD=BE=E9=A2=9C=E8=89=B2?= =?UTF-8?q?=E5=B0=B1=E5=8F=98=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java index d3f997295b..83c9c523d1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java @@ -16,6 +16,7 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.style.series.ColorPickerPaneWithMaxMin; import com.fr.design.mainframe.chart.gui.style.series.UIColorPickerPane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.style.color.ColorSelectBox; import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.attr.GaugeDetailStyle; @@ -199,7 +200,9 @@ public class VanChartGaugeSeriesPane extends VanChartMultiColorSeriesPane { if (attrLabelDetail == null || attrLabelDetail.getTextAttr() == null) { return; } - attrLabelDetail.getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_LABEL_FONT); + if (!ChartEditContext.duchampMode()) { + attrLabelDetail.getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_LABEL_FONT); + } if (gaugeLayout.getSelectedIndex() == 0) { attrLabel.getAttrLabelDetail().setPosition(Constants.LEFT); attrLabel.getGaugeValueLabelDetail().setPosition(Constants.LEFT); From 2adee772b27b5092297900c75b180bfe9215f80e Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 23 Sep 2021 19:29:23 +0800 Subject: [PATCH 24/38] =?UTF-8?q?CHART-20686=20=E5=A4=A7=E5=B1=8F=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E4=B8=AD=E7=9A=84=E5=9B=BE=E8=A1=A8=E4=B8=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/designer/other/VanChartInteractivePane.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 78be16ad55..dc72b90221 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 @@ -471,7 +471,11 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { } protected Component[][] createToolBarComponents() { - return new Component[][]{ + return ChartEditContext.duchampMode() ? new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content")), isSort}, + new Component[]{null, fullScreenDisplay}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")), collapse}, + } : new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content")), isSort}, new Component[]{null, exportImages}, new Component[]{null, fullScreenDisplay}, @@ -480,7 +484,10 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { } protected Component[][] createToolBarComponentsWithOutSort() { - return new Component[][]{ + return ChartEditContext.duchampMode() ? new Component[][]{ + new Component[]{null, fullScreenDisplay}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")), collapse} + } : new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content")), exportImages}, new Component[]{null, fullScreenDisplay}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")), collapse} From 71c15a84accd64ae515f8a3ff217758b123b989c Mon Sep 17 00:00:00 2001 From: hades Date: Sun, 26 Sep 2021 11:48:15 +0800 Subject: [PATCH 25/38] =?UTF-8?q?REPORT-60004=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1-=E4=BF=9D=E5=AD=98=E5=BC=B9=E7=AA=97=20?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/file/FILEChooserPane.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java index 4bacf9a85b..ce08662cae 100644 --- a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java +++ b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java @@ -29,6 +29,9 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.JTemplate; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.event.Event; +import com.fr.event.EventDispatcher; +import com.fr.event.Listener; import com.fr.file.filetree.FileNode; import com.fr.file.filter.ChooseFileFilter; import com.fr.file.filter.FILEFilter; @@ -45,6 +48,8 @@ import com.fr.stable.os.windows.WindowsDetector; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; +import com.fr.workspace.Workspace; +import com.fr.workspace.WorkspaceEvent; import javax.swing.AbstractAction; import javax.swing.AbstractListModel; import javax.swing.ActionMap; @@ -66,7 +71,6 @@ import javax.swing.ListModel; import javax.swing.ListSelectionModel; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; -import javax.swing.UIManager; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.event.ListSelectionEvent; @@ -1325,6 +1329,12 @@ public class FILEChooserPane extends BasicPane { LocationButtonPane.this.repaint(10); } }); + EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener() { + @Override + public void on(Event event, Workspace param) { + setPopDir(null); + } + }); } public void highLightButton(FILE dir) { From 2a967d27f26c8a2371e01b0a2a065e618de2a17e Mon Sep 17 00:00:00 2001 From: shine Date: Sun, 26 Sep 2021 14:07:46 +0800 Subject: [PATCH 26/38] =?UTF-8?q?CHART-20411=20=E9=80=82=E9=85=8D=E5=A4=A7?= =?UTF-8?q?=E5=B1=8F=E6=A8=A1=E6=9D=BF=E5=8F=A6=E5=AD=98=E4=B8=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/JTemplate.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d4931763c8..72824b2ea9 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 @@ -1460,7 +1460,7 @@ public abstract class JTemplate> if (editingFILE == null || editingFILE instanceof MemFILE) { return false; } - this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(editingFILE)); + export(); this.editingFILE = editingFILE; return true; } From ac01b5c6fea6d8e88a64ae9c780b1a439c4d2b52 Mon Sep 17 00:00:00 2001 From: shine Date: Sun, 26 Sep 2021 14:08:26 +0800 Subject: [PATCH 27/38] =?UTF-8?q?CHART-20411=20=E9=80=82=E9=85=8D=E5=A4=A7?= =?UTF-8?q?=E5=B1=8F=E6=A8=A1=E6=9D=BF=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/file/MutilTempalteTabPane.java | 3 ++- .../java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index 87b7f2f25c..047420294a 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -4,6 +4,7 @@ package com.fr.design.file; import com.fr.base.BaseUtils; import com.fr.base.GraphHelper; import com.fr.base.vcs.DesignerMode; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.imenu.UIMenuItem; @@ -753,7 +754,7 @@ public class MutilTempalteTabPane extends JComponent { /** * 关闭掉一个模板之后激活新的待显示模板 */ - private void activePrevTemplateAfterClose() { + public void activePrevTemplateAfterClose() { if (openedTemplate.isEmpty()) { //新建并激活模板 DesignerContext.getDesignerFrame().addAndActivateJTemplate(); 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 866c2fabea..cfc4483c95 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 @@ -408,7 +408,9 @@ public abstract class ToolBarMenuDock { menuDef.addShortCut(new OpenRecentReportMenuDef()); - addCloseCurrentTemplateAction(menuDef); + if (!DesignModeContext.isDuchampMode()) { + addCloseCurrentTemplateAction(menuDef); + } scs = plus.shortcut4FileMenu(); if (!ArrayUtils.isEmpty(scs)) { From 291452a0f52cfe806bee77b85e80af728a6f2bad Mon Sep 17 00:00:00 2001 From: shine Date: Sun, 26 Sep 2021 19:37:38 +0800 Subject: [PATCH 28/38] =?UTF-8?q?CHART-21076=20=E6=B8=85=E6=A5=9A=E7=A3=81?= =?UTF-8?q?=E7=9B=98=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/ui/ModernUIPane.java | 5 +++++ 1 file changed, 5 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 90d6accf6b..09fa2bbc08 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 @@ -26,6 +26,7 @@ import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.io.File; import java.util.Map; /** @@ -170,6 +171,10 @@ public class ModernUIPane extends BasicPane { public void clearCache() { if (browser != null) { browser.getCacheStorage().clearCache(); + File file = new File(browser.getContext().getCacheDir()); + if (file.exists()) { + file.delete(); + } } } From 77c7a84eecde096651e1822302db51d47f79ed8e Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 27 Sep 2021 09:50:29 +0800 Subject: [PATCH 29/38] =?UTF-8?q?=E5=92=8C=E6=8A=BD=E4=B9=8B=E5=89=8D?= =?UTF-8?q?=E5=AE=8C=E5=85=A8=E4=B8=80=E6=A0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/JTemplate.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 72824b2ea9..ec0387cef1 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 @@ -877,7 +877,7 @@ public abstract class JTemplate> } protected boolean export() throws Exception { - return this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(editingFILE)); + return this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(getEditingFILE())); } From cc19c999e3fa7c27929d108ca6b75406b1df8f37 Mon Sep 17 00:00:00 2001 From: lucian Date: Mon, 27 Sep 2021 13:59:54 +0800 Subject: [PATCH 30/38] =?UTF-8?q?REPORT-59256=20=E5=A1=AB=E6=8A=A5-?= =?UTF-8?q?=E5=A1=AB=E6=8A=A5=E5=B1=9E=E6=80=A7=E8=AE=BE=E7=BD=AE-?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=87=AA=E5=AE=9A=E4=B9=89=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BC=9A=E5=B8=A6=E5=87=BA=E4=B9=8B=E5=89=8D=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=8F=90=E4=BA=A4=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/write/submit/CustomJobPane.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/write/submit/CustomJobPane.java b/designer-base/src/main/java/com/fr/design/write/submit/CustomJobPane.java index d07d42b3e2..6e4f2d803f 100644 --- a/designer-base/src/main/java/com/fr/design/write/submit/CustomJobPane.java +++ b/designer-base/src/main/java/com/fr/design/write/submit/CustomJobPane.java @@ -13,6 +13,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.stable.ListMap; import com.fr.stable.StringUtils; import com.fr.design.utils.gui.GUICoreUtils; @@ -115,7 +116,12 @@ public abstract class CustomJobPane extends BasicBeanPane { @Override public void populateBean(Object ob) { - if (ob instanceof AbstractClassJob) { + if (ob == null) { + // 自定义提交新增时初始化页面 REPORT-59256 + this.classNameTextField.setText(StringUtils.EMPTY); + this.objectProperiesPane.populateBean(new ListMap()); + } + else if (ob instanceof AbstractClassJob) { AbstractClassJob cj = (AbstractClassJob) ob; this.classNameTextField.setText(cj.getClassName()); this.objectProperiesPane.populateBean(cj.getPropertyMap()); From b7fae76db7bc6b074cd53dd88138ad97c6a5e224 Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 27 Sep 2021 19:50:41 +0800 Subject: [PATCH 31/38] =?UTF-8?q?CHART-20937=20fix:=E4=B8=8D=E6=96=B0?= =?UTF-8?q?=E5=88=9B=E5=BB=BAeditpane=E4=BD=86=E6=98=AF=E8=A6=81=E9=87=8D?= =?UTF-8?q?=E7=BD=AElastChartCollection=20=E5=90=A6=E5=88=99=E4=B8=8D?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/gui/chart/ChartEditPaneProvider.java | 3 +++ .../main/java/com/fr/design/mainframe/ChartPropertyPane.java | 2 ++ .../java/com/fr/design/mainframe/chart/ChartEditPane.java | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/gui/chart/ChartEditPaneProvider.java b/designer-base/src/main/java/com/fr/design/gui/chart/ChartEditPaneProvider.java index 3003800364..0a3684ba30 100644 --- a/designer-base/src/main/java/com/fr/design/gui/chart/ChartEditPaneProvider.java +++ b/designer-base/src/main/java/com/fr/design/gui/chart/ChartEditPaneProvider.java @@ -16,4 +16,7 @@ public interface ChartEditPaneProvider { default void removeChartEditPaneActionListener(ChartEditPaneActionListener l) { } + default void resetLastChartCollection() { + } + } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java index 90b0e88054..2d4d5fef6c 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java @@ -55,6 +55,8 @@ public class ChartPropertyPane extends BaseChartPropertyPane { chartEditPane.setContainer(container); currentID = plotID; resetChartEditPane(); + } else { + chartEditPane.resetLastChartCollection(); } } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java index d6acb929a7..70b7130f12 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java @@ -118,6 +118,10 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare this.listenerList.remove(ChartEditPaneActionListener.class, l); } + public void resetLastChartCollection() { + this.lastCollection = null; + } + private void fireAttributeChange(ChartCollection chartCollection) { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); From 7ada3e18e010964529dbba1b79422cf0b3d9f313 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 28 Sep 2021 18:03:10 +0800 Subject: [PATCH 32/38] =?UTF-8?q?REPORT-59959=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8-=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=93=8D=E4=BD=9C-11?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=88=B6=E4=BD=9C=E7=9A=84=E9=99=84?= =?UTF-8?q?=E4=BB=B6=E6=A8=A1=E6=9D=BF=EF=BC=8C10=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=8F=AF=E4=BB=A5=E6=89=93=E5=BC=80=EF=BC=9B=E4=BD=86?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E7=9A=8411=E5=81=9A=E7=9A=84=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=EF=BC=8C=E5=B0=9D=E8=AF=95=E7=94=A810=E6=89=93?= =?UTF-8?q?=E5=BC=80=E6=97=B6=E9=83=BD=E4=BC=9A=E6=AD=A3=E5=B8=B8=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E5=BC=B9=E7=AA=97=E6=89=93=E4=B8=8D=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesktopCardPane.java | 5 +-- .../com/fr/design/mainframe/JTemplate.java | 32 ++++++++++++++++--- .../fr/design/mainframe/OpenFailedPane.java | 10 +++++- .../com/fr/design/worker/open/OpenWorker.java | 26 ++++++++++++--- 4 files changed, 62 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java index 0e26ff3ded..a2c6efcb2b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java @@ -86,7 +86,7 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener } else if (jt.isOpening()) { showOpenStatus(); } else if (jt.isOpenFailed()) { - showOpenFailedCover(); + showOpenFailedCover(jt.getTemplateOpenFailedTip()); } else { hideCover(); } @@ -115,7 +115,8 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener layeredPane.moveToFront(loadingPane); } - public void showOpenFailedCover() { + public void showOpenFailedCover(String text) { + failedPane.setFailedTip(text); layeredPane.moveToFront(failedPane); } 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 d4931763c8..a4db8e88ff 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 @@ -114,6 +114,8 @@ public abstract class JTemplate> private JComponent centerPane; private DesignModelAdapter designModel; private PreviewProvider previewType; + private String templateOpenFailedTip; + /** * 统计模板制作耗时 * @@ -1051,35 +1053,49 @@ public abstract class JTemplate> /** * 判断是否是新版设计器 * + * @param showTipPane 是否需要展示弹窗 * @return 是返回true */ - public boolean isNewDesigner() { + public boolean isNewDesigner(boolean showTipPane) { String xmlDesignerVersion = getTarget().getXMLDesignerVersion(); if (isLowerThanHBB(xmlDesignerVersion)) { String info = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Open-New_Form_Tip"); String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info"); - new InformationWarnPane(info, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show(); + if (showTipPane) { + new InformationWarnPane(info, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show(); + } return true; } return false; } + public boolean isNewDesigner() { + return isNewDesigner(true); + } + /** * 是否是就版本设计器 * + * @param showTipPane 是否需要展示弹窗 * @return 是就返回true */ - public boolean isOldDesigner() { + public boolean isOldDesigner(boolean showTipPane) { String xmlDesignerVersion = getTarget().getXMLDesignerVersion(); if (isHigherThanCurrent(xmlDesignerVersion)) { String infor = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Version_Not_Match", DesignUtils.parseVersion(xmlDesignerVersion)); String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info"); - new InformationWarnPane(infor, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show(); + if (showTipPane) { + new InformationWarnPane(infor, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show(); + } return true; } return false; } + public boolean isOldDesigner() { + return isOldDesigner(true); + } + /** * */ @@ -1628,4 +1644,12 @@ public abstract class JTemplate> public String getRuntimeId() { return runtimeId; } + + public String getTemplateOpenFailedTip() { + return templateOpenFailedTip; + } + + public void setTemplateOpenFailedTip(String templateOpenFailedTip) { + this.templateOpenFailedTip = templateOpenFailedTip; + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/OpenFailedPane.java b/designer-base/src/main/java/com/fr/design/mainframe/OpenFailedPane.java index 132569c236..63ab984da6 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/OpenFailedPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/OpenFailedPane.java @@ -24,6 +24,7 @@ public class OpenFailedPane extends JPanel { private UILabel label; private MessageWithLink link; + private String defaultFailedText; public OpenFailedPane() { this.setLayout(new LayoutManager() { @@ -83,11 +84,18 @@ public class OpenFailedPane extends JPanel { }); } }; + this.defaultFailedText = link.getText(); link.setBackground(Color.WHITE); this.add(label); this.add(link); } - + public void setFailedTip(String text) { + if (StringUtils.isEmpty(text)) { + this.link.setText(defaultFailedText); + } else { + this.link.setText(text); + } + } } diff --git a/designer-base/src/main/java/com/fr/design/worker/open/OpenWorker.java b/designer-base/src/main/java/com/fr/design/worker/open/OpenWorker.java index 819660a99d..1c03c67594 100644 --- a/designer-base/src/main/java/com/fr/design/worker/open/OpenWorker.java +++ b/designer-base/src/main/java/com/fr/design/worker/open/OpenWorker.java @@ -7,12 +7,14 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; +import com.fr.design.utils.DesignUtils; import com.fr.design.worker.WorkerManager; import com.fr.exception.DecryptTemplateException; import com.fr.file.FILE; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; +import com.fr.stable.StringUtils; import javax.swing.JOptionPane; import javax.swing.SwingWorker; import javax.swing.UIManager; @@ -51,6 +53,7 @@ public class OpenWorker extends SwingWorker { @Override protected T doInBackground() throws Exception { + TimeUnit.SECONDS.sleep(5); return this.callable.call(); } @@ -61,7 +64,7 @@ public class OpenWorker extends SwingWorker { } catch (CancellationException ignored) { return; } catch (Throwable t) { - processFailed(); + processFailed(StringUtils.EMPTY); Throwable cause = t.getCause(); if (cause instanceof DecryptTemplateException) { FineJOptionPane.showMessageDialog( @@ -91,6 +94,11 @@ public class OpenWorker extends SwingWorker { if (slowly && templateCallable != null) { try { JTemplate book = templateCallable.call(); + if (inValidDesigner(book)) { + String text = Toolkit.i18nText("Fine-Design_Report_Template_Version_Not_Match", DesignUtils.parseVersion(book.getTarget().getDesignerVersion())); + processFailed(text); + return; + } FILE tplFile = book.getEditingFILE(); JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); // 当前tab页是正在打开的模板 @@ -117,11 +125,21 @@ public class OpenWorker extends SwingWorker { WorkerManager.getInstance().removeWorker(taskName); } - private void processFailed() { + private boolean inValidDesigner(JTemplate jt) { + return jt.isOldDesigner(false) || (!jt.isJWorkBook() && jt.isNewDesigner(false)); + } + + private void processFailed(String text) { this.template.setOpenFailed(true); this.template.setOpening(false); - DesignerContext.getDesignerFrame().getCenterTemplateCardPane().showOpenFailedCover(); - DesignerFrameFileDealerPane.getInstance().stateChange(); + JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + // 需要判断当前打开的模板是不是异步执行后失败的模板 是的话立即展示失败后的提示内容 否则只设置下失败的提示内容 + if (ComparatorUtils.equals(currentTemplate.getEditingFILE().getName(), this.template.getName())) { + DesignerContext.getDesignerFrame().getCenterTemplateCardPane().showOpenFailedCover(text); + DesignerFrameFileDealerPane.getInstance().stateChange(); + } else { + this.template.setTemplateOpenFailedTip(text); + } WorkerManager.getInstance().removeWorker(taskName); } From 29835e7d04e224072cfd55d052995fe1244d8cd6 Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 28 Sep 2021 19:05:45 +0800 Subject: [PATCH 33/38] =?UTF-8?q?CHART-21222=20=E5=A4=A7=E5=B1=8F=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E4=B8=AD=E7=9A=84=E9=92=BB=E5=8F=96=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E5=B1=8F=E8=94=BD=E9=92=BB=E5=8F=96=E7=9B=AE=E5=BD=95=E7=9A=84?= =?UTF-8?q?=E8=B6=85=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/other/VanChartDrillMapInteractivePane.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java index c439c4d4d9..ce06ca4b6b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java @@ -101,7 +101,12 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith double f = TableLayout.FILL; double[] columnSize = {f}; double[] rowSize = {p, p, p, p, p, p}; - Component[][] components = new Component[][]{ + Component[][] components = ChartEditContext.duchampMode() ? new Component[][]{ + new Component[]{null}, + new Component[]{createTitlePane(Toolkit.i18nText("Fine-Design_Chart_Character"), textAttrPane)}, + new Component[]{backgroundPane}, + new Component[]{selectBackgroundPane} + } : new Component[][]{ new Component[]{null}, new Component[]{createTitlePane(Toolkit.i18nText("Fine-Design_Chart_Character"), textAttrPane)}, new Component[]{backgroundPane}, From c4f405531ac16339b8efb0aba2e8d19bba1cc591 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Wed, 29 Sep 2021 16:16:51 +0800 Subject: [PATCH 34/38] =?UTF-8?q?REPORT-59681=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E6=8E=A7=E5=88=B6=E6=A8=A1=E6=9D=BF=E8=87=AA?= =?UTF-8?q?=E9=80=82=E5=BA=94=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/report/fit/BaseFitAttrPane.java | 228 ++++++++++++++++++ .../fr/design/report/fit/CptFitAttrModel.java | 51 ++++ .../fr/design/report/fit/FitAttrModel.java | 44 ++++ .../fr/design/report/fit/FrmFitAttrModel.java | 53 ++++ .../fit/menupane/ReportFitAttrAction.java | 10 +- .../fit/menupane/TemplateFitAttrPane.java | 104 +++++--- .../AbstractFitAttrModelProvider.java | 18 ++ .../fit/provider/FitAttrModelProvider.java | 11 + .../fr/design/webattr/ServerFitAttrPane.java | 78 ++++++ 9 files changed, 555 insertions(+), 42 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java create mode 100644 designer-base/src/main/java/com/fr/design/report/fit/CptFitAttrModel.java create mode 100644 designer-base/src/main/java/com/fr/design/report/fit/FitAttrModel.java create mode 100644 designer-base/src/main/java/com/fr/design/report/fit/FrmFitAttrModel.java create mode 100644 designer-base/src/main/java/com/fr/design/report/fit/provider/AbstractFitAttrModelProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/report/fit/provider/FitAttrModelProvider.java create mode 100644 designer-realize/src/main/java/com/fr/design/webattr/ServerFitAttrPane.java diff --git a/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java b/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java new file mode 100644 index 0000000000..718ce09bf6 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java @@ -0,0 +1,228 @@ +package com.fr.design.report.fit; + +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.report.fit.menupane.FitPreviewPane; +import com.fr.design.report.fit.menupane.FitRadioGroup; +import com.fr.design.report.fit.menupane.FontRadioGroup; +import com.fr.design.report.fit.provider.FitAttrModelProvider; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.ComparatorUtils; +import com.fr.report.fit.ReportFitAttr; + + +import javax.swing.*; +import javax.swing.border.EmptyBorder; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Set; +import java.util.stream.Collectors; + +import static com.fr.design.i18n.Toolkit.i18nText; + +public abstract class BaseFitAttrPane extends BasicBeanPane { + + protected JPanel contentJPanel; + protected UIComboBox itemChoose; + protected java.util.List fitAttrModelList = new ArrayList<>(); + + public FontRadioGroup fontRadioGroup; + public FitRadioGroup adaptRadioGroup; + public JPanel attrJPanel; + public FitPreviewPane previewJPanel; + public FitAttrModel fitAttrModel; + + + protected BaseFitAttrPane() { + initFitAttrModel(); + } + + private void initFitAttrModel() { + fitAttrModelList.add(new FrmFitAttrModel()); + fitAttrModelList.add(new CptFitAttrModel()); + + Set fitAttrModelProviders = ExtraDesignClassManager.getInstance().getArray(FitAttrModelProvider.XML_TAG); + + for (FitAttrModelProvider fitAttrModelProvider : fitAttrModelProviders) { + fitAttrModelList.add(fitAttrModelProvider); + } + + fitAttrModelList = fitAttrModelList.stream().sorted(Comparator.comparing(FitAttrModel::getPriority).reversed()).collect(Collectors.toList()); + } + + protected void populateModel(FitAttrModel fitAttrModel) { + this.fitAttrModel = fitAttrModel; + if (attrJPanel != null) { + contentJPanel.remove(attrJPanel); + } + if (previewJPanel != null) { + contentJPanel.remove(previewJPanel); + } + + fontRadioGroup = new FontRadioGroup(); + adaptRadioGroup = new FitRadioGroup(); + initAttrJPanel(); + initPreviewJPanel(); + } + + + protected void initAttrJPanel() { + int colCount = fitAttrModel.getFitTypes().length + 1; + Component[][] components = new Component[2][colCount]; + initFitRadioGroup(fontRadioGroup, i18nText("Fine-Designer_Fit-Font"), new String[]{i18nText("Fine-Designer_Fit"), i18nText("Fine-Designer_Fit-No")}, components[0]); + initFitRadioGroup(adaptRadioGroup, fitAttrModel.getFitName(), Arrays.stream(fitAttrModel.getFitTypes()).map(FitType::description).toArray(String[]::new), components[1]); + + double[] rowSize = new double[2]; + double[] columnSize = new double[colCount]; + for (int i = 0; i < rowSize.length; i++) { + rowSize[i] = 20; + } + for (int i = 0; i < columnSize.length; i++) { + if (i == 0) { + columnSize[i] = 80; + } else { + columnSize[i] = 100; + } + } + + attrJPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + attrJPanel.setBorder(new EmptyBorder(0, 100, 10, 100)); + contentJPanel.add(attrJPanel); + } + + private void initFitRadioGroup(FitRadioGroup fitRadioGroup, String name, String[] options, Component[] components) { + components[0] = new UILabel(name); + for (int i = 0; i < options.length; i++) { + + if (options[i] != null) { + UIRadioButton fontFitRadio = new UIRadioButton(options[i]); + fitRadioGroup.add(fontFitRadio); + components[i + 1] = fontFitRadio; + } else { + components[i + 1] = null; + } + } + fitRadioGroup.addActionListener(getPreviewActionListener()); + } + + protected ActionListener getPreviewActionListener() { + return new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + refreshPreviewJPanel(); + } + }; + } + + protected void refreshPreviewJPanel() { + String previewIndex = getPreviewIndex(); + previewJPanel.refreshPreview(previewIndex, fontRadioGroup.isEnabled()); + } + + protected String getPreviewIndex() { + return getStateInPC(adaptRadioGroup.getSelectRadioIndex()) + "" + fontRadioGroup.getSelectRadioIndex(); + } + + protected void initPreviewJPanel() { + previewJPanel = new FitPreviewPane(); + contentJPanel.add(previewJPanel); + } + + protected int getStateInPC(int index) { + FitType[] fitTypes = fitAttrModel.getFitTypes(); + return fitTypes[index].getState(); + } + + protected int getOptionIndex(int state) { + FitType[] fitTypes = fitAttrModel.getFitTypes(); + for (int i = 0; i < fitTypes.length; i++) { + if (ComparatorUtils.equals(state, fitTypes[i].getState())) { + return i; + } + } + return 0; + } + + + @Override + public void populateBean(ReportFitAttr ob) { + fontRadioGroup.selectIndexButton(ob.isFitFont() ? 0 : 1); + adaptRadioGroup.selectIndexButton(getOptionIndex(ob.fitStateInPC())); + refreshPreviewJPanel(); + } + + @Override + public ReportFitAttr updateBean() { + ReportFitAttr reportFitAttr = new ReportFitAttr(); + reportFitAttr.setFitFont(fontRadioGroup.isFontFit()); + reportFitAttr.setFitStateInPC(getStateInPC(adaptRadioGroup.getSelectRadioIndex())); + return reportFitAttr; + } + + + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + fontRadioGroup.setEnabled(enabled); + adaptRadioGroup.setEnabled(enabled); + refreshPreviewJPanel(); + } + + @Override + protected String title4PopupWindow() { + return i18nText("Fine-Designer_PC_Element_Case_Fit_Attr"); + } + + protected abstract String[] getItemNames(); + + protected void initComponents() { + this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + contentJPanel = new JPanel(); + contentJPanel.setLayout(FRGUIPaneFactory.createCenterFlowLayout()); + this.add(contentJPanel); + initItemChoose(); + } + + + private void initItemChoose() { + JPanel chooseJPanel = new JPanel(); + chooseJPanel.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); + ItemListener itemListener = getItemListener(); + itemChoose = new UIComboBox(getItemNames()); + itemChoose.addItemListener(itemListener); + UILabel belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set")); + JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[]{ + belowSetLabel, itemChoose}, FlowLayout.LEFT, 0, 0); + chooseJPanel.add(buttonPane); + chooseJPanel.setPreferredSize(new Dimension(500, 50)); + JPanel jPanel = new JPanel(); + jPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + jPanel.add(chooseJPanel, BorderLayout.WEST); + + contentJPanel.add(jPanel); + } + + + protected abstract ItemListener getItemListener(); + + + public void populate(ReportFitAttr reportFitAttr) { + + } + + protected void refresh() { + validate(); + repaint(); + revalidate(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/report/fit/CptFitAttrModel.java b/designer-base/src/main/java/com/fr/design/report/fit/CptFitAttrModel.java new file mode 100644 index 0000000000..176f2cee1a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/report/fit/CptFitAttrModel.java @@ -0,0 +1,51 @@ +package com.fr.design.report.fit; + + +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.JTemplate; +import com.fr.report.fit.ReportFitAttr; +import com.fr.report.fit.ReportFitConfig; + + +public class CptFitAttrModel implements FitAttrModel { + + @Override + public FitType[] getFitTypes() { + return new FitType[]{ + FitType.HORIZONTAL_FIT, + FitType.DOUBLE_FIT, + FitType.NOT_FIT + }; + } + + @Override + public String getFitName() { + return Toolkit.i18nText("Fine-Designer_Fit-Element"); + } + + + @Override + public String getModelName() { + return Toolkit.i18nText("Fine-Design_Basic_Plain_Report"); + } + + @Override + public ReportFitAttr getGlobalReportFitAttr() { + return ReportFitConfig.getInstance().getCptFitAttr(); + } + + @Override + public void setGlobalReportFitAttr(ReportFitAttr reportFitAttr) { + ReportFitConfig.getInstance().setCptFitAttr(reportFitAttr); + } + + @Override + public int getPriority() { + return 0; + } + + @Override + public boolean isAvailable(JTemplate jTemplate) { + return jTemplate.isJWorkBook(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/report/fit/FitAttrModel.java b/designer-base/src/main/java/com/fr/design/report/fit/FitAttrModel.java new file mode 100644 index 0000000000..1d1ac02f0d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/report/fit/FitAttrModel.java @@ -0,0 +1,44 @@ +package com.fr.design.report.fit; + +import com.fr.design.mainframe.JTemplate; +import com.fr.report.fit.ReportFitAttr; + +public interface FitAttrModel { + /** + * @Description 名称,比如:普通报表、决策报表等 + **/ + String getModelName(); + + /** + * @Description 自适应选项的名称,比如返回:表格 + **/ + String getFitName(); + + /** + * @Description 自适应选项 + **/ + FitType[] getFitTypes(); + + + /** + * @Description 获取全局的自适应属性 + **/ + ReportFitAttr getGlobalReportFitAttr(); + + /** + * @Description 设置全局的自适应属性 + * @param: reportFitAttr + **/ + void setGlobalReportFitAttr(ReportFitAttr reportFitAttr); + + /** + * @Description 优先级 + **/ + int getPriority(); + + /** + * @Description 是否可用 + * @param: jTemplate + **/ + boolean isAvailable(JTemplate jTemplate); +} diff --git a/designer-base/src/main/java/com/fr/design/report/fit/FrmFitAttrModel.java b/designer-base/src/main/java/com/fr/design/report/fit/FrmFitAttrModel.java new file mode 100644 index 0000000000..258dfbf49c --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/report/fit/FrmFitAttrModel.java @@ -0,0 +1,53 @@ +package com.fr.design.report.fit; + + +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.JTemplate; +import com.fr.report.fit.ReportFitAttr; +import com.fr.report.fit.ReportFitConfig; + + +public class FrmFitAttrModel implements FitAttrModel { + + + @Override + public String getModelName() { + return Toolkit.i18nText("Fine-Design_Basic_Decision_Report"); + } + + @Override + public String getFitName() { + return Toolkit.i18nText("Fine-Designer_Fit-Element"); + } + + public FitType[] getFitTypes() { + return new FitType[]{ + FitType.DEFAULT, + FitType.HORIZONTAL_FIT, + FitType.DOUBLE_FIT, + FitType.NOT_FIT + }; + } + + @Override + public ReportFitAttr getGlobalReportFitAttr() { + return ReportFitConfig.getInstance().getFrmFitAttr(); + } + + @Override + public void setGlobalReportFitAttr(ReportFitAttr reportFitAttr) { + ReportFitConfig.getInstance().setFrmFitAttr(reportFitAttr); + } + + @Override + public int getPriority() { + return 1; + } + + @Override + public boolean isAvailable(JTemplate jTemplate) { + return !jTemplate.isJWorkBook(); + } + + +} diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java index ae0cfd2b65..7f66596a93 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java @@ -1,6 +1,5 @@ package com.fr.design.report.fit.menupane; -import com.fr.base.svg.IconUtils; import com.fr.design.actions.JTemplateAction; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionAdapter; @@ -82,13 +81,8 @@ public class ReportFitAttrAction extends JTemplateAction { } final FitProvider wbTpl = (FitProvider) jwb.getTarget(); ReportFitAttr fitAttr = wbTpl.getReportFitAttr(); - if (jwb.isJWorkBook()) { - final TemplateFitAttrPane attrPane = new TemplateFitAttrPane(); - showReportFitDialog(fitAttr, jwb, wbTpl, attrPane); - } else { - final ReportFitAttrPane attrPane = new ReportFitAttrPane(); - showReportFitDialog(fitAttr, jwb, wbTpl, attrPane); - } + TemplateFitAttrPane templateFitAttrPane = new TemplateFitAttrPane(); + showReportFitDialog(fitAttr, jwb, wbTpl, templateFitAttrPane); } private void showReportFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane attrPane) { diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateFitAttrPane.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateFitAttrPane.java index 66673fc5f5..393cbfc711 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateFitAttrPane.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateFitAttrPane.java @@ -1,55 +1,91 @@ package com.fr.design.report.fit.menupane; -import com.fr.design.beans.BasicBeanPane; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.report.fit.BaseFitAttrPane; +import com.fr.design.report.fit.FitAttrModel; +import com.fr.general.ComparatorUtils; +import com.fr.report.fit.FitProvider; import com.fr.report.fit.ReportFitAttr; -import javax.swing.BorderFactory; -import javax.swing.BoxLayout; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; -/** - * Created by 夏翔 on 2016/6/24. - */ -public class TemplateFitAttrPane extends BasicBeanPane { - private TemplateBrowserFitAttrPane attrPane; +public class TemplateFitAttrPane extends BaseFitAttrPane { public TemplateFitAttrPane() { initComponents(); } - private void initComponents() { - this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - attrPane = new TemplateBrowserFitAttrPane(); - this.add(attrPane); + @Override + protected void initComponents() { + super.initComponents(); + for (FitAttrModel fitAttrModel : fitAttrModelList) { + if (fitAttrModel.isAvailable(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate())) { + populateModel(fitAttrModel); + break; + } + } + } + @Override + public void populateBean(ReportFitAttr reportFitAttr) { + if (reportFitAttr == null) { + itemChoose.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_Using_Server_Report_View_Settings")); + } else { + itemChoose.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single")); + } + populate(reportFitAttr); } - /** - * 展示界面 - * - * @param fitAttr 自适应属性 - */ - public void populateBean(ReportFitAttr fitAttr) { - attrPane.populateBean(fitAttr); + public void populate(ReportFitAttr reportFitAttr) { + if (reportFitAttr == null) { + reportFitAttr = fitAttrModel.getGlobalReportFitAttr(); + } + + super.setEnabled(isTemplateSingleSet()); + super.populateBean(reportFitAttr); } - /** - * 提交数据 - * - * @return 界面上的更新数据 - */ public ReportFitAttr updateBean() { - return attrPane.updateBean(); + if (!isTemplateSingleSet()) { + return null; + } else { + return super.updateBean(); + } + } + + @Override + protected String[] getItemNames() { + return new String[]{Toolkit.i18nText("Fine-Design_Report_Using_Server_Report_View_Settings"), + Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single")}; + } + + @Override + protected ItemListener getItemListener() { + return new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + if(isTemplateSingleSet()){ + JTemplate jwb = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (jwb != null) { + FitProvider wbTpl = (FitProvider) jwb.getTarget(); + ReportFitAttr fitAttr = wbTpl.getReportFitAttr(); + populate(fitAttr); + } + }else { + populate(fitAttrModel.getGlobalReportFitAttr()); + } + } + } + }; } - /** - * 标题 - * - * @return 标题 - */ - protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_PC_Fit_Attr"); + private boolean isTemplateSingleSet() { + return ComparatorUtils.equals(Toolkit.i18nText("Fine-Design_Report_I_Want_To_Set_Single"), itemChoose.getSelectedItem()); } -} +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/report/fit/provider/AbstractFitAttrModelProvider.java b/designer-base/src/main/java/com/fr/design/report/fit/provider/AbstractFitAttrModelProvider.java new file mode 100644 index 0000000000..44d048b7de --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/report/fit/provider/AbstractFitAttrModelProvider.java @@ -0,0 +1,18 @@ +package com.fr.design.report.fit.provider; + +import com.fr.stable.fun.mark.API; + + +@API(level = FitAttrModelProvider.CURRENT_LEVEL) +public abstract class AbstractFitAttrModelProvider implements FitAttrModelProvider { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String mark4Provider() { + return getClass().getName(); + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/report/fit/provider/FitAttrModelProvider.java b/designer-base/src/main/java/com/fr/design/report/fit/provider/FitAttrModelProvider.java new file mode 100644 index 0000000000..88f7335d42 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/report/fit/provider/FitAttrModelProvider.java @@ -0,0 +1,11 @@ +package com.fr.design.report.fit.provider; + + +import com.fr.design.report.fit.FitAttrModel; +import com.fr.stable.fun.mark.Mutable; + + +public interface FitAttrModelProvider extends Mutable, FitAttrModel { + String XML_TAG = "FitAttrModelProvider"; + int CURRENT_LEVEL = 1; +} diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ServerFitAttrPane.java b/designer-realize/src/main/java/com/fr/design/webattr/ServerFitAttrPane.java new file mode 100644 index 0000000000..bbe52ae998 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/webattr/ServerFitAttrPane.java @@ -0,0 +1,78 @@ +package com.fr.design.webattr; + +import com.fr.config.Configuration; +import com.fr.design.report.fit.BaseFitAttrPane; +import com.fr.design.report.fit.FitAttrModel; +import com.fr.general.ComparatorUtils; +import com.fr.report.fit.ReportFitAttr; +import com.fr.report.fit.ReportFitConfig; +import com.fr.transaction.Configurations; +import com.fr.transaction.Worker; + +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + + +public class ServerFitAttrPane extends BaseFitAttrPane { + + public ServerFitAttrPane() { + super(); + initComponents(); + } + + @Override + protected void initComponents() { + super.initComponents(); + populateModel(fitAttrModelList.get(0)); + } + + + @Override + public void populateBean(ReportFitAttr reportFitAttr) { + reportFitAttr = fitAttrModel.getGlobalReportFitAttr(); + super.populateBean(reportFitAttr); + } + + + public ReportFitAttr updateBean() { + ReportFitAttr reportFitAttr = super.updateBean(); + Configurations.update(new Worker() { + @Override + public void run() { + fitAttrModel.setGlobalReportFitAttr(reportFitAttr); + } + + @Override + public Class[] targets() { + return new Class[]{ReportFitConfig.class}; + } + }); + return null; + + } + + @Override + protected String[] getItemNames() { + return fitAttrModelList.stream().map(FitAttrModel::getModelName).toArray(String[]::new); + } + + @Override + protected ItemListener getItemListener() { + ServerFitAttrPane self = this; + return new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + for (FitAttrModel fitAttrModel : fitAttrModelList) { + if (ComparatorUtils.equals(e.getItem(), fitAttrModel.getModelName())) { + self.populateModel(fitAttrModel); + populateBean(null); + refresh(); + } + } + } + } + }; + } +} + From 8edae1949cb668399f4d4341b8e60dafe81b61da Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Wed, 29 Sep 2021 16:20:06 +0800 Subject: [PATCH 35/38] =?UTF-8?q?REPORT-59681=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E6=8E=A7=E5=88=B6=E6=A8=A1=E6=9D=BF=E8=87=AA?= =?UTF-8?q?=E9=80=82=E5=BA=94=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EditReportServerParameterPane.java | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java b/designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java index 18d110400c..92885a3b3c 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/EditReportServerParameterPane.java @@ -9,6 +9,7 @@ import com.fr.config.PrintConfig; import com.fr.config.ServerPreferenceConfig; import com.fr.design.gui.frpane.LoadingBasicPane; import com.fr.design.gui.frpane.UITabbedPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.webattr.printsettings.GlobalNativePrintSettingPane; import com.fr.design.webattr.printsettings.PrintSettingPane; @@ -17,6 +18,7 @@ import com.fr.report.web.WebPage; import com.fr.report.web.WebView; import com.fr.report.web.WebWrite; import com.fr.web.attr.ReportWebAttr; +import com.fr.workspace.WorkContext; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -35,18 +37,20 @@ public class EditReportServerParameterPane extends LoadingBasicPane { private WriteToolBarPane writePane; private ReportWebAttr webAttr; private PrintSettingsAttrMark printSettings; - + private WebCssPane cssPane; - + private WebJsPane jsPane; - + private ErrorTemplatePane errorTemplatePane; private PrintSettingPane printSettingPane; + private ServerFitAttrPane serverFitAttrPane; + @Override - protected synchronized void initComponents(JPanel container) { + protected synchronized void initComponents(JPanel container) { JPanel defaultPane = container; defaultPane.setLayout(FRGUIPaneFactory.createBorderLayout()); @@ -61,11 +65,14 @@ public class EditReportServerParameterPane extends LoadingBasicPane { tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"), jsPane = new WebJsPane()); tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Error_Handler_Template"), errorTemplatePane = new ErrorTemplatePane()); tabbedPane.addTab(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Print_Setting"), printSettingPane = new PrintSettingPane(new GlobalNativePrintSettingPane())); + if (WorkContext.getCurrent().isRoot()) { + tabbedPane.addTab(Toolkit.i18nText("Fine-Designer_PC_Fit_Attr"), serverFitAttrPane = new ServerFitAttrPane()); + } } - + @Override protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Report_Server_Parameter"); + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Report_Server_Parameter"); } public void populate(ServerPreferenceConfig reportServerPreferenceConfig) { @@ -78,28 +85,31 @@ public class EditReportServerParameterPane extends LoadingBasicPane { WebPage webPage = webAttr.getWebPage(); WebView webView = webAttr.getWebView(); WebWrite webWrite = webAttr.getWebWrite(); - if(webPage != null){ + if (webPage != null) { pagePane.populateBean(webPage); } - if(webView != null){ + if (webView != null) { viewPane.populateBean(webView); } - if(webWrite != null){ + if (webWrite != null) { writePane.populateBean(webWrite); } cssPane.populate(webAttr); jsPane.populate(webAttr); printSettings = ReportUtils.getPrintSettingsFromServerConfig(); printSettingPane.populate(printSettings); - + this.errorTemplatePane.populateBean(reportServerPreferenceConfig.getErrorTemplate()); + if (serverFitAttrPane != null) { + serverFitAttrPane.populateBean(null); + } } /** * Update. */ public void update(ServerPreferenceConfig reportServerPreferenceConfig) { - ReportWebAttr webAttr = ((ReportWebAttr)ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class)); + ReportWebAttr webAttr = ((ReportWebAttr) ConfigManager.getProviderInstance().getGlobalAttribute(ReportWebAttr.class)); webAttr.setWebPage(pagePane.updateBean()); webAttr.setWebView(viewPane.updateBean()); webAttr.setWebWrite(writePane.updateBean()); @@ -110,5 +120,8 @@ public class EditReportServerParameterPane extends LoadingBasicPane { PrintConfig.getInstance().setPrintSettings(printSettings); reportServerPreferenceConfig.setErrorTemplate(this.errorTemplatePane.updateBean()); + if (serverFitAttrPane != null) { + serverFitAttrPane.updateBean(); + } } } From b5296e5251015737e03cefaad67e2e195bcd5799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Wed, 29 Sep 2021 17:01:12 +0800 Subject: [PATCH 36/38] =?UTF-8?q?REPORT-60134=20=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=B1=9E=E6=80=A7=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?-=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/xpane/LayoutStylePane.java | 47 +++++++++++++------ 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java index 453bd5e0da..1d521cd6f0 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java @@ -22,6 +22,7 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane; +import com.fr.design.widget.FRWidgetFactory; import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.WidgetTitle; import com.fr.general.Background; @@ -30,11 +31,23 @@ import com.fr.general.IOUtils; import com.fr.general.act.TitlePacker; import com.fr.stable.Constants; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JPanel; import javax.swing.border.LineBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BasicStroke; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.Stroke; /** * @author Starryi @@ -145,16 +158,16 @@ public class LayoutStylePane extends BasicBeanPane { double[] rowSize = supportCornerRadius ? new double[] {p, p, p, p} : new double[]{p, p, p}; double[] columnSize = {SETTING_LABEL_WIDTH, f}; - UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Background_Style")); + UILabel uiLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Background_Style")); Font font = uiLabel.getFont().deriveFont(Font.BOLD); uiLabel.setFont(font); uiLabel.setForeground(new Color(143, 143, 146)); JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ {uiLabel, null}, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Render_Style")), borderStyleCombo}, + {FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Render_Style")), createBorderLayoutNorthPaneWithComponent(borderStyleCombo)}, {this.borderLineAndImagePane, null}, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Radius")), cornerSpinner}, + {FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Radius")), cornerSpinner}, }, rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); @@ -180,7 +193,7 @@ public class LayoutStylePane extends BasicBeanPane { this.backgroundPane, this.backgroundOpacityPane); - UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Content")); + UILabel uiLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Content")); Font font = uiLabel.getFont().deriveFont(Font.BOLD); uiLabel.setFont(font); uiLabel.setForeground(new Color(143, 143, 146)); @@ -297,11 +310,11 @@ public class LayoutStylePane extends BasicBeanPane { double[] columnSize = {SETTING_LABEL_WIDTH, f}; final JPanel bottomPane = TableLayoutHelper.createCommonTableLayoutPane( new JComponent[][]{ - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Content")), titleTextPane}, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Format")), titleFontFamilyComboBox}, + {FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Content")), titleTextPane}, + {FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Format")), createBorderLayoutNorthPaneWithComponent(titleFontFamilyComboBox)}, {null, createTitleFontButtonPane()}, {titleInsetImagePane, null}, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Text_Align")), titleAlignPane}, + {FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Text_Align")), titleAlignPane}, {this.createTitleBackgroundAndOpacityPane(), null}, }, rowSize, columnSize, IntervalConstants.INTERVAL_L1); @@ -312,9 +325,9 @@ public class LayoutStylePane extends BasicBeanPane { titleVisibleCheckbox.setSelected(false); visibleComposedPane.add(titleVisibleCheckbox, BorderLayout.WEST); - visibleComposedPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Visible")), BorderLayout.CENTER); + visibleComposedPane.add(FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Visible")), BorderLayout.CENTER); - UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title")); + UILabel uiLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title")); Font font = uiLabel.getFont().deriveFont(Font.BOLD); uiLabel.setFont(font); uiLabel.setForeground(new Color(143, 143, 146)); @@ -339,6 +352,12 @@ public class LayoutStylePane extends BasicBeanPane { return container; } + private JPanel createBorderLayoutNorthPaneWithComponent(JComponent content) { + JPanel jPanel = new JPanel(new BorderLayout()); + jPanel.add(content, BorderLayout.NORTH); + return jPanel; + } + protected JPanel createTitleFontButtonPane(){ double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -511,8 +530,8 @@ public class LayoutStylePane extends BasicBeanPane { // 确保BackgroundSpecialPane高度变化时,Label依然保持与其顶部对齐 JPanel backgroundLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - backgroundLabelPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0)); - backgroundLabelPane.add(new UILabel(name), BorderLayout.NORTH); + backgroundLabelPane.setBorder(BorderFactory.createEmptyBorder(7, 0, 0, 0)); + backgroundLabelPane.add(FRWidgetFactory.createLineWrapLabel(name), BorderLayout.NORTH); JPanel backgroundComposedPane = TableLayoutHelper.createGapTableLayoutPane( new JComponent[][]{ @@ -522,7 +541,7 @@ public class LayoutStylePane extends BasicBeanPane { JPanel opacityComposedPane = TableLayoutHelper.createGapTableLayoutPane( new JComponent[][]{ - {new UILabel(""), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Alpha"))}, + {new UILabel(""), FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Alpha"))}, {new UILabel(""), opacityPane} }, new double[]{p, p}, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); From 6cfbdf33a2b5dcf31f5e420b43202585ed002a4d Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 29 Sep 2021 17:10:44 +0800 Subject: [PATCH 37/38] =?UTF-8?q?REPORT-50201=20=E8=BF=9C=E7=A8=8Baf?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=A8=A1=E6=9D=BF=EF=BC=8C=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=8F=B3=E4=BE=A7=E5=8A=A0=E8=BD=BD=E4=B8=8D?= =?UTF-8?q?=E5=87=BA=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/component/AlphaFineDialog.java | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index e7612c0010..8006917611 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -32,19 +32,17 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.RecentSearchManager import com.fr.design.mainframe.alphafine.search.manager.impl.RecommendSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.SegmentationManager; import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManager; -import com.fr.form.main.Form; -import com.fr.form.main.FormIO; import com.fr.general.ComparatorUtils; import com.fr.general.http.HttpClient; -import com.fr.io.TemplateWorkBookIO; -import com.fr.io.exporter.ImageExporter; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; -import com.fr.main.impl.WorkBook; import com.fr.stable.CodeUtils; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.exporter.LocalExportOperator; +import com.fr.workspace.server.exporter.TemplateExportOperator; import javax.imageio.ImageIO; import javax.swing.BorderFactory; import javax.swing.DefaultListModel; @@ -601,14 +599,15 @@ public class AlphaFineDialog extends UIDialog { checkWorker(); this.showWorker = new SwingWorker() { @Override - protected BufferedImage doInBackground() { - Form form = null; + protected BufferedImage doInBackground() throws Exception { + byte[] bytes = null; try { - form = FormIO.readForm(fileName); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + bytes = WorkContext.getCurrent().get(TemplateExportOperator.class).exportFormAsImageData(fileName); + } catch (Exception ignored) { + // 兼容下老版本 + bytes = new LocalExportOperator().exportFormAsImageData(fileName); } - return FormIO.exportFormAsImage(form); + return TemplateExportOperator.byteDataToIamge(bytes); } @Override @@ -631,15 +630,15 @@ public class AlphaFineDialog extends UIDialog { checkWorker(); this.showWorker = new SwingWorker() { @Override - protected BufferedImage doInBackground() { - WorkBook workBook = null; + protected BufferedImage doInBackground() throws Exception { + byte[] bytes = null; try { - workBook = (WorkBook) TemplateWorkBookIO.readTemplateWorkBook(fileName); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + bytes = WorkContext.getCurrent().get(TemplateExportOperator.class).exportWorkBookAsImageData(fileName); + } catch (Exception ignored) { + // 兼容下老版本 + bytes = new LocalExportOperator().exportWorkBookAsImageData(fileName); } - BufferedImage bufferedImage = new ImageExporter().exportToImage(workBook); - return bufferedImage; + return TemplateExportOperator.byteDataToIamge(bytes); } @Override From 25f5999d450e06a472edfa5db935e76ddc5f5347 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 29 Sep 2021 17:32:26 +0800 Subject: [PATCH 38/38] =?UTF-8?q?REPORT-50201=20fix=20=E6=8B=BC=E5=86=99?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/alphafine/component/AlphaFineDialog.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 8006917611..47c2e6c7e6 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -607,7 +607,7 @@ public class AlphaFineDialog extends UIDialog { // 兼容下老版本 bytes = new LocalExportOperator().exportFormAsImageData(fileName); } - return TemplateExportOperator.byteDataToIamge(bytes); + return TemplateExportOperator.byteDataToImage(bytes); } @Override @@ -638,7 +638,7 @@ public class AlphaFineDialog extends UIDialog { // 兼容下老版本 bytes = new LocalExportOperator().exportWorkBookAsImageData(fileName); } - return TemplateExportOperator.byteDataToIamge(bytes); + return TemplateExportOperator.byteDataToImage(bytes); } @Override