From c89baa08b8eff679e922ea1849d9a01430932617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 18 Oct 2021 14:13:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-60897=20=E3=80=90=E5=9B=BA=E5=AE=9A?= =?UTF-8?q?=E5=B8=83=E5=B1=80-=E5=8E=9F=E5=B8=83=E5=B1=80=E6=8E=A8?= =?UTF-8?q?=E8=8D=904.1=E3=80=91=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8-?= =?UTF-8?q?=E8=87=AA=E9=80=82=E5=BA=94=E5=B8=83=E5=B1=80-=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E6=8E=A8=E8=8D=90=E5=BC=B9=E7=AA=97=E5=8F=B3=E4=B8=8A?= =?UTF-8?q?=E6=96=B9=E7=9A=84=E7=AE=80=E7=BA=A6=E8=A7=86=E5=9B=BE=E5=92=8C?= =?UTF-8?q?=E7=9C=9F=E5=AE=9E=E8=A7=86=E5=9B=BE=EF=BC=8C=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E9=A2=84=E6=9C=9F=E6=98=AF=E4=B8=80=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=E9=BB=98=E8=AE=A4=E6=98=AF=E7=AE=80=E7=BA=A6=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=EF=BC=8C=E4=B8=94=E8=AE=B0=E5=BD=95=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=9A=84=E9=80=89=E6=8B=A9=EF=BC=8C=E4=B8=8B=E6=AC=A1=E6=89=93?= =?UTF-8?q?=E5=BC=80=E6=97=B6=E6=98=BE=E7=A4=BA=E4=B8=8A=E6=AC=A1=E7=9A=84?= =?UTF-8?q?=E9=80=89=E6=8B=A9=EF=BC=9B=E7=8E=B0=E5=9C=A8=E6=95=88=E6=9E=9C?= =?UTF-8?q?=E6=98=AF=E9=BB=98=E8=AE=A4=E7=9C=9F=E5=AE=9E=EF=BC=8C=E4=B8=94?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/DesignerEnvManager.java | 12 ++++++++++++ .../fr/design/widget/ui/designer/NewFormPane.java | 8 ++++++-- .../widget/ui/designer/PredefinedLayoutPane.java | 6 ++++++ 3 files changed, 24 insertions(+), 2 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 f00e1a8558..d2d768ea16 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -205,6 +205,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private boolean showTemplateMissingPlugin = true; + private boolean useSimpleStyleLayout = false; + /** * DesignerEnvManager. */ @@ -1691,6 +1693,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { this.openDebug = openDebug; } + public boolean isUseSimpleStyleLayout() { + return useSimpleStyleLayout; + } + + public void setUseSimpleStyleLayout(boolean useSimpleStyleLayout) { + this.useSimpleStyleLayout = useSimpleStyleLayout; + } + /** * Read XML.
* The method will be invoked when read data from XML file.
@@ -1861,6 +1871,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { this.setEmbedServerLazyStartup(reader.getAttrAsBoolean("embedServerLazyStartup", false)); this.setShowTemplateMissingPlugin(reader.getAttrAsBoolean("showTemplateMissingPlugin", true)); this.setShowServerDatasetAuthTip(reader.getAttrAsBoolean("showServerDatasetAuthTip", true)); + this.setUseSimpleStyleLayout(reader.getAttrAsBoolean("useSimpleStyleLayout", false)); } private void readReportPaneAttributions(XMLableReader reader) { @@ -2134,6 +2145,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { if (!this.isShowTemplateMissingPlugin()) { writer.attr("showTemplateMissingPlugin", this.isShowTemplateMissingPlugin()); } + writer.attr("useSimpleStyleLayout", this.isUseSimpleStyleLayout()); writer.attr("showServerDatasetAuthTip", this.isShowServerDatasetAuthTip()); writer.end(); } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java index dfa156d5e1..5a518f73bb 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java @@ -1,6 +1,7 @@ package com.fr.design.widget.ui.designer; import com.fr.base.iofile.attr.TemplateLayoutIdAttrMark; +import com.fr.design.DesignerEnvManager; import com.fr.design.border.UITitledMatteBorder; import com.fr.design.designer.beans.PredefinedLayout; import com.fr.design.designer.beans.models.NewFormModel; @@ -50,6 +51,8 @@ import java.util.Map; public class NewFormPane extends BasicPane { private static final String EMPTY_FORM_LAYOUTID = "9ebf6aff-ad53-45a9-a175-9633f4162a3a"; + private static final int SIMPLE_STYLE_LAYOUT_INDEX = 0; + private static final int REAL_STYLE_LAYOUT_INDEX = 1; private NewFormModel newFormModel; private UIDialog dialog; @@ -187,13 +190,14 @@ public class NewFormPane extends BasicPane { Toolkit.i18nText("Fine-Design_Real_Style_Template") }); buttonGroup.setPreferredSize(new Dimension(140, 20)); - buttonGroup.setSelectedIndex(1); + buttonGroup.setSelectedIndex(DesignerEnvManager.getEnvManager().isUseSimpleStyleLayout()? SIMPLE_STYLE_LAYOUT_INDEX : REAL_STYLE_LAYOUT_INDEX); buttonGroup.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { int selectedIndex = buttonGroup.getSelectedIndex(); for (PredefinedLayoutPane layoutCard : layoutCards) { - if (selectedIndex == 1) { + DesignerEnvManager.getEnvManager().setUseSimpleStyleLayout(selectedIndex == SIMPLE_STYLE_LAYOUT_INDEX); + if (selectedIndex == REAL_STYLE_LAYOUT_INDEX) { layoutCard.showRealStyle(); } else { layoutCard.showSimpleStyle(); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/PredefinedLayoutPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/PredefinedLayoutPane.java index bde9b07eed..5094faa4d4 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/PredefinedLayoutPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/PredefinedLayoutPane.java @@ -2,6 +2,7 @@ package com.fr.design.widget.ui.designer; import com.fr.base.GraphHelper; import com.fr.base.svg.IconUtils; +import com.fr.design.DesignerEnvManager; import com.fr.design.designer.beans.PredefinedLayout; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.share.ui.base.MouseClickListener; @@ -39,6 +40,11 @@ public class PredefinedLayoutPane extends JPanel { this.add(realStyle, 0); this.add(simpleStyle, 1); this.setPreferredSize(new Dimension(235, 134)); + if (DesignerEnvManager.getEnvManager().isUseSimpleStyleLayout()) { + showSimpleStyle(); + } else { + showRealStyle(); + } this.initListener(); } From abf637fd2a5f1fbacf6719fea4e8b7f5ed7872aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 18 Oct 2021 14:25:52 +0800 Subject: [PATCH 2/2] REPORT-60897 --- .../java/com/fr/design/DesignerEnvManager.java | 16 +++++++++------- .../design/widget/ui/designer/NewFormPane.java | 12 +++--------- .../widget/ui/designer/PredefinedLayoutPane.java | 14 +++++++++----- 3 files changed, 21 insertions(+), 21 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 d2d768ea16..48f05f7e2c 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -91,6 +91,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private static final String VERSION100 = "100"; private static final int CACHINGTEMPLATE_LIMIT = 5; private static final String WEB_NAME = "webapps"; + public static final int LAYOUT_TEMPLATE_SIMPLE_STYLE = 0; + public static final int LAYOUT_TEMPLATE_REAL_STYLE = 1; /** * 指定默认工作空间 */ @@ -205,7 +207,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private boolean showTemplateMissingPlugin = true; - private boolean useSimpleStyleLayout = false; + private int layoutTemplateStyle = LAYOUT_TEMPLATE_SIMPLE_STYLE; /** * DesignerEnvManager. @@ -1693,12 +1695,12 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { this.openDebug = openDebug; } - public boolean isUseSimpleStyleLayout() { - return useSimpleStyleLayout; + public int getLayoutTemplateStyle() { + return layoutTemplateStyle; } - public void setUseSimpleStyleLayout(boolean useSimpleStyleLayout) { - this.useSimpleStyleLayout = useSimpleStyleLayout; + public void setLayoutTemplateStyle(int layoutTemplateStyle) { + this.layoutTemplateStyle = layoutTemplateStyle; } /** @@ -1871,7 +1873,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { this.setEmbedServerLazyStartup(reader.getAttrAsBoolean("embedServerLazyStartup", false)); this.setShowTemplateMissingPlugin(reader.getAttrAsBoolean("showTemplateMissingPlugin", true)); this.setShowServerDatasetAuthTip(reader.getAttrAsBoolean("showServerDatasetAuthTip", true)); - this.setUseSimpleStyleLayout(reader.getAttrAsBoolean("useSimpleStyleLayout", false)); + this.setLayoutTemplateStyle(reader.getAttrAsInt("layoutTemplateStyle", LAYOUT_TEMPLATE_SIMPLE_STYLE)); } private void readReportPaneAttributions(XMLableReader reader) { @@ -2145,7 +2147,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { if (!this.isShowTemplateMissingPlugin()) { writer.attr("showTemplateMissingPlugin", this.isShowTemplateMissingPlugin()); } - writer.attr("useSimpleStyleLayout", this.isUseSimpleStyleLayout()); + writer.attr("layoutTemplateStyle", this.getLayoutTemplateStyle()); writer.attr("showServerDatasetAuthTip", this.isShowServerDatasetAuthTip()); writer.end(); } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java index 5a518f73bb..ca3e266543 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java @@ -51,8 +51,6 @@ import java.util.Map; public class NewFormPane extends BasicPane { private static final String EMPTY_FORM_LAYOUTID = "9ebf6aff-ad53-45a9-a175-9633f4162a3a"; - private static final int SIMPLE_STYLE_LAYOUT_INDEX = 0; - private static final int REAL_STYLE_LAYOUT_INDEX = 1; private NewFormModel newFormModel; private UIDialog dialog; @@ -190,18 +188,14 @@ public class NewFormPane extends BasicPane { Toolkit.i18nText("Fine-Design_Real_Style_Template") }); buttonGroup.setPreferredSize(new Dimension(140, 20)); - buttonGroup.setSelectedIndex(DesignerEnvManager.getEnvManager().isUseSimpleStyleLayout()? SIMPLE_STYLE_LAYOUT_INDEX : REAL_STYLE_LAYOUT_INDEX); + buttonGroup.setSelectedIndex(DesignerEnvManager.getEnvManager().getLayoutTemplateStyle()); buttonGroup.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { int selectedIndex = buttonGroup.getSelectedIndex(); for (PredefinedLayoutPane layoutCard : layoutCards) { - DesignerEnvManager.getEnvManager().setUseSimpleStyleLayout(selectedIndex == SIMPLE_STYLE_LAYOUT_INDEX); - if (selectedIndex == REAL_STYLE_LAYOUT_INDEX) { - layoutCard.showRealStyle(); - } else { - layoutCard.showSimpleStyle(); - } + DesignerEnvManager.getEnvManager().setLayoutTemplateStyle(selectedIndex); + layoutCard.showCard(); } } }); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/PredefinedLayoutPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/PredefinedLayoutPane.java index 5094faa4d4..097440f961 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/PredefinedLayoutPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/PredefinedLayoutPane.java @@ -40,12 +40,8 @@ public class PredefinedLayoutPane extends JPanel { this.add(realStyle, 0); this.add(simpleStyle, 1); this.setPreferredSize(new Dimension(235, 134)); - if (DesignerEnvManager.getEnvManager().isUseSimpleStyleLayout()) { - showSimpleStyle(); - } else { - showRealStyle(); - } this.initListener(); + this.showCard(); } protected void initListener() { @@ -90,6 +86,14 @@ public class PredefinedLayoutPane extends JPanel { this.clickListener = clickListener; } + public void showCard() { + if (DesignerEnvManager.getEnvManager().getLayoutTemplateStyle() == DesignerEnvManager.LAYOUT_TEMPLATE_SIMPLE_STYLE) { + showSimpleStyle(); + } else if (DesignerEnvManager.getEnvManager().getLayoutTemplateStyle() == DesignerEnvManager.LAYOUT_TEMPLATE_REAL_STYLE) { + showRealStyle(); + } + } + public void showSimpleStyle() { cardLayout.last(this); }