From 764d729328452fb8059a031824f18c9235a238e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=2EYing-=E5=BA=94=E5=BF=97=E6=B5=A9?= Date: Wed, 29 Mar 2023 18:31:35 +0800 Subject: [PATCH 01/42] =?UTF-8?q?REPORT-92506=20=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=B8=BB=E9=A2=98=E5=88=87=E6=8D=A2-?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E4=B8=8D=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/parameter/RootDesignDefinePane.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java index 86e3f49986..a794a7bd69 100644 --- a/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java @@ -368,12 +368,11 @@ public class RootDesignDefinePane extends AbstractDataModify { wParameterLayout.setParamsFireStopEdit(fireAfterEditor.isSelected()); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected()); - wParameterLayout.setBackground((Background) background.getValue()); if (extraPaneList.isEmpty()) { - background.setValue(wParameterLayout.getBackground()); + wParameterLayout.setBackground((Background) background.getValue()); } else { for (BasicBeanPane pane : extraPaneList) { - pane.populateBean(wParameterLayout); + pane.updateBean(wParameterLayout); } } //设置参数模板面板的高度 From 9309a2265b0e49ef665926ae0e4fab557adcdc29 Mon Sep 17 00:00:00 2001 From: "coral.chen@fanruan.com" Date: Thu, 30 Mar 2023 16:07:17 +0800 Subject: [PATCH 02/42] =?UTF-8?q?REPORT-90316=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E6=8E=A7=E4=BB=B6=E7=BF=BB=E6=96=B0----=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E9=83=A8=E5=88=86=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/creator/XNumberEditor.java | 16 +++- .../fr/design/designer/creator/XPassword.java | 6 ++ .../fr/design/designer/creator/XTextArea.java | 10 +- .../mobile/NumberEditorMobilePropertyUI.java | 37 ++++++++ .../mobile/PasswordMobilePropertyUI.java | 37 ++++++++ .../mobile/TextAreaMobilePropertyUI.java | 37 ++++++++ .../BaseTextEditorMobileDefinePane.java | 94 +++++++++++++++++++ .../mobile/NumberEditorMobileDefinePane.java | 33 +++++++ .../mobile/PasswordMobileDefinePane.java | 25 +++++ .../mobile/ScanCodeMobileDefinePane.java | 57 +++++------ .../mobile/TextAreaAdvancedDefinePane.java | 25 +++++ .../MobilePasswordEditSettingPane.java | 43 +++++++++ .../component/MobileTextAreaSettingPane.java | 38 ++++++++ .../component/MobileTextEditSettingPane.java | 59 ++++++++++++ .../MobileTextFieldInputSettingPane.java | 28 ++++-- 15 files changed, 499 insertions(+), 46 deletions(-) create mode 100644 designer-form/src/main/java/com/fr/design/designer/properties/mobile/NumberEditorMobilePropertyUI.java create mode 100644 designer-form/src/main/java/com/fr/design/designer/properties/mobile/PasswordMobilePropertyUI.java create mode 100644 designer-form/src/main/java/com/fr/design/designer/properties/mobile/TextAreaMobilePropertyUI.java create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BaseTextEditorMobileDefinePane.java create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/NumberEditorMobileDefinePane.java create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/PasswordMobileDefinePane.java create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TextAreaAdvancedDefinePane.java create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobilePasswordEditSettingPane.java create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextAreaSettingPane.java create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextEditSettingPane.java diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XNumberEditor.java b/designer-form/src/main/java/com/fr/design/designer/creator/XNumberEditor.java index 15cd30c6fd..8861d6fcbc 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XNumberEditor.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XNumberEditor.java @@ -6,7 +6,9 @@ package com.fr.design.designer.creator; import com.fr.base.BaseUtils; import com.fr.base.ScreenResolution; import com.fr.base.Style; +import com.fr.design.designer.properties.mobile.NumberEditorMobilePropertyUI; import com.fr.design.form.util.XCreatorConstants; +import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.mainframe.widget.editors.InChangeBooleanEditor; import com.fr.design.mainframe.widget.editors.SpinnerMaxNumberEditor; import com.fr.design.mainframe.widget.editors.SpinnerMinNumberEditor; @@ -91,15 +93,19 @@ public class XNumberEditor extends XWrapperedFieldEditor { } } - @Override + @Override protected JComponent initEditor() { setBorder(FIELDBORDER); return this; } - @Override - protected String getIconName() { - return "number_field_16.png"; - } + @Override + protected String getIconName() { + return "number_field_16.png"; + } + @Override + public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { + return new WidgetPropertyUIProvider[]{new NumberEditorMobilePropertyUI(this)}; + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XPassword.java b/designer-form/src/main/java/com/fr/design/designer/creator/XPassword.java index 4194e4be03..29de6c9d05 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XPassword.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XPassword.java @@ -3,7 +3,9 @@ */ package com.fr.design.designer.creator; +import com.fr.design.designer.properties.mobile.PasswordMobilePropertyUI; import com.fr.design.form.util.XCreatorConstants; +import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.gui.ibutton.UIPasswordField; import com.fr.design.mainframe.widget.editors.RegexEditor; import com.fr.design.mainframe.widget.editors.WidgetValueEditor; @@ -68,4 +70,8 @@ public class XPassword extends XWrapperedFieldEditor { (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, new CRPropertyDescriptor[]{regex, waterMark}); } + @Override + public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { + return new WidgetPropertyUIProvider[]{new PasswordMobilePropertyUI(this)}; + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XTextArea.java b/designer-form/src/main/java/com/fr/design/designer/creator/XTextArea.java index 845fe43d9e..f23c24fea7 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XTextArea.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XTextArea.java @@ -6,7 +6,9 @@ package com.fr.design.designer.creator; import com.fr.base.BaseUtils; import com.fr.base.ScreenResolution; import com.fr.base.Style; +import com.fr.design.designer.properties.mobile.TextAreaMobilePropertyUI; import com.fr.design.form.util.XCreatorConstants; +import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.mainframe.widget.editors.RegexEditor; import com.fr.design.mainframe.widget.editors.WidgetValueEditor; import com.fr.design.mainframe.widget.renderer.RegexCellRencerer; @@ -26,7 +28,7 @@ import java.beans.IntrospectionException; * @author richer * @since 6.5.3 */ -public class XTextArea extends XFieldEditor { +public class XTextArea extends XWrapperedFieldEditor { public XTextArea(TextArea widget, Dimension initSize) { super(widget, initSize); @@ -81,4 +83,10 @@ public class XTextArea extends XFieldEditor { protected String getIconName() { return "text_area_16.png"; } + + @Override + public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { + return new WidgetPropertyUIProvider[]{new TextAreaMobilePropertyUI(this)}; + } + } diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/NumberEditorMobilePropertyUI.java b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/NumberEditorMobilePropertyUI.java new file mode 100644 index 0000000000..67a8569f72 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/NumberEditorMobilePropertyUI.java @@ -0,0 +1,37 @@ +package com.fr.design.designer.properties.mobile; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.dialog.BasicPane; +import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; +import com.fr.design.gui.itable.AbstractPropertyTable; +import com.fr.design.widget.ui.designer.mobile.NumberEditorMobileDefinePane; + +/** + * 数字控件属性面板注册 + * + * @author Coral.Chen + * @since 11.0 + * Created on 2023/3/30 + */ +public class NumberEditorMobilePropertyUI extends AbstractWidgetPropertyUIProvider { + private XCreator xCreator; + + public NumberEditorMobilePropertyUI(XCreator xCreator) { + this.xCreator = xCreator; + } + + @Override + public AbstractPropertyTable createWidgetAttrTable() { + return null; + } + + @Override + public BasicPane createWidgetAttrPane() { + return new NumberEditorMobileDefinePane(xCreator); + } + + @Override + public String tableTitle() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr"); + } +} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/PasswordMobilePropertyUI.java b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/PasswordMobilePropertyUI.java new file mode 100644 index 0000000000..2c3b3b2270 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/PasswordMobilePropertyUI.java @@ -0,0 +1,37 @@ +package com.fr.design.designer.properties.mobile; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.dialog.BasicPane; +import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; +import com.fr.design.gui.itable.AbstractPropertyTable; +import com.fr.design.widget.ui.designer.mobile.PasswordMobileDefinePane; + +/** + * 密码控件移动端属性注册 + * + * @author Coral.Chen + * @since 11.0 + * Created on 2023/3/30 + */ +public class PasswordMobilePropertyUI extends AbstractWidgetPropertyUIProvider { + private XCreator xCreator; + + public PasswordMobilePropertyUI(XCreator xCreator) { + this.xCreator = xCreator; + } + + @Override + public AbstractPropertyTable createWidgetAttrTable() { + return null; + } + + @Override + public BasicPane createWidgetAttrPane() { + return new PasswordMobileDefinePane(xCreator); + } + + @Override + public String tableTitle() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr"); + } +} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/TextAreaMobilePropertyUI.java b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/TextAreaMobilePropertyUI.java new file mode 100644 index 0000000000..1c24e06bce --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/TextAreaMobilePropertyUI.java @@ -0,0 +1,37 @@ +package com.fr.design.designer.properties.mobile; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.dialog.BasicPane; +import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; +import com.fr.design.gui.itable.AbstractPropertyTable; +import com.fr.design.widget.ui.designer.mobile.TextAreaAdvancedDefinePane; + +/** + * 文本域控件移动端属性 + * + * @author Coral.Chen + * @since 11.0 + * Created on 2023/3/29 + */ +public class TextAreaMobilePropertyUI extends AbstractWidgetPropertyUIProvider { + private XCreator xCreator; + + public TextAreaMobilePropertyUI(XCreator xCreator) { + this.xCreator = xCreator; + } + + @Override + public AbstractPropertyTable createWidgetAttrTable() { + return null; + } + + @Override + public BasicPane createWidgetAttrPane() { + return new TextAreaAdvancedDefinePane(xCreator); + } + + @Override + public String tableTitle() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr"); + } +} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BaseTextEditorMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BaseTextEditorMobileDefinePane.java new file mode 100644 index 0000000000..57faab6a72 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BaseTextEditorMobileDefinePane.java @@ -0,0 +1,94 @@ +package com.fr.design.widget.ui.designer.mobile; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.widget.ui.designer.mobile.component.MobileTextEditSettingPane; +import com.fr.form.ui.TextEditor; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.FlowLayout; + +/** + *

文本类组件移动端高级属性的定义面板,基础扩展可以直接继承此面板 + *

往内部添加其他配置 + * + * @author Coral.Chen + * @since 11.0 + * Created on 2023/3/30 + */ +public class BaseTextEditorMobileDefinePane extends MobileWidgetDefinePane { + + private XCreator xCreator; + protected MobileTextEditSettingPane textSettingPane; + + public BaseTextEditorMobileDefinePane(XCreator xCreator) { + this.xCreator = xCreator; + } + + @Override + public void initPropertyGroups(Object source) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel container = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 5); + addPropertyPanesToContainer(container); + this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, container), BorderLayout.NORTH); + this.repaint(); + } + + /** + * 添加其他属性面板 + * + * @param container 展开容器 + */ + protected void addPropertyPanesToContainer(JPanel container) { + initSettingPane(container); + } + + /** + * 初始化文本类基础面板 + * + * @param container + */ + protected void initSettingPane(JPanel container) { + textSettingPane = new MobileTextEditSettingPane(); + container.add(textSettingPane); + } + + @Override + public void populate(FormDesigner designer) { + TextEditor textEditor = (TextEditor) xCreator.toData(); + textSettingPane.populateBean(textEditor.getMobileTextEditAttr()); + this.bindListeners2Widgets(); + } + + protected void bindListeners2Widgets() { + reInitAllListeners(); + AttributeChangeListener changeListener = new AttributeChangeListener() { + @Override + public void attributeChange() { + update(); + } + }; + this.addAttributeChangeListener(changeListener); + } + + private void reInitAllListeners() { + initListener(this); + } + + @Override + public void update() { + TextEditor textEditor = (TextEditor) xCreator.toData(); + textSettingPane.updateBean(textEditor.getMobileTextEditAttr()); + DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); + } + + public XCreator getxCreator() { + return xCreator; + } +} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/NumberEditorMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/NumberEditorMobileDefinePane.java new file mode 100644 index 0000000000..75c6dbefc0 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/NumberEditorMobileDefinePane.java @@ -0,0 +1,33 @@ +package com.fr.design.widget.ui.designer.mobile; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.FormDesigner; +import com.fr.form.ui.NumberEditor; + +/** + * 数字控件 + * + * @author Coral.Chen + * @since 11.0 + * Created on 2023/3/30 + */ +public class NumberEditorMobileDefinePane extends BaseTextEditorMobileDefinePane { + public NumberEditorMobileDefinePane(XCreator xCreator) { + super(xCreator); + } + + @Override + public void populate(FormDesigner designer) { + NumberEditor numberEditor = (NumberEditor) getxCreator().toData(); + textSettingPane.populateBean(numberEditor.getMobileTextEditAttr()); + this.bindListeners2Widgets(); + } + + @Override + public void update() { + NumberEditor numberEditor = (NumberEditor) getxCreator().toData(); + textSettingPane.updateBean(numberEditor.getMobileTextEditAttr()); + DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); + } +} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/PasswordMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/PasswordMobileDefinePane.java new file mode 100644 index 0000000000..68c878b459 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/PasswordMobileDefinePane.java @@ -0,0 +1,25 @@ +package com.fr.design.widget.ui.designer.mobile; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.widget.ui.designer.mobile.component.MobilePasswordEditSettingPane; + +import javax.swing.JPanel; + +/** + * 密码控件移动端高级属性 + * + * @author Coral.Chen + * @since 11.0 + * Created on 2023/3/30 + */ +public class PasswordMobileDefinePane extends BaseTextEditorMobileDefinePane { + public PasswordMobileDefinePane(XCreator xCreator) { + super(xCreator); + } + + @Override + protected void initSettingPane(JPanel container) { + textSettingPane = new MobilePasswordEditSettingPane(); + container.add(textSettingPane); + } +} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java index a9876b7a3d..bb785c27d9 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java @@ -1,61 +1,50 @@ package com.fr.design.widget.ui.designer.mobile; -import com.fr.base.mobile.MobileScanCodeAttr; import com.fr.design.designer.creator.XCreator; -import com.fr.design.foldablepane.UIExpandablePane; -import com.fr.design.gui.frpane.AttributeChangeListener; -import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.FormDesigner; +import com.fr.design.widget.ui.designer.mobile.component.MobileTextEditSettingPane; import com.fr.design.widget.ui.designer.mobile.component.MobileTextFieldInputSettingPane; import com.fr.form.ui.TextEditor; -import java.awt.BorderLayout; +import javax.swing.JPanel; -public class ScanCodeMobileDefinePane extends MobileWidgetDefinePane { +/** + * 输入方式: + * + * @author hades + * @since 11.0 + * Created on 2018/11/27 + */ +public class ScanCodeMobileDefinePane extends BaseTextEditorMobileDefinePane { - private XCreator xCreator; - private MobileTextFieldInputSettingPane settingPane; + private MobileTextFieldInputSettingPane inputSettingPane; public ScanCodeMobileDefinePane(XCreator xCreator) { - this.xCreator = xCreator; + super(xCreator); } @Override - public void initPropertyGroups(Object source) { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - settingPane = new MobileTextFieldInputSettingPane(); - this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, settingPane), BorderLayout.NORTH); - this.repaint(); + protected void initSettingPane(JPanel container) { + inputSettingPane = new MobileTextFieldInputSettingPane(); + textSettingPane = new MobileTextEditSettingPane(); + container.add(inputSettingPane); + container.add(textSettingPane); } - private void bindListeners2Widgets() { - reInitAllListeners(); - AttributeChangeListener changeListener = new AttributeChangeListener() { - @Override - public void attributeChange() { - update(); - } - }; - this.addAttributeChangeListener(changeListener); - } - - private void reInitAllListeners() { - initListener(this); - } @Override public void populate(FormDesigner designer) { - MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) xCreator.toData()).getMobileScanCodeAttr(); - settingPane.populateBean(mobileScanCodeAttr); + super.populate(designer); + TextEditor textEditor = (TextEditor) getxCreator().toData(); + inputSettingPane.populateBean(textEditor.getMobileScanCodeAttr()); this.bindListeners2Widgets(); } - @Override public void update() { - MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) xCreator.toData()).getMobileScanCodeAttr(); - settingPane.updateBean(mobileScanCodeAttr); + super.update(); + TextEditor textEditor = (TextEditor) getxCreator().toData(); + inputSettingPane.updateBean(textEditor.getMobileScanCodeAttr()); DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TextAreaAdvancedDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TextAreaAdvancedDefinePane.java new file mode 100644 index 0000000000..ccc3194f9f --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TextAreaAdvancedDefinePane.java @@ -0,0 +1,25 @@ +package com.fr.design.widget.ui.designer.mobile; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.widget.ui.designer.mobile.component.MobileTextAreaSettingPane; + +import javax.swing.JPanel; + +/** + * 文本域控件 + * + * @author Coral.Chen + * @since 11.0 + * Created on 2023/3/29 + */ +public class TextAreaAdvancedDefinePane extends BaseTextEditorMobileDefinePane { + public TextAreaAdvancedDefinePane(XCreator xCreator) { + super(xCreator); + } + + @Override + protected void initSettingPane(JPanel container) { + textSettingPane = new MobileTextAreaSettingPane(); + container.add(textSettingPane); + } +} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobilePasswordEditSettingPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobilePasswordEditSettingPane.java new file mode 100644 index 0000000000..db475dc569 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobilePasswordEditSettingPane.java @@ -0,0 +1,43 @@ +package com.fr.design.widget.ui.designer.mobile.component; + +import com.fr.base.mobile.MobileTextEditAttr; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.i18n.Toolkit; + +import java.awt.BorderLayout; + +/** + * 密码控件编辑属性设置面板 + * + * @author Coral.Chen + * @since 11.0 + * Created on 2023/3/30 + */ +public class MobilePasswordEditSettingPane extends MobileTextEditSettingPane { + // 显示字数统计 + private UICheckBox showPassword; + + public MobilePasswordEditSettingPane() { + super(); + showPassword = new UICheckBox(Toolkit.i18nText("Fine-Design_Mobile_Show_Password"), false); + this.add(showPassword, BorderLayout.NORTH); + } + + @Override + protected boolean getClearDefaultState() { + return true; + } + + @Override + public void populateBean(MobileTextEditAttr ob) { + super.populateBean(ob); + // 要兼容处理一下,为null 的话赋默认值,默认开启 + this.showPassword.setSelected(ob.isShowPassword() == null || ob.isShowPassword()); + } + + @Override + public void updateBean(MobileTextEditAttr ob) { + super.updateBean(ob); + ob.setShowPassword(showPassword.isSelected()); + } +} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextAreaSettingPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextAreaSettingPane.java new file mode 100644 index 0000000000..d660508e6e --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextAreaSettingPane.java @@ -0,0 +1,38 @@ +package com.fr.design.widget.ui.designer.mobile.component; + +import com.fr.base.mobile.MobileTextEditAttr; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.i18n.Toolkit; + +import java.awt.BorderLayout; + +/** + * 文本域控件 + * + * @author Coral.Chen + * @since 11.0 + * Created on 2023/3/29 + */ +public class MobileTextAreaSettingPane extends MobileTextEditSettingPane { + // 显示字数统计 + private UICheckBox showWordCount; + + public MobileTextAreaSettingPane() { + super(); + showWordCount = new UICheckBox(Toolkit.i18nText("Fine-Design_Mobile_Show_Word_Count"), false); + this.add(showWordCount, BorderLayout.NORTH); + } + + @Override + public void populateBean(MobileTextEditAttr ob) { + super.populateBean(ob); + // 要兼容处理一下,为null 的话赋默认值,默认不开启 + this.showWordCount.setSelected(ob.isShowWordCount() != null && ob.isShowWordCount()); + } + + @Override + public void updateBean(MobileTextEditAttr ob) { + super.updateBean(ob); + ob.setShowWordCount(showWordCount.isSelected()); + } +} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextEditSettingPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextEditSettingPane.java new file mode 100644 index 0000000000..56d340e4d0 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextEditSettingPane.java @@ -0,0 +1,59 @@ +package com.fr.design.widget.ui.designer.mobile.component; + +import com.fr.base.mobile.MobileTextEditAttr; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.VerticalFlowLayout; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; + +/** + * 文本类基础设置 + * + * @author Coral.Chen + * @since 11.0 + * Created on 2023/3/29 + */ +public class MobileTextEditSettingPane extends BasicBeanPane { + // 允许一键清空 + protected UICheckBox allowOneClickClear; + + public MobileTextEditSettingPane() { + initLayout(); + allowOneClickClear = new UICheckBox(Toolkit.i18nText("Fine-Design_Mobile_Allow_One_Click_Clear"), getClearDefaultState()); + this.add(allowOneClickClear, BorderLayout.NORTH); + } + + protected boolean getClearDefaultState() { + return false; + } + + protected void initLayout() { + VerticalFlowLayout verticalFlowLayout = new VerticalFlowLayout(FlowLayout.LEADING, 0, 5); + verticalFlowLayout.setAlignLeft(true); + this.setLayout(verticalFlowLayout); + } + + @Override + public void populateBean(MobileTextEditAttr ob) { + allowOneClickClear.setSelected(ob.isAllowOneClickClear() != null && ob.isAllowOneClickClear()); + } + + @Override + public MobileTextEditAttr updateBean() { + // do nothing + return null; + } + + @Override + public void updateBean(MobileTextEditAttr ob) { + ob.setAllowOneClickClear(allowOneClickClear.isSelected()); + } + + @Override + protected String title4PopupWindow() { + return null; + } +} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java index 75d924e53a..faaec45bc8 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java @@ -2,12 +2,17 @@ package com.fr.design.widget.ui.designer.mobile.component; import com.fr.base.mobile.MobileScanCodeAttr; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; -import java.awt.BorderLayout; -import java.awt.FlowLayout; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; + import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; /** * @author hades @@ -22,13 +27,24 @@ public class MobileTextFieldInputSettingPane extends BasicBeanPane Date: Thu, 30 Mar 2023 16:14:44 +0800 Subject: [PATCH 03/42] =?UTF-8?q?REPORT-90316=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E6=8E=A7=E4=BB=B6=E7=BF=BB=E6=96=B0----=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E9=83=A8=E5=88=86=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/designer/creator/XTextArea.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XTextArea.java b/designer-form/src/main/java/com/fr/design/designer/creator/XTextArea.java index f23c24fea7..88d0391ceb 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XTextArea.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XTextArea.java @@ -27,6 +27,7 @@ import java.beans.IntrospectionException; /** * @author richer * @since 6.5.3 + * Created on 2016/3/29 */ public class XTextArea extends XWrapperedFieldEditor { From bbc5a3f916cffa104c6020e5dbe5bb18f4cc8d09 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 3 Apr 2023 17:22:00 +0800 Subject: [PATCH 04/42] =?UTF-8?q?REPORT-90581=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=B7=BB=E5=8A=A0=E4=BA=8B=E4=BB=B6=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=85=85=E6=BB=A1=EF=BC=8C=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=95=99=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/controlpane/UIListGroupControlPane.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java index ed07ecc2d5..41e40d8b17 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java @@ -28,14 +28,7 @@ import javax.swing.event.ListDataEvent; import javax.swing.event.ListDataListener; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -import java.awt.AlphaComposite; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.Graphics2D; +import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.lang.reflect.Constructor; @@ -336,7 +329,9 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li Map.Entry entry = iterator.next(); ListWrapperPane wrapperPane = entry.getValue(); UIList uiList = wrapperPane.getNameEdList(); - uiList.setFixedCellWidth(width); + //contentPane是外层的Panel,如果不进行判断的话宽度就可能会小于contentPanel,右侧会有空隙 + //所以需要判断一下,如果外层比较宽就取外层的宽度,防止空隙出现 + uiList.setFixedCellWidth(Math.max(width, contentPane == null? 0 : contentPane.getWidth())); } } From 704028d58a89a0d648560ce78c1bb6b396411d56 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 3 Apr 2023 17:28:41 +0800 Subject: [PATCH 05/42] =?UTF-8?q?REPORT-90581=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=B7=BB=E5=8A=A0=E4=BA=8B=E4=BB=B6=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=85=85=E6=BB=A1=EF=BC=8C=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=95=99=E7=99=BD=20=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/controlpane/UIListGroupControlPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java index 41e40d8b17..890d56da66 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java @@ -331,7 +331,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li UIList uiList = wrapperPane.getNameEdList(); //contentPane是外层的Panel,如果不进行判断的话宽度就可能会小于contentPanel,右侧会有空隙 //所以需要判断一下,如果外层比较宽就取外层的宽度,防止空隙出现 - uiList.setFixedCellWidth(Math.max(width, contentPane == null? 0 : contentPane.getWidth())); + uiList.setFixedCellWidth(Math.max(width, contentPane == null ? 0 : contentPane.getWidth())); } } From 5cb91f8270f1590d3b0112aa2aaacfd7c2492e18 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 4 Apr 2023 14:03:07 +0800 Subject: [PATCH 06/42] =?UTF-8?q?REPORT-90581=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=B7=BB=E5=8A=A0=E4=BA=8B=E4=BB=B6=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=85=85=E6=BB=A1=EF=BC=8C=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=95=99=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controlpane/UIListGroupControlPane.java | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java index 890d56da66..47581fb626 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java @@ -139,7 +139,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li } this.checkButtonEnabled(); refreshEventListWrapperPane(); - this.checkGroupPaneSize(); + this.updateGroupPaneSize(contentPane); isPopulating = false; } @@ -207,7 +207,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li nameEdList.addModNameActionListener(new ModNameActionListener() { @Override public void nameModed(int index, String oldName, String newName) { - checkGroupPaneSize(); + updateGroupPaneSize(contentPane); saveSettings(); } }); @@ -297,24 +297,30 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li public void onAddItem(NameableCreator creator) { updateSelectedNameList(creator); getCommonHandlers().onAddItem(creator); - checkGroupPaneSize(); + updateGroupPaneSize(contentPane); } @Override public void onRemoveItem() { getCommonHandlers().onRemoveItem(); refreshEventListWrapperPane(); - checkGroupPaneSize(); + updateGroupPaneSize(contentPane); } @Override public void onCopyItem() { getCommonHandlers().onCopyItem(); - checkGroupPaneSize(); + updateGroupPaneSize(contentPane); } - private void checkGroupPaneSize() { + /** + * 根据父面板更新对应的面板宽度 + * (如果小于父面板的宽度就填充到与父面板宽度一致) + * + * @param parentPane 父面板 + */ + private void updateGroupPaneSize(JPanel parentPane) { int width = 180; Iterator> iterator = nameEdListMap.entrySet().iterator(); while (iterator.hasNext()) { @@ -324,14 +330,14 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li width = Math.max(width, calculateUIListMaxCellWidth(uiList.getModel(), uiList.getFontMetrics(uiList.getFont()))); } iterator = nameEdListMap.entrySet().iterator(); - width += 30; + //contentPane是外层的Panel,如果不进行判断的话宽度就可能会小于contentPanel,右侧会有空隙 + //所以需要判断一下,如果外层比较宽就取外层的宽度,防止空隙出现 + width = Math.max(width + 30, parentPane == null ? 0 : parentPane.getWidth()); while (iterator.hasNext()) { Map.Entry entry = iterator.next(); ListWrapperPane wrapperPane = entry.getValue(); UIList uiList = wrapperPane.getNameEdList(); - //contentPane是外层的Panel,如果不进行判断的话宽度就可能会小于contentPanel,右侧会有空隙 - //所以需要判断一下,如果外层比较宽就取外层的宽度,防止空隙出现 - uiList.setFixedCellWidth(Math.max(width, contentPane == null ? 0 : contentPane.getWidth())); + uiList.setFixedCellWidth(width); } } From 6c67564b624906abbe6033fe7a76e371fe4c7f65 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 4 Apr 2023 16:38:29 +0800 Subject: [PATCH 07/42] =?UTF-8?q?REPORT-93235=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E8=8F=9C=E5=8D=95=E6=A0=8F-=E7=A4=BE=E5=8C=BA?= =?UTF-8?q?=EF=BC=8C=E6=8A=A5=E8=A1=A8=E5=B7=A5=E7=A8=8B=E5=B8=88=E8=AE=A4?= =?UTF-8?q?=E8=AF=81=E8=B7=B3=E8=BD=AC=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/actions/community/QuestionAction.java | 2 +- .../main/java/com/fr/design/actions/community/SignAction.java | 2 +- .../com/fr/design/actions/community/TechSolutionAction.java | 2 +- .../src/main/java/com/fr/design/locale/impl/VideoMark.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java b/designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java index 5b44112254..d6b95217a5 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java @@ -18,7 +18,7 @@ public class QuestionAction extends AbstractDesignerSSO { @Override public String getJumpUrl() { - return CloudCenter.getInstance().acquireUrlByKind("bbs.questions", "http://bbs.fanruan.com/wenda"); + return CloudCenter.getInstance().acquireUrlByKind("bbs.questions", "https://home.fanruan.com/finereport/wenda"); } public static final MenuKeySet QUESTIONS = new MenuKeySet() { diff --git a/designer-base/src/main/java/com/fr/design/actions/community/SignAction.java b/designer-base/src/main/java/com/fr/design/actions/community/SignAction.java index 8c29ee5e66..110af35340 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/SignAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/SignAction.java @@ -18,7 +18,7 @@ public class SignAction extends AbstractDesignerSSO { @Override public String getJumpUrl() { - return CloudCenter.getInstance().acquireUrlByKind("bbs.aut", "https://bbs.fanruan.com/certification/"); + return CloudCenter.getInstance().acquireUrlByKind("bbs.aut", "https://cert.fanruan.com/"); } public static final MenuKeySet SIGN = new MenuKeySet() { diff --git a/designer-base/src/main/java/com/fr/design/actions/community/TechSolutionAction.java b/designer-base/src/main/java/com/fr/design/actions/community/TechSolutionAction.java index 8975555780..9372304868 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/TechSolutionAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/TechSolutionAction.java @@ -20,7 +20,7 @@ public class TechSolutionAction extends AbstractDesignerSSO { @Override public String getJumpUrl() { - return CloudCenter.getInstance().acquireUrlByKind("bbs.solution", "http://bbs.fanruan.com/forum-113-1.html"); + return CloudCenter.getInstance().acquireUrlByKind("bbs.solution", "https://home.fanruan.com/finereport/forum"); } public static final MenuKeySet TSO = new MenuKeySet() { diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java b/designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java index 2521c82c23..571c5e02e9 100644 --- a/designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java +++ b/designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java @@ -16,7 +16,7 @@ public class VideoMark implements LocaleMark { private Map map = new HashMap<>(); private static final String VIDEO_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en_US", "http://www.finereport.com/en/Learning-path"); - private static final String VIDEO_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.zh_CN", "https://edu.fanruan.com/video?class1=16&class2=0"); + private static final String VIDEO_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.zh_CN", "https://home.fanruan.com/finereport/video"); private static final String VIDEO_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.video.zh_TW", "http://www.finereport.com/tw/video"); public VideoMark() { From 62e2b5d6a44f94d78e948a493de2fd300b490f89 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 4 Apr 2023 16:48:52 +0800 Subject: [PATCH 08/42] =?UTF-8?q?REPORT-93234=20=E4=B8=8D=E6=89=93?= =?UTF-8?q?=E5=BC=80=E4=BB=BB=E4=BD=95=E6=8A=A5=E8=A1=A8=EF=BC=8C=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E5=88=87=E6=8D=A2=E5=B7=A5=E4=BD=9C=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=EF=BC=8C=E6=A8=A1=E6=9D=BFtab=E4=BC=9A=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=BC=B9=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/EnvChangeEntrance.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 17d7d5883e..0a464aa6d9 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -134,7 +134,7 @@ public class EnvChangeEntrance { } //REPORT-13810如果只是添加了工作目录,没有切换,这里ToolArea也是要显示新建的工作目录 JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (template != null) { + if (JTemplate.isValid(template)) { template.refreshToolArea(); } PluginErrorDesignReminder.getInstance().remindStartFailedPlugins(); From ba509e753f469b10f296b5b7168a7fd9c93d784f Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Thu, 6 Apr 2023 13:42:54 +0800 Subject: [PATCH 09/42] =?UTF-8?q?REPORT-93250=20=E4=B8=8D=E6=89=93?= =?UTF-8?q?=E5=BC=80=E4=BB=BB=E4=BD=95=E6=8A=A5=E8=A1=A8=EF=BC=8C=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8=E9=85=8D=E7=BD=AE=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E7=82=B9=E5=87=BB=E6=B2=A1=E5=8F=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/webattr/EventPane.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/EventPane.java b/designer-realize/src/main/java/com/fr/design/webattr/EventPane.java index 8c11bc5929..347d942834 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/EventPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/EventPane.java @@ -5,8 +5,11 @@ import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itoolbar.UIToolbar; +import com.fr.design.i18n.Toolkit; import com.fr.design.javascript.ListenerEditPane; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.MenuDef; import com.fr.design.menu.ToolBarDef; import com.fr.design.widget.EventCreator; @@ -238,6 +241,23 @@ public class EventPane extends BasicPane { } public void actionPerformed(ActionEvent e) { + JTemplate jTemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate(); + if (!JTemplate.isValid(jTemplate)) { + //如果当前没打开模板就跳出弹窗 + Object[] options = new Object[]{Toolkit.i18nText("Fine-Design_Basic_Button_OK")}; + FineJOptionPane.showOptionDialog( + EventPane.this, + Toolkit.i18nText("Fine-Design_Please_Open_Template_First"), + Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + JOptionPane.YES_NO_CANCEL_OPTION, + JOptionPane.WARNING_MESSAGE, + null, + options, + options[0] + ); + //如果不支持就直接返回,不提供事件功能 + return ; + } String[] def = WebContent.getDefaultArg(menuName[j]); final ListenerEditPane listenerPane = def == null ? new ListenerEditPane() : new ListenerEditPane(def); Listener lis = new Listener(menuName[j], new JavaScriptImpl()); From bf9b529af8e15f6ac76bcf42120e6e63b3db092f Mon Sep 17 00:00:00 2001 From: "Sky.Luo" Date: Thu, 6 Apr 2023 17:05:34 +0800 Subject: [PATCH 10/42] =?UTF-8?q?REPORT-89901=20feat:=20sql=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/tabledata/wrapper/AbstractTableDataWrapper.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java index be993fa686..fc520a4d36 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java @@ -2,11 +2,13 @@ package com.fr.design.data.tabledata.wrapper; import com.fr.base.TableData; import com.fr.data.TableDataSource; +import com.fr.data.impl.DBTableData; import com.fr.data.impl.EmbeddedTableData; import com.fr.design.DesignModelAdapter; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.utils.DesignUtils; import com.fr.general.ComparatorUtils; @@ -58,6 +60,9 @@ public abstract class AbstractTableDataWrapper implements TableDataWrapper { } EmbeddedTableData embeddedTableData = null; + if (tabledata instanceof DBTableData) { + ((DBTableData) tabledata).setDesignerCurrEditTemplate(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getName()); + } try { embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tds, tabledata, TableData.RESULT_NOT_NEED, false); } catch (Exception e) { @@ -103,6 +108,9 @@ public abstract class AbstractTableDataWrapper implements TableDataWrapper { * */ public void previewData() { + if (tabledata instanceof DBTableData) { + ((DBTableData) tabledata).setDesignerCurrEditTemplate(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getName()); + } PreviewTablePane.previewTableData(tabledata); } From 5728ed0fb0a05f41cab69b9d974ccc8bacaa2016 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Fri, 7 Apr 2023 12:00:17 +0800 Subject: [PATCH 11/42] =?UTF-8?q?REPORT-93234=20=E4=B8=8D=E6=89=93?= =?UTF-8?q?=E5=BC=80=E4=BB=BB=E4=BD=95=E6=8A=A5=E8=A1=A8=EF=BC=8C=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E5=88=87=E6=8D=A2=E5=B7=A5=E4=BD=9C=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=EF=BC=8C=E6=A8=A1=E6=9D=BFtab=E4=BC=9A=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=BC=B9=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/toolbar/ToolBarMenuDock.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 3c75eff39d..3372e2ad13 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 @@ -42,6 +42,7 @@ 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.HistoryTemplateListCache; import com.fr.design.file.NewTemplatePane; import com.fr.design.fun.MenuHandler; import com.fr.design.fun.OemProcessor; @@ -275,7 +276,10 @@ public abstract class ToolBarMenuDock { insertTemplateExtendMenu(plus, menuDefs); // 添加模板菜单 - menuList.addAll(Arrays.asList(menuDefs)); + // 如果是JNullTemplate不能添加模板菜单,之前没有这个JNullTemplate所以没考虑 + if (JTemplate.isValid(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate())) { + menuList.addAll(Arrays.asList(menuDefs)); + } // 添加服务器菜单 if (WorkContext.getCurrent() != null && WorkContext.getCurrent().isRoot()) { From 52277923da17a7f7f406bb6e64842006d3463879 Mon Sep 17 00:00:00 2001 From: "Sky.Luo" Date: Fri, 7 Apr 2023 15:55:20 +0800 Subject: [PATCH 12/42] =?UTF-8?q?REPORT-89901=20feat:=20sql=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/data/DesignTableDataManager.java | 1 + .../data/tabledata/wrapper/AbstractTableDataWrapper.java | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java index 5134e88c8b..2f97977f5b 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java @@ -571,6 +571,7 @@ public abstract class DesignTableDataManager { parameter.setValue(parameterMap.get(parameter.getName())); } } + parameterMap.put("templateName", HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath()); return DataOperator.getInstance().previewTableData(TableDataSourceTailor.extractTableData(tableDataSource), tabledata, parameterMap, rowCount); } catch (Exception e) { throw new TableDataException(e.getMessage(), e); diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java index fc520a4d36..43a9771caf 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java @@ -60,9 +60,6 @@ public abstract class AbstractTableDataWrapper implements TableDataWrapper { } EmbeddedTableData embeddedTableData = null; - if (tabledata instanceof DBTableData) { - ((DBTableData) tabledata).setDesignerCurrEditTemplate(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getName()); - } try { embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tds, tabledata, TableData.RESULT_NOT_NEED, false); } catch (Exception e) { @@ -108,9 +105,6 @@ public abstract class AbstractTableDataWrapper implements TableDataWrapper { * */ public void previewData() { - if (tabledata instanceof DBTableData) { - ((DBTableData) tabledata).setDesignerCurrEditTemplate(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getName()); - } PreviewTablePane.previewTableData(tabledata); } From 8b6fa967afbd8efd4465f98665cf0b7688438ab9 Mon Sep 17 00:00:00 2001 From: "Sky.Luo" Date: Fri, 7 Apr 2023 16:00:10 +0800 Subject: [PATCH 13/42] =?UTF-8?q?REPORT-89901=20feat:=20sql=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/tabledata/wrapper/AbstractTableDataWrapper.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java index 43a9771caf..be993fa686 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java @@ -2,13 +2,11 @@ package com.fr.design.data.tabledata.wrapper; import com.fr.base.TableData; import com.fr.data.TableDataSource; -import com.fr.data.impl.DBTableData; import com.fr.data.impl.EmbeddedTableData; import com.fr.design.DesignModelAdapter; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; -import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.utils.DesignUtils; import com.fr.general.ComparatorUtils; From be631852114495177ae5cc4123b1fcfabe7cdab2 Mon Sep 17 00:00:00 2001 From: Yvan Date: Tue, 11 Apr 2023 17:15:09 +0800 Subject: [PATCH 14/42] =?UTF-8?q?REPORT-89863=5F=E3=80=90=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96=E3=80=91=E7=A7=BB=E5=8A=A8=E7=AB=AFNFC?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=AF=BB=E5=8F=96uid=E4=BF=A1=E6=81=AF=5F?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E6=94=AF=E6=92=91=20=E3=80=90=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91rt=20=E3=80=90=E6=94=B9?= =?UTF-8?q?=E5=8A=A8=E6=80=9D=E8=B7=AF=E3=80=91=E8=AF=A6=E8=A7=81=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E6=96=87=E6=A1=A3-=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E9=83=A8=E5=88=86=EF=BC=8Chttps://kms.fineres.com/pages/viewpa?= =?UTF-8?q?ge.action=3FpageId=3D722437221=20=E3=80=90review=E5=BB=BA?= =?UTF-8?q?=E8=AE=AE=E3=80=91=E6=97=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MobileTextFieldInputSettingPane.java | 90 ++++++++++++++++++- 1 file changed, 87 insertions(+), 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java index faaec45bc8..b736230dd7 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java @@ -3,13 +3,16 @@ package com.fr.design.widget.ui.designer.mobile.component; import com.fr.base.mobile.MobileScanCodeAttr; import com.fr.design.beans.BasicBeanPane; import com.fr.design.constants.LayoutConstants; +import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.layout.VerticalFlowLayout; +import javax.swing.ButtonGroup; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; @@ -25,25 +28,38 @@ public class MobileTextFieldInputSettingPane extends BasicBeanPane { + UICheckBox source = (UICheckBox) e.getSource(); + // 更新面板是否可见 + updateNfcContentTypePane(source.isSelected(), nfcContentTypePane.getSelectedType()); + }); initComponents(); + // 初始状态,内容类型面板不可见 + nfcContentTypePane.setVisible(false); } private void initComponents() { Component[][] components = new Component[][]{ new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Input_Way")), manualInputCheckBox}, new Component[]{null, scanCodeCheckBox}, - new Component[]{null, nfcInputCheckBox} + new Component[]{null, nfcInputCheckBox}, + new Component[]{null, nfcContentTypePane}, }; double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - double[] rowSize = {p, p, p}; + double[] rowSize = {p, p, p, p}; double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; JPanel settingPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.HGAP_LARGE, LayoutConstants.VGAP_LARGE); this.add(settingPane, BorderLayout.NORTH); } @@ -53,6 +69,7 @@ public class MobileTextFieldInputSettingPane extends BasicBeanPane Date: Tue, 11 Apr 2023 19:59:23 +0800 Subject: [PATCH 15/42] =?UTF-8?q?REPORT-93649=20=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E6=9D=83=E9=99=90=EF=BC=8C?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=95=B0=E6=8D=AE=E9=9B=86=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=BB=8D=E7=84=B6=E5=8F=AF=E4=BB=A5=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/BasicTableDataTreePane.java | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java index b3a076a92b..af9850172b 100644 --- a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java @@ -5,14 +5,17 @@ import com.fr.base.TableData; import com.fr.base.svg.IconUtils; import com.fr.data.MultiResultTableData; import com.fr.data.TableDataSource; +import com.fr.data.impl.DBTableData; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; import com.fr.design.data.datapane.TableDataCreatorProducer; import com.fr.design.data.datapane.TableDataNameObjectCreator; import com.fr.design.data.datapane.TableDataSourceOP; import com.fr.design.data.datapane.TableDataTree; +import com.fr.design.data.datapane.auth.TableDataAuthHelper; import com.fr.design.data.tabledata.ResponseDataSourceChange; import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; +import com.fr.design.data.tabledata.tabledatapane.loading.TableDataLoadingPane; import com.fr.design.data.tabledata.wrapper.MultiResultTableDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; @@ -42,6 +45,8 @@ import javax.swing.DefaultCellEditor; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JTree; +import javax.swing.SwingUtilities; +import javax.swing.SwingWorker; import javax.swing.event.CellEditorListener; import javax.swing.event.ChangeEvent; import javax.swing.tree.TreeCellEditor; @@ -51,6 +56,7 @@ import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; +import java.util.Collection; import java.util.EventObject; import java.util.HashMap; import java.util.HashSet; @@ -449,7 +455,45 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp storeProcedureDataWrapper.previewData(MultiResultTableDataWrapper.PREVIEW_ALL); } } else { - ((TableDataWrapper) data).previewData(); + TableDataWrapper wrapper = ((TableDataWrapper) data); + if (TableDataAuthHelper.needCheckAuthWhenEdit(wrapper.getTableData())) { + // 先打开一个Loading面板 + TableDataLoadingPane loadingPane = new TableDataLoadingPane(); + BasicDialog loadingDialog = loadingPane.showLargeWindow(SwingUtilities.getWindowAncestor(BasicTableDataTreePane.this), null); + // 查询权限 + new SwingWorker() { + @Override + protected Boolean doInBackground() throws Exception { + // 获取无权限连接名称集合 + Collection noAuthConnections = TableDataAuthHelper.getNoAuthConnections(); + // 获取当前数据集对应的数据连接名称 + String connectionName = TableDataAuthHelper.getConnectionNameByDBTableData((DBTableData) wrapper.getTableData()); + return !noAuthConnections.contains(connectionName); + } + + @Override + protected void done() { + try { + Boolean hasAuth = get(); + if (hasAuth) { + // 有权限时,关闭Loading面板,打开编辑面板 + loadingDialog.setVisible(false); + wrapper.previewData(); + } else { + // 无权限时,给出无权限提示 + loadingPane.switchTo(TableDataLoadingPane.NO_AUTH_PANE_NAME); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error("loading connection error in remote design", e.getMessage()); + // 查询权限失败时,给出报错提示 + loadingPane.switchTo(TableDataLoadingPane.ERROR_NAME); + } + } + }.execute(); + loadingDialog.setVisible(true); + } else { + wrapper.previewData(); + } } } catch (Exception ex) { From 7a3f3dc7166e2da29fda7b1cd1daeafe2685b418 Mon Sep 17 00:00:00 2001 From: "Sky.Luo" Date: Wed, 12 Apr 2023 11:31:55 +0800 Subject: [PATCH 16/42] =?UTF-8?q?REPORT-89901=20feat:=20sql=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/data/DesignTableDataManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java index 2f97977f5b..175af0653f 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java @@ -32,6 +32,7 @@ import com.fr.file.TableDataConfig; import com.fr.general.ComparatorUtils; import com.fr.general.data.DataModel; import com.fr.general.data.TableDataException; +import com.fr.general.sql.sqlnote.SqlNoteConstants; import com.fr.log.FineLoggerFactory; import com.fr.module.ModuleContext; import com.fr.script.Calculator; @@ -571,7 +572,7 @@ public abstract class DesignTableDataManager { parameter.setValue(parameterMap.get(parameter.getName())); } } - parameterMap.put("templateName", HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath()); + parameterMap.put(SqlNoteConstants.SQL_NOTE_TEMPLATE, HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath()); return DataOperator.getInstance().previewTableData(TableDataSourceTailor.extractTableData(tableDataSource), tabledata, parameterMap, rowCount); } catch (Exception e) { throw new TableDataException(e.getMessage(), e); From 470d10722047618d14deec69d11721c386ef640e Mon Sep 17 00:00:00 2001 From: "coral.chen@fanruan.com" Date: Wed, 12 Apr 2023 13:36:42 +0800 Subject: [PATCH 17/42] =?UTF-8?q?REPORT-90316=20=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E6=8E=A7=E4=BB=B6=E7=9A=84=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...I.java => TextEditorMobilePropertyUI.java} | 15 ++++-- ...e.java => TextEditorMobileDefinePane.java} | 10 ++-- .../widget/WidgetMobilePaneFactory.java | 13 ++++- .../ui/mobile/NumberEditorMobilePane.java | 41 ++++++++++++++ .../widget/ui/mobile/PasswordMobilePane.java | 42 +++++++++++++++ .../widget/ui/mobile/ScanCodeMobilePane.java | 38 ------------- .../widget/ui/mobile/TextAreaMobilePane.java | 42 +++++++++++++++ .../ui/mobile/TextEditorMobilePane.java | 53 +++++++++++++++++++ 8 files changed, 207 insertions(+), 47 deletions(-) rename designer-form/src/main/java/com/fr/design/designer/properties/mobile/{ScanCodeMobilePropertyUI.java => TextEditorMobilePropertyUI.java} (65%) rename designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/{ScanCodeMobileDefinePane.java => TextEditorMobileDefinePane.java} (86%) create mode 100644 designer-realize/src/main/java/com/fr/design/widget/ui/mobile/NumberEditorMobilePane.java create mode 100644 designer-realize/src/main/java/com/fr/design/widget/ui/mobile/PasswordMobilePane.java delete mode 100644 designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java create mode 100644 designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextAreaMobilePane.java create mode 100644 designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextEditorMobilePane.java diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/ScanCodeMobilePropertyUI.java b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/TextEditorMobilePropertyUI.java similarity index 65% rename from designer-form/src/main/java/com/fr/design/designer/properties/mobile/ScanCodeMobilePropertyUI.java rename to designer-form/src/main/java/com/fr/design/designer/properties/mobile/TextEditorMobilePropertyUI.java index 85011ee2b9..531e2c4fc8 100644 --- a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/ScanCodeMobilePropertyUI.java +++ b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/TextEditorMobilePropertyUI.java @@ -5,13 +5,20 @@ import com.fr.design.designer.creator.XTextEditor; import com.fr.design.dialog.BasicPane; import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; import com.fr.design.gui.itable.AbstractPropertyTable; -import com.fr.design.widget.ui.designer.mobile.ScanCodeMobileDefinePane; +import com.fr.design.widget.ui.designer.mobile.TextEditorMobileDefinePane; -public class ScanCodeMobilePropertyUI extends AbstractWidgetPropertyUIProvider { +/** + * 文本控件 + * + * @author Coral.Chen + * @since 11.0 + * Created on 2023/3/30 + */ +public class TextEditorMobilePropertyUI extends AbstractWidgetPropertyUIProvider { private XCreator xCreator; - public ScanCodeMobilePropertyUI(XTextEditor xTextEditor) { + public TextEditorMobilePropertyUI(XTextEditor xTextEditor) { this.xCreator = xTextEditor; } @@ -22,7 +29,7 @@ public class ScanCodeMobilePropertyUI extends AbstractWidgetPropertyUIProvider { @Override public BasicPane createWidgetAttrPane() { - return new ScanCodeMobileDefinePane(xCreator); + return new TextEditorMobileDefinePane(xCreator); } @Override diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TextEditorMobileDefinePane.java similarity index 86% rename from designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java rename to designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TextEditorMobileDefinePane.java index bb785c27d9..17342a372c 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TextEditorMobileDefinePane.java @@ -10,17 +10,21 @@ import com.fr.form.ui.TextEditor; import javax.swing.JPanel; /** + * 文本控件移动端属性 * 输入方式: + * 输入框属性: * * @author hades * @since 11.0 * Created on 2018/11/27 */ -public class ScanCodeMobileDefinePane extends BaseTextEditorMobileDefinePane { - +public class TextEditorMobileDefinePane extends BaseTextEditorMobileDefinePane { + /** + * 输入方式 + */ private MobileTextFieldInputSettingPane inputSettingPane; - public ScanCodeMobileDefinePane(XCreator xCreator) { + public TextEditorMobileDefinePane(XCreator xCreator) { super(xCreator); } diff --git a/designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java b/designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java index 86eba335d9..eef3477c97 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java +++ b/designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java @@ -4,8 +4,14 @@ import com.fr.design.ExtraDesignClassManager; import com.fr.design.fun.CellWidgetOptionProvider; import com.fr.design.widget.mobile.WidgetMobilePane; import com.fr.design.widget.ui.mobile.MultiFileEditorMobilePane; -import com.fr.design.widget.ui.mobile.ScanCodeMobilePane; +import com.fr.design.widget.ui.mobile.NumberEditorMobilePane; +import com.fr.design.widget.ui.mobile.PasswordMobilePane; +import com.fr.design.widget.ui.mobile.TextAreaMobilePane; +import com.fr.design.widget.ui.mobile.TextEditorMobilePane; import com.fr.form.ui.MultiFileEditor; +import com.fr.form.ui.NumberEditor; +import com.fr.form.ui.Password; +import com.fr.form.ui.TextArea; import com.fr.form.ui.TextEditor; import com.fr.form.ui.Widget; import com.fr.general.GeneralContext; @@ -28,7 +34,10 @@ public class WidgetMobilePaneFactory { static { mobilePaneMap.put(MultiFileEditor.class, MultiFileEditorMobilePane.class); - mobilePaneMap.put(TextEditor.class, ScanCodeMobilePane.class); + mobilePaneMap.put(TextEditor.class, TextEditorMobilePane.class); + mobilePaneMap.put(TextArea.class, TextAreaMobilePane.class); + mobilePaneMap.put(NumberEditor.class, NumberEditorMobilePane.class); + mobilePaneMap.put(Password.class, PasswordMobilePane.class); mobilePluginPaneMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetMobileOptionsMap()); GeneralContext.listenPluginRunningChanged(new PluginEventListener() { diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/NumberEditorMobilePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/NumberEditorMobilePane.java new file mode 100644 index 0000000000..8f105c870c --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/NumberEditorMobilePane.java @@ -0,0 +1,41 @@ +package com.fr.design.widget.ui.mobile; + +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.widget.mobile.WidgetMobilePane; +import com.fr.design.widget.ui.designer.mobile.component.MobileTextEditSettingPane; +import com.fr.form.ui.NumberEditor; +import com.fr.form.ui.Widget; + +import java.awt.BorderLayout; + +/** + * 数字控件移动端属性 + * + * @author Coral.Chen + * @since 11.0 + * Created on 2023/4/11 + */ +public class NumberEditorMobilePane extends WidgetMobilePane { + private MobileTextEditSettingPane textSettingPane; + + @Override + protected void init() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + textSettingPane = new MobileTextEditSettingPane(); + this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, textSettingPane), BorderLayout.NORTH); + } + + @Override + public void populate(Widget widget) { + NumberEditor numberEditor = (NumberEditor) widget; + textSettingPane.populateBean(numberEditor.getMobileTextEditAttr()); + } + + @Override + public void update(Widget widget) { + NumberEditor numberEditor = (NumberEditor) widget; + textSettingPane.updateBean(numberEditor.getMobileTextEditAttr()); + } +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/PasswordMobilePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/PasswordMobilePane.java new file mode 100644 index 0000000000..196e6aa1c3 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/PasswordMobilePane.java @@ -0,0 +1,42 @@ +package com.fr.design.widget.ui.mobile; + +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.widget.mobile.WidgetMobilePane; +import com.fr.design.widget.ui.designer.mobile.component.MobilePasswordEditSettingPane; +import com.fr.design.widget.ui.designer.mobile.component.MobileTextEditSettingPane; +import com.fr.form.ui.TextEditor; +import com.fr.form.ui.Widget; + +import java.awt.BorderLayout; + +/** + * 密码控件移动端属性 + * + * @author Coral.Chen + * @since 11.0 + * Created on 2023/4/11 + */ +public class PasswordMobilePane extends WidgetMobilePane { + private MobileTextEditSettingPane textSettingPane; + + @Override + protected void init() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + textSettingPane = new MobilePasswordEditSettingPane(); + this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, textSettingPane), BorderLayout.NORTH); + } + + @Override + public void populate(Widget widget) { + TextEditor textEditor = (TextEditor) widget; + textSettingPane.populateBean(textEditor.getMobileTextEditAttr()); + } + + @Override + public void update(Widget widget) { + TextEditor textEditor = (TextEditor) widget; + textSettingPane.updateBean(textEditor.getMobileTextEditAttr()); + } +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java deleted file mode 100644 index 6f9b379067..0000000000 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.fr.design.widget.ui.mobile; - -import com.fr.base.mobile.MobileScanCodeAttr; -import com.fr.design.foldablepane.UIExpandablePane; -import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.widget.mobile.WidgetMobilePane; -import com.fr.design.widget.ui.designer.mobile.component.MobileTextFieldInputSettingPane; -import com.fr.form.ui.TextEditor; -import com.fr.form.ui.Widget; -import java.awt.BorderLayout; - - -public class ScanCodeMobilePane extends WidgetMobilePane { - - private MobileTextFieldInputSettingPane settingPane; - - @Override - protected void init() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - settingPane = new MobileTextFieldInputSettingPane(); - this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, settingPane), BorderLayout.NORTH); - } - - @Override - public void populate(Widget widget) { - MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr(); - settingPane.populateBean(mobileScanCodeAttr); - } - - @Override - public void update(Widget widget) { - MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr(); - settingPane.updateBean(mobileScanCodeAttr); - } - - -} diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextAreaMobilePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextAreaMobilePane.java new file mode 100644 index 0000000000..2b8edc0e15 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextAreaMobilePane.java @@ -0,0 +1,42 @@ +package com.fr.design.widget.ui.mobile; + +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.widget.mobile.WidgetMobilePane; +import com.fr.design.widget.ui.designer.mobile.component.MobileTextAreaSettingPane; +import com.fr.design.widget.ui.designer.mobile.component.MobileTextEditSettingPane; +import com.fr.form.ui.TextEditor; +import com.fr.form.ui.Widget; + +import java.awt.BorderLayout; + +/** + * 文本域控件移动端属性 + * + * @author Coral.Chen + * @since 11.0 + * Created on 2023/4/11 + */ +public class TextAreaMobilePane extends WidgetMobilePane { + private MobileTextEditSettingPane textSettingPane; + + @Override + protected void init() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + textSettingPane = new MobileTextAreaSettingPane(); + this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, textSettingPane), BorderLayout.NORTH); + } + + @Override + public void populate(Widget widget) { + TextEditor textEditor = (TextEditor) widget; + textSettingPane.populateBean(textEditor.getMobileTextEditAttr()); + } + + @Override + public void update(Widget widget) { + TextEditor textEditor = (TextEditor) widget; + textSettingPane.updateBean(textEditor.getMobileTextEditAttr()); + } +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextEditorMobilePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextEditorMobilePane.java new file mode 100644 index 0000000000..60818cdf95 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextEditorMobilePane.java @@ -0,0 +1,53 @@ +package com.fr.design.widget.ui.mobile; + +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.widget.mobile.WidgetMobilePane; +import com.fr.design.widget.ui.designer.mobile.component.MobileTextEditSettingPane; +import com.fr.design.widget.ui.designer.mobile.component.MobileTextFieldInputSettingPane; +import com.fr.form.ui.TextEditor; +import com.fr.form.ui.Widget; + +import javax.swing.JPanel; +import java.awt.BorderLayout; + + +public class TextEditorMobilePane extends WidgetMobilePane { + + /** + * 输入方式 + */ + private MobileTextFieldInputSettingPane settingPane; + /** + * 输入框属性配置 + */ + private MobileTextEditSettingPane textSettingPane; + + @Override + protected void init() { + JPanel container = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + settingPane = new MobileTextFieldInputSettingPane(); + textSettingPane = new MobileTextEditSettingPane(); + container.add(settingPane); + container.add(textSettingPane); + this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, container), BorderLayout.NORTH); + } + + @Override + public void populate(Widget widget) { + TextEditor textEditor = (TextEditor) widget; + settingPane.populateBean(textEditor.getMobileScanCodeAttr()); + textSettingPane.populateBean(textEditor.getMobileTextEditAttr()); + } + + @Override + public void update(Widget widget) { + TextEditor textEditor = (TextEditor) widget; + settingPane.updateBean(textEditor.getMobileScanCodeAttr()); + textSettingPane.updateBean(textEditor.getMobileTextEditAttr()); + } + + +} From fbb07da941e3495bb1ac33adc9305ecf8a1161c1 Mon Sep 17 00:00:00 2001 From: "coral.chen@fanruan.com" Date: Wed, 12 Apr 2023 13:46:49 +0800 Subject: [PATCH 18/42] =?UTF-8?q?REPORT-90316=20=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/widget/ui/mobile/TextEditorMobilePane.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextEditorMobilePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextEditorMobilePane.java index 60818cdf95..7c836389d7 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextEditorMobilePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextEditorMobilePane.java @@ -12,7 +12,13 @@ import com.fr.form.ui.Widget; import javax.swing.JPanel; import java.awt.BorderLayout; - +/** + * 文本控件移动端属性面板 + * + * @author Coral.Chen + * @since 11.0 + * Created on 2023/4/12 + */ public class TextEditorMobilePane extends WidgetMobilePane { /** From 2fd5bef6309e0db0e1e014f4374047dce9ce5dc5 Mon Sep 17 00:00:00 2001 From: "coral.chen@fanruan.com" Date: Wed, 12 Apr 2023 16:02:54 +0800 Subject: [PATCH 19/42] =?UTF-8?q?REPORT-90316=20=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E5=BB=B6=E6=9C=9F=EF=BC=8C=E5=90=8E=E7=AB=AF=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/creator/XNumberEditor.java | 6 - .../fr/design/designer/creator/XPassword.java | 6 - .../fr/design/designer/creator/XTextArea.java | 11 +- .../mobile/NumberEditorMobilePropertyUI.java | 37 ------ .../mobile/PasswordMobilePropertyUI.java | 37 ------ ...yUI.java => ScanCodeMobilePropertyUI.java} | 15 +-- .../mobile/TextAreaMobilePropertyUI.java | 37 ------ .../BaseTextEditorMobileDefinePane.java | 94 --------------- .../mobile/NumberEditorMobileDefinePane.java | 33 ------ .../mobile/PasswordMobileDefinePane.java | 25 ---- .../mobile/ScanCodeMobileDefinePane.java | 63 ++++++++++ .../mobile/TextAreaAdvancedDefinePane.java | 25 ---- .../mobile/TextEditorMobileDefinePane.java | 55 --------- .../MobilePasswordEditSettingPane.java | 43 ------- .../component/MobileTextAreaSettingPane.java | 38 ------ .../component/MobileTextEditSettingPane.java | 59 ---------- .../MobileTextFieldInputSettingPane.java | 109 +----------------- .../widget/WidgetMobilePaneFactory.java | 13 +-- .../ui/mobile/NumberEditorMobilePane.java | 41 ------- .../widget/ui/mobile/PasswordMobilePane.java | 42 ------- .../widget/ui/mobile/ScanCodeMobilePane.java | 39 +++++++ .../widget/ui/mobile/TextAreaMobilePane.java | 42 ------- .../ui/mobile/TextEditorMobilePane.java | 59 ---------- 23 files changed, 114 insertions(+), 815 deletions(-) delete mode 100644 designer-form/src/main/java/com/fr/design/designer/properties/mobile/NumberEditorMobilePropertyUI.java delete mode 100644 designer-form/src/main/java/com/fr/design/designer/properties/mobile/PasswordMobilePropertyUI.java rename designer-form/src/main/java/com/fr/design/designer/properties/mobile/{TextEditorMobilePropertyUI.java => ScanCodeMobilePropertyUI.java} (65%) delete mode 100644 designer-form/src/main/java/com/fr/design/designer/properties/mobile/TextAreaMobilePropertyUI.java delete mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BaseTextEditorMobileDefinePane.java delete mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/NumberEditorMobileDefinePane.java delete mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/PasswordMobileDefinePane.java create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java delete mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TextAreaAdvancedDefinePane.java delete mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TextEditorMobileDefinePane.java delete mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobilePasswordEditSettingPane.java delete mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextAreaSettingPane.java delete mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextEditSettingPane.java delete mode 100644 designer-realize/src/main/java/com/fr/design/widget/ui/mobile/NumberEditorMobilePane.java delete mode 100644 designer-realize/src/main/java/com/fr/design/widget/ui/mobile/PasswordMobilePane.java create mode 100644 designer-realize/src/main/java/com/fr/design/widget/ui/mobile/ScanCodeMobilePane.java delete mode 100644 designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextAreaMobilePane.java delete mode 100644 designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextEditorMobilePane.java diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XNumberEditor.java b/designer-form/src/main/java/com/fr/design/designer/creator/XNumberEditor.java index 8861d6fcbc..fc359976e2 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XNumberEditor.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XNumberEditor.java @@ -6,9 +6,7 @@ package com.fr.design.designer.creator; import com.fr.base.BaseUtils; import com.fr.base.ScreenResolution; import com.fr.base.Style; -import com.fr.design.designer.properties.mobile.NumberEditorMobilePropertyUI; import com.fr.design.form.util.XCreatorConstants; -import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.mainframe.widget.editors.InChangeBooleanEditor; import com.fr.design.mainframe.widget.editors.SpinnerMaxNumberEditor; import com.fr.design.mainframe.widget.editors.SpinnerMinNumberEditor; @@ -104,8 +102,4 @@ public class XNumberEditor extends XWrapperedFieldEditor { return "number_field_16.png"; } - @Override - public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { - return new WidgetPropertyUIProvider[]{new NumberEditorMobilePropertyUI(this)}; - } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XPassword.java b/designer-form/src/main/java/com/fr/design/designer/creator/XPassword.java index 29de6c9d05..4194e4be03 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XPassword.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XPassword.java @@ -3,9 +3,7 @@ */ package com.fr.design.designer.creator; -import com.fr.design.designer.properties.mobile.PasswordMobilePropertyUI; import com.fr.design.form.util.XCreatorConstants; -import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.gui.ibutton.UIPasswordField; import com.fr.design.mainframe.widget.editors.RegexEditor; import com.fr.design.mainframe.widget.editors.WidgetValueEditor; @@ -70,8 +68,4 @@ public class XPassword extends XWrapperedFieldEditor { (CRPropertyDescriptor[]) ArrayUtils.addAll(sup, new CRPropertyDescriptor[]{regex, waterMark}); } - @Override - public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { - return new WidgetPropertyUIProvider[]{new PasswordMobilePropertyUI(this)}; - } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XTextArea.java b/designer-form/src/main/java/com/fr/design/designer/creator/XTextArea.java index 88d0391ceb..845fe43d9e 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XTextArea.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XTextArea.java @@ -6,9 +6,7 @@ package com.fr.design.designer.creator; import com.fr.base.BaseUtils; import com.fr.base.ScreenResolution; import com.fr.base.Style; -import com.fr.design.designer.properties.mobile.TextAreaMobilePropertyUI; import com.fr.design.form.util.XCreatorConstants; -import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.mainframe.widget.editors.RegexEditor; import com.fr.design.mainframe.widget.editors.WidgetValueEditor; import com.fr.design.mainframe.widget.renderer.RegexCellRencerer; @@ -27,9 +25,8 @@ import java.beans.IntrospectionException; /** * @author richer * @since 6.5.3 - * Created on 2016/3/29 */ -public class XTextArea extends XWrapperedFieldEditor { +public class XTextArea extends XFieldEditor { public XTextArea(TextArea widget, Dimension initSize) { super(widget, initSize); @@ -84,10 +81,4 @@ public class XTextArea extends XWrapperedFieldEditor { protected String getIconName() { return "text_area_16.png"; } - - @Override - public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { - return new WidgetPropertyUIProvider[]{new TextAreaMobilePropertyUI(this)}; - } - } diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/NumberEditorMobilePropertyUI.java b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/NumberEditorMobilePropertyUI.java deleted file mode 100644 index 67a8569f72..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/NumberEditorMobilePropertyUI.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fr.design.designer.properties.mobile; - -import com.fr.design.designer.creator.XCreator; -import com.fr.design.dialog.BasicPane; -import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; -import com.fr.design.gui.itable.AbstractPropertyTable; -import com.fr.design.widget.ui.designer.mobile.NumberEditorMobileDefinePane; - -/** - * 数字控件属性面板注册 - * - * @author Coral.Chen - * @since 11.0 - * Created on 2023/3/30 - */ -public class NumberEditorMobilePropertyUI extends AbstractWidgetPropertyUIProvider { - private XCreator xCreator; - - public NumberEditorMobilePropertyUI(XCreator xCreator) { - this.xCreator = xCreator; - } - - @Override - public AbstractPropertyTable createWidgetAttrTable() { - return null; - } - - @Override - public BasicPane createWidgetAttrPane() { - return new NumberEditorMobileDefinePane(xCreator); - } - - @Override - public String tableTitle() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr"); - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/PasswordMobilePropertyUI.java b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/PasswordMobilePropertyUI.java deleted file mode 100644 index 2c3b3b2270..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/PasswordMobilePropertyUI.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fr.design.designer.properties.mobile; - -import com.fr.design.designer.creator.XCreator; -import com.fr.design.dialog.BasicPane; -import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; -import com.fr.design.gui.itable.AbstractPropertyTable; -import com.fr.design.widget.ui.designer.mobile.PasswordMobileDefinePane; - -/** - * 密码控件移动端属性注册 - * - * @author Coral.Chen - * @since 11.0 - * Created on 2023/3/30 - */ -public class PasswordMobilePropertyUI extends AbstractWidgetPropertyUIProvider { - private XCreator xCreator; - - public PasswordMobilePropertyUI(XCreator xCreator) { - this.xCreator = xCreator; - } - - @Override - public AbstractPropertyTable createWidgetAttrTable() { - return null; - } - - @Override - public BasicPane createWidgetAttrPane() { - return new PasswordMobileDefinePane(xCreator); - } - - @Override - public String tableTitle() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr"); - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/TextEditorMobilePropertyUI.java b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/ScanCodeMobilePropertyUI.java similarity index 65% rename from designer-form/src/main/java/com/fr/design/designer/properties/mobile/TextEditorMobilePropertyUI.java rename to designer-form/src/main/java/com/fr/design/designer/properties/mobile/ScanCodeMobilePropertyUI.java index 531e2c4fc8..85011ee2b9 100644 --- a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/TextEditorMobilePropertyUI.java +++ b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/ScanCodeMobilePropertyUI.java @@ -5,20 +5,13 @@ import com.fr.design.designer.creator.XTextEditor; import com.fr.design.dialog.BasicPane; import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; import com.fr.design.gui.itable.AbstractPropertyTable; -import com.fr.design.widget.ui.designer.mobile.TextEditorMobileDefinePane; +import com.fr.design.widget.ui.designer.mobile.ScanCodeMobileDefinePane; -/** - * 文本控件 - * - * @author Coral.Chen - * @since 11.0 - * Created on 2023/3/30 - */ -public class TextEditorMobilePropertyUI extends AbstractWidgetPropertyUIProvider { +public class ScanCodeMobilePropertyUI extends AbstractWidgetPropertyUIProvider { private XCreator xCreator; - public TextEditorMobilePropertyUI(XTextEditor xTextEditor) { + public ScanCodeMobilePropertyUI(XTextEditor xTextEditor) { this.xCreator = xTextEditor; } @@ -29,7 +22,7 @@ public class TextEditorMobilePropertyUI extends AbstractWidgetPropertyUIProvider @Override public BasicPane createWidgetAttrPane() { - return new TextEditorMobileDefinePane(xCreator); + return new ScanCodeMobileDefinePane(xCreator); } @Override diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/TextAreaMobilePropertyUI.java b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/TextAreaMobilePropertyUI.java deleted file mode 100644 index 1c24e06bce..0000000000 --- a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/TextAreaMobilePropertyUI.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fr.design.designer.properties.mobile; - -import com.fr.design.designer.creator.XCreator; -import com.fr.design.dialog.BasicPane; -import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; -import com.fr.design.gui.itable.AbstractPropertyTable; -import com.fr.design.widget.ui.designer.mobile.TextAreaAdvancedDefinePane; - -/** - * 文本域控件移动端属性 - * - * @author Coral.Chen - * @since 11.0 - * Created on 2023/3/29 - */ -public class TextAreaMobilePropertyUI extends AbstractWidgetPropertyUIProvider { - private XCreator xCreator; - - public TextAreaMobilePropertyUI(XCreator xCreator) { - this.xCreator = xCreator; - } - - @Override - public AbstractPropertyTable createWidgetAttrTable() { - return null; - } - - @Override - public BasicPane createWidgetAttrPane() { - return new TextAreaAdvancedDefinePane(xCreator); - } - - @Override - public String tableTitle() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr"); - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BaseTextEditorMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BaseTextEditorMobileDefinePane.java deleted file mode 100644 index 57faab6a72..0000000000 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BaseTextEditorMobileDefinePane.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.fr.design.widget.ui.designer.mobile; - -import com.fr.design.designer.creator.XCreator; -import com.fr.design.foldablepane.UIExpandablePane; -import com.fr.design.gui.frpane.AttributeChangeListener; -import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.FormDesigner; -import com.fr.design.widget.ui.designer.mobile.component.MobileTextEditSettingPane; -import com.fr.form.ui.TextEditor; - -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.FlowLayout; - -/** - *

文本类组件移动端高级属性的定义面板,基础扩展可以直接继承此面板 - *

往内部添加其他配置 - * - * @author Coral.Chen - * @since 11.0 - * Created on 2023/3/30 - */ -public class BaseTextEditorMobileDefinePane extends MobileWidgetDefinePane { - - private XCreator xCreator; - protected MobileTextEditSettingPane textSettingPane; - - public BaseTextEditorMobileDefinePane(XCreator xCreator) { - this.xCreator = xCreator; - } - - @Override - public void initPropertyGroups(Object source) { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel container = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 5); - addPropertyPanesToContainer(container); - this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, container), BorderLayout.NORTH); - this.repaint(); - } - - /** - * 添加其他属性面板 - * - * @param container 展开容器 - */ - protected void addPropertyPanesToContainer(JPanel container) { - initSettingPane(container); - } - - /** - * 初始化文本类基础面板 - * - * @param container - */ - protected void initSettingPane(JPanel container) { - textSettingPane = new MobileTextEditSettingPane(); - container.add(textSettingPane); - } - - @Override - public void populate(FormDesigner designer) { - TextEditor textEditor = (TextEditor) xCreator.toData(); - textSettingPane.populateBean(textEditor.getMobileTextEditAttr()); - this.bindListeners2Widgets(); - } - - protected void bindListeners2Widgets() { - reInitAllListeners(); - AttributeChangeListener changeListener = new AttributeChangeListener() { - @Override - public void attributeChange() { - update(); - } - }; - this.addAttributeChangeListener(changeListener); - } - - private void reInitAllListeners() { - initListener(this); - } - - @Override - public void update() { - TextEditor textEditor = (TextEditor) xCreator.toData(); - textSettingPane.updateBean(textEditor.getMobileTextEditAttr()); - DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); - } - - public XCreator getxCreator() { - return xCreator; - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/NumberEditorMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/NumberEditorMobileDefinePane.java deleted file mode 100644 index 75c6dbefc0..0000000000 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/NumberEditorMobileDefinePane.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.fr.design.widget.ui.designer.mobile; - -import com.fr.design.designer.creator.XCreator; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.FormDesigner; -import com.fr.form.ui.NumberEditor; - -/** - * 数字控件 - * - * @author Coral.Chen - * @since 11.0 - * Created on 2023/3/30 - */ -public class NumberEditorMobileDefinePane extends BaseTextEditorMobileDefinePane { - public NumberEditorMobileDefinePane(XCreator xCreator) { - super(xCreator); - } - - @Override - public void populate(FormDesigner designer) { - NumberEditor numberEditor = (NumberEditor) getxCreator().toData(); - textSettingPane.populateBean(numberEditor.getMobileTextEditAttr()); - this.bindListeners2Widgets(); - } - - @Override - public void update() { - NumberEditor numberEditor = (NumberEditor) getxCreator().toData(); - textSettingPane.updateBean(numberEditor.getMobileTextEditAttr()); - DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/PasswordMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/PasswordMobileDefinePane.java deleted file mode 100644 index 68c878b459..0000000000 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/PasswordMobileDefinePane.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.fr.design.widget.ui.designer.mobile; - -import com.fr.design.designer.creator.XCreator; -import com.fr.design.widget.ui.designer.mobile.component.MobilePasswordEditSettingPane; - -import javax.swing.JPanel; - -/** - * 密码控件移动端高级属性 - * - * @author Coral.Chen - * @since 11.0 - * Created on 2023/3/30 - */ -public class PasswordMobileDefinePane extends BaseTextEditorMobileDefinePane { - public PasswordMobileDefinePane(XCreator xCreator) { - super(xCreator); - } - - @Override - protected void initSettingPane(JPanel container) { - textSettingPane = new MobilePasswordEditSettingPane(); - container.add(textSettingPane); - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java new file mode 100644 index 0000000000..71c35574a3 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ScanCodeMobileDefinePane.java @@ -0,0 +1,63 @@ +package com.fr.design.widget.ui.designer.mobile; + +import com.fr.base.mobile.MobileScanCodeAttr; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.widget.ui.designer.mobile.component.MobileTextFieldInputSettingPane; +import com.fr.form.ui.TextEditor; + +import java.awt.BorderLayout; + + +public class ScanCodeMobileDefinePane extends MobileWidgetDefinePane { + + private XCreator xCreator; + private MobileTextFieldInputSettingPane settingPane; + + public ScanCodeMobileDefinePane(XCreator xCreator) { + this.xCreator = xCreator; + } + + @Override + public void initPropertyGroups(Object source) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + settingPane = new MobileTextFieldInputSettingPane(); + this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, settingPane), BorderLayout.NORTH); + this.repaint(); + } + + private void bindListeners2Widgets() { + reInitAllListeners(); + AttributeChangeListener changeListener = new AttributeChangeListener() { + @Override + public void attributeChange() { + update(); + } + }; + this.addAttributeChangeListener(changeListener); + } + + private void reInitAllListeners() { + initListener(this); + } + + @Override + public void populate(FormDesigner designer) { + MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) xCreator.toData()).getMobileScanCodeAttr(); + settingPane.populateBean(mobileScanCodeAttr); + this.bindListeners2Widgets(); + } + + @Override + public void update() { + MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) xCreator.toData()).getMobileScanCodeAttr(); + settingPane.updateBean(mobileScanCodeAttr); + DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); + } + +} diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TextAreaAdvancedDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TextAreaAdvancedDefinePane.java deleted file mode 100644 index ccc3194f9f..0000000000 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TextAreaAdvancedDefinePane.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.fr.design.widget.ui.designer.mobile; - -import com.fr.design.designer.creator.XCreator; -import com.fr.design.widget.ui.designer.mobile.component.MobileTextAreaSettingPane; - -import javax.swing.JPanel; - -/** - * 文本域控件 - * - * @author Coral.Chen - * @since 11.0 - * Created on 2023/3/29 - */ -public class TextAreaAdvancedDefinePane extends BaseTextEditorMobileDefinePane { - public TextAreaAdvancedDefinePane(XCreator xCreator) { - super(xCreator); - } - - @Override - protected void initSettingPane(JPanel container) { - textSettingPane = new MobileTextAreaSettingPane(); - container.add(textSettingPane); - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TextEditorMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TextEditorMobileDefinePane.java deleted file mode 100644 index 17342a372c..0000000000 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TextEditorMobileDefinePane.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.fr.design.widget.ui.designer.mobile; - -import com.fr.design.designer.creator.XCreator; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.FormDesigner; -import com.fr.design.widget.ui.designer.mobile.component.MobileTextEditSettingPane; -import com.fr.design.widget.ui.designer.mobile.component.MobileTextFieldInputSettingPane; -import com.fr.form.ui.TextEditor; - -import javax.swing.JPanel; - -/** - * 文本控件移动端属性 - * 输入方式: - * 输入框属性: - * - * @author hades - * @since 11.0 - * Created on 2018/11/27 - */ -public class TextEditorMobileDefinePane extends BaseTextEditorMobileDefinePane { - /** - * 输入方式 - */ - private MobileTextFieldInputSettingPane inputSettingPane; - - public TextEditorMobileDefinePane(XCreator xCreator) { - super(xCreator); - } - - @Override - protected void initSettingPane(JPanel container) { - inputSettingPane = new MobileTextFieldInputSettingPane(); - textSettingPane = new MobileTextEditSettingPane(); - container.add(inputSettingPane); - container.add(textSettingPane); - } - - - @Override - public void populate(FormDesigner designer) { - super.populate(designer); - TextEditor textEditor = (TextEditor) getxCreator().toData(); - inputSettingPane.populateBean(textEditor.getMobileScanCodeAttr()); - this.bindListeners2Widgets(); - } - @Override - public void update() { - super.update(); - TextEditor textEditor = (TextEditor) getxCreator().toData(); - inputSettingPane.updateBean(textEditor.getMobileScanCodeAttr()); - DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); - } - -} diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobilePasswordEditSettingPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobilePasswordEditSettingPane.java deleted file mode 100644 index db475dc569..0000000000 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobilePasswordEditSettingPane.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.fr.design.widget.ui.designer.mobile.component; - -import com.fr.base.mobile.MobileTextEditAttr; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.i18n.Toolkit; - -import java.awt.BorderLayout; - -/** - * 密码控件编辑属性设置面板 - * - * @author Coral.Chen - * @since 11.0 - * Created on 2023/3/30 - */ -public class MobilePasswordEditSettingPane extends MobileTextEditSettingPane { - // 显示字数统计 - private UICheckBox showPassword; - - public MobilePasswordEditSettingPane() { - super(); - showPassword = new UICheckBox(Toolkit.i18nText("Fine-Design_Mobile_Show_Password"), false); - this.add(showPassword, BorderLayout.NORTH); - } - - @Override - protected boolean getClearDefaultState() { - return true; - } - - @Override - public void populateBean(MobileTextEditAttr ob) { - super.populateBean(ob); - // 要兼容处理一下,为null 的话赋默认值,默认开启 - this.showPassword.setSelected(ob.isShowPassword() == null || ob.isShowPassword()); - } - - @Override - public void updateBean(MobileTextEditAttr ob) { - super.updateBean(ob); - ob.setShowPassword(showPassword.isSelected()); - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextAreaSettingPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextAreaSettingPane.java deleted file mode 100644 index d660508e6e..0000000000 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextAreaSettingPane.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.fr.design.widget.ui.designer.mobile.component; - -import com.fr.base.mobile.MobileTextEditAttr; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.i18n.Toolkit; - -import java.awt.BorderLayout; - -/** - * 文本域控件 - * - * @author Coral.Chen - * @since 11.0 - * Created on 2023/3/29 - */ -public class MobileTextAreaSettingPane extends MobileTextEditSettingPane { - // 显示字数统计 - private UICheckBox showWordCount; - - public MobileTextAreaSettingPane() { - super(); - showWordCount = new UICheckBox(Toolkit.i18nText("Fine-Design_Mobile_Show_Word_Count"), false); - this.add(showWordCount, BorderLayout.NORTH); - } - - @Override - public void populateBean(MobileTextEditAttr ob) { - super.populateBean(ob); - // 要兼容处理一下,为null 的话赋默认值,默认不开启 - this.showWordCount.setSelected(ob.isShowWordCount() != null && ob.isShowWordCount()); - } - - @Override - public void updateBean(MobileTextEditAttr ob) { - super.updateBean(ob); - ob.setShowWordCount(showWordCount.isSelected()); - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextEditSettingPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextEditSettingPane.java deleted file mode 100644 index 56d340e4d0..0000000000 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextEditSettingPane.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.fr.design.widget.ui.designer.mobile.component; - -import com.fr.base.mobile.MobileTextEditAttr; -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.i18n.Toolkit; -import com.fr.design.layout.VerticalFlowLayout; - -import java.awt.BorderLayout; -import java.awt.FlowLayout; - -/** - * 文本类基础设置 - * - * @author Coral.Chen - * @since 11.0 - * Created on 2023/3/29 - */ -public class MobileTextEditSettingPane extends BasicBeanPane { - // 允许一键清空 - protected UICheckBox allowOneClickClear; - - public MobileTextEditSettingPane() { - initLayout(); - allowOneClickClear = new UICheckBox(Toolkit.i18nText("Fine-Design_Mobile_Allow_One_Click_Clear"), getClearDefaultState()); - this.add(allowOneClickClear, BorderLayout.NORTH); - } - - protected boolean getClearDefaultState() { - return false; - } - - protected void initLayout() { - VerticalFlowLayout verticalFlowLayout = new VerticalFlowLayout(FlowLayout.LEADING, 0, 5); - verticalFlowLayout.setAlignLeft(true); - this.setLayout(verticalFlowLayout); - } - - @Override - public void populateBean(MobileTextEditAttr ob) { - allowOneClickClear.setSelected(ob.isAllowOneClickClear() != null && ob.isAllowOneClickClear()); - } - - @Override - public MobileTextEditAttr updateBean() { - // do nothing - return null; - } - - @Override - public void updateBean(MobileTextEditAttr ob) { - ob.setAllowOneClickClear(allowOneClickClear.isSelected()); - } - - @Override - protected String title4PopupWindow() { - return null; - } -} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java index b736230dd7..cdddc3e79f 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java @@ -2,20 +2,13 @@ package com.fr.design.widget.ui.designer.mobile.component; import com.fr.base.mobile.MobileScanCodeAttr; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.constants.LayoutConstants; -import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.layout.VerticalFlowLayout; -import javax.swing.ButtonGroup; import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.Component; +import java.awt.FlowLayout; /** * @author hades @@ -28,39 +21,15 @@ public class MobileTextFieldInputSettingPane extends BasicBeanPane { - UICheckBox source = (UICheckBox) e.getSource(); - // 更新面板是否可见 - updateNfcContentTypePane(source.isSelected(), nfcContentTypePane.getSelectedType()); - }); - initComponents(); - // 初始状态,内容类型面板不可见 - nfcContentTypePane.setVisible(false); - } - - private void initComponents() { - Component[][] components = new Component[][]{ - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Input_Way")), manualInputCheckBox}, - new Component[]{null, scanCodeCheckBox}, - new Component[]{null, nfcInputCheckBox}, - new Component[]{null, nfcContentTypePane}, - }; - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] rowSize = {p, p, p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; - JPanel settingPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.HGAP_LARGE, LayoutConstants.VGAP_LARGE); + settingPane.add(manualInputCheckBox); + settingPane.add(scanCodeCheckBox); + settingPane.add(nfcInputCheckBox); this.add(settingPane, BorderLayout.NORTH); } @@ -69,7 +38,6 @@ public class MobileTextFieldInputSettingPane extends BasicBeanPane Date: Thu, 13 Apr 2023 10:14:01 +0800 Subject: [PATCH 20/42] =?UTF-8?q?REPORT-89863=20=E3=80=90=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96=E3=80=91=E7=A7=BB=E5=8A=A8=E7=AB=AFNFC?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=AF=BB=E5=8F=96uid=E4=BF=A1=E6=81=AF---?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E6=94=AF=E6=92=91=20=E3=80=90=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91=E4=BB=BB=E5=8A=A1REPORT-90?= =?UTF-8?q?316=20=E5=BB=B6=E6=9C=9F=EF=BC=8C=E5=9B=9E=E9=80=80=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=BD=B1=E5=93=8D=E4=BA=86=E8=BF=99=E9=83=A8=E5=88=86?= =?UTF-8?q?=20=E3=80=90=E6=94=B9=E5=8A=A8=E6=80=9D=E8=B7=AF=E3=80=91?= =?UTF-8?q?=E6=8C=89=E7=85=A7=E5=8E=9F=E6=9D=A5=E7=9A=84=E8=A7=84=E6=A0=BC?= =?UTF-8?q?=E6=8A=8A=E6=96=B0=E9=9D=A2=E6=9D=BF=E5=8A=A0=E4=B8=8A=E5=8E=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MobileTextFieldInputSettingPane.java | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java index cdddc3e79f..fb9daa30f3 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTextFieldInputSettingPane.java @@ -2,10 +2,13 @@ package com.fr.design.widget.ui.designer.mobile.component; import com.fr.base.mobile.MobileScanCodeAttr; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.VerticalFlowLayout; +import javax.swing.ButtonGroup; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.FlowLayout; @@ -21,15 +24,28 @@ public class MobileTextFieldInputSettingPane extends BasicBeanPane { + UICheckBox source = (UICheckBox) e.getSource(); + // 更新面板是否可见 + updateNfcContentTypePane(source.isSelected(), nfcContentTypePane.getSelectedType()); + }); settingPane.add(manualInputCheckBox); settingPane.add(scanCodeCheckBox); settingPane.add(nfcInputCheckBox); + settingPane.add(nfcContentTypePane); + // 初始状态,内容类型面板不可见 + nfcContentTypePane.setVisible(false); this.add(settingPane, BorderLayout.NORTH); } @@ -38,6 +54,7 @@ public class MobileTextFieldInputSettingPane extends BasicBeanPane Date: Thu, 13 Apr 2023 19:46:07 +0800 Subject: [PATCH 21/42] =?UTF-8?q?REPORT-75308=20FVS=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=94=AF=E6=8C=81=E5=90=8C=E6=97=B6=E6=89=93?= =?UTF-8?q?=E5=BC=80=E5=A4=9A=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../file/CloseCurrentTemplateAction.java | 8 +- .../fr/design/actions/file/RenameAction.java | 4 +- .../design/actions/file/SwitchExistEnv.java | 2 +- .../java/com/fr/design/file/CloseOption.java | 43 ++ .../design/file/HistoryTemplateListCache.java | 41 +- .../file/MultiTemplateTabMenuFactory.java | 346 +++++++++++++ .../fr/design/file/MultiTemplateTabPane.java | 486 ++---------------- .../fr/design/file/MutilTempalteTabPane.java | 6 +- .../com/fr/design/file/NewTemplatePane.java | 6 +- .../fr/design/file/SaveSomeTemplatePane.java | 19 +- .../fr/design/file/TemplateTabManager.java | 253 +++++++++ .../file/TemplateTabOperateProvider.java | 114 ++++ .../file/impl/AbstractTemplateTabOperate.java | 332 ++++++++++++ .../file/impl/DefaultTemplateTabOperate.java | 31 ++ .../file/impl/EmptyTemplateTabOperator.java | 109 ++++ .../mainframe/CenterRegionContainerPane.java | 29 +- .../mainframe/DefaultToolKitConfig.java | 8 + .../fr/design/mainframe/DesignerFrame.java | 8 +- .../DesignerFrameFileDealerPane.java | 15 +- .../com/fr/design/mainframe/JTemplate.java | 21 +- .../mainframe/ToolKitConfigStrategy.java | 10 + .../mainframe/toolbar/ToolBarMenuDock.java | 4 +- .../vcs/ui/FileVersionCellEditor.java | 8 +- .../mainframe/vcs/ui/FileVersionsPanel.java | 8 +- .../com/fr/design/worker/open/OpenWorker.java | 4 +- .../designer/toolbar/TemplateTransformer.java | 8 +- .../main/java/com/fr/start/BaseDesigner.java | 6 +- .../start/common/DesignerOpenEmptyPanel.java | 4 +- .../fr/design/fit/common/TemplateTool.java | 4 +- .../fr/design/preview/DeveloperPreview.java | 5 +- .../com/fr/design/mainframe/JWorkBook.java | 4 +- .../main/java/com/fr/start/MainDesigner.java | 4 +- 32 files changed, 1426 insertions(+), 524 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/file/CloseOption.java create mode 100644 designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java create mode 100644 designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java create mode 100644 designer-base/src/main/java/com/fr/design/file/TemplateTabOperateProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java create mode 100644 designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java create mode 100644 designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java diff --git a/designer-base/src/main/java/com/fr/design/actions/file/CloseCurrentTemplateAction.java b/designer-base/src/main/java/com/fr/design/actions/file/CloseCurrentTemplateAction.java index 22263a871e..b2ab237d7d 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/CloseCurrentTemplateAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/CloseCurrentTemplateAction.java @@ -3,7 +3,7 @@ package com.fr.design.actions.file; import com.fr.design.actions.UpdateAction; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.file.MultiTemplateTabPane; +import com.fr.design.file.TemplateTabManager; import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.KeySetUtils; @@ -28,9 +28,9 @@ public class CloseCurrentTemplateAction extends UpdateAction { * @param e 事件 */ public void actionPerformed(ActionEvent e) { - MultiTemplateTabPane.getInstance().setIsCloseCurrent(true); - MultiTemplateTabPane.getInstance().closeFormat(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); - MultiTemplateTabPane.getInstance().closeSpecifiedTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); + TemplateTabManager.getInstance().setCloseCurrent(true); + TemplateTabManager.getInstance().closeFormat(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); + TemplateTabManager.getInstance().closeSpecifiedTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); } @Override diff --git a/designer-base/src/main/java/com/fr/design/actions/file/RenameAction.java b/designer-base/src/main/java/com/fr/design/actions/file/RenameAction.java index 842292ce2a..33f51b77aa 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/RenameAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/RenameAction.java @@ -7,7 +7,7 @@ import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.FileOperations; import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.file.MultiTemplateTabPane; +import com.fr.design.file.TemplateTabManager; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; @@ -88,7 +88,7 @@ public class RenameAction extends UpdateAction { } new FileRenameDialog(node); - MultiTemplateTabPane.getInstance().repaint(); + TemplateTabManager.getInstance().refresh(); DesignerFrameFileDealerPane.getInstance().stateChange(); } diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java index 33761a92e2..e38a39895a 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java @@ -68,7 +68,7 @@ public class SwitchExistEnv extends MenuDef { EnvChangeEntrance.getInstance().chooseEnv(envName); } else { SaveSomeTemplatePane saveSomeTemplatePane = new SaveSomeTemplatePane(true); - if (saveSomeTemplatePane.showSavePane()) { + if (saveSomeTemplatePane.showSavePane(true)) { // 用户模板保存后,才进行切换目录操作 EnvChangeEntrance.getInstance().switch2Env(envName); } diff --git a/designer-base/src/main/java/com/fr/design/file/CloseOption.java b/designer-base/src/main/java/com/fr/design/file/CloseOption.java new file mode 100644 index 0000000000..c88e7658c8 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/file/CloseOption.java @@ -0,0 +1,43 @@ +package com.fr.design.file; + +import com.fr.design.i18n.Toolkit; + +public enum CloseOption { + Left(Toolkit.i18nText("Fine-Design_Close_templates_To_The_Left")) { + @Override + public boolean shouldClose(int tplIndex, int i) { + return i < tplIndex; + } + }, + + Right(Toolkit.i18nText("Fine-Design_Close_templates_To_The_Right")) { + @Override + public boolean shouldClose(int tplIndex, int i) { + return i > tplIndex; + } + + }, All(Toolkit.i18nText("Fine-Design_Close_All_templates")), + + Others(Toolkit.i18nText("Fine-Design_Close_Other_templates")) { + @Override + public boolean shouldClose(int tplIndex, int i) { + return i != tplIndex; + } + }; + + + private String optionName; + + public String getOptionName() { + return this.optionName; + } + + CloseOption(String optionName) { + this.optionName = optionName; + } + + public boolean shouldClose(int tplIndex, int i) { + return true; + } + +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 86820aa227..083aa2ed08 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -75,7 +75,7 @@ public class HistoryTemplateListCache implements CallbackEvent { historyList.remove(contains(selected)); selected.getEditingFILE().closeTemplate(); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Closed_Warn_Text", selected.getEditingFILE().getName())); - MultiTemplateTabPane.getInstance().refreshOpenedTemplate(historyList); + TemplateTabManager.getInstance().refreshOpenedTemplate(historyList); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -134,10 +134,10 @@ public class HistoryTemplateListCache implements CallbackEvent { if (contains(jt) == -1) { addHistory(); } - MultiTemplateTabPane.getInstance().refreshOpenedTemplate(historyList); + TemplateTabManager.getInstance().refreshOpenedTemplate(historyList); //设置tab栏为当前选中的那一栏 if (editingTemplate != null) { - MultiTemplateTabPane.getInstance().setSelectedIndex(contains(jt)); + TemplateTabManager.getInstance().resetSelectIndex(jt); } } @@ -268,13 +268,14 @@ public class HistoryTemplateListCache implements CallbackEvent { boolean replaceWithJVirtualTemplate = overTemplate.getEditingFILE().exists() && overTemplate.isALLSaved() && overTemplate != editingTemplate - && overTemplate.checkEnable(); + && overTemplate.checkEnable() + && overTemplate.supportCache(); if (replaceWithJVirtualTemplate) { closeVirtualSelectedReport(overTemplate); historyList.set(i, new JVirtualTemplate(overTemplate.getEditingFILE())); } } - MultiTemplateTabPane.getInstance().refreshOpenedTemplate(historyList); + TemplateTabManager.getInstance().refreshOpenedTemplate(historyList); } @@ -285,35 +286,27 @@ public class HistoryTemplateListCache implements CallbackEvent { // path like reportlets/xx/xxx/xxx String path = file.getPath() + suffix; - - ListIterator> iterator = historyList.listIterator(); - + List list = new ArrayList(); + for(JTemplate jTemplate : historyList){ + list.add(jTemplate); + } + ListIterator> iterator = list.listIterator(); while (iterator.hasNext()) { JTemplate template = iterator.next(); String tPath = template.getPath(); if (isDir ? tPath.startsWith(path) : tPath.equals(path)) { - int size = getHistoryCount(); - iterator.remove(); - int index = iterator.nextIndex(); - if (size == index + 1 && index > 0) { - //如果删除的是后一个Tab,则定位到前一个 - MultiTemplateTabPane.getInstance().setSelectedIndex(index - 1); - } + historyList.remove(template); + TemplateTabManager.getInstance().deleteOpenedTemplate(template); } } - //如果打开过,则删除,实时刷新多tab面板 - int openFileCount = getHistoryCount(); - if (openFileCount == 0) { - DesignerContext.getDesignerFrame().addAndActivateJTemplate(); - } - JTemplate selectedFile = MultiTemplateTabPane.getInstance().getSelectedFile(); + JTemplate selectedFile = TemplateTabManager.getInstance().getSelectedFile(); if (!isCurrentEditingFile(selectedFile.getPath())) { //如果此时面板上的实时刷新的selectedIndex得到的和历史的不一样 DesignerContext.getDesignerFrame().activateJTemplate(selectedFile); } - MultiTemplateTabPane.getInstance().repaint(); + TemplateTabManager.getInstance().refresh(); } @@ -474,7 +467,7 @@ public class HistoryTemplateListCache implements CallbackEvent { int index = contains(this.editingTemplate); this.editingTemplate = jt; historyList.set(index, jt); - MultiTemplateTabPane.getInstance().refreshOpenedTemplate(historyList); - MultiTemplateTabPane.getInstance().setSelectedIndex(contains(jt)); + TemplateTabManager.getInstance().refreshOpenedTemplate(historyList); + TemplateTabManager.getInstance().resetSelectIndex(jt); } } diff --git a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java new file mode 100644 index 0000000000..a67e129f78 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java @@ -0,0 +1,346 @@ +package com.fr.design.file; + +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.imenu.UIMenuItem; +import com.fr.design.gui.imenu.UIScrollPopUpMenu; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.utils.TemplateUtils; +import com.fr.file.FILE; +import com.fr.general.IOUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.collections.CollectionUtils; +import com.fr.third.javax.annotation.Nonnull; + +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * @author Carlson + * @version 11.0 + * @description + **/ +public class MultiTemplateTabMenuFactory { + + private static final Icon CLOSE = IOUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png"); + private static final Icon MOUSE_OVER_CLOSE = IOUtils.readIcon("/com/fr/design/images/buttonicon/mouseoverclose icon.png"); + private static final Icon MOUSE_PRESS_CLOSE = IOUtils.readIcon("/com/fr/design/images/buttonicon/pressclose icon.png"); + + private static final int ITEM_SIZE = 25; + + private UIScrollPopUpMenu menu = null; + + private static MultiTemplateTabMenuFactory INSTANCE = new MultiTemplateTabMenuFactory(); + + private MultiTemplateTabMenuFactory() { + + } + + public static MultiTemplateTabMenuFactory getInstance() { + return INSTANCE; + } + + /** + * tab上的下拉菜单 + */ + public UIScrollPopUpMenu createMenu() { + menu = new UIScrollPopUpMenu(); + menu.setBorder(BorderFactory.createEmptyBorder(-3, 3, 3, 0)); + + menu.add(initCloseOther()); + menu.add(createEmptyRow()); + menu.addSeparator(); + menu.add(createEmptyRow()); + menu.add(createCategory(Toolkit.i18nText("Fine-Design_Basic_Tab_Current_Category_Templates"))); + Component[] items = createCurrentCategory(); + for (Component item : items) { + menu.add(item); + } + items = createOtherCategory(); + if (items.length > 0) { + menu.addSeparator(); + menu.add(createEmptyRow()); + menu.add(createCategory(Toolkit.i18nText("Fine-Design_Basic_Tab_Other_Category_Templates"))); + for (Component item : items) { + menu.add(item); + } + } + Dimension dimension = menu.getPreferredSize(); + dimension.width += ITEM_SIZE; + menu.setPreferredSize(dimension); + return menu; + } + + /** + * 关闭其它按钮 + */ + private UIMenuItem initCloseOther() { + UIMenuItem closeOther = new UIMenuItem(Toolkit.i18nText("Fine-Design_Basic_Tab_Close_Other_Templates_Of_Current_Category")); + closeOther.setHorizontalAlignment(SwingConstants.CENTER); + Dimension dimension = closeOther.getPreferredSize(); + dimension.height = ITEM_SIZE; + closeOther.setPreferredSize(dimension); + closeOther.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + TemplateTabManager.getInstance().closeOthers(); + } + + }); + if (TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().size() <= 1) { + closeOther.setEnabled(false); + } + return closeOther; + } + + private void closeAndFreeLock(@Nonnull JTemplate template) { + FILE file = template.getEditingFILE(); + // 只有是环境内的文件,才执行释放锁 + if (file != null && file.isEnvFile()) { + // release lock + TemplateResourceManager.getResource().closeTemplate(file.getPath()); + } + } + + /** + * 美观用 + */ + private JPanel createEmptyRow() { + return new JPanel() { + @Override + public Dimension getPreferredSize() { + Dimension d = super.getPreferredSize(); + d.height = 1; + return d; + } + }; + } + + /** + * 模板分类item + */ + private UIButton createCategory(String categoryName) { + UIButton button = new UIButton(categoryName); + button.setBorderPainted(false); + button.setExtraPainted(false); + button.setPreferredSize(new Dimension(menu.getWidth(), ITEM_SIZE)); + button.setOpaque(true); + button.setBackground(UIConstants.NORMAL_BACKGROUND); + button.setHorizontalAlignment(SwingConstants.LEFT); + button.setForeground(UIConstants.FLESH_BLUE); + return button; + } + + /** + * 创建 当前分类模板 item数组 + */ + private Component[] createCurrentCategory() { + return createListDownItem(TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates()); + } + + /** + * 创建 其它分类模板 item数组 + */ + private Component[] createOtherCategory() { + List> openedTemplates = new ArrayList<>(); + Map>> map = TemplateTabManager.getInstance().getAllOpenedTemplateMap(); + for (Map.Entry>> entry : map.entrySet()) { + if (!StringUtils.equals(TemplateTabManager.getInstance().getCurrentOperator().getOperatorType(), entry.getKey())) { + openedTemplates.addAll(entry.getValue()); + } + } + return createListDownItem(openedTemplates); + } + + /** + * 根据template列表创建多个item + */ + private Component[] createListDownItem(List> openedTemplates) { + if (!CollectionUtils.isEmpty(openedTemplates)) { + Component[] templates = new Component[openedTemplates.size()]; + for (int i = 0; i < openedTemplates.size(); i++) { + templates[i] = createListDownMenuItem(openedTemplates.get(i)); + } + return templates; + } + return new Component[0]; + } + + /** + * 根据template对象创建item + */ + private Component createListDownMenuItem(JTemplate template) { + JPanel jPanel = new JPanel(); + jPanel.setPreferredSize(new Dimension(menu.getWidth(), ITEM_SIZE)); + jPanel.setLayout(new BorderLayout()); + + MenuItemButtonGroup menuItemButtonGroup = new MenuItemButtonGroup(template); + if (template == HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()) { + menuItemButtonGroup.templateButton.setForeground(UIConstants.FLESH_BLUE); + } + + jPanel.add(menuItemButtonGroup.iconButton, BorderLayout.WEST); + jPanel.add(menuItemButtonGroup.templateButton, BorderLayout.CENTER); + jPanel.add(menuItemButtonGroup.closeButton, BorderLayout.EAST); + + return jPanel; + } + + /** + * menu的item由模板图标、模板名、模板关闭按钮组成 + */ + private class MenuItemButtonGroup { + + private final UIButton iconButton; + private final UIButton templateButton; + private final UIButton closeButton; + + public MenuItemButtonGroup(JTemplate template) { + iconButton = createIconButton(template); + templateButton = createTemplateButton(template); + closeButton = createCloseButton(); + initListener(template); + } + + /** + * item[0] 模板图标按钮初始化 + */ + private UIButton createIconButton(JTemplate template) { + UIButton button = new UIButton(template.getIcon(), template.getIcon(), template.getIcon()); + button.setPreferredSize(new Dimension(ITEM_SIZE, ITEM_SIZE)); + button.setOpaque(true); + button.setBackground(UIConstants.NORMAL_BACKGROUND); + return button; + } + + /** + * item[1] 切换模板按钮初始化 + */ + private UIButton createTemplateButton(JTemplate template) { + UIButton button = new UIButton(TemplateUtils.createLockeTemplatedName(template, template.getTemplateName())); + button.setBorderPainted(false); + button.setExtraPainted(false); + button.setPreferredSize(new Dimension(menu.getWidth() - ITEM_SIZE * 2, ITEM_SIZE)); + button.setOpaque(true); + button.setBackground(UIConstants.NORMAL_BACKGROUND); + button.setHorizontalAlignment(SwingConstants.LEFT); + return button; + } + + /** + * item[2] 关闭模板图标按钮初始化 + */ + private UIButton createCloseButton() { + UIButton button = new UIButton(CLOSE, MOUSE_OVER_CLOSE, MOUSE_PRESS_CLOSE); + button.setPreferredSize(new Dimension(ITEM_SIZE, ITEM_SIZE)); + button.setOpaque(true); + button.setBackground(UIConstants.NORMAL_BACKGROUND); + button.setVisible(false); + return button; + } + + private void initListener(JTemplate template) { + initIconButtonListener(); + initTemplateButtonListener(template); + initCloseButtonListener(template); + } + + /** + * item[0] 模板图标按钮鼠标事件 + */ + private void initIconButtonListener() { + iconButton.addMouseListener(new MouseAdapter() { + @Override + public void mouseEntered(MouseEvent e) { + fireMouseEnteredEvent(); + } + + @Override + public void mouseExited(MouseEvent e) { + fireMouseExitedEvent(); + } + }); + } + + /** + * item[1] 切换模板按钮鼠标事件 + */ + private void initTemplateButtonListener(JTemplate template) { + templateButton.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + menu.setVisible(false); + TemplateTabManager.getInstance().switchByJTemplate(template); + } + + @Override + public void mouseEntered(MouseEvent e) { + fireMouseEnteredEvent(); + } + + @Override + public void mouseExited(MouseEvent e) { + fireMouseExitedEvent(); + } + }); + } + + /** + * item[2] 关闭模板按钮鼠标事件 + */ + private void initCloseButtonListener(JTemplate template) { + closeButton.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + menu.setVisible(false); + TemplateTabManager.getInstance().closeByJTemplate(template); + } + + @Override + public void mouseEntered(MouseEvent e) { + fireMouseEnteredEvent(); + } + + @Override + public void mouseExited(MouseEvent e) { + fireMouseExitedEvent(); + } + }); + } + + /** + * mouse移入item范围 + */ + private void fireMouseEnteredEvent() { + iconButton.setBackground(UIConstants.HOVER_BLUE); + templateButton.setBackground(UIConstants.HOVER_BLUE); + closeButton.setBackground(UIConstants.HOVER_BLUE); + closeButton.setVisible(true); + } + + /** + * mouse移出item范围 + */ + private void fireMouseExitedEvent() { + iconButton.setBackground(UIConstants.NORMAL_BACKGROUND); + templateButton.setBackground(UIConstants.NORMAL_BACKGROUND); + closeButton.setBackground(UIConstants.NORMAL_BACKGROUND); + closeButton.setVisible(false); + } + + } + +} diff --git a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java index 8e302fd977..efc4565e00 100644 --- a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java @@ -1,38 +1,28 @@ package com.fr.design.file; -import com.fr.base.BaseUtils; import com.fr.base.GraphHelper; import com.fr.base.svg.IconUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.file.LocateAction; import com.fr.design.constants.UIConstants; -import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIScrollPopUpMenu; import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.i18n.Toolkit; -import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.TemplateSavingChecker; -import com.fr.design.mainframe.manager.search.TemplateTreeSearchManager; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.TemplateUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUIPaintUtils; -import com.fr.design.worker.WorkerManager; -import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.file.FILE; -import com.fr.file.FileNodeFILE; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; -import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.third.javax.annotation.Nonnull; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.lock.TplOperator; import javax.swing.BorderFactory; import javax.swing.ButtonModel; @@ -41,7 +31,6 @@ import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JMenu; import javax.swing.JMenuItem; -import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JSeparator; import javax.swing.MenuElement; @@ -69,12 +58,6 @@ import java.awt.geom.GeneralPath; import java.awt.geom.Line2D; import java.awt.geom.Path2D; import java.awt.geom.RoundRectangle2D; -import java.util.List; - -import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog; -import static javax.swing.JOptionPane.OK_CANCEL_OPTION; -import static javax.swing.JOptionPane.OK_OPTION; -import static javax.swing.JOptionPane.WARNING_MESSAGE; /** * 改个名字,一个拼写 n 个错误 @@ -114,10 +97,6 @@ public class MultiTemplateTabPane extends JComponent { private static MultiTemplateTabPane THIS; - //用于存放工作簿 - private java.util.List> openedTemplate; - //选中的Tab项 - private int selectedIndex = 0; // private int mouseOveredIndex = -1; @@ -136,16 +115,11 @@ public class MultiTemplateTabPane extends JComponent { //记录关闭按钮的状态 private int closeIconIndex = -1; - private boolean isCloseCurrent = false; + private Icon clodeMode = CLOSE; private Icon listDownMode = LIST_DOWN; private boolean isShowList = false; - //自动新建的模板B若没有进行任何编辑,切换到其他 - // - // 模板时,模板B会自动关闭 - private JTemplate temTemplate = null; - public static MultiTemplateTabPane getInstance() { if (THIS == null) { @@ -165,8 +139,6 @@ public class MultiTemplateTabPane extends JComponent { this.setBorder(null); this.setForeground(new Color(58, 56, 58)); this.setFont(DesignUtils.getDefaultGUIFont().applySize(12)); - openedTemplate = HistoryTemplateListCache.getInstance().getHistoryList(); - selectedIndex = openedTemplate.size() - 1; AWTEventListener awt = new AWTEventListener() { @Override public void eventDispatched(AWTEvent event) { @@ -206,45 +178,13 @@ public class MultiTemplateTabPane extends JComponent { //根据当前i18n语言环境,动态调整popupMenu的宽度 menu.setPreferredSize(new Dimension((int) DesignSizeI18nManager.getInstance(). i18nDimension("com.fr.design.file.MultiTemplateTabPane.popUpMenu").getWidth(), height)); - GUICoreUtils.showPopupMenu(menu, MultiTemplateTabPane.getInstance(), e.getX(), MultiTemplateTabPane.getInstance().getY() - 1 + MultiTemplateTabPane.getInstance().getHeight()); + GUICoreUtils.showPopupMenu(menu, MultiTemplateTabPane.this, e.getX(), MultiTemplateTabPane.this.getY() - 1 + MultiTemplateTabPane.this.getHeight()); } } } }); } - enum CloseOption { - Left(Toolkit.i18nText("Fine-Design_Close_templates_To_The_Left")) { - @Override - boolean shouldClose(int tplIndex, int i) { - return i < tplIndex; - } - }, - Right(Toolkit.i18nText("Fine-Design_Close_templates_To_The_Right")) { - @Override - boolean shouldClose(int tplIndex, int i) { - return i > tplIndex; - } - }, - All(Toolkit.i18nText("Fine-Design_Close_All_templates")), - Others(Toolkit.i18nText("Fine-Design_Close_Other_templates")) { - @Override - boolean shouldClose(int tplIndex, int i) { - return i != tplIndex; - } - }; - - - String optionName; - - CloseOption(String optionName) { - this.optionName = optionName; - } - - boolean shouldClose(int tplIndex, int i) { - return true; - } - } private static class CloseMenuItemJSeparator extends JSeparator { @Override @@ -272,41 +212,10 @@ public class MultiTemplateTabPane extends JComponent { @Override public void actionPerformed(ActionEvent e) { - //处于搜索模式时,先退出搜索模式,再定位 - if (TemplateTreeSearchManager.getInstance().isInSearchMode()) { - TemplateTreeSearchManager.getInstance().outOfSearchMode(); - TemplateTreePane.getInstance().refreshDockingView(); - } - JTemplate template = openedTemplate.get(this.tplIndex); - locateTemplate(template); + //DefaultTemplateTabOperate.getInstance().locateTemplateInTree(this.tplIndex); + TemplateTabManager.getInstance().getCurrentOperator().locateTemplateInTree(this.tplIndex); } - private void locateTemplate(JTemplate template) { - FILE currentTemplate = template.getEditingFILE(); - //模板不属于当前环境,跟预览一样先提示保存,再定位模板 - //如果是拖拽进来的模板单单用exist不能判断,这边参考预览的判断逻辑(browserTemplate),补充一下 - if (!currentTemplate.exists() || !(currentTemplate instanceof FileNodeFILE)) { - int selVal = showConfirmDialog( - DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"), - Toolkit.i18nText("Fine-Design_Basic_Preview_Tool_Tips"), - OK_CANCEL_OPTION, - WARNING_MESSAGE - ); - if (OK_OPTION == selVal) { - CallbackSaveWorker worker = template.saveAs(); - worker.start(template.getRuntimeId()); - worker.addSuccessCallback(new Runnable() { - @Override - public void run() { - gotoEditingTemplateLeaf(template.getPath()); - } - }); - } - } else { - gotoEditingTemplateLeaf(template.getPath()); - } - } } private class RightMenuCloseAction extends UpdateAction { @@ -316,80 +225,15 @@ public class MultiTemplateTabPane extends JComponent { public RightMenuCloseAction(CloseOption option, int tplIndex) { this.option = option; - this.setName(option.optionName); + this.setName(option.getOptionName()); this.tplIndex = tplIndex; } @Override public void actionPerformed(ActionEvent e) { - SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(false); - if (saveSomeTempaltePane.showSavePane()) { - - JTemplate[] templates = new JTemplate[openedTemplate.size()]; - for (int i = 0; i < openedTemplate.size(); i++) { - templates[i] = openedTemplate.get(i); - } - JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - closeTemplate(templates, currentTemplate); - - if (option == CloseOption.All) { - DesignerContext.getDesignerFrame().addAndActivateJTemplate(); - } else { - DesignerContext.getDesignerFrame().activateJTemplate(currentTemplate); - } - - MultiTemplateTabPane.getInstance().repaint(); - } - } - - private void closeTemplate(JTemplate[] templates, JTemplate currentTemplate) { - for (int i = 0; i < templates.length; i++) { - if (option.shouldClose(tplIndex, i)) { - JTemplate jTemplate = templates[i]; - if (jTemplate == currentTemplate) { - currentTemplate = option == CloseOption.All ? null : templates[tplIndex]; - } - //判断关闭的模板是不是格式刷的被参照的模板 - openedTemplate.remove(jTemplate); - if (jTemplate != currentTemplate) { - MultiTemplateTabPane.getInstance().closeFormat(jTemplate); - HistoryTemplateListCache.getInstance().closeSelectedReport(jTemplate); - closeAndFreeLock(jTemplate); - } - } - } - } - - private void closeAndFreeLock(@Nonnull JTemplate template) { - FILE file = template.getEditingFILE(); - // 只有是环境内的文件,才执行释放锁 - if (file != null && file.isEnvFile()) { - // release lock - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath()); - } - } - } - - public JTemplate getSelectedFile() { - if (openedTemplate.size() == selectedIndex) { - selectedIndex = Math.max(--selectedIndex, 0); - } - return openedTemplate.get(selectedIndex); - } - - - /** - * 关闭掉当前已打开文件列表中指定的文件 - * - * @param file 指定的文件 - */ - public void closeFileTemplate(FILE file) { - for (JTemplate temp : openedTemplate) { - if (ComparatorUtils.equals(file, temp.getEditingFILE())) { - closeSpecifiedTemplate(temp); - break; - } + TemplateTabManager.getInstance().getCurrentOperator().closeAction(option, this.tplIndex); + MultiTemplateTabPane.this.repaint(); } } @@ -409,7 +253,9 @@ public class MultiTemplateTabPane extends JComponent { closeOther.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - if (openedTemplate.size() == 1) { + //int tabSize = TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().size(); + int tabSize = TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().size(); + if (tabSize == 1) { return; } if (!TemplateSavingChecker.check()) { @@ -418,29 +264,28 @@ public class MultiTemplateTabPane extends JComponent { SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(false); //点击关闭其他模板,并且点击确定保存 if (saveSomeTempaltePane.showSavePane()) { - JTemplate[] panes = new JTemplate[openedTemplate.size()]; - for (int i = 0; i < openedTemplate.size(); i++) { - panes[i] = openedTemplate.get(i); + JTemplate[] panes = new JTemplate[tabSize]; + for (int i = 0; i < tabSize; i++) { + panes[i] = TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().get(i); } for (int i = 0; i < panes.length; i++) { - if (i != selectedIndex) { + if (i != TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex()) { JTemplate jTemplate = panes[i]; //判断关闭的模板是不是格式刷的被参照的模板 - openedTemplate.remove(jTemplate); - closeFormat(jTemplate); + TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().remove(jTemplate); + TemplateTabManager.getInstance().closeFormat(jTemplate); HistoryTemplateListCache.getInstance().closeSelectedReport(jTemplate); closeAndFreeLock(jTemplate); } } JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - HistoryTemplateListCache.getInstance().removeAllHistory(); - DesignerContext.getDesignerFrame().activateJTemplate(currentTemplate); + TemplateTabManager.getInstance().resetSelectIndex(currentTemplate); THIS.repaint(); } //如果取消保存了,则不关闭其他模板 } }); - if (openedTemplate.size() == 1) { + if (TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().size() == 1) { closeOther.setEnabled(false); } return closeOther; @@ -448,21 +293,22 @@ public class MultiTemplateTabPane extends JComponent { private UIMenuItem[] createListDownTemplate() { - UIMenuItem[] templates = new UIMenuItem[openedTemplate.size()]; - for (int i = 0; i < openedTemplate.size(); i++) { + int templateTabCount = TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().size(); + UIMenuItem[] templates = new UIMenuItem[templateTabCount]; + for (int i = 0; i < templateTabCount; i++) { final int index = i; - final JTemplate tem = openedTemplate.get(i); + final JTemplate tem = TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().get(i); templates[i] = new UIMenuItem(tempalteShowName(tem), tem.getIcon()); templates[i].setUI(new UIListDownItemUI()); setListDownItemPreferredSize(templates[i]); - if (i == selectedIndex) { + if (i == TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex()) { //画选中的高亮 templates[i].setBackground(UIConstants.SHADOW_CENTER); } templates[i].addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - selectedIndex = index; + TemplateTabManager.getInstance().getCurrentOperator().setSelectIndex(index); tem.activeNewJTemplate(); } }); @@ -478,68 +324,13 @@ public class MultiTemplateTabPane extends JComponent { private String tempalteShowName(JTemplate template) { - String name = TemplateUtils.createLockeTemplatedName(template, template.getTemplateName()); - if (!template.isSaved() && !name.endsWith(" *")) { - name += " *"; - } - return name; - } - - /** - * 刷新打开模板 - * - * @param history 模板 - */ - public void refreshOpenedTemplate(List> history) { - openedTemplate = history; - } - - public void setTemTemplate(JTemplate auotCreate) { - temTemplate = auotCreate; + return TemplateTabManager.getInstance().getTemplateShowName(template); } private void showListDown() { - - UIScrollPopUpMenu menu = new UIScrollPopUpMenu(); - menu.setBorder(BorderFactory.createEmptyBorder(-3, 3, 3, 0)); - menu.add(initCloseOther()); - JSeparator separator = new JSeparator() { - @Override - public Dimension getPreferredSize() { - Dimension d = super.getPreferredSize(); - d.height = 1; - return d; - } - }; - menu.add(new JPanel() { - @Override - public Dimension getPreferredSize() { - Dimension d = super.getPreferredSize(); - d.height = 1; - return d; - } - }); - separator.setForeground(UIConstants.LINE_COLOR); - menu.add(separator); - menu.add(new JPanel() { - @Override - public Dimension getPreferredSize() { - Dimension d = super.getPreferredSize(); - d.height = 1; - return d; - } - }); - UIMenuItem[] items = createListDownTemplate(); - for (int i = 0; i < items.length; i++) { - menu.add(items[i]); - } - GUICoreUtils.showPopupMenu(menu, MultiTemplateTabPane.getInstance(), MultiTemplateTabPane.getInstance().getWidth() - menu.getPreferredSize().width, getY() - 1 + getHeight()); - } - - - public void setSelectedIndex(int index) { - selectedIndex = index; + UIScrollPopUpMenu menu = MultiTemplateTabMenuFactory.getInstance().createMenu(); + GUICoreUtils.showPopupMenu(menu, MultiTemplateTabPane.this, MultiTemplateTabPane.this.getWidth() - menu.getPreferredSize().width, getY() - 1 + getHeight()); } @@ -566,15 +357,18 @@ public class MultiTemplateTabPane extends JComponent { paintDefaultBackground(g2d); //最多能画的个数 int maxTemplateNum = (int) (maxWidth) / MINWIDTH; + int templateTabCount = TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().size(); + int currentSelectedIndex = TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex(); //计算开始画的最小模板index和最大模板index calMinAndMaxIndex(maxTemplateNum); calculateRealAverageWidth(maxWidth, maxTemplateNum); int maxStringlength = calculateStringMaxLength(); - if (selectedIndex >= openedTemplate.size()) { - selectedIndex = openedTemplate.size() - 1; + if ( currentSelectedIndex >= templateTabCount) { + TemplateTabManager.getInstance().getCurrentOperator().setSelectIndex( + templateTabCount - 1); } - if (selectedIndex < 0) { - selectedIndex = 0; + if (TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex() < 0) { + TemplateTabManager.getInstance().getCurrentOperator().setSelectIndex(0); } double templateStartX = 0; startX = new int[maxPaintIndex - minPaintIndex + 1]; @@ -582,7 +376,7 @@ public class MultiTemplateTabPane extends JComponent { //从可以开始展示在tab面板上的tab开始画 for (int i = minPaintIndex; i <= maxPaintIndex; i++) { - JTemplate template = openedTemplate.get(i); + JTemplate template = TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().get(i); Icon icon = template.getIcon(); String name = tempalteShowName(template); //如果tab名字的长度大于最大能显示的英文字符长度,则进行省略号处理 @@ -599,7 +393,7 @@ public class MultiTemplateTabPane extends JComponent { } else { selectedIcon = CLOSE; } - if (i == selectedIndex) { + if (i == TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex()) { if (template.isSaving()) { selectedIcon = WHITE_SAVING_CLOSE_ICON; } @@ -608,7 +402,7 @@ public class MultiTemplateTabPane extends JComponent { if (template.isSaving()) { selectedIcon = GREY_SAVING_CLOSE_ICON; } - boolean isLeft = i < selectedIndex; + boolean isLeft = i < TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex(); startX[i - minPaintIndex] = paintUnSelectedTab(g2d, icon, templateStartX, name, selectedIcon, isLeft, mouseOveredIndex, i); } templateStartX += realWidth; @@ -684,38 +478,39 @@ public class MultiTemplateTabPane extends JComponent { } private void calMinAndMaxIndex(int maxTemplateNum) { + int templateTabCount = TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().size(); //如果个数大于最多能容纳的个数,则多余的进行处理 - if (openedTemplate.size() > maxTemplateNum) { + if (templateTabCount > maxTemplateNum) { //所点击列表中的标签页处在标签页栏最后一个标签页之后,则标签页栏左移至所点击标签页出现 - if (selectedIndex >= maxPaintIndex) { - minPaintIndex = selectedIndex - maxTemplateNum + 1; - maxPaintIndex = selectedIndex; + if (TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex() >= maxPaintIndex) { + minPaintIndex = TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex() - maxTemplateNum + 1; + maxPaintIndex = TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex(); if (minPaintIndex <= 0) { minPaintIndex = 0; maxPaintIndex = maxTemplateNum - 1; } - } else if (selectedIndex <= minPaintIndex) { + } else if (TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex() <= minPaintIndex) { //所点击列表中的标签页处在标签页栏第一个标签页之前,则标签页栏右移至所点击标签页出现 - minPaintIndex = selectedIndex; + minPaintIndex = TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex(); maxPaintIndex = minPaintIndex + maxTemplateNum - 1; - if (maxPaintIndex > openedTemplate.size() - 1) { - maxPaintIndex = openedTemplate.size() - 1; + if (maxPaintIndex > templateTabCount- 1) { + maxPaintIndex = templateTabCount - 1; } } else { - if (selectedIndex >= openedTemplate.size() - 1) { - selectedIndex = openedTemplate.size() - 1; - maxPaintIndex = selectedIndex; - minPaintIndex = selectedIndex - maxTemplateNum + 1; + if (TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex() >= templateTabCount - 1) { + TemplateTabManager.getInstance().getCurrentOperator().setSelectIndex(templateTabCount - 1); + maxPaintIndex = TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex(); + minPaintIndex = TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex() - maxTemplateNum + 1; } else { maxPaintIndex = minPaintIndex + maxTemplateNum - 1; - if (maxPaintIndex > openedTemplate.size() - 1) { - maxPaintIndex = openedTemplate.size() - 1; + if (maxPaintIndex > templateTabCount - 1) { + maxPaintIndex = templateTabCount - 1; } } } } else { minPaintIndex = 0; - maxPaintIndex = openedTemplate.size() - 1; + maxPaintIndex = templateTabCount - 1; } } @@ -723,7 +518,7 @@ public class MultiTemplateTabPane extends JComponent { //个数小于最多能容纳的个数的情况下,看看宽度每个要画多少 private void calculateRealAverageWidth(double maxwidth, int templateNum) { - int num = openedTemplate.size() > templateNum ? templateNum : openedTemplate.size(); + int num = TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().size() > templateNum ? templateNum : TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().size(); realWidth = (int) (maxwidth / (num)); if (realWidth > MAXWIDTH) { realWidth = MAXWIDTH; @@ -888,50 +683,6 @@ public class MultiTemplateTabPane extends JComponent { } - public void setIsCloseCurrent(boolean isCloseCurrent) { - this.isCloseCurrent = isCloseCurrent; - - } - - /** - * 关闭模板 - * - * @param specifiedTemplate 模板 - */ - public void closeSpecifiedTemplate(JTemplate specifiedTemplate) { - if (specifiedTemplate == null) { - return; - } - - if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) { - specifiedTemplate.stopEditing(); - int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?", - Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); - if (returnVal == JOptionPane.YES_OPTION) { - CallbackSaveWorker worker = specifiedTemplate.save(); - worker.addSuccessCallback(new Runnable() { - @Override - public void run() { - FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName())); - closeTpl(specifiedTemplate); - } - }); - worker.start(specifiedTemplate.getRuntimeId()); - } else if (returnVal == JOptionPane.NO_OPTION) { - closeTpl(specifiedTemplate); - } - } else { - closeTpl(specifiedTemplate); - } - - } - - private void closeTpl(@Nonnull JTemplate specifiedTemplate) { - HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate); - closeAndFreeLock(specifiedTemplate); - activePrevTemplateAfterClose(); - } - private void closeAndFreeLock(@Nonnull JTemplate template) { FILE file = template.getEditingFILE(); // 只有是环境内的文件,才执行释放锁 @@ -941,70 +692,6 @@ public class MultiTemplateTabPane extends JComponent { } } - /** - * 后台关闭当前编辑模板 - */ - public void closeCurrentTpl() { - JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - this.setIsCloseCurrent(true); - this.closeFormat(jTemplate); - this.closeSpecifiedTemplate(jTemplate); - } - - /** - * 关闭模板 - * - * @param closedTemplate 模板 - */ - public void closeFormat(JTemplate closedTemplate) { - //表单不需要处理 - if (!closedTemplate.isJWorkBook()) { - return; - } - - if (DesignerContext.getFormatState() == DesignerContext.FORMAT_STATE_NULL) { - return; - } - - //是被参照的模板被关闭,则重置格式刷 - closedTemplate.doConditionCancelFormat(); - } - - /** - * 关闭掉一个模板之后激活新的待显示模板 - */ - public void activePrevTemplateAfterClose() { - if (openedTemplate.isEmpty()) { - //新建并激活模板 - DesignerContext.getDesignerFrame().addAndActivateJTemplate(); - selectedIndex = 0; - //此时刚自动新建的模板在HistoryTemplateListCache的editingTemplate - temTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - - } else { - // 如果关闭的模板是当前选中的模板,则重新激活当前 selectIndex 的模板; - // selectIndex 没有变化,但是对应的模板已经变成了前一张模板 - if (closeIconIndex == selectedIndex || isCloseCurrent) { - // 如果当前关闭的模板在最右侧,那么预览上一个,防止数组越界 - if (selectedIndex >= maxPaintIndex) { - // selectIndex 不会 <0 因为如果关闭的是打开的最后一个模板,那么关闭之后 openedTemplate.isEmpty() = true - selectedIndex--; - } - isCloseCurrent = false; - } - // 如果关闭的模板不是当前选中的模板,那么重新获取一下当前模板的 index,激活该 index - else { - JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - selectedIndex = HistoryTemplateListCache.getInstance().contains(template); - } - if (selectedIndex < openedTemplate.size()) { - //如果是已后台关闭的模板,则重新打开文件 - openedTemplate.get(selectedIndex).activeOldJTemplate(); - } - - } - } - private boolean isOverCloseIcon(int evtX) { boolean isOverCloseIcon = false; @@ -1036,29 +723,6 @@ public class MultiTemplateTabPane extends JComponent { return -1; } - - /** - * 处理自动新建的模板 在切换时的处理 - */ - public void doWithtemTemplate() { - //temtemplate保存的一定是手动新建的没有编辑或是编辑了没有保存的模板 - //没有保存,说明有编辑;已经保存在磁盘里的文件,说明有过处理,并且已经保存,此时切换都不将其自动关闭 - if (temTemplate == null || temTemplate == HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()) { - return; - } - - if (!temTemplate.isSaved() || !temTemplate.getEditingFILE().isMemFile()) { - temTemplate = null; - } - - //自动新建的模板B若没有进行任何编辑(新建模板没有进行任何编辑时saved都是true):还没有存盘 - if (temTemplate != null && temTemplate.getEditingFILE().isMemFile() && temTemplate.isSaved()) { - HistoryTemplateListCache.getInstance().closeSelectedReport(temTemplate); - temTemplate = null; - setSelectedIndex(HistoryTemplateListCache.getInstance().contains(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate())); - } - } - private class UIListDownItemUI extends BasicMenuItemUI { @Override protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) { @@ -1161,44 +825,13 @@ public class MultiTemplateTabPane extends JComponent { closeIconIndex = getTemplateIndex(evtX); clodeMode = MOUSE_PRESS_CLOSE; //关闭close图标所在的模板{ - JTemplate template = openedTemplate.get(closeIconIndex); - if (template.isOpening()) { - WorkerManager.getInstance().cancelWorker(template.getPath()); - } else if (template.isSaving()) { - boolean completed = WorkerManager.getInstance().isCompleted(template.getTarget().getTemplateID()); - if (!completed) { - FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Close_Template_Tip", template.getEditingFILE().getName())); - return; - } - } - //参考CloseCurrentTemplateAction,在closeFormat与closeSpecifiedTemplate之前要先设定isCloseCurrent,这样关闭之后才会自动切换tab - if (checkCurrentClose(template)) { - setIsCloseCurrent(true); - } - closeFormat(template); - closeSpecifiedTemplate(template); - DesignerContext.getDesignerFrame().getContentFrame().repaint(); + TemplateTabManager.getInstance().getCurrentOperator().closeByIndex(closeIconIndex); isShowList = false; } else { //没有点击关闭和ListDown按钮,则切换到点击的模板处 closeIconIndex = -1; clodeMode = CLOSE; - int tempSelectedIndex = selectedIndex; - if (selectedIndex != getTemplateIndex(evtX) && getTemplateIndex(evtX) != -1) { - openedTemplate.get(selectedIndex).stopEditing(); - selectedIndex = getTemplateIndex(evtX); - //如果在权限编辑情况下,不允许切换到表单类型的工作簿 - if (DesignerMode.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()) { - DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(tempSelectedIndex)); - FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Form_Authority_Edited_Cannot_Be_Supported") - + "!", Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); - MultiTemplateTabPane.this.repaint(); - return; - } - JTemplate evtXTemplate = openedTemplate.get(getTemplateIndex(evtX)); - evtXTemplate.activeNewJTemplate(); - } + TemplateTabManager.getInstance().getCurrentOperator().switchTpl(getTemplateIndex(evtX)); isShowList = false; } MultiTemplateTabPane.this.repaint(); @@ -1209,11 +842,6 @@ public class MultiTemplateTabPane extends JComponent { } - private boolean checkCurrentClose(JTemplate template) { - JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - return JTemplate.isValid(currentTemplate) && ComparatorUtils.equals(template.getPath(), currentTemplate.getPath()); - } - private class MultiTemplateTabMouseMotionListener implements MouseMotionListener { /** * 鼠标拖拽 @@ -1237,7 +865,7 @@ public class MultiTemplateTabPane extends JComponent { //看是否需要显示toolTip if (mouseOveredIndex != -1 && isNeedToolTips[mouseOveredIndex - minPaintIndex]) { - setToolTipText(openedTemplate.get(mouseOveredIndex).getEditingFILE().getName()); + setToolTipText(TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().get(mouseOveredIndex).getEditingFILE().getName()); } else { setToolTipText(null); } 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 36e0b58754..d92533552c 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 @@ -1,5 +1,7 @@ package com.fr.design.file; +import com.fr.design.file.impl.DefaultTemplateTabOperate; + /** * @author shine * @version 10.0 @@ -14,11 +16,11 @@ public class MutilTempalteTabPane { } public void setIsCloseCurrent(boolean b) { - MultiTemplateTabPane.getInstance().setIsCloseCurrent(b); + TemplateTabManager.getInstance().setCloseCurrent(b); } public void activePrevTemplateAfterClose() { - MultiTemplateTabPane.getInstance().activePrevTemplateAfterClose(); + DefaultTemplateTabOperate.getInstance().activePrevTemplateAfterClose(true); } } diff --git a/designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java b/designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java index dae921a1c8..9949888349 100644 --- a/designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java +++ b/designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java @@ -81,11 +81,15 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene } if (isOverNewIcon(evtX) && newWorkBookIconMode != GRAY_NEW_CPT) { newWorkBookIconMode = getMousePressNew(); - DesignerContext.getDesignerFrame().addAndActivateJTemplate(); + createNewTemplate(); } this.repaint(); } + protected void createNewTemplate() { + DesignerContext.getDesignerFrame().addAndActivateJTemplate(); + } + /** *鼠标松开 * @param e 事件 diff --git a/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java b/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java index 72945b31c9..96d72d34c1 100644 --- a/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java +++ b/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java @@ -3,8 +3,8 @@ package com.fr.design.file; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.dialog.FineJOptionPane; import com.fr.design.event.StateChangeListener; +import com.fr.design.file.impl.DefaultTemplateTabOperate; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; @@ -19,10 +19,10 @@ import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import javax.swing.*; -import javax.swing.border.EmptyBorder; import java.awt.*; import java.awt.event.*; import java.util.ArrayList; +import java.util.List; /** * Author : daisy @@ -152,7 +152,16 @@ public class SaveSomeTemplatePane extends BasicPane { public boolean showSavePane() { - populate(); + return showSavePane(false); + } + + public boolean showSavePane(boolean switchEnv) { + return switchEnv ? + showSavePane(DefaultTemplateTabOperate.getInstance().getOpenedJTemplates()) : + showSavePane(HistoryTemplateListPane.getInstance().getHistoryList()); + } + public boolean showSavePane(List> jTemplates) { + populate(jTemplates); //如果有未保存的文件 ,则跳出保存对话框,选择要存储的项目 if (!unSavedTemplate.isEmpty()) { dialog.setVisible(true); @@ -162,8 +171,8 @@ public class SaveSomeTemplatePane extends BasicPane { return isAllSaved; } - public void populate() { - java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); + + private void populate(java.util.List> opendedTemplate) { JTemplate currentTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); for (int i = 0; i < opendedTemplate.size(); i++) { if (isneedToAdd(opendedTemplate.get(i), currentTemplate)) { diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java b/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java new file mode 100644 index 0000000000..22a0bc37e4 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java @@ -0,0 +1,253 @@ +package com.fr.design.file; + +import com.finebi.cbb.utils.CompareUtils; +import com.fr.design.file.impl.DefaultTemplateTabOperate; +import com.fr.design.file.impl.EmptyTemplateTabOperator; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; +import com.fr.file.FILE; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class TemplateTabManager { + private static class HOLDER { + private static final TemplateTabManager singleton = new TemplateTabManager(); + } + + public static TemplateTabManager getInstance() { + return HOLDER.singleton; + } + + private TemplateTabManager() { + list.add(DefaultTemplateTabOperate.getInstance()); + } + + private List list = new ArrayList<>(); + + public void register(TemplateTabOperateProvider templateTabOperateProvider) { + this.list.add(templateTabOperateProvider); + } + + public void remove(TemplateTabOperateProvider templateTabOperateProvider) { + this.list.remove(templateTabOperateProvider); + } + + private boolean isCloseCurrent = false; + //自动新建的模板B若没有进行任何编辑,切换到其他 + + // 模板时,模板B会自动关闭 + private JTemplate temTemplate = null; + + + public boolean isCloseCurrent() { + return isCloseCurrent; + } + + public void setCloseCurrent(boolean closeCurrent) { + isCloseCurrent = closeCurrent; + } + + public void setTemTemplate(JTemplate temTemplate) { + this.temTemplate = temTemplate; + } + + public void refresh() { + getCurrentOperator().refresh(); + } + + /** + * 从模板树删除文件 + */ + public void deleteOpenedTemplate(JTemplate template) { + TemplateTabOperateProvider provider = getOperatorByTemplate(template); + provider.deleteOpenedTemplate(template); + this.refresh(); + } + + public JTemplate getSelectedFile() { + return getCurrentOperator().getSelectedFile(); + } + + /** + * 关闭掉当前文件列表中指定的文件 + * + * @param file 指定的文件 + */ + public void closeFileTemplate(FILE file) { + for (TemplateTabOperateProvider provider : list) { + provider.closeFileTemplate(file); + } + } + + /** + * 关闭指定模板 + * + * @param specifiedTemplate + */ + public void closeSpecifiedTemplate(JTemplate specifiedTemplate) { + getCurrentOperator().closeSpecifiedTemplate(specifiedTemplate); + } + + + /** + * 刷新打开模板 + * + * @param tempalteLsit + */ + public void refreshOpenedTemplate(List> tempalteLsit) { + for (TemplateTabOperateProvider provider : list) { + provider.refreshOpenedTemplate(tempalteLsit); + } + } + + + /** + * 处理自动新建的模板 在切换时的处理 + */ + public void doWithtemTemplate() { + //temtemplate保存的一定是手动新建的没有编辑或是编辑了没有保存的模板 + //没有保存,说明有编辑;已经保存在磁盘里的文件,说明有过处理,并且已经保存,此时切换都不将其自动关闭 + if (temTemplate == null || temTemplate == HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()) { + return; + } + + if (!temTemplate.isSaved() || !temTemplate.getEditingFILE().isMemFile()) { + temTemplate = null; + } + + //自动新建的模板B若没有进行任何编辑(新建模板没有进行任何编辑时saved都是true):还没有存盘 + if (temTemplate != null && temTemplate.getEditingFILE().isMemFile() && temTemplate.isSaved()) { + HistoryTemplateListCache.getInstance().closeSelectedReport(temTemplate); + temTemplate = null; + resetSelectIndex(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()); + } + } + + + public void resetSelectIndex(JTemplate jTemplate) { + getCurrentOperator().resetSelectIndex(jTemplate); + } + + + public void activeNewTemplate() { + //先看其他模式中是否有已打开的模板,有的话切换过去 + for (TemplateTabOperateProvider templateTabOperateProvider : list) { + if (templateTabOperateProvider.getOpenedJTemplates().size() != 0) { + templateTabOperateProvider.getSelectedFile().activeNewJTemplate(); + refresh(); + return; + + } + } + //都没有的话,新建并激活模板 + DesignerContext.getDesignerFrame().addAndActivateJTemplate(); + //此时刚自动新建的模板在HistoryTemplateListCache的editingTemplate + TemplateTabManager.getInstance().setTemTemplate(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()); + refresh(); + } + + /** + * 后台关闭当前编辑模板 + */ + public void closeCurrentTpl() { + JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + this.setCloseCurrent(true); + this.closeFormat(jTemplate); + this.closeSpecifiedTemplate(jTemplate); + } + + + /** + * 关闭指定索引值模板 + * + * @param index + */ + public void closeByIndex(int index) { + getCurrentOperator().closeByIndex(index); + } + + /** + * 关闭指定索引值模板 + * + * @param jTemplate + */ + public void closeByJTemplate(JTemplate jTemplate) { + TemplateTabOperateProvider operator = getOperatorByOperatorType(jTemplate.getTemplateTabOperatorType()); + operator.closeByIndex(operator.getJTemplateIndex(jTemplate)); + } + + /** + * 切换到指定tab栏的指定索引值模板 + * + * @param jTemplate + */ + public void switchByJTemplate(JTemplate jTemplate) { + TemplateTabOperateProvider operator = getOperatorByOperatorType(jTemplate.getTemplateTabOperatorType()); + operator.switchTpl(operator.getJTemplateIndex(jTemplate)); + } + + /** + * 获取所有打开的模板map + * + * @return + */ + public Map>> getAllOpenedTemplateMap() { + Map>> resultMap = new HashMap<>(); + for (TemplateTabOperateProvider provider : list) { + resultMap.put(provider.getOperatorType(), provider.getOpenedJTemplates()); + } + return resultMap; + } + + public void closeOthers() { + TemplateTabOperateProvider currentOperator = getCurrentOperator(); + currentOperator.closeAction(CloseOption.Others, + currentOperator.getJTemplateIndex(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate())); + } + + public String getTemplateShowName(JTemplate temTemplate){ + return getCurrentOperator().getTemplateShowName(temTemplate); + } + + + /** + * 关闭模板 + * + * @param closedTemplate 模板 + */ + public void closeFormat(JTemplate closedTemplate) { + //表单不需要处理 + if (!closedTemplate.isJWorkBook()) { + return; + } + + if (DesignerContext.getFormatState() == DesignerContext.FORMAT_STATE_NULL) { + return; + } + + //是被参照的模板被关闭,则重置格式刷 + closedTemplate.doConditionCancelFormat(); + } + + + public TemplateTabOperateProvider getCurrentOperator() { + return getOperatorByTemplate(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()); + } + + private TemplateTabOperateProvider getOperatorByTemplate(JTemplate jTemplate) { + return getOperatorByOperatorType(jTemplate.getTemplateTabOperatorType()); + } + + private TemplateTabOperateProvider getOperatorByOperatorType(String type) { + for (TemplateTabOperateProvider provider : list) { + if (CompareUtils.isEqual(provider.getOperatorType(), type)) { + return provider; + } + } + return EmptyTemplateTabOperator.getInstance(); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTabOperateProvider.java b/designer-base/src/main/java/com/fr/design/file/TemplateTabOperateProvider.java new file mode 100644 index 0000000000..ff913f3342 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTabOperateProvider.java @@ -0,0 +1,114 @@ +package com.fr.design.file; + + +import com.fr.design.mainframe.JTemplate; +import com.fr.file.FILE; + +import java.util.List; + +public interface TemplateTabOperateProvider { + /** + * 找到模板树中的位置 + */ + void locateTemplateInTree(int tplIndex); + + + /** + * 右键一系列关闭操作 + * + * @param option closeType + * @param index + */ + void closeAction(CloseOption option, int index); + + + /** + * 切换模板 + * + * @param templateIndex 模板索引值 + */ + void switchTpl(int templateIndex); + + + /** + * 获取打开模板的基本信息 + * + * @return + */ + List> getOpenedJTemplates(); + + + void closeByIndex(int index); + /** + * 关闭指定模板 + * + * @param specifiedTemplate + */ + void closeSpecifiedTemplate(JTemplate specifiedTemplate); + /** + * 删除已打开的模板 + */ + void deleteOpenedTemplate(JTemplate template); + + /** + * 获取选中模板 + * @return + */ + JTemplate getSelectedFile(); + + /** + * 刷新ui + */ + void refresh(); + + /** + * 重置下选中的Index + * @param jTemplate + */ + void resetSelectIndex(JTemplate jTemplate); + + /** + * 刷新下打开的模板list + * @param list + */ + void refreshOpenedTemplate(List> list); + + /** + * 关闭指定节点 + * @param file + */ + void closeFileTemplate(FILE file); + + /** + * 获取操作类型标识 + * @return + */ + String getOperatorType(); + + /** + * 获取当前选中模板的index + * @return + */ + int getSelectIndex(); + + /** + * 设置当前选中模板的index + * @return + */ + void setSelectIndex(int index); + + /** + * 获取指定模板在operator中的索引值 + * @param jTemplate + * @return + */ + int getJTemplateIndex(JTemplate jTemplate); + + /** + * 获取template在tab中显示的名称 + * @param jTemplate + * @return + */ + String getTemplateShowName(JTemplate jTemplate); + +} diff --git a/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java b/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java new file mode 100644 index 0000000000..b6bee6e6d8 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java @@ -0,0 +1,332 @@ +package com.fr.design.file.impl; + +import com.finebi.cbb.utils.CompareUtils; +import com.fr.base.vcs.DesignerMode; +import com.fr.design.actions.file.LocateAction; +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.file.CloseOption; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.file.SaveSomeTemplatePane; +import com.fr.design.file.TemplateTabManager; +import com.fr.design.file.TemplateTabOperateProvider; +import com.fr.design.file.TemplateTreePane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.manager.search.TemplateTreeSearchManager; +import com.fr.design.utils.TemplateUtils; +import com.fr.design.worker.WorkerManager; +import com.fr.design.worker.save.CallbackSaveWorker; +import com.fr.file.FILE; +import com.fr.file.FileNodeFILE; +import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.third.javax.annotation.Nonnull; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.lock.TplOperator; + +import javax.swing.*; +import java.util.ArrayList; +import java.util.List; + +import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog; +import static javax.swing.JOptionPane.*; + +public abstract class AbstractTemplateTabOperate implements TemplateTabOperateProvider { + //用于存放工作簿 + protected java.util.List> openedTemplate = new ArrayList<>(); + //选中的Tab项 + protected int selectedIndex = -1; + + public AbstractTemplateTabOperate() { + + } + + @Override + public void locateTemplateInTree(int tplIndex) { + //处于搜索模式时,先退出搜索模式,再定位 + if (TemplateTreeSearchManager.getInstance().isInSearchMode()) { + TemplateTreeSearchManager.getInstance().outOfSearchMode(); + TemplateTreePane.getInstance().refreshDockingView(); + } + JTemplate template = openedTemplate.get(tplIndex); + locateTemplate(template); + } + + private void locateTemplate(JTemplate template) { + FILE currentTemplate = template.getEditingFILE(); + //模板不属于当前环境,跟预览一样先提示保存,再定位模板 + //如果是拖拽进来的模板单单用exist不能判断,这边参考预览的判断逻辑(browserTemplate),补充一下 + if ((!currentTemplate.exists() || !(currentTemplate instanceof FileNodeFILE)) && template.canBeSaved()) { + int selVal = showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"), Toolkit.i18nText("Fine-Design_Basic_Preview_Tool_Tips"), OK_CANCEL_OPTION, WARNING_MESSAGE); + if (OK_OPTION == selVal) { + CallbackSaveWorker worker = template.saveAs(); + worker.start(template.getRuntimeId()); + worker.addSuccessCallback(new Runnable() { + @Override + public void run() { + LocateAction.gotoEditingTemplateLeaf(template.getPath()); + } + }); + } + } else { + LocateAction.gotoEditingTemplateLeaf(template.getPath()); + } + } + + @Override + public void closeAction(CloseOption option, int index) { + SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true); + if (saveSomeTempaltePane.showSavePane(this.openedTemplate)) { + + JTemplate[] templates = new JTemplate[openedTemplate.size()]; + for (int i = 0; i < openedTemplate.size(); i++) { + templates[i] = openedTemplate.get(i); + } + JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + + closeTemplate(templates, currentTemplate, option, index); + + if (openedTemplate.isEmpty()) { + TemplateTabManager.getInstance().activeNewTemplate(); + selectedIndex = 0; + } else { + DesignerContext.getDesignerFrame().activateJTemplate(currentTemplate); + } + } + } + + public void closeByIndex(int index) { + //关闭close图标所在的模板{ + JTemplate template = openedTemplate.get(index); + if (template.isOpening()) { + WorkerManager.getInstance().cancelWorker(template.getPath()); + } else if (template.isSaving()) { + boolean completed = WorkerManager.getInstance().isCompleted(template.getTarget().getTemplateID()); + if (!completed) { + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Close_Template_Tip", template.getEditingFILE().getName())); + return; + } + } + //参考CloseCurrentTemplateAction,在closeFormat与closeSpecifiedTemplate之前要先设定isCloseCurrent,这样关闭之后才会自动切换tab + if (checkCurrentClose(template)) { + TemplateTabManager.getInstance().setCloseCurrent(true); + } + TemplateTabManager.getInstance().closeFormat(template); + closeSpecifiedTemplate(template); + DesignerContext.getDesignerFrame().getContentFrame().repaint(); + } + + private boolean checkCurrentClose(JTemplate template) { + JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + return JTemplate.isValid(currentTemplate) && ComparatorUtils.equals(template.getPath(), currentTemplate.getPath()); + } + + private void closeTemplate(JTemplate[] templates, JTemplate currentTemplate, CloseOption option, int tplIndex) { + for (int i = 0; i < templates.length; i++) { + if (option.shouldClose(tplIndex, i)) { + JTemplate jTemplate = templates[i]; + if (jTemplate == currentTemplate) { + currentTemplate = option == CloseOption.All ? null : templates[tplIndex]; + } + //判断关闭的模板是不是格式刷的被参照的模板 + openedTemplate.remove(jTemplate); + if (jTemplate != currentTemplate) { + TemplateTabManager.getInstance().closeFormat(jTemplate); + HistoryTemplateListCache.getInstance().closeSelectedReport(jTemplate); + closeAndFreeLock(jTemplate); + } + } + } + } + + private void closeAndFreeLock(@Nonnull JTemplate template) { + FILE file = template.getEditingFILE(); + // 只有是环境内的文件,才执行释放锁 + if (file != null && file.isEnvFile()) { + // release lock + WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath()); + } + } + + @Override + public void switchTpl(int templateIndex) { + int tempSelectedIndex = selectedIndex; + JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if ((selectedIndex != templateIndex || !this.accept(jTemplate.getTemplateTabOperatorType())) + && templateIndex != -1) { + openedTemplate.get(selectedIndex).stopEditing(); + selectedIndex = templateIndex; + //如果在权限编辑情况下,不允许切换到表单类型的工作簿 + if (DesignerMode.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()) { + DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(tempSelectedIndex)); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Form_Authority_Edited_Cannot_Be_Supported") + "!", Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); + return; + } + JTemplate evtXTemplate = openedTemplate.get(templateIndex); + evtXTemplate.activeNewJTemplate(); + } + } + + @Override + public void deleteOpenedTemplate(JTemplate template) { + if (!openedTemplate.contains(template)) { + return; + } + openedTemplate.remove(template); + if (openedTemplate.size() == 0) { + TemplateTabManager.getInstance().activeNewTemplate(); + return; + } + if (openedTemplate.size() == selectedIndex) { + //如果删除的是后一个Tab,则定位到前一个 + this.selectedIndex--; + } + } + + @Override + public JTemplate getSelectedFile() { + if (openedTemplate.size() == selectedIndex) { + selectedIndex = Math.max(--selectedIndex, 0); + } + return openedTemplate.get(selectedIndex); + } + + + /** + * 关闭掉当前已打开文件列表中指定的文件 + * + * @param file 指定的文件 + */ + public void closeFileTemplate(FILE file) { + for (JTemplate temp : openedTemplate) { + if (ComparatorUtils.equals(file, temp.getEditingFILE())) { + closeSpecifiedTemplate(temp); + break; + } + } + + } + + + /** + * 关闭模板 + * + * @param specifiedTemplate 模板 + */ + public void closeSpecifiedTemplate(JTemplate specifiedTemplate) { + if (specifiedTemplate == null && !openedTemplate.contains(specifiedTemplate)) { + return; + } + + if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) { + specifiedTemplate.stopEditing(); + int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?", Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); + if (returnVal == JOptionPane.YES_OPTION) { + CallbackSaveWorker worker = specifiedTemplate.save(); + worker.addSuccessCallback(new Runnable() { + @Override + public void run() { + FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName())); + closeTpl(specifiedTemplate); + } + }); + worker.start(specifiedTemplate.getRuntimeId()); + } else if (returnVal == JOptionPane.NO_OPTION) { + closeTpl(specifiedTemplate); + } + } else { + closeTpl(specifiedTemplate); + } + + } + + private void closeTpl(@Nonnull JTemplate specifiedTemplate) { + HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate); + closeAndFreeLock(specifiedTemplate); + activePrevTemplateAfterClose(specifiedTemplate == HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()); + } + + /** + * 关闭掉一个模板之后激活新的待显示模板 + */ + public void activePrevTemplateAfterClose(boolean isCurrentSelectedTpl) { + if (openedTemplate.isEmpty()) { + TemplateTabManager.getInstance().activeNewTemplate(); + selectedIndex = 0; + } else { + // 如果关闭的模板是当前选中的模板,则重新激活当前 selectIndex 的模板; + // selectIndex 没有变化,但是对应的模板已经变成了前一张模板 + if (isCurrentSelectedTpl || TemplateTabManager.getInstance().isCloseCurrent()) { + // 如果当前关闭的模板在最右侧,那么预览上一个,防止数组越界 + if (selectedIndex >= openedTemplate.size()) { + // selectIndex 不会 <0 因为如果关闭的是打开的最后一个模板,那么关闭之后 openedTemplate.isEmpty() = true + selectedIndex--; + } + TemplateTabManager.getInstance().setCloseCurrent(false); + } + // 如果关闭的模板不是当前选中的模板,那么重新获取一下当前模板的 index,激活该 index + else { + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + selectedIndex = this.openedTemplate.indexOf(template); + } + if (selectedIndex < openedTemplate.size()) { + //如果是已后台关闭的模板,则重新打开文件 + openedTemplate.get(selectedIndex).activeOldJTemplate(); + } + + } + TemplateTabManager.getInstance().refresh(); + } + + @Override + public void resetSelectIndex(JTemplate jTemplate) { + this.selectedIndex = openedTemplate.indexOf(jTemplate); + TemplateTabManager.getInstance().refresh(); + } + + public void refreshOpenedTemplate(List> list) { + List> result = new ArrayList<>(); + for (JTemplate jTemplate : list) { + if (this.accept(jTemplate.getTemplateTabOperatorType())) { + result.add(jTemplate); + } + } + this.openedTemplate = result; + TemplateTabManager.getInstance().refresh(); + } + + public List> getOpenedJTemplates() { + return this.openedTemplate; + } + + @Override + public void setSelectIndex(int index) { + this.selectedIndex = index; + } + + @Override + public int getSelectIndex() { + return this.selectedIndex; + } + + @Override + public int getJTemplateIndex(JTemplate jTemplate) { + return this.openedTemplate.indexOf(jTemplate); + } + + public boolean accept(String type) { + return CompareUtils.isEqual(getOperatorType(), type); + } + + + @Override + public String getTemplateShowName(JTemplate template) { + String name = TemplateUtils.createLockeTemplatedName(template, template.getTemplateName()); + if (!template.isSaved() && !name.endsWith(" *")) { + name += " *"; + } + return name; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java new file mode 100644 index 0000000000..511b74894f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java @@ -0,0 +1,31 @@ +package com.fr.design.file.impl; + +import com.fr.design.file.MultiTemplateTabPane; + +public class DefaultTemplateTabOperate extends AbstractTemplateTabOperate { + + public static final String OPERATOR_TYPE = "DEFAULT_TEMPLATE_TAB_OPERATOR"; + + private static class HOLDER { + private static final DefaultTemplateTabOperate singleton = new DefaultTemplateTabOperate(); + } + + private DefaultTemplateTabOperate() { + super(); + } + + public static DefaultTemplateTabOperate getInstance() { + return HOLDER.singleton; + } + + @Override + public void refresh() { + MultiTemplateTabPane.getInstance().repaint(); + } + + @Override + public String getOperatorType() { + return OPERATOR_TYPE; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java b/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java new file mode 100644 index 0000000000..804874138d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java @@ -0,0 +1,109 @@ +package com.fr.design.file.impl; + +import com.fr.design.file.CloseOption; +import com.fr.design.file.TemplateTabOperateProvider; +import com.fr.design.mainframe.JTemplate; +import com.fr.file.FILE; +import com.fr.stable.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +public class EmptyTemplateTabOperator implements TemplateTabOperateProvider { + private static class HOLDER { + private static final EmptyTemplateTabOperator singleton = new EmptyTemplateTabOperator(); + } + + + private EmptyTemplateTabOperator() { + + } + + public static EmptyTemplateTabOperator getInstance() { + return HOLDER.singleton; + } + + @Override + public void locateTemplateInTree(int tplIndex) { + + } + + @Override + public void closeAction(CloseOption option, int index) { + + } + + @Override + public void closeByIndex(int index) { + + } + + @Override + public void switchTpl(int templateIndex) { + + } + + @Override + public List> getOpenedJTemplates() { + return new ArrayList<>(); + } + + @Override + public void closeSpecifiedTemplate(JTemplate specifiedTemplate) { + + } + + @Override + public void deleteOpenedTemplate(JTemplate template) { + + } + + @Override + public JTemplate getSelectedFile() { + return null; + } + + @Override + public void refresh() { + + } + + @Override + public void resetSelectIndex(JTemplate jTemplate) { + + } + + @Override + public void refreshOpenedTemplate(List> list) { + + } + + @Override + public void closeFileTemplate(FILE file) { + + } + @Override + public String getOperatorType() { + return StringUtils.EMPTY; + } + + @Override + public int getSelectIndex() { + return 0; + } + + @Override + public void setSelectIndex(int index) { + + } + + @Override + public int getJTemplateIndex(JTemplate jTemplate) { + return 0; + } + + @Override + public String getTemplateShowName(JTemplate jTemplate) { + return StringUtils.EMPTY; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java index b18b346525..63c00deaaf 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java @@ -230,12 +230,11 @@ public class CenterRegionContainerPane extends JPanel { // 颜色,字体那些按钮的工具栏 toolbarPane.add(toolbarComponent = ad.resetToolBar(toolbarComponent, plus), BorderLayout.CENTER); - if (strategy.hasToolBarPane(plus)) { - this.add(toolbarPane, BorderLayout.NORTH); - } else { - this.remove(toolbarPane); + JPanel customNorthPane = strategy.customNorthPane(toolbarPane,plus); + if (!isExist(customNorthPane)){ + this.removeNorth(); + this.add(customNorthPane, BorderLayout.NORTH); } - if (strategy.hasTemplateTabPane(plus)) { eastCenterPane.add(templateTabPane, BorderLayout.CENTER); } else { @@ -250,6 +249,26 @@ public class CenterRegionContainerPane extends JPanel { resetByDesignMode(); } + private void removeNorth(){ + Component[] components = this.getComponents(); + for(Component c : components){ + if (c!= centerTemplateCardPane){ + this.remove(c); + } + } + } + + + private boolean isExist(JPanel customNorthPane) { + Component[] components = this.getComponents(); + for (Component component : components) { + if (component == customNorthPane) { + return true; + } + } + return false; + } + private void resetByDesignMode() { if (DesignModeContext.isDuchampMode()) { eastPane.remove(largeToolbar); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DefaultToolKitConfig.java b/designer-base/src/main/java/com/fr/design/mainframe/DefaultToolKitConfig.java index 305c44aa21..581dc54cb8 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DefaultToolKitConfig.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DefaultToolKitConfig.java @@ -3,6 +3,9 @@ package com.fr.design.mainframe; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; +import javax.swing.JPanel; + + public class DefaultToolKitConfig implements ToolKitConfigStrategy { @Override public boolean hasTemplateTabPane(ToolBarMenuDockPlus plus) { @@ -18,4 +21,9 @@ public class DefaultToolKitConfig implements ToolKitConfigStrategy { public boolean hasToolBarPane(ToolBarMenuDockPlus plus) { return plus.hasToolBarPane(); } + + @Override + public JPanel customNorthPane(JPanel toolBarPane, ToolBarMenuDockPlus plus) { + return toolBarPane; + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index e88d0c946c..2f05dbbeb2 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -19,11 +19,7 @@ import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; -import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.file.MultiTemplateTabPane; -import com.fr.design.file.SaveSomeTemplatePane; -import com.fr.design.file.TemplateTreePane; +import com.fr.design.file.*; import com.fr.design.fun.OemProcessor; import com.fr.design.fun.impl.AbstractTemplateTreeShortCutProvider; import com.fr.design.gui.iprogressbar.ProgressDialog; @@ -1110,7 +1106,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta // 新的form不往前兼容 if (inValidDesigner(jt)) { this.addAndActivateJTemplate(); - MultiTemplateTabPane.getInstance().setTemTemplate( + TemplateTabManager.getInstance().setTemTemplate( HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()); } else { this.addAndActivateJTemplate(jt); 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 8cfd263421..a07bfe1f1d 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 @@ -17,12 +17,7 @@ import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.management.search.TableDataTreeSearchManager; import com.fr.design.data.tabledata.ResponseDataSourceChange; import com.fr.design.dialog.FineJOptionPane; -import com.fr.design.file.FileOperations; -import com.fr.design.file.FileToolbarStateChangeListener; -import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.file.MultiTemplateTabPane; -import com.fr.design.file.TemplateTreePane; +import com.fr.design.file.*; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIMenuHighLight; @@ -275,7 +270,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); HistoryTemplateListPane.getInstance().setCurrentEditingTemplate(jt); //处理自动新建的模板 - MultiTemplateTabPane.getInstance().doWithtemTemplate(); + TemplateTabManager.getInstance().doWithtemTemplate(); if (DesignerMode.isAuthorityEditing()) { RolesAlreadyEditedPane.getInstance().refreshDockingView(); } @@ -547,10 +542,10 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt for (JTemplate jTemplate : HistoryTemplateListCache.getInstance().getHistoryList()) { if (ComparatorUtils.equals(jTemplate.getEditingFILE().getPath(), path)) { if (isCurrentEditing) { - MultiTemplateTabPane.getInstance().setIsCloseCurrent(true); + TemplateTabManager.getInstance().setCloseCurrent(true); } - MultiTemplateTabPane.getInstance().closeFormat(jTemplate); - MultiTemplateTabPane.getInstance().closeSpecifiedTemplate(jTemplate); + TemplateTabManager.getInstance().closeFormat(jTemplate); + TemplateTabManager.getInstance().closeSpecifiedTemplate(jTemplate); return; } } 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 0082e091f3..b8fef1b007 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 @@ -30,9 +30,8 @@ import com.fr.design.designer.DesignerProxy; import com.fr.design.designer.TargetComponent; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.InformationWarnPane; -import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.file.TemplateResourceManager; +import com.fr.design.file.*; +import com.fr.design.file.impl.DefaultTemplateTabOperate; import com.fr.design.fun.DesignerFrameUpButtonProvider; import com.fr.design.fun.MenuHandler; import com.fr.design.fun.PreviewProvider; @@ -615,7 +614,7 @@ public abstract class JTemplate> * @return 是则返回true */ public boolean isALLSaved() { - return this.saved && this.authoritySaved; + return this.saved && this.authoritySaved && this.canBeSaved(); } @@ -1979,7 +1978,11 @@ public abstract class JTemplate> public void setDesignerUIMode() { DesignerUIModeConfig.getInstance().setAbsoluteMeasureUIMode(); } - + + public String getTemplateTabOperatorType(){ + return DefaultTemplateTabOperate.OPERATOR_TYPE; + } + /** * 判断当前的模板是否是有效的模板 * @@ -1989,4 +1992,12 @@ public abstract class JTemplate> public static boolean isValid(JTemplate jt) { return jt != null && jt != JNullTemplate.NULL; } + + public boolean canBeSaved(){ + return true; + } + + public boolean supportCache(){ + return true; + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/ToolKitConfigStrategy.java b/designer-base/src/main/java/com/fr/design/mainframe/ToolKitConfigStrategy.java index 67b1409b36..f2feff8042 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/ToolKitConfigStrategy.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/ToolKitConfigStrategy.java @@ -2,6 +2,9 @@ package com.fr.design.mainframe; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; +import javax.swing.JPanel; + + public interface ToolKitConfigStrategy { /** @@ -24,4 +27,11 @@ public interface ToolKitConfigStrategy { * @return */ boolean hasToolBarPane(ToolBarMenuDockPlus plus); + /** + * 定制工具栏 + * @param toolBarPane + * @param plus + * @return + */ + JPanel customNorthPane(JPanel toolBarPane, ToolBarMenuDockPlus plus); } 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 3372e2ad13..37812c106f 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 @@ -416,9 +416,7 @@ public abstract class ToolBarMenuDock { menuDef.addShortCut(new OpenRecentReportMenuDef()); - if (!DesignModeContext.isDuchampMode()) { - addCloseCurrentTemplateAction(menuDef); - } + addCloseCurrentTemplateAction(menuDef); scs = plus.shortcut4FileMenu(); if (!ArrayUtils.isEmpty(scs)) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java index 8cff3ffbb1..6bfc39b78e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java @@ -1,7 +1,7 @@ package com.fr.design.mainframe.vcs.ui; import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.file.MultiTemplateTabPane; +import com.fr.design.file.TemplateTabManager; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; @@ -57,9 +57,9 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe jt.stopEditing(); //只有模板路径一致时关闭当前模板 if (ComparatorUtils.equals(fileOfVersion, jt.getPath())) { - MultiTemplateTabPane.getInstance().setIsCloseCurrent(true); - MultiTemplateTabPane.getInstance().closeFormat(jt); - MultiTemplateTabPane.getInstance().closeSpecifiedTemplate(jt); + TemplateTabManager.getInstance().setCloseCurrent(true); + TemplateTabManager.getInstance().closeFormat(jt); + TemplateTabManager.getInstance().closeSpecifiedTemplate(jt); } //再打开cache中的模板 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java index 4dd14bce6d..47a95f2620 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java @@ -5,7 +5,7 @@ import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignerMode; import com.fr.design.dialog.BasicPane; import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.file.MultiTemplateTabPane; +import com.fr.design.file.TemplateTabManager; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; @@ -115,9 +115,9 @@ public class FileVersionsPanel extends BasicPane { // 关闭当前打开的版本 JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - MultiTemplateTabPane.getInstance().setIsCloseCurrent(true); - MultiTemplateTabPane.getInstance().closeFormat(jt); - MultiTemplateTabPane.getInstance().closeSpecifiedTemplate(jt); + TemplateTabManager.getInstance().setCloseCurrent(true); + TemplateTabManager.getInstance().closeFormat(jt); + TemplateTabManager.getInstance().closeSpecifiedTemplate(jt); updateDesignerFrame(true); 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 d9c8568bf9..baa73fc53a 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 @@ -3,7 +3,7 @@ package com.fr.design.worker.open; import com.fr.base.chart.exception.ChartNotFoundException; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.file.MultiTemplateTabPane; +import com.fr.design.file.TemplateTabManager; import com.fr.design.file.TemplateTreePane; import com.fr.design.i18n.Toolkit; import com.fr.design.lock.LockInfoDialog; @@ -87,7 +87,7 @@ public class OpenWorker extends SwingWorker { UIManager.getIcon("OptionPane.errorIcon")); } if (cause.getCause() instanceof TplLockedException) { - MultiTemplateTabPane.getInstance().closeCurrentTpl(); + TemplateTabManager.getInstance().closeCurrentTpl(); TemplateTreePane.getInstance().getFileNode().setLock(UUID.randomUUID().toString()); LockInfoDialog.show(null); } diff --git a/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TemplateTransformer.java b/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TemplateTransformer.java index 1a6e2bf1c8..f277320dd0 100644 --- a/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TemplateTransformer.java +++ b/designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TemplateTransformer.java @@ -2,7 +2,7 @@ package com.fr.nx.app.designer.toolbar; import com.fr.base.extension.FileExtension; import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.file.MultiTemplateTabPane; +import com.fr.design.file.TemplateTabManager; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.file.FILE; @@ -103,9 +103,9 @@ public enum TemplateTransformer { DesignerContext.getDesignerFrame().openTemplate(file); return; } - MultiTemplateTabPane.getInstance().setIsCloseCurrent(true); - MultiTemplateTabPane.getInstance().closeFormat(jt); - MultiTemplateTabPane.getInstance().closeSpecifiedTemplate(jt); + TemplateTabManager.getInstance().setCloseCurrent(true); + TemplateTabManager.getInstance().closeFormat(jt); + TemplateTabManager.getInstance().closeSpecifiedTemplate(jt); DesignerContext.getDesignerFrame().openTemplate(file); } diff --git a/designer-base/src/main/java/com/fr/start/BaseDesigner.java b/designer-base/src/main/java/com/fr/start/BaseDesigner.java index 44228c2a4a..50f2cd35c0 100644 --- a/designer-base/src/main/java/com/fr/start/BaseDesigner.java +++ b/designer-base/src/main/java/com/fr/start/BaseDesigner.java @@ -8,7 +8,7 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.constants.DesignerLaunchStatus; import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.file.MultiTemplateTabPane; +import com.fr.design.file.TemplateTabManager; import com.fr.design.file.TemplateTreePane; import com.fr.design.fun.DesignerStartOpenFileProcessor; import com.fr.design.fun.impl.DesignerStartWithEmptyFile; @@ -193,7 +193,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock { } else { df.addAndActivateJTemplate(); // 如果没有模板,则需要确认一下 - MultiTemplateTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); + TemplateTabManager.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); } } @@ -253,7 +253,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock { private boolean createNewTemplate(DesignerFrame df) { df.addAndActivateJTemplate(); // 如果没有模板,则需要确认一下 - MultiTemplateTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); + TemplateTabManager.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); return true; } diff --git a/designer-base/src/main/java/com/fr/start/common/DesignerOpenEmptyPanel.java b/designer-base/src/main/java/com/fr/start/common/DesignerOpenEmptyPanel.java index b42cc4ed8f..5dcaa147ac 100644 --- a/designer-base/src/main/java/com/fr/start/common/DesignerOpenEmptyPanel.java +++ b/designer-base/src/main/java/com/fr/start/common/DesignerOpenEmptyPanel.java @@ -3,7 +3,7 @@ package com.fr.start.common; import com.fr.base.svg.IconUtils; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.file.MultiTemplateTabPane; +import com.fr.design.file.TemplateTabManager; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.i18n.Toolkit; @@ -59,7 +59,7 @@ public class DesignerOpenEmptyPanel extends JPanel { HistoryTemplateListCache.getInstance().setCurrentEditingTemplate(null); df.addAndActivateJTemplate(); // 如果没有模板,则需要确认一下 - MultiTemplateTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); + TemplateTabManager.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); } }); createButton.setBorder(new EmptyBorder(0, 10, 0, 10)); diff --git a/designer-form/src/main/java/com/fr/design/fit/common/TemplateTool.java b/designer-form/src/main/java/com/fr/design/fit/common/TemplateTool.java index 04633435be..c362ae76d1 100644 --- a/designer-form/src/main/java/com/fr/design/fit/common/TemplateTool.java +++ b/designer-form/src/main/java/com/fr/design/fit/common/TemplateTool.java @@ -1,7 +1,7 @@ package com.fr.design.fit.common; import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.file.MultiTemplateTabPane; +import com.fr.design.file.TemplateTabManager; import com.fr.design.fit.NewJForm; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; @@ -86,7 +86,7 @@ public class TemplateTool { JTemplate oldJTemplate = jTemplateList.get(i); if (oldJTemplate != null && ComparatorUtils.equals(oldJTemplate.getEditingFILE(), newJTemplate.getEditingFILE())) { jTemplateList.set(i, newJTemplate); - MultiTemplateTabPane.getInstance().refreshOpenedTemplate(jTemplateList); + TemplateTabManager.getInstance().refreshOpenedTemplate(jTemplateList); return; } } diff --git a/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java b/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java index 4afacee781..03e8e2b445 100644 --- a/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java +++ b/designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java @@ -1,7 +1,8 @@ package com.fr.design.preview; import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.file.MultiTemplateTabPane; +import com.fr.design.file.TemplateTabManager; +import com.fr.design.file.TemplateTreePane; import com.fr.design.fun.impl.AbstractPreviewProvider; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JForm; @@ -66,7 +67,7 @@ public class DeveloperPreview extends AbstractPreviewProvider { } private void onPreview(JTemplate jt) { - MultiTemplateTabPane.getInstance().closeCurrentTpl(); + TemplateTabManager.getInstance().closeCurrentTpl(); jt.generateForBiddenTemplate(); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index f9c086a50b..5ba4838d6e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -39,7 +39,7 @@ import com.fr.design.designer.TargetComponent; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.file.MultiTemplateTabPane; +import com.fr.design.file.TemplateTabManager; import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PropertyItemPaneProvider; import com.fr.design.fun.ReportSupportedFileUIProvider; @@ -1175,7 +1175,7 @@ public class JWorkBook extends JTemplate { public boolean saveShareFile() { FILE newFile = createNewEmptyFile(); //如果文件已经打开, 那么就覆盖关闭掉他 - MultiTemplateTabPane.getInstance().closeFileTemplate(newFile); + TemplateTabManager.getInstance().closeFileTemplate(newFile); final WorkBook tpl = this.getTarget(); // 弹出输入参数 java.util.Map parameterMap = inputParameters(tpl); diff --git a/designer-realize/src/main/java/com/fr/start/MainDesigner.java b/designer-realize/src/main/java/com/fr/start/MainDesigner.java index 7b974d871c..55b6548ac5 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -17,6 +17,7 @@ import com.fr.design.deeplink.DeepLinkManager; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.MultiTemplateTabPane; +import com.fr.design.file.TemplateTabManager; import com.fr.design.fun.MenuHandler; import com.fr.design.fun.OemProcessor; import com.fr.design.gui.ibutton.UIButton; @@ -409,8 +410,7 @@ public class MainDesigner extends BaseDesigner { return; } saveButton.setEnabled(!jt.isSaved() && !DesignModeContext.isVcsMode() && jt.checkEnable()); - MultiTemplateTabPane.getInstance().refreshOpenedTemplate(HistoryTemplateListCache.getInstance().getHistoryList()); - MultiTemplateTabPane.getInstance().repaint(); + TemplateTabManager.getInstance().refreshOpenedTemplate(HistoryTemplateListCache.getInstance().getHistoryList()); if (DesignerEnvManager.getEnvManager().isSupportUndo()) { undo.setEnabled(jt.canUndo()); redo.setEnabled(jt.canRedo()); From 7f70d695d6d9e226c9a5ec0b75dd7290e3690fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=2EYing-=E5=BA=94=E5=BF=97=E6=B5=A9?= Date: Fri, 14 Apr 2023 11:08:09 +0800 Subject: [PATCH 22/42] =?UTF-8?q?REPORT-83195=20=E5=8D=A1=E9=A1=BF?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96-=E4=BF=9D=E5=AD=98=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/JTemplate.java | 115 ++++++++++++++---- .../com/fr/design/worker/save/SaveWorker.java | 51 +++++--- .../fr/design/worker/save/type/SaveType.java | 50 ++++++++ .../worker/save/type/SaveTypeWorker.java | 75 ++++++++++++ 4 files changed, 255 insertions(+), 36 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/worker/save/type/SaveType.java create mode 100644 designer-base/src/main/java/com/fr/design/worker/save/type/SaveTypeWorker.java diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 0082e091f3..229ba848d8 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 @@ -61,6 +61,8 @@ import com.fr.design.utils.DesignUtils; import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.design.worker.save.EmptyCallBackSaveWorker; import com.fr.design.worker.save.SaveFailureHandler; +import com.fr.design.worker.save.type.SaveType; +import com.fr.design.worker.save.type.SaveTypeWorker; import com.fr.design.write.submit.DBManipulationInWidgetEventPane; import com.fr.design.write.submit.DBManipulationPane; import com.fr.event.EventDispatcher; @@ -1687,24 +1689,7 @@ public abstract class JTemplate> if (!editingFILE.exists()) { return saveAs(showLoc); } - - CallbackSaveWorker worker = new CallbackSaveWorker(new Callable() { - @Override - public Boolean call() throws Exception { - return saveRealFileByWorker(); - } - }, this); - - worker.addSuccessCallback(new Runnable() { - @Override - public void run() { - callBackForSave(); - //在保存后的回调中执行预编译流程 - CptCompileUtil.compile(JTemplate.this); - } - }); - - return worker; + return getSaveCallBackSaveWorker(); } /** @@ -1750,6 +1735,8 @@ public abstract class JTemplate> } } + + private CallbackSaveWorker saveAs(boolean showLoc) { FILE editingFILE = this.getEditingFILE(); if (editingFILE == null) { @@ -1771,7 +1758,6 @@ public abstract class JTemplate> // 目标文件 editingFILE = fileChooser.getSelectedFILE(); } - FILE finalEditingFILE = editingFILE; CallbackSaveWorker worker = new CallbackSaveWorker(new Callable() { @Override @@ -1872,10 +1858,95 @@ public abstract class JTemplate> return saveAs(true); } + /** + * 获取保存用到的saveWorker + */ + private CallbackSaveWorker getSaveCallBackSaveWorker() { + CallbackSaveWorker worker = new CallbackSaveWorker(new Callable() { + @Override + public Boolean call() throws Exception { + return saveRealFileByWorker(); + } + }, this); + + worker.addSuccessCallback(new Runnable() { + @Override + public void run() { + callBackForSave(); + //在保存后的回调中执行预编译流程 + CptCompileUtil.compile(JTemplate.this); + } + }); + return worker; + } + + /** + * 获取保存的类别执行的callable + */ + private Callable getSaveTypeCallable() { + return () -> { + fireJTemplateSaveBefore(); + FILE editingFILE = getEditingFILE(); + // carl:editingFILE没有,当然不存了,虽然不会有这种情况 + if (editingFILE == null) { + return SaveType.TypeEnum.EMPTY; + } + // 检查一下editingFILE是不是已存在的文件,如果不存在则用saveAs + if (!editingFILE.exists()) { + return SaveType.TypeEnum.SAVE_AS; + } + return SaveType.TypeEnum.SAVE; + }; + } + + /** + * 根据保存类型获取对应的saveWorker + * + * @param saveType 保存类型 + */ + private CallbackSaveWorker getSaveTypeWorker(SaveType saveType) { + CallbackSaveWorker callbackSaveWorker; + switch (saveType.getType()) { + case EMPTY: + callbackSaveWorker = new EmptyCallBackSaveWorker(); + break; + case SAVE: + callbackSaveWorker = getSaveCallBackSaveWorker(); + break; + default: + callbackSaveWorker = saveAs(true); + } + return callbackSaveWorker; + } + + + @Override public void saveDirectly() { - CallbackSaveWorker worker = save(); - worker.start(getRuntimeId()); + new SaveTypeWorker(getSaveTypeCallable(), this) { + @Override + protected void done() { + try { + SaveType saveType = get(); + CallbackSaveWorker callbackSaveWorker = getSaveTypeWorker(saveType); + //告诉一下后面执行的saveWorker,当前判断文件是否存在的操作是否已经进行了开始转圈的那个等待动画,避免重复 + callbackSaveWorker.setSlowly(saveType.isSlowly()); + callbackSaveWorker.start(getRuntimeId()); + //如果是空也就是不保存,需要恢复一下界面(如果saveTypeWorker里进行了操作的话) + if (callbackSaveWorker instanceof EmptyCallBackSaveWorker) { + setSaving(false); + if (saveType.isSlowly()) { + if (ComparatorUtils.equals(getName(), HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getName())) { + DesignerContext.getDesignerFrame().getCenterTemplateCardPane().hideCover(); + } + } + DesignerFrameFileDealerPane.getInstance().stateChange(); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + }.start(); } @Override @@ -1979,7 +2050,7 @@ public abstract class JTemplate> public void setDesignerUIMode() { DesignerUIModeConfig.getInstance().setAbsoluteMeasureUIMode(); } - + /** * 判断当前的模板是否是有效的模板 * diff --git a/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java b/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java index 60d797c3e9..188aedacb9 100644 --- a/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java +++ b/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java @@ -5,12 +5,15 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.JTemplate; +import com.fr.design.ui.util.UIUtil; import com.fr.design.worker.WorkerManager; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; + import java.util.concurrent.Callable; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; + +import com.fr.third.org.apache.commons.lang3.time.StopWatch; + import javax.swing.SwingWorker; /** @@ -34,6 +37,14 @@ public class SaveWorker extends SwingWorker { private boolean slowly; + public boolean isSlowly() { + return slowly; + } + + public void setSlowly(boolean slowly) { + this.slowly = slowly; + } + public SaveWorker(Callable callable, JTemplate template) { this.callable = callable; this.template = template; @@ -47,10 +58,11 @@ public class SaveWorker extends SwingWorker { @Override protected void done() { try { - success = get(); + success = get(); } catch (Exception e) { processResult(); FineLoggerFactory.getLogger().error(e.getMessage(), e); + WorkerManager.getInstance().removeWorker(taskName); SaveFailureHandler.getInstance().process(e); return; } @@ -62,6 +74,7 @@ public class SaveWorker extends SwingWorker { // 恢复界面 if (slowly && ComparatorUtils.equals(this.template.getName(), HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getName())) { DesignerContext.getDesignerFrame().getCenterTemplateCardPane().hideCover(); + slowly = false; } DesignerFrameFileDealerPane.getInstance().stateChange(); WorkerManager.getInstance().removeWorker(taskName); @@ -69,21 +82,31 @@ public class SaveWorker extends SwingWorker { public void start(String taskName) { this.taskName = taskName; + StopWatch stopWatch = StopWatch.createStarted(); this.template.setSaving(true); this.execute(); // worker纳入管理 WorkerManager.getInstance().registerWorker(taskName, this); - try { - this.get(TIME_OUT, TimeUnit.MILLISECONDS); - } catch (TimeoutException timeoutException) { - slowly = true; - // 开始禁用 - EastRegionContainerPane.getInstance().updateAllPropertyPane(); - DesignerContext.getDesignerFrame().getCenterTemplateCardPane().showCover(); - DesignerFrameFileDealerPane.getInstance().stateChange(); - } catch (Exception exception) { - FineLoggerFactory.getLogger().error(exception.getMessage(), exception); - WorkerManager.getInstance().removeWorker(taskName); + if (!slowly) { + new Thread(() -> { + while (true) { + if (stopWatch.getTime() > TIME_OUT || isDone()) { + if (!isDone()) { + slowly = true; + UIUtil.invokeLaterIfNeeded(() -> { + // 开始禁用 + if (slowly) { + EastRegionContainerPane.getInstance().updateAllPropertyPane(); + DesignerContext.getDesignerFrame().getCenterTemplateCardPane().showCover(); + DesignerFrameFileDealerPane.getInstance().stateChange(); + } + }); + } + stopWatch.stop(); + break; + } + } + }).start(); } } } diff --git a/designer-base/src/main/java/com/fr/design/worker/save/type/SaveType.java b/designer-base/src/main/java/com/fr/design/worker/save/type/SaveType.java new file mode 100644 index 0000000000..63cf6c4c7e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/worker/save/type/SaveType.java @@ -0,0 +1,50 @@ +package com.fr.design.worker.save.type; + +/** + * 保存的类别 + * + * @author John.Ying + * @since 11.0 + * Created on 2023/4/14 + */ +public class SaveType { + + private TypeEnum type; + //保存时间是否慢(是否展示了保存中的UI界面) + private boolean slowly; + + public TypeEnum getType() { + return type; + } + + public void setType(TypeEnum saveType) { + this.type = saveType; + } + + public boolean isSlowly() { + return slowly; + } + + public void setSlowly(boolean slowly) { + this.slowly = slowly; + } + + /** + * 保存类型:save or saveAs or empty + */ + public enum TypeEnum { + /** + * 保存 + */ + SAVE, + /** + * 另存 + */ + SAVE_AS, + /** + * 空保存 + */ + EMPTY; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/worker/save/type/SaveTypeWorker.java b/designer-base/src/main/java/com/fr/design/worker/save/type/SaveTypeWorker.java new file mode 100644 index 0000000000..e087f701f7 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/worker/save/type/SaveTypeWorker.java @@ -0,0 +1,75 @@ +package com.fr.design.worker.save.type; + + +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerFrameFileDealerPane; +import com.fr.design.mainframe.EastRegionContainerPane; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.ui.util.UIUtil; +import com.fr.third.org.apache.commons.lang3.time.StopWatch; + +import javax.swing.SwingWorker; +import java.util.concurrent.Callable; + +/** + * 判断保存类别时执行的worker + * + * @author John.Ying + * @since 11.0 + * Created on 2023/4/14 + */ +public class SaveTypeWorker extends SwingWorker { + + private final Callable callable; + + private static final int TIME_OUT = 400; + + private final JTemplate template; + + private final SaveType saveType; + + public SaveTypeWorker(Callable callable, JTemplate template) { + this.callable = callable; + this.template = template; + this.saveType = new SaveType(); + } + + @Override + protected SaveType doInBackground() throws Exception { + this.saveType.setType(callable.call()); + return this.saveType; + } + + @Override + protected void done() { + + } + + /** + * 启动saveTypeWorker + */ + public void start() { + StopWatch stopWatch = StopWatch.createStarted(); + this.template.setSaving(true); + this.execute(); + new Thread(() -> { + while (true) { + //大于最大等待时间或者worker已经完成该线程都要结束循环 + if (stopWatch.getTime() > TIME_OUT || isDone()) { + //如果是大于最大等待时间结束的,就需要进行等待中界面的覆盖 + if (!isDone()) { + saveType.setSlowly(true); + UIUtil.invokeLaterIfNeeded(() -> { + // 开始禁用 + EastRegionContainerPane.getInstance().updateAllPropertyPane(); + DesignerContext.getDesignerFrame().getCenterTemplateCardPane().showCover(); + DesignerFrameFileDealerPane.getInstance().stateChange(); + }); + } + stopWatch.stop(); + break; + } + } + }).start(); + } +} From 437c05bbc0959de6b61fa468c2877f77338e6988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=2EYing-=E5=BA=94=E5=BF=97=E6=B5=A9?= Date: Fri, 14 Apr 2023 11:39:01 +0800 Subject: [PATCH 23/42] =?UTF-8?q?REPORT-83195=20=E5=8D=A1=E9=A1=BF?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96-=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E5=88=9D=E6=AC=A1=E6=B7=BB=E5=8A=A0=E5=9B=BE=E8=A1=A8=E5=8D=A1?= =?UTF-8?q?=E6=AD=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/ChartPropertyPane.java | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) 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 4efe977ff3..8e6b80c53a 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 @@ -9,6 +9,7 @@ import com.fr.base.chart.BaseChartCollection; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chartx.attr.ChartProvider; +import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.designer.TargetComponent; import com.fr.design.gui.chart.BaseChartPropertyPane; @@ -19,6 +20,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.BorderFactory; import javax.swing.Icon; +import javax.swing.SwingWorker; import java.awt.BorderLayout; import java.awt.Component; @@ -95,16 +97,25 @@ public class ChartPropertyPane extends BaseChartPropertyPane { * @param ePane 面板 */ public void populateChartPropertyPane(ChartCollection collection, TargetComponent ePane) { - String chartID = collection.getSelectedChartProvider(ChartProvider.class).getID(); - updateChartEditPane(collection.getSelectedChartProvider(ChartProvider.class).getID()); - setSupportCellData(true); - this.container.setEPane(ePane); - - if (ChartTypeManager.getInstance().chartExit(chartID)) { - chartEditPane.populate(collection); - } else { - GUICoreUtils.setEnabled(chartEditPane, false); - } + new SwingWorker() { + @Override + protected Void doInBackground() throws Exception { + GEOJSONHelper.getInstance(); + return null; + } + @Override + protected void done() { + String chartID = collection.getSelectedChartProvider(ChartProvider.class).getID(); + updateChartEditPane(collection.getSelectedChartProvider(ChartProvider.class).getID()); + setSupportCellData(true); + container.setEPane(ePane); + if (ChartTypeManager.getInstance().chartExit(chartID)) { + chartEditPane.populate(collection); + } else { + GUICoreUtils.setEnabled(chartEditPane, false); + } + } + }.execute(); } /** From ca53cd0f6e84fa93a91795747b631f58b301b543 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 14 Apr 2023 13:35:38 +0800 Subject: [PATCH 24/42] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=94=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/file/CloseOption.java | 11 +++++ .../file/MultiTemplateTabMenuFactory.java | 8 +++- .../fr/design/file/SaveSomeTemplatePane.java | 15 +++++++ .../fr/design/file/TemplateTabManager.java | 40 ++++++++++++++--- .../file/TemplateTabOperateProvider.java | 9 ++++ .../file/impl/AbstractTemplateTabOperate.java | 44 ++++++++++++++----- .../file/impl/DefaultTemplateTabOperate.java | 13 +++++- .../file/impl/EmptyTemplateTabOperator.java | 13 +++++- .../fr/design/mainframe/DesignerFrame.java | 6 ++- .../DesignerFrameFileDealerPane.java | 7 ++- .../com/fr/design/mainframe/JTemplate.java | 13 +++++- 11 files changed, 154 insertions(+), 25 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/CloseOption.java b/designer-base/src/main/java/com/fr/design/file/CloseOption.java index c88e7658c8..79667dec0f 100644 --- a/designer-base/src/main/java/com/fr/design/file/CloseOption.java +++ b/designer-base/src/main/java/com/fr/design/file/CloseOption.java @@ -2,6 +2,11 @@ package com.fr.design.file; import com.fr.design.i18n.Toolkit; +/** + * @author kerry + * @since 11.0 + * created on 2023-04-14 + **/ public enum CloseOption { Left(Toolkit.i18nText("Fine-Design_Close_templates_To_The_Left")) { @Override @@ -36,6 +41,12 @@ public enum CloseOption { this.optionName = optionName; } + /** + * 判断指定索引模板是否应该被关闭 + * @param tplIndex + * @param i + * @return + */ public boolean shouldClose(int tplIndex, int i) { return true; } diff --git a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java index a67e129f78..edbe9cbab3 100644 --- a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java +++ b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java @@ -30,8 +30,8 @@ import java.util.Map; /** * @author Carlson - * @version 11.0 - * @description + * @since 11.0 + * created on 2023-04-14 **/ public class MultiTemplateTabMenuFactory { @@ -49,6 +49,10 @@ public class MultiTemplateTabMenuFactory { } + /** + * 返回右侧下拉菜单的工厂类 + * @return + */ public static MultiTemplateTabMenuFactory getInstance() { return INSTANCE; } diff --git a/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java b/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java index 96d72d34c1..715cc94ba0 100644 --- a/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java +++ b/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java @@ -151,15 +151,30 @@ public class SaveSomeTemplatePane extends BasicPane { } + /** + * 显示未保存弹窗 + * @return + */ public boolean showSavePane() { return showSavePane(false); } + /** + * 显示未保存弹窗 + * @param switchEnv + * @return + */ public boolean showSavePane(boolean switchEnv) { return switchEnv ? showSavePane(DefaultTemplateTabOperate.getInstance().getOpenedJTemplates()) : showSavePane(HistoryTemplateListPane.getInstance().getHistoryList()); } + + /** + * 显示未保存弹窗 + * @param jTemplates + * @return + */ public boolean showSavePane(List> jTemplates) { populate(jTemplates); //如果有未保存的文件 ,则跳出保存对话框,选择要存储的项目 diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java b/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java index 22a0bc37e4..da151d9b0f 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java @@ -12,13 +12,22 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +/** + * @author kerry + * @since 11.0 + * created on 2023-04-14 + **/ public class TemplateTabManager { private static class HOLDER { - private static final TemplateTabManager singleton = new TemplateTabManager(); + private static final TemplateTabManager SINGLETON = new TemplateTabManager(); } + /** + * 返回TemplateTabManager单例对象 + * @return + */ public static TemplateTabManager getInstance() { - return HOLDER.singleton; + return HOLDER.SINGLETON; } private TemplateTabManager() { @@ -27,15 +36,23 @@ public class TemplateTabManager { private List list = new ArrayList<>(); + /** + * 支持注册新的Operator + * @param templateTabOperateProvider + */ public void register(TemplateTabOperateProvider templateTabOperateProvider) { this.list.add(templateTabOperateProvider); } + /** + * 移除operator + * @param templateTabOperateProvider + */ public void remove(TemplateTabOperateProvider templateTabOperateProvider) { this.list.remove(templateTabOperateProvider); } - private boolean isCloseCurrent = false; + private boolean closeCurrent = false; //自动新建的模板B若没有进行任何编辑,切换到其他 // 模板时,模板B会自动关闭 @@ -43,17 +60,20 @@ public class TemplateTabManager { public boolean isCloseCurrent() { - return isCloseCurrent; + return closeCurrent; } public void setCloseCurrent(boolean closeCurrent) { - isCloseCurrent = closeCurrent; + this.closeCurrent = closeCurrent; } public void setTemTemplate(JTemplate temTemplate) { this.temTemplate = temTemplate; } + /** + * 刷新tab栏 + */ public void refresh() { getCurrentOperator().refresh(); } @@ -127,11 +147,18 @@ public class TemplateTabManager { } + /** + * 重置选中index + * @param jTemplate + */ public void resetSelectIndex(JTemplate jTemplate) { getCurrentOperator().resetSelectIndex(jTemplate); } + /** + * 激活新模板 + */ public void activeNewTemplate() { //先看其他模式中是否有已打开的模板,有的话切换过去 for (TemplateTabOperateProvider templateTabOperateProvider : list) { @@ -202,6 +229,9 @@ public class TemplateTabManager { return resultMap; } + /** + * 关闭其他 + */ public void closeOthers() { TemplateTabOperateProvider currentOperator = getCurrentOperator(); currentOperator.closeAction(CloseOption.Others, diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTabOperateProvider.java b/designer-base/src/main/java/com/fr/design/file/TemplateTabOperateProvider.java index ff913f3342..7bcc816526 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTabOperateProvider.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTabOperateProvider.java @@ -6,6 +6,11 @@ import com.fr.file.FILE; import java.util.List; +/** + * @author kerry + * @since 11.0 + * created on 2023-04-14 + **/ public interface TemplateTabOperateProvider { /** * 找到模板树中的位置 @@ -38,6 +43,10 @@ public interface TemplateTabOperateProvider { List> getOpenedJTemplates(); + /** + * 根据指定索引关闭模板 + * @param index + */ void closeByIndex(int index); /** * 关闭指定模板 diff --git a/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java b/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java index b6bee6e6d8..e42b336f57 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java @@ -25,18 +25,25 @@ import com.fr.third.javax.annotation.Nonnull; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.TplOperator; -import javax.swing.*; +import javax.swing.JOptionPane; import java.util.ArrayList; import java.util.List; import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog; -import static javax.swing.JOptionPane.*; - +import static javax.swing.JOptionPane.OK_CANCEL_OPTION; +import static javax.swing.JOptionPane.OK_OPTION; +import static javax.swing.JOptionPane.WARNING_MESSAGE; + +/** + * @author kerry + * @since 11.0 + * created on 2023-04-14 + **/ public abstract class AbstractTemplateTabOperate implements TemplateTabOperateProvider { //用于存放工作簿 - protected java.util.List> openedTemplate = new ArrayList<>(); + private java.util.List> openedTemplate = new ArrayList<>(); //选中的Tab项 - protected int selectedIndex = -1; + private int selectedIndex = -1; public AbstractTemplateTabOperate() { @@ -57,7 +64,8 @@ public abstract class AbstractTemplateTabOperate implements TemplateTabOperatePr FILE currentTemplate = template.getEditingFILE(); //模板不属于当前环境,跟预览一样先提示保存,再定位模板 //如果是拖拽进来的模板单单用exist不能判断,这边参考预览的判断逻辑(browserTemplate),补充一下 - if ((!currentTemplate.exists() || !(currentTemplate instanceof FileNodeFILE)) && template.canBeSaved()) { + boolean needSave = (!currentTemplate.exists() || !(currentTemplate instanceof FileNodeFILE)) && template.canBeSaved(); + if (needSave) { int selVal = showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"), Toolkit.i18nText("Fine-Design_Basic_Preview_Tool_Tips"), OK_CANCEL_OPTION, WARNING_MESSAGE); if (OK_OPTION == selVal) { CallbackSaveWorker worker = template.saveAs(); @@ -96,6 +104,10 @@ public abstract class AbstractTemplateTabOperate implements TemplateTabOperatePr } } + /** + * 根据指定索引值关闭模板 + * @param index + */ public void closeByIndex(int index) { //关闭close图标所在的模板{ JTemplate template = openedTemplate.get(index); @@ -153,18 +165,19 @@ public abstract class AbstractTemplateTabOperate implements TemplateTabOperatePr public void switchTpl(int templateIndex) { int tempSelectedIndex = selectedIndex; JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if ((selectedIndex != templateIndex || !this.accept(jTemplate.getTemplateTabOperatorType())) - && templateIndex != -1) { + boolean shouldSwitch = (selectedIndex != templateIndex || !this.accept(jTemplate.getTemplateTabOperatorType())) + && templateIndex != -1; + if (shouldSwitch) { openedTemplate.get(selectedIndex).stopEditing(); selectedIndex = templateIndex; //如果在权限编辑情况下,不允许切换到表单类型的工作簿 if (DesignerMode.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()) { DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(tempSelectedIndex)); - FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Form_Authority_Edited_Cannot_Be_Supported") + "!", Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Form_Authority_Edited_Cannot_Be_Supported") + "!", Toolkit.i18nText("Fine-Design_Basic_Alert"), WARNING_MESSAGE); return; } - JTemplate evtXTemplate = openedTemplate.get(templateIndex); - evtXTemplate.activeNewJTemplate(); + JTemplate evtTemplate = openedTemplate.get(templateIndex); + evtTemplate.activeNewJTemplate(); } } @@ -285,6 +298,10 @@ public abstract class AbstractTemplateTabOperate implements TemplateTabOperatePr TemplateTabManager.getInstance().refresh(); } + /** + * 刷新已打开的模板 + * @param list + */ public void refreshOpenedTemplate(List> list) { List> result = new ArrayList<>(); for (JTemplate jTemplate : list) { @@ -315,6 +332,11 @@ public abstract class AbstractTemplateTabOperate implements TemplateTabOperatePr return this.openedTemplate.indexOf(jTemplate); } + /** + * 是否支持指定操作类型 + * @param type + * @return + */ public boolean accept(String type) { return CompareUtils.isEqual(getOperatorType(), type); } diff --git a/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java index 511b74894f..ae8ea292a9 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java @@ -2,20 +2,29 @@ package com.fr.design.file.impl; import com.fr.design.file.MultiTemplateTabPane; +/** + * @author kerry + * @since 11.0 + * created on 2023-04-14 + **/ public class DefaultTemplateTabOperate extends AbstractTemplateTabOperate { public static final String OPERATOR_TYPE = "DEFAULT_TEMPLATE_TAB_OPERATOR"; private static class HOLDER { - private static final DefaultTemplateTabOperate singleton = new DefaultTemplateTabOperate(); + private static final DefaultTemplateTabOperate SINGLETON = new DefaultTemplateTabOperate(); } private DefaultTemplateTabOperate() { super(); } + /** + * 返回DefaultTemplateTabOperate 单例 + * @return + */ public static DefaultTemplateTabOperate getInstance() { - return HOLDER.singleton; + return HOLDER.SINGLETON; } @Override diff --git a/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java b/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java index 804874138d..4afe59f16b 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java @@ -9,9 +9,14 @@ import com.fr.stable.StringUtils; import java.util.ArrayList; import java.util.List; +/** + * @author kerry + * @since 11.0 + * created on 2023-04-14 + **/ public class EmptyTemplateTabOperator implements TemplateTabOperateProvider { private static class HOLDER { - private static final EmptyTemplateTabOperator singleton = new EmptyTemplateTabOperator(); + private static final EmptyTemplateTabOperator SINGLETON = new EmptyTemplateTabOperator(); } @@ -19,8 +24,12 @@ public class EmptyTemplateTabOperator implements TemplateTabOperateProvider { } + /** + * 返回空的模板taboperator单例 + * @return + */ public static EmptyTemplateTabOperator getInstance() { - return HOLDER.singleton; + return HOLDER.SINGLETON; } @Override diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 2f05dbbeb2..8b63b73e96 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -19,7 +19,11 @@ import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; -import com.fr.design.file.*; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.file.SaveSomeTemplatePane; +import com.fr.design.file.TemplateTabManager; +import com.fr.design.file.TemplateTreePane; import com.fr.design.fun.OemProcessor; import com.fr.design.fun.impl.AbstractTemplateTreeShortCutProvider; import com.fr.design.gui.iprogressbar.ProgressDialog; 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 a07bfe1f1d..80fccc95cb 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 @@ -17,7 +17,12 @@ import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.management.search.TableDataTreeSearchManager; import com.fr.design.data.tabledata.ResponseDataSourceChange; import com.fr.design.dialog.FineJOptionPane; -import com.fr.design.file.*; +import com.fr.design.file.FileOperations; +import com.fr.design.file.FileToolbarStateChangeListener; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.file.TemplateTabManager; +import com.fr.design.file.TemplateTreePane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIMenuHighLight; 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 b8fef1b007..dbf63e077c 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 @@ -30,7 +30,9 @@ import com.fr.design.designer.DesignerProxy; import com.fr.design.designer.TargetComponent; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.InformationWarnPane; -import com.fr.design.file.*; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.file.TemplateResourceManager; import com.fr.design.file.impl.DefaultTemplateTabOperate; import com.fr.design.fun.DesignerFrameUpButtonProvider; import com.fr.design.fun.MenuHandler; @@ -1993,10 +1995,19 @@ public abstract class JTemplate> return jt != null && jt != JNullTemplate.NULL; } + /** + * 当前模板是否可以被保存 + * @return 是/否 + */ public boolean canBeSaved(){ return true; } + /** + * 当前的模板是否支持缓存 + * + * @return 是/否 + */ public boolean supportCache(){ return true; } From 808f940df284f1f95e0d4550383f65dedba6ec64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=2EYing-=E5=BA=94=E5=BF=97=E6=B5=A9?= Date: Fri, 14 Apr 2023 13:41:06 +0800 Subject: [PATCH 25/42] =?UTF-8?q?REPORT-83195=20=E5=8D=A1=E9=A1=BF?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96-=E5=BC=80=E5=8F=91=E8=80=85?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/carton/SwitchForSwingChecker.java | 74 ++++++++- .../design/carton/developer/AwtEventInfo.java | 73 +++++++++ .../developer/EventDispatchDeveloperMode.java | 146 ++++++++++++++++++ 3 files changed, 288 insertions(+), 5 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/carton/developer/AwtEventInfo.java create mode 100644 designer-base/src/main/java/com/fr/design/carton/developer/EventDispatchDeveloperMode.java diff --git a/designer-base/src/main/java/com/fr/design/carton/SwitchForSwingChecker.java b/designer-base/src/main/java/com/fr/design/carton/SwitchForSwingChecker.java index 683179293e..837bdb1c8b 100644 --- a/designer-base/src/main/java/com/fr/design/carton/SwitchForSwingChecker.java +++ b/designer-base/src/main/java/com/fr/design/carton/SwitchForSwingChecker.java @@ -1,6 +1,7 @@ package com.fr.design.carton; +import com.fr.design.carton.developer.EventDispatchDeveloperMode; import com.fr.design.i18n.Toolkit; import com.fr.general.GeneralUtils; import com.fr.json.JSON; @@ -29,11 +30,22 @@ import java.util.Map; import java.util.Date; import java.util.Calendar; + public class SwitchForSwingChecker implements XMLReadable, XMLWriter { /** * Designer4Debug类名 */ private static final String DEBUG_MAIN_CLASS_NAME = "com.fr.start.Designer4Debug"; + + /** + * 真正主类 + */ + private static final String NORMAL_MAIN_CLASS_NAME = "com.fr.start.MainDesigner"; + + /** + * 开发者模式jvm参数 + */ + private static final String CARTON_DEVELOPER_JVM_PARAM = "cartonDeveloper"; /** * XML标签 */ @@ -249,11 +261,7 @@ public class SwitchForSwingChecker implements XMLReadable, XMLWriter { */ public static void initThreadMonitoring () { String mainClass = System.getProperty("sun.java.command"); - //判断一下,如果是以Designer4Debug启动,就不注册代码,不然会覆盖掉SwingExplorer,导致其无法使用 - if (!StringUtils.equals(mainClass, DEBUG_MAIN_CLASS_NAME)) { - EventDispatchThreadHangMonitor.initMonitoring(); - AppContext.getAppContext().put(SwingWorker.class, CartonThreadExecutorPool.getTimerThreadExecutorPool()); - } + MainClassType.getMainClassType(mainClass).initEventQueue(); } /** @@ -309,4 +317,60 @@ public class SwitchForSwingChecker implements XMLReadable, XMLWriter { writer.end(); } + /** + * 根据程序启动类路径进行区分 + * + * @author John.Ying + * @since 11.0 + * Created on 2023/4/14 + */ + enum MainClassType { + /** + * 用mainDesigner启动 + */ + MAIN(NORMAL_MAIN_CLASS_NAME) { + @Override + void initEventQueue() { + if (StringUtils.equals("true", System.getProperty(CARTON_DEVELOPER_JVM_PARAM))) { + EventDispatchDeveloperMode.INSTANCE.initMonitoring(); + } else { + EventDispatchThreadHangMonitor.initMonitoring(); + AppContext.getAppContext().put(SwingWorker.class, CartonThreadExecutorPool.getTimerThreadExecutorPool()); + } + } + }, + + /** + * designer4debug启动 + */ + DEBUG_MAIN(DEBUG_MAIN_CLASS_NAME) { + @Override + void initEventQueue() { + + } + }; + + MainClassType(String classPath) { + this.classPath = classPath; + } + + String classPath; + + /** + * 初始化重写的EDT + */ + abstract void initEventQueue(); + + /** + * @param classPath 启动类路径 + */ + static MainClassType getMainClassType(String classPath) { + for (MainClassType mainClassType : MainClassType.values()) { + if (StringUtils.equals(classPath, mainClassType.classPath)) { + return mainClassType; + } + } + return MAIN; + } + } } diff --git a/designer-base/src/main/java/com/fr/design/carton/developer/AwtEventInfo.java b/designer-base/src/main/java/com/fr/design/carton/developer/AwtEventInfo.java new file mode 100644 index 0000000000..77274a36ab --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/carton/developer/AwtEventInfo.java @@ -0,0 +1,73 @@ +package com.fr.design.carton.developer; + +import java.awt.AWTEvent; + +/** + * EDT事件的包装类,用来额外处理信息 + * + * @author John.Ying + * @since 11.0 + * Created on 2023/4/14 + */ +public class AwtEventInfo { + //获取执行该事件的线程 + private final Thread eventDispatchThread = Thread.currentThread(); + //在队列中等待执行的事件最后未执行的时间,当有一个事件执行完后就遍历dispatches给该值赋当前时间 + private long lastDispatchTimeMillis = System.currentTimeMillis(); + //事件开始的时间 + private final long startDispatchTimeMillis = System.currentTimeMillis(); + //awt事件 + private AWTEvent awtEvent; + //事件堆栈 + private StackTraceElement[] stackTrace; + + /** + * 检查是否要给堆栈赋值 + */ + public void checkForHang() { + if (isNeedToStackTrace()) { + this.stackTrace = eventDispatchThread.getStackTrace(); + } + } + + /** + * 是否需要赋值堆栈满足 + * 耗时>20ms + */ + private boolean isNeedToStackTrace() { + return (System.currentTimeMillis() - startDispatchTimeMillis) > EventDispatchDeveloperMode.MAX_TIME + && stackTrace == null; + } + + public Thread getEventDispatchThread() { + return eventDispatchThread; + } + + public long getLastDispatchTimeMillis() { + return lastDispatchTimeMillis; + } + + public void setLastDispatchTimeMillis(long lastDispatchTimeMillis) { + this.lastDispatchTimeMillis = lastDispatchTimeMillis; + } + + public long getStartDispatchTimeMillis() { + return startDispatchTimeMillis; + } + + public AWTEvent getAwtEvent() { + return awtEvent; + } + + public void setAwtEvent(AWTEvent awtEvent) { + this.awtEvent = awtEvent; + } + + public StackTraceElement[] getStackTrace() { + return stackTrace; + } + + public void setStackTrace(StackTraceElement[] stackTrace) { + this.stackTrace = stackTrace; + } +} diff --git a/designer-base/src/main/java/com/fr/design/carton/developer/EventDispatchDeveloperMode.java b/designer-base/src/main/java/com/fr/design/carton/developer/EventDispatchDeveloperMode.java new file mode 100644 index 0000000000..4fd136da37 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/carton/developer/EventDispatchDeveloperMode.java @@ -0,0 +1,146 @@ +package com.fr.design.carton.developer; + + +import com.fr.concurrent.FineExecutors; +import com.fr.design.carton.EventDispatchThreadHangMonitor; +import com.fr.design.ui.util.UIUtil; +import com.fr.log.FineLoggerFactory; + +import java.awt.AWTEvent; +import java.awt.EventQueue; +import java.awt.Toolkit; +import java.util.LinkedList; +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +/** + * 开发者模式重写的EDT + * + * @author John.Ying + * @since 11.0 + * Created on 2023/4/14 + */ +public final class EventDispatchDeveloperMode extends EventQueue { + + /** + * 该链表为主要的实现定时任务的容器,在重写的dispatchEvent中由pre方法将DispatchInfo加入到链表,由post方法remove + */ + private final LinkedList dispatches = new LinkedList<>(); + /** + * 开启间隔检测后两次检测的相隔时间ms + */ + public static final long CHECK_INTERVAL_MS = 5; + + private Timer timer; + + /** + * edt事件最大允许的时间 + */ + public static final long MAX_TIME = 20; + public static final EventDispatchDeveloperMode INSTANCE = new EventDispatchDeveloperMode(); + + @Override + protected void dispatchEvent(AWTEvent event) { + try { + preDispatchEvent(event); + super.dispatchEvent(event); + } finally { + postDispatchEvent(); + } + } + + /** + * 事件分发前处理 + */ + private synchronized void preDispatchEvent(AWTEvent event) { + synchronized (dispatches) { + AwtEventInfo awtEventInfo = new AwtEventInfo(); + awtEventInfo.setAwtEvent(event); + dispatches.addLast(awtEventInfo); + } + } + + /** + * 事件分发后处理 + */ + private synchronized void postDispatchEvent() { + synchronized (dispatches) { + AwtEventInfo awtEventInfo = dispatches.removeLast(); + //嵌套最深的事件执行完毕后刷新链表中其他事件的lastDispatchTimeMillis + Thread currentEventDispatchThread = Thread.currentThread(); + for (AwtEventInfo info : dispatches) { + info.setLastDispatchTimeMillis(System.currentTimeMillis()); + } + long nowTime = System.currentTimeMillis(); + long totalTime = nowTime - awtEventInfo.getStartDispatchTimeMillis(); + long continuationTime = nowTime - awtEventInfo.getLastDispatchTimeMillis(); + if (continuationTime > MAX_TIME) { + FineLoggerFactory.getLogger() + .warn("awt event spend time more than 20ms, totalTime {} continuationTime {} the stack is {}" + , totalTime, continuationTime, EventDispatchThreadHangMonitor.stackTraceToStringForConsole(awtEventInfo.getStackTrace())); + } + } + } + + /** + * 将swing中默认的EventQueue换成自己的 + */ + public void initMonitoring() { + UIUtil.invokeLaterIfNeeded(() -> Toolkit.getDefaultToolkit().getSystemEventQueue().push(INSTANCE)); + initTimer(); + startFilterModalWindow(); + } + + /** + * Sets up a timer to check for hangs frequently. + * 初始化一个Timer + */ + public void initTimer() { + final long initialDelayMs = 0; + final boolean daemon = true; + timer = new Timer("EventDispatchDeveloperMode", daemon); + timer.schedule(new HangChecker(), initialDelayMs, CHECK_INTERVAL_MS); + } + + /** + * /消除Timer + */ + public void stopTimer() { + if (timer != null) { + timer.cancel(); + } + } + + /** + * /定时执行的任务 + */ + public class HangChecker extends TimerTask { + @Override + public void run() { + synchronized (dispatches) { + //如果链表为空定时检测就不进行 + if (dispatches.isEmpty()) { + return; + } + dispatches.getLast().checkForHang(); + } + } + } + + /** + * 消除模态框影响 + */ + public void startFilterModalWindow() { + ScheduledExecutorService scheduledExecutorService = FineExecutors.newSingleThreadScheduledExecutor(); + scheduledExecutorService.scheduleAtFixedRate(new Runnable() { + @Override + public void run() { + UIUtil.invokeLaterIfNeeded(() -> { + //不用干事,切个片就可以 + }); + } + }, 0, 10, TimeUnit.MILLISECONDS); + } +} From b682394b3ec451d4b7b75e4a9f448628f9196269 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 14 Apr 2023 13:51:00 +0800 Subject: [PATCH 26/42] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=94=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/file/CloseOption.java | 16 +++++++++++++++- .../com/fr/design/file/MultiTemplateTabPane.java | 4 ++-- .../com/fr/design/file/TemplateTabManager.java | 4 ++-- .../file/impl/AbstractTemplateTabOperate.java | 5 +++-- .../file/impl/DefaultTemplateTabOperate.java | 4 ++-- .../file/impl/EmptyTemplateTabOperator.java | 4 ++-- 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/CloseOption.java b/designer-base/src/main/java/com/fr/design/file/CloseOption.java index 79667dec0f..ecb70d6a5f 100644 --- a/designer-base/src/main/java/com/fr/design/file/CloseOption.java +++ b/designer-base/src/main/java/com/fr/design/file/CloseOption.java @@ -8,6 +8,10 @@ import com.fr.design.i18n.Toolkit; * created on 2023-04-14 **/ public enum CloseOption { + + /** + * 关闭左侧所有模板 + */ Left(Toolkit.i18nText("Fine-Design_Close_templates_To_The_Left")) { @Override public boolean shouldClose(int tplIndex, int i) { @@ -15,14 +19,24 @@ public enum CloseOption { } }, + /** + * 关闭右侧所有模板 + */ Right(Toolkit.i18nText("Fine-Design_Close_templates_To_The_Right")) { @Override public boolean shouldClose(int tplIndex, int i) { return i > tplIndex; } + }, - }, All(Toolkit.i18nText("Fine-Design_Close_All_templates")), + /** + * 关闭所有模板 + */ + All(Toolkit.i18nText("Fine-Design_Close_All_templates")), + /** + * 关闭其他模板 + */ Others(Toolkit.i18nText("Fine-Design_Close_Other_templates")) { @Override public boolean shouldClose(int tplIndex, int i) { diff --git a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java index efc4565e00..0fd4bdecf9 100644 --- a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java @@ -402,8 +402,8 @@ public class MultiTemplateTabPane extends JComponent { if (template.isSaving()) { selectedIcon = GREY_SAVING_CLOSE_ICON; } - boolean isLeft = i < TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex(); - startX[i - minPaintIndex] = paintUnSelectedTab(g2d, icon, templateStartX, name, selectedIcon, isLeft, mouseOveredIndex, i); + boolean left = i < TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex(); + startX[i - minPaintIndex] = paintUnSelectedTab(g2d, icon, templateStartX, name, selectedIcon, left, mouseOveredIndex, i); } templateStartX += realWidth; } diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java b/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java index da151d9b0f..f7fb354b3f 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java @@ -18,7 +18,7 @@ import java.util.Map; * created on 2023-04-14 **/ public class TemplateTabManager { - private static class HOLDER { + private static class Holder { private static final TemplateTabManager SINGLETON = new TemplateTabManager(); } @@ -27,7 +27,7 @@ public class TemplateTabManager { * @return */ public static TemplateTabManager getInstance() { - return HOLDER.SINGLETON; + return Holder.SINGLETON; } private TemplateTabManager() { diff --git a/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java b/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java index e42b336f57..1f089c5773 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java @@ -40,6 +40,7 @@ import static javax.swing.JOptionPane.WARNING_MESSAGE; * created on 2023-04-14 **/ public abstract class AbstractTemplateTabOperate implements TemplateTabOperateProvider { + private static final String UNSAVED_SUFFIX = " *"; //用于存放工作簿 private java.util.List> openedTemplate = new ArrayList<>(); //选中的Tab项 @@ -345,8 +346,8 @@ public abstract class AbstractTemplateTabOperate implements TemplateTabOperatePr @Override public String getTemplateShowName(JTemplate template) { String name = TemplateUtils.createLockeTemplatedName(template, template.getTemplateName()); - if (!template.isSaved() && !name.endsWith(" *")) { - name += " *"; + if (!template.isSaved() && !name.endsWith(UNSAVED_SUFFIX)) { + name += UNSAVED_SUFFIX; } return name; } diff --git a/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java index ae8ea292a9..1dec669cc4 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java @@ -11,7 +11,7 @@ public class DefaultTemplateTabOperate extends AbstractTemplateTabOperate { public static final String OPERATOR_TYPE = "DEFAULT_TEMPLATE_TAB_OPERATOR"; - private static class HOLDER { + private static class Holder { private static final DefaultTemplateTabOperate SINGLETON = new DefaultTemplateTabOperate(); } @@ -24,7 +24,7 @@ public class DefaultTemplateTabOperate extends AbstractTemplateTabOperate { * @return */ public static DefaultTemplateTabOperate getInstance() { - return HOLDER.SINGLETON; + return Holder.SINGLETON; } @Override diff --git a/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java b/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java index 4afe59f16b..f5e2b93d5b 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java @@ -15,7 +15,7 @@ import java.util.List; * created on 2023-04-14 **/ public class EmptyTemplateTabOperator implements TemplateTabOperateProvider { - private static class HOLDER { + private static class Holder { private static final EmptyTemplateTabOperator SINGLETON = new EmptyTemplateTabOperator(); } @@ -29,7 +29,7 @@ public class EmptyTemplateTabOperator implements TemplateTabOperateProvider { * @return */ public static EmptyTemplateTabOperator getInstance() { - return HOLDER.SINGLETON; + return Holder.SINGLETON; } @Override From 196d9182e7095473304b13fc2344c68cfb1d0fe6 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 14 Apr 2023 14:03:26 +0800 Subject: [PATCH 27/42] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=94=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/file/TemplateTabManager.java | 1 + .../main/java/com/fr/design/file/TemplateTabOperateProvider.java | 1 + .../java/com/fr/design/file/impl/AbstractTemplateTabOperate.java | 1 + .../java/com/fr/design/file/impl/DefaultTemplateTabOperate.java | 1 + .../java/com/fr/design/file/impl/EmptyTemplateTabOperator.java | 1 + 5 files changed, 5 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java b/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java index f7fb354b3f..f5dca0c005 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java @@ -13,6 +13,7 @@ import java.util.List; import java.util.Map; /** + * 模板tab的操作统一管理类 * @author kerry * @since 11.0 * created on 2023-04-14 diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTabOperateProvider.java b/designer-base/src/main/java/com/fr/design/file/TemplateTabOperateProvider.java index 7bcc816526..98d48ad4af 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTabOperateProvider.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTabOperateProvider.java @@ -7,6 +7,7 @@ import com.fr.file.FILE; import java.util.List; /** + * 模板tab的操作接口 * @author kerry * @since 11.0 * created on 2023-04-14 diff --git a/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java b/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java index 1f089c5773..7793a26dcf 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java @@ -35,6 +35,7 @@ import static javax.swing.JOptionPane.OK_OPTION; import static javax.swing.JOptionPane.WARNING_MESSAGE; /** + * 模板tab的操作抽象类 * @author kerry * @since 11.0 * created on 2023-04-14 diff --git a/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java index 1dec669cc4..90853568dd 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java @@ -3,6 +3,7 @@ package com.fr.design.file.impl; import com.fr.design.file.MultiTemplateTabPane; /** + * 默认的模板tab的操作类 * @author kerry * @since 11.0 * created on 2023-04-14 diff --git a/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java b/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java index f5e2b93d5b..3f4ef4d99f 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java @@ -10,6 +10,7 @@ import java.util.ArrayList; import java.util.List; /** + * 空的模板tab的操作类 * @author kerry * @since 11.0 * created on 2023-04-14 From 0b4917e0ea6f21117bcd9d90897689a1abeb44e0 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 14 Apr 2023 14:47:04 +0800 Subject: [PATCH 28/42] =?UTF-8?q?fix=EF=BC=9A=E5=A4=84=E7=90=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/file/MultiTemplateTabPane.java | 184 +++++++++--------- .../fr/design/file/SaveSomeTemplatePane.java | 7 + .../fr/design/file/TemplateTabManager.java | 7 + .../file/TemplateTabOperateProvider.java | 5 + .../file/impl/AbstractTemplateTabOperate.java | 8 + 5 files changed, 123 insertions(+), 88 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java index 0fd4bdecf9..01e45816eb 100644 --- a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java @@ -13,16 +13,13 @@ import com.fr.design.gui.imenu.UIScrollPopUpMenu; import com.fr.design.i18n.DesignSizeI18nManager; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.JTemplate; -import com.fr.design.mainframe.TemplateSavingChecker; import com.fr.design.utils.DesignUtils; -import com.fr.design.utils.TemplateUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.file.FILE; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; import com.fr.stable.Constants; -import com.fr.third.javax.annotation.Nonnull; import javax.swing.BorderFactory; import javax.swing.ButtonModel; @@ -31,10 +28,8 @@ import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JMenu; import javax.swing.JMenuItem; -import javax.swing.JPanel; import javax.swing.JSeparator; import javax.swing.MenuElement; -import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.plaf.basic.BasicMenuItemUI; import java.awt.AWTEvent; @@ -48,7 +43,6 @@ import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.event.AWTEventListener; import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; @@ -58,6 +52,7 @@ import java.awt.geom.GeneralPath; import java.awt.geom.Line2D; import java.awt.geom.Path2D; import java.awt.geom.RoundRectangle2D; +import java.util.List; /** * 改个名字,一个拼写 n 个错误 @@ -238,90 +233,60 @@ public class MultiTemplateTabPane extends JComponent { } - @Override - public Dimension getPreferredSize() { - Dimension dimension = super.getPreferredSize(); - dimension.height = HEIGHT; - return dimension; + /** + * 留作兼容 + * @return + */ + @Deprecated + public JTemplate getSelectedFile() { + return TemplateTabManager.getInstance().getSelectedFile(); } - private UIMenuItem initCloseOther() { - UIMenuItem closeOther = new UIMenuItem(Toolkit.i18nText("Fine-Design_Basic_FS_Close_Other_Templates")); - // Yvan: 英文下文本显示不全,后续发现如果将模板名设置的比较短,其它语言也会出现显示不全的问题,所以设置一下文本水平居中 - closeOther.setHorizontalAlignment(SwingConstants.CENTER); - setListDownItemPreferredSize(closeOther); - closeOther.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - //int tabSize = TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().size(); - int tabSize = TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().size(); - if (tabSize == 1) { - return; - } - if (!TemplateSavingChecker.check()) { - return; - } - SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(false); - //点击关闭其他模板,并且点击确定保存 - if (saveSomeTempaltePane.showSavePane()) { - JTemplate[] panes = new JTemplate[tabSize]; - for (int i = 0; i < tabSize; i++) { - panes[i] = TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().get(i); - } - for (int i = 0; i < panes.length; i++) { - if (i != TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex()) { - JTemplate jTemplate = panes[i]; - //判断关闭的模板是不是格式刷的被参照的模板 - TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().remove(jTemplate); - TemplateTabManager.getInstance().closeFormat(jTemplate); - HistoryTemplateListCache.getInstance().closeSelectedReport(jTemplate); - closeAndFreeLock(jTemplate); - } - } - JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - TemplateTabManager.getInstance().resetSelectIndex(currentTemplate); - THIS.repaint(); - } - //如果取消保存了,则不关闭其他模板 - } - }); - if (TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().size() == 1) { - closeOther.setEnabled(false); - } - return closeOther; + /** + * 关闭掉当前已打开文件列表中指定的文件 + * + * @param file 指定的文件 + */ + @Deprecated + public void closeFileTemplate(FILE file) { + TemplateTabManager.getInstance().closeFileTemplate(file); } - private UIMenuItem[] createListDownTemplate() { - int templateTabCount = TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().size(); - UIMenuItem[] templates = new UIMenuItem[templateTabCount]; - for (int i = 0; i < templateTabCount; i++) { - final int index = i; - final JTemplate tem = TemplateTabManager.getInstance().getCurrentOperator().getOpenedJTemplates().get(i); - templates[i] = new UIMenuItem(tempalteShowName(tem), tem.getIcon()); - templates[i].setUI(new UIListDownItemUI()); - setListDownItemPreferredSize(templates[i]); - if (i == TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex()) { - //画选中的高亮 - templates[i].setBackground(UIConstants.SHADOW_CENTER); - } - templates[i].addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - TemplateTabManager.getInstance().getCurrentOperator().setSelectIndex(index); - tem.activeNewJTemplate(); - } - }); - } - return templates; + /** + * 刷新打开模板 + * + * @param history 模板 + */ + @Deprecated + public void refreshOpenedTemplate(List> history) { + TemplateTabManager.getInstance().refreshOpenedTemplate(history); } - private void setListDownItemPreferredSize(UIMenuItem item) { - Dimension dimension = item.getPreferredSize(); - dimension.height = LIST_DOWN_HEIGHT; - item.setPreferredSize(dimension); + /** + * 设置临时Template + * @param auotCreate + */ + @Deprecated + public void setTemTemplate(JTemplate auotCreate) { + TemplateTabManager.getInstance().setTemTemplate(auotCreate); } + /** + * 设置选中模板索引 + * @param index + */ + @Deprecated + public void setSelectedIndex(int index) { + TemplateTabManager.getInstance().getCurrentOperator().setSelectIndex(index); + } + + @Override + public Dimension getPreferredSize() { + Dimension dimension = super.getPreferredSize(); + dimension.height = HEIGHT; + return dimension; + } private String tempalteShowName(JTemplate template) { return TemplateTabManager.getInstance().getTemplateShowName(template); @@ -682,14 +647,23 @@ public class MultiTemplateTabPane extends JComponent { generalPath.closePath(); } + /** + * 设置是否关闭当前打开的模板 + * @param isCloseCurrent + */ + @Deprecated + public void setIsCloseCurrent(boolean isCloseCurrent) { + TemplateTabManager.getInstance().setCloseCurrent(isCloseCurrent); + } - private void closeAndFreeLock(@Nonnull JTemplate template) { - FILE file = template.getEditingFILE(); - // 只有是环境内的文件,才执行释放锁 - if (file != null && file.isEnvFile()) { - // release lock - TemplateResourceManager.getResource().closeTemplate(file.getPath()); - } + /** + * 关闭模板 + * + * @param specifiedTemplate 模板 + */ + @Deprecated + public void closeSpecifiedTemplate(JTemplate specifiedTemplate) { + TemplateTabManager.getInstance().closeSpecifiedTemplate(specifiedTemplate); } @@ -710,6 +684,40 @@ public class MultiTemplateTabPane extends JComponent { return evtX >= (maxWidth + SMALLGAP) && evtX <= (getWidth() - SMALLGAP); } + /** + * 后台关闭当前编辑模板 + */ + @Deprecated + public void closeCurrentTpl() { + TemplateTabManager.getInstance().closeCurrentTpl(); + } + + /** + * 关闭模板 + * + * @param closedTemplate 模板 + */ + @Deprecated + public void closeFormat(JTemplate closedTemplate) { + TemplateTabManager.getInstance().closeFormat(closedTemplate); + } + + /** + * 关闭掉一个模板之后激活新的待显示模板 + */ + @Deprecated + public void activePrevTemplateAfterClose() { + TemplateTabManager.getInstance().activePrevTemplateAfterClose(); + } + + /** + * 处理自动新建的模板 在切换时的处理 + */ + @Deprecated + public void doWithtemTemplate() { + TemplateTabManager.getInstance().doWithtemTemplate(); + } + private int getTemplateIndex(int evtX) { int textX = 0; diff --git a/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java b/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java index 715cc94ba0..c83c5ca800 100644 --- a/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java +++ b/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java @@ -186,6 +186,13 @@ public class SaveSomeTemplatePane extends BasicPane { return isAllSaved; } + /** + * 兼容方法 + */ + @Deprecated + public void populate() { + populate(HistoryTemplateListPane.getInstance().getHistoryList()); + } private void populate(java.util.List> opendedTemplate) { JTemplate currentTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java b/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java index f5dca0c005..499706f523 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java @@ -230,6 +230,13 @@ public class TemplateTabManager { return resultMap; } + /** + * 留作兼容 + */ + public void activePrevTemplateAfterClose(){ + getCurrentOperator().activePrevTemplateAfterClose(); + } + /** * 关闭其他 */ diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTabOperateProvider.java b/designer-base/src/main/java/com/fr/design/file/TemplateTabOperateProvider.java index 98d48ad4af..a9a317a8b4 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTabOperateProvider.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTabOperateProvider.java @@ -121,4 +121,9 @@ public interface TemplateTabOperateProvider { */ String getTemplateShowName(JTemplate jTemplate); + + /** + * 留作兼容,在关闭模板后激活前一个模板 + */ + void activePrevTemplateAfterClose(); } diff --git a/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java b/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java index 7793a26dcf..3f67fb69b2 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java @@ -262,6 +262,14 @@ public abstract class AbstractTemplateTabOperate implements TemplateTabOperatePr activePrevTemplateAfterClose(specifiedTemplate == HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()); } + /** + * 关闭掉一个模板之后激活新的待显示模板 + */ + @Override + public void activePrevTemplateAfterClose(){ + activePrevTemplateAfterClose(TemplateTabManager.getInstance().isCloseCurrent()); + } + /** * 关闭掉一个模板之后激活新的待显示模板 */ From c600233de6061525f41c6945b1414e1217899f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=2EYing-=E5=BA=94=E5=BF=97=E6=B5=A9?= Date: Fri, 14 Apr 2023 15:08:58 +0800 Subject: [PATCH 29/42] =?UTF-8?q?REPORT-83195=20=E5=8D=A1=E9=A1=BF?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96-=E6=A0=B9=E6=8D=AE=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E6=8F=90=E7=A4=BA=E4=BF=AE=E6=94=B9=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=B8=8B=E4=BB=A3=E7=A0=81=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../developer/EventDispatchDeveloperMode.java | 37 ++++++++----------- .../com/fr/design/worker/save/SaveWorker.java | 37 +++++++++---------- .../worker/save/type/SaveTypeWorker.java | 10 ++++- 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/carton/developer/EventDispatchDeveloperMode.java b/designer-base/src/main/java/com/fr/design/carton/developer/EventDispatchDeveloperMode.java index 4fd136da37..a87e900ac1 100644 --- a/designer-base/src/main/java/com/fr/design/carton/developer/EventDispatchDeveloperMode.java +++ b/designer-base/src/main/java/com/fr/design/carton/developer/EventDispatchDeveloperMode.java @@ -1,6 +1,7 @@ package com.fr.design.carton.developer; +import com.aspose.words.Run; import com.fr.concurrent.FineExecutors; import com.fr.design.carton.EventDispatchThreadHangMonitor; import com.fr.design.ui.util.UIUtil; @@ -33,7 +34,9 @@ public final class EventDispatchDeveloperMode extends EventQueue { */ public static final long CHECK_INTERVAL_MS = 5; - private Timer timer; + private static final int CORE_THREAD_SIZE = 5; + + private ScheduledExecutorService timer; /** * edt事件最大允许的时间 @@ -76,6 +79,7 @@ public final class EventDispatchDeveloperMode extends EventQueue { long nowTime = System.currentTimeMillis(); long totalTime = nowTime - awtEventInfo.getStartDispatchTimeMillis(); long continuationTime = nowTime - awtEventInfo.getLastDispatchTimeMillis(); + //判断连续执行时间是否超过了20ms,超过了则进行提示 if (continuationTime > MAX_TIME) { FineLoggerFactory.getLogger() .warn("awt event spend time more than 20ms, totalTime {} continuationTime {} the stack is {}" @@ -99,26 +103,8 @@ public final class EventDispatchDeveloperMode extends EventQueue { */ public void initTimer() { final long initialDelayMs = 0; - final boolean daemon = true; - timer = new Timer("EventDispatchDeveloperMode", daemon); - timer.schedule(new HangChecker(), initialDelayMs, CHECK_INTERVAL_MS); - } - - /** - * /消除Timer - */ - public void stopTimer() { - if (timer != null) { - timer.cancel(); - } - } - - /** - * /定时执行的任务 - */ - public class HangChecker extends TimerTask { - @Override - public void run() { + timer = FineExecutors.newScheduledThreadPool(CORE_THREAD_SIZE); + timer.schedule(() -> { synchronized (dispatches) { //如果链表为空定时检测就不进行 if (dispatches.isEmpty()) { @@ -126,6 +112,15 @@ public final class EventDispatchDeveloperMode extends EventQueue { } dispatches.getLast().checkForHang(); } + }, initialDelayMs, TimeUnit.MILLISECONDS); + } + + /** + * /消除Timer + */ + public void stopTimer() { + if (timer != null) { + timer.shutdown(); } } diff --git a/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java b/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java index 188aedacb9..cd1fcb3dd0 100644 --- a/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java +++ b/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java @@ -7,6 +7,7 @@ import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.JTemplate; import com.fr.design.ui.util.UIUtil; import com.fr.design.worker.WorkerManager; +import com.fr.design.worker.save.type.SaveTypeWorker; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; @@ -87,26 +88,24 @@ public class SaveWorker extends SwingWorker { this.execute(); // worker纳入管理 WorkerManager.getInstance().registerWorker(taskName, this); - if (!slowly) { - new Thread(() -> { - while (true) { - if (stopWatch.getTime() > TIME_OUT || isDone()) { - if (!isDone()) { - slowly = true; - UIUtil.invokeLaterIfNeeded(() -> { - // 开始禁用 - if (slowly) { - EastRegionContainerPane.getInstance().updateAllPropertyPane(); - DesignerContext.getDesignerFrame().getCenterTemplateCardPane().showCover(); - DesignerFrameFileDealerPane.getInstance().stateChange(); - } - }); - } - stopWatch.stop(); - break; + SaveTypeWorker.saveTypePool.execute(() -> { + while (true) { + if (stopWatch.getTime() > TIME_OUT || isDone()) { + if (!isDone()) { + slowly = true; + UIUtil.invokeLaterIfNeeded(() -> { + // 开始禁用 + if (slowly) { + EastRegionContainerPane.getInstance().updateAllPropertyPane(); + DesignerContext.getDesignerFrame().getCenterTemplateCardPane().showCover(); + DesignerFrameFileDealerPane.getInstance().stateChange(); + } + }); } + stopWatch.stop(); + break; } - }).start(); - } + } + }); } } diff --git a/designer-base/src/main/java/com/fr/design/worker/save/type/SaveTypeWorker.java b/designer-base/src/main/java/com/fr/design/worker/save/type/SaveTypeWorker.java index e087f701f7..b004dea7d2 100644 --- a/designer-base/src/main/java/com/fr/design/worker/save/type/SaveTypeWorker.java +++ b/designer-base/src/main/java/com/fr/design/worker/save/type/SaveTypeWorker.java @@ -1,6 +1,7 @@ package com.fr.design.worker.save.type; +import com.fr.concurrent.FineExecutors; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.EastRegionContainerPane; @@ -10,6 +11,7 @@ import com.fr.third.org.apache.commons.lang3.time.StopWatch; import javax.swing.SwingWorker; import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; /** * 判断保存类别时执行的worker @@ -20,6 +22,8 @@ import java.util.concurrent.Callable; */ public class SaveTypeWorker extends SwingWorker { + public static final ExecutorService saveTypePool = FineExecutors.newSingleThreadExecutor(); + private final Callable callable; private static final int TIME_OUT = 400; @@ -28,6 +32,8 @@ public class SaveTypeWorker extends SwingWorker { private final SaveType saveType; + + public SaveTypeWorker(Callable callable, JTemplate template) { this.callable = callable; this.template = template; @@ -52,7 +58,7 @@ public class SaveTypeWorker extends SwingWorker { StopWatch stopWatch = StopWatch.createStarted(); this.template.setSaving(true); this.execute(); - new Thread(() -> { + saveTypePool.execute(() -> { while (true) { //大于最大等待时间或者worker已经完成该线程都要结束循环 if (stopWatch.getTime() > TIME_OUT || isDone()) { @@ -70,6 +76,6 @@ public class SaveTypeWorker extends SwingWorker { break; } } - }).start(); + }); } } From e1c6e99c1b7fbf674b5d208276c5cdbe7a914588 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 14 Apr 2023 15:09:14 +0800 Subject: [PATCH 30/42] =?UTF-8?q?fix=EF=BC=9A=E4=BB=A3=E7=A0=81=E8=A7=84?= =?UTF-8?q?=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/file/MultiTemplateTabPane.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java index 01e45816eb..3078c54d1e 100644 --- a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java @@ -668,14 +668,14 @@ public class MultiTemplateTabPane extends JComponent { private boolean isOverCloseIcon(int evtX) { - boolean isOverCloseIcon = false; + boolean overCloseIcon = false; for (int i = 0; i < startX.length; i++) { if (evtX >= startX[i] && evtX <= startX[i] + CLOSE.getIconWidth()) { - isOverCloseIcon = true; + overCloseIcon = true; break; } } - return isOverCloseIcon; + return overCloseIcon; } From e2c4db30a80b8686c87b9ee7b151bf6456f21a77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=2EYing-=E5=BA=94=E5=BF=97=E6=B5=A9?= Date: Fri, 14 Apr 2023 15:10:03 +0800 Subject: [PATCH 31/42] =?UTF-8?q?REPORT-83195=20=E5=8D=A1=E9=A1=BF?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96-=E6=A0=B9=E6=8D=AE=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E6=8F=90=E7=A4=BA=E4=BF=AE=E6=94=B9=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=B8=8B=E4=BB=A3=E7=A0=81=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/carton/developer/EventDispatchDeveloperMode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/carton/developer/EventDispatchDeveloperMode.java b/designer-base/src/main/java/com/fr/design/carton/developer/EventDispatchDeveloperMode.java index a87e900ac1..5381ff7ff2 100644 --- a/designer-base/src/main/java/com/fr/design/carton/developer/EventDispatchDeveloperMode.java +++ b/designer-base/src/main/java/com/fr/design/carton/developer/EventDispatchDeveloperMode.java @@ -34,7 +34,7 @@ public final class EventDispatchDeveloperMode extends EventQueue { */ public static final long CHECK_INTERVAL_MS = 5; - private static final int CORE_THREAD_SIZE = 5; + private static final int CORE_THREAD_SIZE = 1; private ScheduledExecutorService timer; From 135f588ff103020ae0f75b28ff8bcdedd714c1c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=2EYing-=E5=BA=94=E5=BF=97=E6=B5=A9?= Date: Fri, 14 Apr 2023 15:15:38 +0800 Subject: [PATCH 32/42] =?UTF-8?q?REPORT-83195=20=E5=8D=A1=E9=A1=BF?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96-=E6=A0=B9=E6=8D=AE=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E6=8F=90=E7=A4=BA=E4=BF=AE=E6=94=B9=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=B8=8B=E4=BB=A3=E7=A0=81=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/carton/SwitchForSwingChecker.java | 5 +++-- .../src/main/java/com/fr/design/worker/save/SaveWorker.java | 2 +- .../java/com/fr/design/worker/save/type/SaveTypeWorker.java | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/carton/SwitchForSwingChecker.java b/designer-base/src/main/java/com/fr/design/carton/SwitchForSwingChecker.java index 837bdb1c8b..2f884bc301 100644 --- a/designer-base/src/main/java/com/fr/design/carton/SwitchForSwingChecker.java +++ b/designer-base/src/main/java/com/fr/design/carton/SwitchForSwingChecker.java @@ -58,6 +58,7 @@ public class SwitchForSwingChecker implements XMLReadable, XMLWriter { * 简单记录事件执行时间的开关 */ private static boolean easyChecker = false; + /** * 一个标识位用于区分耗时任务时长检测(简单检测)和timer检测 */ @@ -331,7 +332,7 @@ public class SwitchForSwingChecker implements XMLReadable, XMLWriter { MAIN(NORMAL_MAIN_CLASS_NAME) { @Override void initEventQueue() { - if (StringUtils.equals("true", System.getProperty(CARTON_DEVELOPER_JVM_PARAM))) { + if (StringUtils.equals(TURE_JVM, System.getProperty(CARTON_DEVELOPER_JVM_PARAM))) { EventDispatchDeveloperMode.INSTANCE.initMonitoring(); } else { EventDispatchThreadHangMonitor.initMonitoring(); @@ -353,7 +354,7 @@ public class SwitchForSwingChecker implements XMLReadable, XMLWriter { MainClassType(String classPath) { this.classPath = classPath; } - + public static final String TURE_JVM = "true"; String classPath; /** diff --git a/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java b/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java index cd1fcb3dd0..83b7c50d49 100644 --- a/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java +++ b/designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java @@ -88,7 +88,7 @@ public class SaveWorker extends SwingWorker { this.execute(); // worker纳入管理 WorkerManager.getInstance().registerWorker(taskName, this); - SaveTypeWorker.saveTypePool.execute(() -> { + SaveTypeWorker.SAVE_TYPE_POOL.execute(() -> { while (true) { if (stopWatch.getTime() > TIME_OUT || isDone()) { if (!isDone()) { diff --git a/designer-base/src/main/java/com/fr/design/worker/save/type/SaveTypeWorker.java b/designer-base/src/main/java/com/fr/design/worker/save/type/SaveTypeWorker.java index b004dea7d2..d415537eb4 100644 --- a/designer-base/src/main/java/com/fr/design/worker/save/type/SaveTypeWorker.java +++ b/designer-base/src/main/java/com/fr/design/worker/save/type/SaveTypeWorker.java @@ -22,7 +22,7 @@ import java.util.concurrent.ExecutorService; */ public class SaveTypeWorker extends SwingWorker { - public static final ExecutorService saveTypePool = FineExecutors.newSingleThreadExecutor(); + public static final ExecutorService SAVE_TYPE_POOL = FineExecutors.newSingleThreadExecutor(); private final Callable callable; @@ -58,7 +58,7 @@ public class SaveTypeWorker extends SwingWorker { StopWatch stopWatch = StopWatch.createStarted(); this.template.setSaving(true); this.execute(); - saveTypePool.execute(() -> { + SAVE_TYPE_POOL.execute(() -> { while (true) { //大于最大等待时间或者worker已经完成该线程都要结束循环 if (stopWatch.getTime() > TIME_OUT || isDone()) { From 855a032de3113a05f41ba3d2984c17ac767c41fc Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Fri, 14 Apr 2023 15:26:09 +0800 Subject: [PATCH 33/42] =?UTF-8?q?REPORT-93901=20=E6=89=93=E5=BC=80js?= =?UTF-8?q?=E9=AB=98=E7=BA=A7=E7=BC=96=E8=BE=91=E7=95=8C=E9=9D=A2=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=8D=A1=E6=AD=BB=E9=9C=80=E9=87=8D=E5=90=AF?= =?UTF-8?q?=20&=20REPORT-83195=20=E5=8D=A1=E9=A1=BF=E7=82=B9=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20=E5=8D=A1=E9=A1=BF/=E5=8D=A1=E6=AD=BB=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JSContentWithDescriptionPane.java | 62 +++++++++++++------ 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java index 8e8ef45b9f..dc74d7e991 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java @@ -50,6 +50,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; +import java.util.concurrent.ExecutionException; import javax.swing.BorderFactory; import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; @@ -59,6 +60,7 @@ import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTree; +import javax.swing.SwingWorker; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.event.TreeSelectionEvent; @@ -352,27 +354,51 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi private void doHelpDocumentSearch() { Object value = interfaceNameList.getSelectedValue(); if (value != null) { - String url = CloudCenter.getInstance().acquireUrlByKind("af.doc_search", DOCUMENT_SEARCH_URL) + value.toString(); - try { - String result = HttpToolbox.get(url); - JSONObject jsonObject = new JSONObject(result); - JSONArray jsonArray = jsonObject.optJSONArray("list"); - if (jsonArray != null) { - DefaultListModel helpDOCModel = (DefaultListModel) helpDOCList.getModel(); - helpDOCModel.clear(); - for (int i = 0; i < jsonArray.length(); i++) { - JSONObject resultJSONObject = jsonArray.optJSONObject(i); - String docURL = resultJSONObject.optString("url"); - String name = resultJSONObject.optString("title").trim(); - HelpDocument helpDocument = new HelpDocument(docURL, name); - helpDOCModel.addElement(helpDocument); + new SwingWorker, Void>() { + @Override + protected List doInBackground() throws Exception { + List helpDocuments = new ArrayList<>(); + updateHelpDocuments(value, helpDocuments); + return helpDocuments; + } + + @Override + protected void done() { + try { + List helpDocuments = get(); + DefaultListModel helpDOCModel = (DefaultListModel) helpDOCList.getModel(); + helpDOCModel.clear(); + for (HelpDocument helpDocument : helpDocuments) { + helpDOCModel.addElement(helpDocument); + } + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); } } - } catch (JSONException e) { - FineLoggerFactory.getLogger().debug(e.getMessage(), e); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + + }.execute(); + } + } + + private void updateHelpDocuments(Object value, List helpDocuments) { + String url = CloudCenter.getInstance().acquireUrlByKind("af.doc_search", DOCUMENT_SEARCH_URL) + value.toString(); + try { + String result = HttpToolbox.get(url); + JSONObject jsonObject = new JSONObject(result); + JSONArray jsonArray = jsonObject.optJSONArray("list"); + if (jsonArray != null) { + for (int i = 0; i < jsonArray.length(); i++) { + JSONObject resultJSONObject = jsonArray.optJSONObject(i); + String docURL = resultJSONObject.optString("url"); + String name = resultJSONObject.optString("title").trim(); + HelpDocument helpDocument = new HelpDocument(docURL, name); + helpDocuments.add(helpDocument); + } } + } catch (JSONException e) { + FineLoggerFactory.getLogger().debug(e.getMessage(), e); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } From f44541c77e9f786b3221945f71b24194d71dd9fd Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Fri, 14 Apr 2023 15:29:13 +0800 Subject: [PATCH 34/42] =?UTF-8?q?REPORT-93901=20=E6=89=93=E5=BC=80js?= =?UTF-8?q?=E9=AB=98=E7=BA=A7=E7=BC=96=E8=BE=91=E7=95=8C=E9=9D=A2=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=8D=A1=E6=AD=BB=E9=9C=80=E9=87=8D=E5=90=AF?= =?UTF-8?q?=20&=20REPORT-83195=20=E5=8D=A1=E9=A1=BF=E7=82=B9=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20=E5=8D=A1=E9=A1=BF/=E5=8D=A1=E6=AD=BB=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/javascript/JSContentWithDescriptionPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java index dc74d7e991..3be90999f1 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java @@ -372,7 +372,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi helpDOCModel.addElement(helpDocument); } } catch (InterruptedException | ExecutionException e) { - e.printStackTrace(); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } From 0671f5442e72d333d871cfaaf7e88c944ade9fc6 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Fri, 14 Apr 2023 15:44:28 +0800 Subject: [PATCH 35/42] =?UTF-8?q?REPORT-93901=20=E6=89=93=E5=BC=80js?= =?UTF-8?q?=E9=AB=98=E7=BA=A7=E7=BC=96=E8=BE=91=E7=95=8C=E9=9D=A2=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=8D=A1=E6=AD=BB=E9=9C=80=E9=87=8D=E5=90=AF?= =?UTF-8?q?=20&=20REPORT-83195=20=E5=8D=A1=E9=A1=BF=E7=82=B9=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20=E5=8D=A1=E9=A1=BF/=E5=8D=A1=E6=AD=BB=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/javascript/JSContentWithDescriptionPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java index 3be90999f1..e2a8dd0d5c 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java @@ -356,7 +356,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi if (value != null) { new SwingWorker, Void>() { @Override - protected List doInBackground() throws Exception { + protected List doInBackground() { List helpDocuments = new ArrayList<>(); updateHelpDocuments(value, helpDocuments); return helpDocuments; From b1486e5031b001c6334a7c04325d1121355c6f8b Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 14 Apr 2023 15:50:10 +0800 Subject: [PATCH 36/42] =?UTF-8?q?fix=EF=BC=9A=E4=BB=A3=E7=A0=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/file/impl/EmptyTemplateTabOperator.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java b/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java index 3f4ef4d99f..9951157fde 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java @@ -116,4 +116,9 @@ public class EmptyTemplateTabOperator implements TemplateTabOperateProvider { public String getTemplateShowName(JTemplate jTemplate) { return StringUtils.EMPTY; } + + @Override + public void activePrevTemplateAfterClose() { + + } } From 5155311b6e203d96432a8db4019fd75b05b6bd9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=2EYing-=E5=BA=94=E5=BF=97=E6=B5=A9?= Date: Fri, 14 Apr 2023 16:04:58 +0800 Subject: [PATCH 37/42] =?UTF-8?q?REPORT-83195=20=E5=8D=A1=E9=A1=BF?= =?UTF-8?q?=E7=82=B9=E4=BC=98=E5=8C=96-=E5=9B=9E=E9=80=80=E4=B8=80?= =?UTF-8?q?=E4=B8=8B=E5=BC=80=E5=8F=91=E8=80=85=E6=A8=A1=E5=BC=8F=E9=83=A8?= =?UTF-8?q?=E5=88=86=E4=BB=A3=E7=A0=81=EF=BC=8C=E8=AE=BE=E8=AE=A1=E6=9C=89?= =?UTF-8?q?=E7=82=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/carton/SwitchForSwingChecker.java | 75 +--------- .../design/carton/developer/AwtEventInfo.java | 73 --------- .../developer/EventDispatchDeveloperMode.java | 141 ------------------ 3 files changed, 5 insertions(+), 284 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/carton/developer/AwtEventInfo.java delete mode 100644 designer-base/src/main/java/com/fr/design/carton/developer/EventDispatchDeveloperMode.java diff --git a/designer-base/src/main/java/com/fr/design/carton/SwitchForSwingChecker.java b/designer-base/src/main/java/com/fr/design/carton/SwitchForSwingChecker.java index 2f884bc301..683179293e 100644 --- a/designer-base/src/main/java/com/fr/design/carton/SwitchForSwingChecker.java +++ b/designer-base/src/main/java/com/fr/design/carton/SwitchForSwingChecker.java @@ -1,7 +1,6 @@ package com.fr.design.carton; -import com.fr.design.carton.developer.EventDispatchDeveloperMode; import com.fr.design.i18n.Toolkit; import com.fr.general.GeneralUtils; import com.fr.json.JSON; @@ -30,22 +29,11 @@ import java.util.Map; import java.util.Date; import java.util.Calendar; - public class SwitchForSwingChecker implements XMLReadable, XMLWriter { /** * Designer4Debug类名 */ private static final String DEBUG_MAIN_CLASS_NAME = "com.fr.start.Designer4Debug"; - - /** - * 真正主类 - */ - private static final String NORMAL_MAIN_CLASS_NAME = "com.fr.start.MainDesigner"; - - /** - * 开发者模式jvm参数 - */ - private static final String CARTON_DEVELOPER_JVM_PARAM = "cartonDeveloper"; /** * XML标签 */ @@ -58,7 +46,6 @@ public class SwitchForSwingChecker implements XMLReadable, XMLWriter { * 简单记录事件执行时间的开关 */ private static boolean easyChecker = false; - /** * 一个标识位用于区分耗时任务时长检测(简单检测)和timer检测 */ @@ -262,7 +249,11 @@ public class SwitchForSwingChecker implements XMLReadable, XMLWriter { */ public static void initThreadMonitoring () { String mainClass = System.getProperty("sun.java.command"); - MainClassType.getMainClassType(mainClass).initEventQueue(); + //判断一下,如果是以Designer4Debug启动,就不注册代码,不然会覆盖掉SwingExplorer,导致其无法使用 + if (!StringUtils.equals(mainClass, DEBUG_MAIN_CLASS_NAME)) { + EventDispatchThreadHangMonitor.initMonitoring(); + AppContext.getAppContext().put(SwingWorker.class, CartonThreadExecutorPool.getTimerThreadExecutorPool()); + } } /** @@ -318,60 +309,4 @@ public class SwitchForSwingChecker implements XMLReadable, XMLWriter { writer.end(); } - /** - * 根据程序启动类路径进行区分 - * - * @author John.Ying - * @since 11.0 - * Created on 2023/4/14 - */ - enum MainClassType { - /** - * 用mainDesigner启动 - */ - MAIN(NORMAL_MAIN_CLASS_NAME) { - @Override - void initEventQueue() { - if (StringUtils.equals(TURE_JVM, System.getProperty(CARTON_DEVELOPER_JVM_PARAM))) { - EventDispatchDeveloperMode.INSTANCE.initMonitoring(); - } else { - EventDispatchThreadHangMonitor.initMonitoring(); - AppContext.getAppContext().put(SwingWorker.class, CartonThreadExecutorPool.getTimerThreadExecutorPool()); - } - } - }, - - /** - * designer4debug启动 - */ - DEBUG_MAIN(DEBUG_MAIN_CLASS_NAME) { - @Override - void initEventQueue() { - - } - }; - - MainClassType(String classPath) { - this.classPath = classPath; - } - public static final String TURE_JVM = "true"; - String classPath; - - /** - * 初始化重写的EDT - */ - abstract void initEventQueue(); - - /** - * @param classPath 启动类路径 - */ - static MainClassType getMainClassType(String classPath) { - for (MainClassType mainClassType : MainClassType.values()) { - if (StringUtils.equals(classPath, mainClassType.classPath)) { - return mainClassType; - } - } - return MAIN; - } - } } diff --git a/designer-base/src/main/java/com/fr/design/carton/developer/AwtEventInfo.java b/designer-base/src/main/java/com/fr/design/carton/developer/AwtEventInfo.java deleted file mode 100644 index 77274a36ab..0000000000 --- a/designer-base/src/main/java/com/fr/design/carton/developer/AwtEventInfo.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.fr.design.carton.developer; - -import java.awt.AWTEvent; - -/** - * EDT事件的包装类,用来额外处理信息 - * - * @author John.Ying - * @since 11.0 - * Created on 2023/4/14 - */ -public class AwtEventInfo { - //获取执行该事件的线程 - private final Thread eventDispatchThread = Thread.currentThread(); - //在队列中等待执行的事件最后未执行的时间,当有一个事件执行完后就遍历dispatches给该值赋当前时间 - private long lastDispatchTimeMillis = System.currentTimeMillis(); - //事件开始的时间 - private final long startDispatchTimeMillis = System.currentTimeMillis(); - //awt事件 - private AWTEvent awtEvent; - //事件堆栈 - private StackTraceElement[] stackTrace; - - /** - * 检查是否要给堆栈赋值 - */ - public void checkForHang() { - if (isNeedToStackTrace()) { - this.stackTrace = eventDispatchThread.getStackTrace(); - } - } - - /** - * 是否需要赋值堆栈满足 - * 耗时>20ms - */ - private boolean isNeedToStackTrace() { - return (System.currentTimeMillis() - startDispatchTimeMillis) > EventDispatchDeveloperMode.MAX_TIME - && stackTrace == null; - } - - public Thread getEventDispatchThread() { - return eventDispatchThread; - } - - public long getLastDispatchTimeMillis() { - return lastDispatchTimeMillis; - } - - public void setLastDispatchTimeMillis(long lastDispatchTimeMillis) { - this.lastDispatchTimeMillis = lastDispatchTimeMillis; - } - - public long getStartDispatchTimeMillis() { - return startDispatchTimeMillis; - } - - public AWTEvent getAwtEvent() { - return awtEvent; - } - - public void setAwtEvent(AWTEvent awtEvent) { - this.awtEvent = awtEvent; - } - - public StackTraceElement[] getStackTrace() { - return stackTrace; - } - - public void setStackTrace(StackTraceElement[] stackTrace) { - this.stackTrace = stackTrace; - } -} diff --git a/designer-base/src/main/java/com/fr/design/carton/developer/EventDispatchDeveloperMode.java b/designer-base/src/main/java/com/fr/design/carton/developer/EventDispatchDeveloperMode.java deleted file mode 100644 index 5381ff7ff2..0000000000 --- a/designer-base/src/main/java/com/fr/design/carton/developer/EventDispatchDeveloperMode.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.fr.design.carton.developer; - - -import com.aspose.words.Run; -import com.fr.concurrent.FineExecutors; -import com.fr.design.carton.EventDispatchThreadHangMonitor; -import com.fr.design.ui.util.UIUtil; -import com.fr.log.FineLoggerFactory; - -import java.awt.AWTEvent; -import java.awt.EventQueue; -import java.awt.Toolkit; -import java.util.LinkedList; -import java.util.Timer; -import java.util.TimerTask; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -/** - * 开发者模式重写的EDT - * - * @author John.Ying - * @since 11.0 - * Created on 2023/4/14 - */ -public final class EventDispatchDeveloperMode extends EventQueue { - - /** - * 该链表为主要的实现定时任务的容器,在重写的dispatchEvent中由pre方法将DispatchInfo加入到链表,由post方法remove - */ - private final LinkedList dispatches = new LinkedList<>(); - /** - * 开启间隔检测后两次检测的相隔时间ms - */ - public static final long CHECK_INTERVAL_MS = 5; - - private static final int CORE_THREAD_SIZE = 1; - - private ScheduledExecutorService timer; - - /** - * edt事件最大允许的时间 - */ - public static final long MAX_TIME = 20; - public static final EventDispatchDeveloperMode INSTANCE = new EventDispatchDeveloperMode(); - - @Override - protected void dispatchEvent(AWTEvent event) { - try { - preDispatchEvent(event); - super.dispatchEvent(event); - } finally { - postDispatchEvent(); - } - } - - /** - * 事件分发前处理 - */ - private synchronized void preDispatchEvent(AWTEvent event) { - synchronized (dispatches) { - AwtEventInfo awtEventInfo = new AwtEventInfo(); - awtEventInfo.setAwtEvent(event); - dispatches.addLast(awtEventInfo); - } - } - - /** - * 事件分发后处理 - */ - private synchronized void postDispatchEvent() { - synchronized (dispatches) { - AwtEventInfo awtEventInfo = dispatches.removeLast(); - //嵌套最深的事件执行完毕后刷新链表中其他事件的lastDispatchTimeMillis - Thread currentEventDispatchThread = Thread.currentThread(); - for (AwtEventInfo info : dispatches) { - info.setLastDispatchTimeMillis(System.currentTimeMillis()); - } - long nowTime = System.currentTimeMillis(); - long totalTime = nowTime - awtEventInfo.getStartDispatchTimeMillis(); - long continuationTime = nowTime - awtEventInfo.getLastDispatchTimeMillis(); - //判断连续执行时间是否超过了20ms,超过了则进行提示 - if (continuationTime > MAX_TIME) { - FineLoggerFactory.getLogger() - .warn("awt event spend time more than 20ms, totalTime {} continuationTime {} the stack is {}" - , totalTime, continuationTime, EventDispatchThreadHangMonitor.stackTraceToStringForConsole(awtEventInfo.getStackTrace())); - } - } - } - - /** - * 将swing中默认的EventQueue换成自己的 - */ - public void initMonitoring() { - UIUtil.invokeLaterIfNeeded(() -> Toolkit.getDefaultToolkit().getSystemEventQueue().push(INSTANCE)); - initTimer(); - startFilterModalWindow(); - } - - /** - * Sets up a timer to check for hangs frequently. - * 初始化一个Timer - */ - public void initTimer() { - final long initialDelayMs = 0; - timer = FineExecutors.newScheduledThreadPool(CORE_THREAD_SIZE); - timer.schedule(() -> { - synchronized (dispatches) { - //如果链表为空定时检测就不进行 - if (dispatches.isEmpty()) { - return; - } - dispatches.getLast().checkForHang(); - } - }, initialDelayMs, TimeUnit.MILLISECONDS); - } - - /** - * /消除Timer - */ - public void stopTimer() { - if (timer != null) { - timer.shutdown(); - } - } - - /** - * 消除模态框影响 - */ - public void startFilterModalWindow() { - ScheduledExecutorService scheduledExecutorService = FineExecutors.newSingleThreadScheduledExecutor(); - scheduledExecutorService.scheduleAtFixedRate(new Runnable() { - @Override - public void run() { - UIUtil.invokeLaterIfNeeded(() -> { - //不用干事,切个片就可以 - }); - } - }, 0, 10, TimeUnit.MILLISECONDS); - } -} From 5ea46e516d6a1f8fa6643cb542241be882f4ddf7 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 14 Apr 2023 16:28:08 +0800 Subject: [PATCH 38/42] =?UTF-8?q?fix=EF=BC=9A=E4=BB=A3=E7=A0=81=E8=A7=84?= =?UTF-8?q?=E8=8C=83=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/file/MultiTemplateTabMenuFactory.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java index edbe9cbab3..3ba3fe79eb 100644 --- a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java +++ b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java @@ -29,6 +29,7 @@ import java.util.List; import java.util.Map; /** + * 右侧下拉菜单的工厂类 * @author Carlson * @since 11.0 * created on 2023-04-14 From 16259563b3f8da9b3d107c17bff763b77d9101f0 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 14 Apr 2023 16:50:47 +0800 Subject: [PATCH 39/42] =?UTF-8?q?fix=EF=BC=9A=E4=BB=A3=E7=A0=81=E8=A7=84?= =?UTF-8?q?=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/file/MultiTemplateTabPane.java | 2 +- .../src/main/java/com/fr/design/mainframe/JTemplate.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java index 3078c54d1e..0292bb8f95 100644 --- a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java @@ -56,7 +56,7 @@ import java.util.List; /** * 改个名字,一个拼写 n 个错误 - * + * 模板tab的操作和ui已拆分,后续需要添加模板tab的操作在 TemplateTabManager 中添加 * @author daisy * @version 11.0 *

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 dbf63e077c..cb2831fc33 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 @@ -616,7 +616,7 @@ public abstract class JTemplate> * @return 是则返回true */ public boolean isALLSaved() { - return this.saved && this.authoritySaved && this.canBeSaved(); + return this.canBeSaved() && this.saved && this.authoritySaved; } From 6584f614a4e46d66f39278c593fedaf451a545ac Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 14 Apr 2023 17:05:18 +0800 Subject: [PATCH 40/42] =?UTF-8?q?=E6=94=B9=E4=B8=8B=E7=B1=BB=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/file/TemplateTabManager.java | 4 ++-- ...plateTabOperator.java => EmptyTemplateTabOperate.java} | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) rename designer-base/src/main/java/com/fr/design/file/impl/{EmptyTemplateTabOperator.java => EmptyTemplateTabOperate.java} (87%) diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java b/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java index 499706f523..fe294f222f 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java @@ -2,7 +2,7 @@ package com.fr.design.file; import com.finebi.cbb.utils.CompareUtils; import com.fr.design.file.impl.DefaultTemplateTabOperate; -import com.fr.design.file.impl.EmptyTemplateTabOperator; +import com.fr.design.file.impl.EmptyTemplateTabOperate; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.file.FILE; @@ -285,7 +285,7 @@ public class TemplateTabManager { return provider; } } - return EmptyTemplateTabOperator.getInstance(); + return EmptyTemplateTabOperate.getInstance(); } } diff --git a/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java b/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperate.java similarity index 87% rename from designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java rename to designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperate.java index 9951157fde..c35a4bf655 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperate.java @@ -15,13 +15,13 @@ import java.util.List; * @since 11.0 * created on 2023-04-14 **/ -public class EmptyTemplateTabOperator implements TemplateTabOperateProvider { +public class EmptyTemplateTabOperate implements TemplateTabOperateProvider { private static class Holder { - private static final EmptyTemplateTabOperator SINGLETON = new EmptyTemplateTabOperator(); + private static final EmptyTemplateTabOperate SINGLETON = new EmptyTemplateTabOperate(); } - private EmptyTemplateTabOperator() { + private EmptyTemplateTabOperate() { } @@ -29,7 +29,7 @@ public class EmptyTemplateTabOperator implements TemplateTabOperateProvider { * 返回空的模板taboperator单例 * @return */ - public static EmptyTemplateTabOperator getInstance() { + public static EmptyTemplateTabOperate getInstance() { return Holder.SINGLETON; } From 2fd647f030254ba91ad79b14edb253219c204bbc Mon Sep 17 00:00:00 2001 From: obo Date: Fri, 14 Apr 2023 17:26:45 +0800 Subject: [PATCH 41/42] =?UTF-8?q?REPORT-91074=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JSContentWithDescriptionPane.java | 51 +++++++++++-------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java index e2a8dd0d5c..c42e3b80d4 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java @@ -18,7 +18,6 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.javascript.jsapi.JSAPITreeHelper; import com.fr.design.javascript.jsapi.JSAPIUserObject; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.general.CloudCenter; import com.fr.general.ComparatorUtils; import com.fr.general.http.HttpToolbox; import com.fr.json.JSONArray; @@ -26,6 +25,26 @@ import com.fr.json.JSONException; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; + +import javax.swing.BorderFactory; +import javax.swing.DefaultListCellRenderer; +import javax.swing.DefaultListModel; +import javax.swing.JComponent; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.SwingWorker; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeNode; +import javax.swing.tree.TreePath; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; @@ -51,25 +70,6 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.concurrent.ExecutionException; -import javax.swing.BorderFactory; -import javax.swing.DefaultListCellRenderer; -import javax.swing.DefaultListModel; -import javax.swing.JComponent; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.JScrollPane; -import javax.swing.JTree; -import javax.swing.SwingWorker; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.TreeNode; -import javax.swing.tree.TreePath; public class JSContentWithDescriptionPane extends JSContentPane implements KeyListener { @@ -119,6 +119,15 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi private static final String RELOAD_CARD = "reloadCard"; private static final String DOC_LIST_CARD = "docListCard"; + /** + * 云中心Js高级编辑器帮助链接前缀在配置文件中对应的配置文件key + */ + private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Js_Editor"; + + /** + * 云中心Js高级编辑器帮助链接前缀在配置文件中对应的配置文件key + */ + private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Js_Editor_Default"; public JSContentWithDescriptionPane(String[] args) { this.setLayout(new BorderLayout()); //=============================== @@ -381,7 +390,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi } private void updateHelpDocuments(Object value, List helpDocuments) { - String url = CloudCenter.getInstance().acquireUrlByKind("af.doc_search", DOCUMENT_SEARCH_URL) + value.toString(); + String url = LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT); try { String result = HttpToolbox.get(url); JSONObject jsonObject = new JSONObject(result); From 69f2982c2bdd19c69e3d2285016b8666cb02a0ca Mon Sep 17 00:00:00 2001 From: obo Date: Fri, 14 Apr 2023 17:31:14 +0800 Subject: [PATCH 42/42] =?UTF-8?q?REPORT-91074=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/javascript/JSContentWithDescriptionPane.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java index c42e3b80d4..3b8d04ffb3 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java @@ -14,6 +14,7 @@ import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextfield.PlaceholderTextField; +import com.fr.design.i18n.LocaleLinkProvider; import com.fr.design.i18n.Toolkit; import com.fr.design.javascript.jsapi.JSAPITreeHelper; import com.fr.design.javascript.jsapi.JSAPIUserObject;