From 4312cf85d90cdefe0a08ef6fdc66da141301ff09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=2EYing-=E5=BA=94=E5=BF=97=E6=B5=A9?= Date: Wed, 8 Feb 2023 10:37:24 +0800 Subject: [PATCH 01/33] =?UTF-8?q?REPORT-29522=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=86=85=E5=AF=BC=E5=87=BA=E6=8C=89=E9=92=AE=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=96=87=E5=AD=97=E5=B8=A6=E6=9C=89"..."=20=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=96=87=E5=AD=97=E5=8F=88=E6=B2=A1=E6=9C=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/file/export/ExcelExportAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/export/ExcelExportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/export/ExcelExportAction.java index 171a68ce8d..0933387062 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/export/ExcelExportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/export/ExcelExportAction.java @@ -12,7 +12,7 @@ public class ExcelExportAction extends AbstractExcelExportAction { public ExcelExportAction(JWorkBook jwb) { super(jwb); this.setMenuKeySet(KeySetUtils.SIMPLE_EXCEL_EXPORT); - this.setName(getMenuKeySet().getMenuKeySetName()); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/excel.png")); } From 9487dda3eb73ddb12309f16cbe2484379edbf640 Mon Sep 17 00:00:00 2001 From: "Cloud.Liu" Date: Thu, 9 Feb 2023 11:14:18 +0800 Subject: [PATCH 02/33] =?UTF-8?q?REPORT-89249=20fix:=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=90=AF=E5=8A=A8FineAnalyzer=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E6=B3=A8=E5=85=A5Instrumentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/record/analyzer/DesignerAnalyzerActivator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/record/analyzer/DesignerAnalyzerActivator.java b/designer-base/src/main/java/com/fr/design/record/analyzer/DesignerAnalyzerActivator.java index 8a23e6fe0e..087a656ba6 100644 --- a/designer-base/src/main/java/com/fr/design/record/analyzer/DesignerAnalyzerActivator.java +++ b/designer-base/src/main/java/com/fr/design/record/analyzer/DesignerAnalyzerActivator.java @@ -18,6 +18,7 @@ import com.fr.event.Null; import com.fr.intelli.metrics.Compute; import com.fr.intelli.record.Focus; import com.fr.intelli.record.PerformancePoint; +import com.fr.jvm.assist.FineAssist; import com.fr.module.Activator; import com.fr.module.extension.Prepare; import com.fr.record.analyzer.AnalyzerConfiguration; @@ -57,7 +58,7 @@ public class DesignerAnalyzerActivator extends Activator implements Prepare { List backwardsConfigurations = findMutableBackwards(AnalyzerKey.KEY); if (!CollectionUtils.isEmpty(backwardsConfigurations)) { // 直接初始化,不添加默认值,防止和下面的冲突 - FineAnalyzer.initDirectly(basicFactory, backwardsConfigurations.toArray(new AnalyzerConfiguration[0])); + FineAnalyzer.initDirectly(FineAssist.findInstrumentation(), basicFactory, backwardsConfigurations.toArray(new AnalyzerConfiguration[0])); } // 等页面完全打开后,再进行 retransform, 别影响了启动速度 From 28ee487a79086915137394df33fdc8d20c3e43a3 Mon Sep 17 00:00:00 2001 From: "Cloud.Liu" Date: Thu, 9 Feb 2023 19:26:10 +0800 Subject: [PATCH 03/33] =?UTF-8?q?Revert=20"KERNEL-12978=20fix:=20=E9=80=82?= =?UTF-8?q?=E9=85=8DCBB=E6=94=B9=E5=8A=A8"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 5a717baaea4cc0f968841f55dff8675ce5ac932c. --- .../src/main/java/com/fr/design/actions/file/LocalePane.java | 3 +-- .../main/java/com/fr/design/actions/file/PreferencePane.java | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java b/designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java index 843b3bf724..634af28b9e 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/LocalePane.java @@ -12,7 +12,6 @@ import com.fr.design.gui.itextfield.UITextField; import com.fr.file.filetree.FileNode; import com.fr.general.GeneralUtils; -import com.fr.general.Inter; import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; @@ -122,7 +121,7 @@ public class LocalePane extends BasicPane { private void initPredefinedProperties() { - Map supportLocaleMap = Inter.getSupportLocaleMap(); + Map supportLocaleMap = InterProviderFactory.getProvider().getSupportLocaleMap(); // richie:暂时去掉设计器中国际化键值对的显示 Map map = new HashMap<>(); diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 840de5867b..46485409bb 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -46,6 +46,7 @@ import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.general.log.Log4jConfig; import com.fr.io.attr.ImageExportAttr; +import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.report.ReportConfigManager; import com.fr.stable.Constants; @@ -633,7 +634,7 @@ public class PreferencePane extends BasicPane { } private UIDictionaryComboBox createLanguageComboBox() { - Map map = Inter.getSupportLocaleMap(); + Map map = InterProviderFactory.getProvider().getSupportLocaleMap(); int size = map.size(); Locale[] keys = new Locale[size]; String[] values = new String[size]; From 9eb8c73c47eb24df3f59ca9c894befaf5d65f5d7 Mon Sep 17 00:00:00 2001 From: vito Date: Thu, 16 Feb 2023 15:53:16 +0800 Subject: [PATCH 04/33] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E4=BE=9D=E8=B5=96=EF=BC=8C=E4=B8=8D=E5=BD=B1?= =?UTF-8?q?=E5=93=8D=E6=89=93=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 671e64fb95..e0bf79aefe 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,5 @@ import org.gradle.plugins.ide.idea.model.IdeaLanguageLevel +import org.gradle.internal.os.OperatingSystem plugins { id 'java' @@ -65,11 +66,7 @@ allprojects { implementation 'com.fr.cbb:fine-universal-skeleton:' + cbbVersion implementation 'com.install4j:install4j-runtime:8.0.4' implementation 'com.fr.third:jxbrowser:6.23' - implementation 'com.fr.third:jxbrowser-mac:6.23' - implementation 'com.fr.third:jxbrowser-win64:6.23' implementation 'com.fr.third:jxbrowser-v7:7.22' - implementation 'com.fr.third:jxbrowser-mac-v7:7.22' - implementation 'com.fr.third:jxbrowser-win64-v7:7.22' implementation 'com.fr.third:jxbrowser-swing-v7:7.22' implementation 'com.fr.third.server:servlet-api:3.0' implementation 'org.swingexplorer:swexpl:2.0.1' @@ -94,4 +91,16 @@ allprojects { testImplementation 'org.powermock:powermock-api-easymock:1.7.1' testImplementation 'junit:junit:4.12' } + + if (OperatingSystem.current().isMacOsX()) { + dependencies { + implementation 'com.fr.third:jxbrowser-mac:6.23' + implementation 'com.fr.third:jxbrowser-mac-v7:7.22' + } + } else if (OperatingSystem.current().isWindows()) { + dependencies { + implementation 'com.fr.third:jxbrowser-win64:6.23' + implementation 'com.fr.third:jxbrowser-win64-v7:7.22' + } + } } From e9c268f525e4e0a8a9c7780473ebf98ba90ac6fd Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Wed, 22 Feb 2023 13:46:40 +0800 Subject: [PATCH 05/33] =?UTF-8?q?REPORT-83259=20&=20REPORT-83263=20?= =?UTF-8?q?=E3=80=90=E6=9C=80=E5=BC=BA=E6=8E=A7=E4=BB=B6=E3=80=91=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E6=A0=B7=E5=BC=8F=E8=B7=9F=E9=9A=8F=E4=B8=BB=E9=A2=98?= =?UTF-8?q?&=E5=BC=80=E6=94=BE=E8=87=AA=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/fun/TemplateThemePaneProvider.java | 22 +++++++++ .../AbstractTemplateThemePaneProvider.java | 25 ++++++++++ .../mainframe/theme/FormThemeProfilePane.java | 9 +++- .../theme/ReportThemeProfilePane.java | 10 +++- .../theme/TemplateThemeEditorPane.java | 27 ++++++++-- .../AbstractThemePreviewPaneProcessor.java | 23 +++++++++ .../processor/ThemePreviewPaneProcessor.java | 35 +++++++++++++ .../fun/WidgetAdvancedPaneProvider.java | 34 +++++++++++++ .../AbstractWidgetAdvancedPaneProvider.java | 25 ++++++++++ .../parameter/RootDesignDefinePane.java | 49 ++++++++++++++++--- .../ui/designer/FieldEditorDefinePane.java | 31 ++++++++++-- .../com/fr/design/mainframe/JWorkBook.java | 3 ++ 12 files changed, 278 insertions(+), 15 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/fun/TemplateThemePaneProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateThemePaneProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/theme/processor/AbstractThemePreviewPaneProcessor.java create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/theme/processor/ThemePreviewPaneProcessor.java create mode 100644 designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java create mode 100644 designer-form/src/main/java/com/fr/design/fun/impl/AbstractWidgetAdvancedPaneProvider.java diff --git a/designer-base/src/main/java/com/fr/design/fun/TemplateThemePaneProvider.java b/designer-base/src/main/java/com/fr/design/fun/TemplateThemePaneProvider.java new file mode 100644 index 0000000000..e33cb4e302 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/TemplateThemePaneProvider.java @@ -0,0 +1,22 @@ +package com.fr.design.fun; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.stable.fun.mark.Mutable; + +/** + * @author Bruce.Deng + * @version 11.0 + * Created by Bruce.Deng on 2023/2/7 + */ +public interface TemplateThemePaneProvider extends Mutable { + + String XML_TAG = "TemplateThemePaneProvider"; + + int CURRENT_LEVEL = 1; + + String getTabName(); + + + BasicBeanPane getTab(); + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateThemePaneProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateThemePaneProvider.java new file mode 100644 index 0000000000..5dd4387277 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateThemePaneProvider.java @@ -0,0 +1,25 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.TemplateThemePaneProvider; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +/** + * @author Bruce.Deng + * @version 11.0 + * Created by Bruce.Deng on 2023/2/7 + */ +@API(level = TemplateThemePaneProvider.CURRENT_LEVEL) +public abstract class AbstractTemplateThemePaneProvider extends AbstractProvider implements TemplateThemePaneProvider { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String mark4Provider() { + return getClass().getName(); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java index 798bb73c59..d3807ffbbe 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java @@ -4,12 +4,14 @@ import com.fr.base.theme.FormTheme; import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.settings.ThemedComponentStyle; import com.fr.base.theme.settings.ThemedFormBodyStyle; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.theme.edit.ChartStyleFormEditPane; import com.fr.design.mainframe.theme.edit.ComponentStyleEditPane; import com.fr.design.mainframe.theme.edit.FormBodyStyleEditPane; import com.fr.design.mainframe.theme.preview.FormThemePreviewPane; +import com.fr.design.mainframe.theme.processor.ThemePreviewPaneProcessor; import javax.swing.JPanel; @@ -31,7 +33,11 @@ public class FormThemeProfilePane extends TemplateThemeProfilePane { } @Override - public FormThemePreviewPane createThemePreviewPane() { + public TemplateThemePreviewPane createThemePreviewPane() { + ThemePreviewPaneProcessor processor = ExtraDesignClassManager.getInstance().getSingle(ThemePreviewPaneProcessor.XML_TAG); + if (processor != null) { + return processor.createFormThemePreviewPane(); + } return new FormThemePreviewPane(); } @@ -61,6 +67,7 @@ public class FormThemeProfilePane extends TemplateThemeProfilePane { componentStyleSettingPane = new ComponentStyleEditPane(); addCustomEditorPane(i18nText("Fine-Design_Predefined_Component_Style"), componentStyleSettingPane); + addExtraEditPane(); } @Override diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java index f0f25f677f..4d1e1b51e0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java @@ -2,10 +2,11 @@ package com.fr.design.mainframe.theme; import com.fr.base.theme.ReportTheme; import com.fr.base.theme.TemplateThemeConfig; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.theme.edit.ReportBodyStyleEditPane; import com.fr.design.mainframe.theme.preview.ReportThemePreviewPane; -import javax.swing.JPanel; +import com.fr.design.mainframe.theme.processor.ThemePreviewPaneProcessor; /** * @author Starryi @@ -20,7 +21,11 @@ public class ReportThemeProfilePane extends TemplateThemeProfilePane createThemePreviewPane() { + ThemePreviewPaneProcessor processor = ExtraDesignClassManager.getInstance().getSingle(ThemePreviewPaneProcessor.XML_TAG); + if (processor != null) { + return processor.createReportThemePreviewPane(); + } return new ReportThemePreviewPane(); } @@ -44,6 +49,7 @@ public class ReportThemeProfilePane extends TemplateThemeProfilePane extends J protected ColorListPane colorListPane; protected CellStyleListEditPane cellStyleSettingPane; protected ChartStyleEditPane chartStyleSettingPane; + protected final List> extraPaneList = new ArrayList<>(); protected boolean isPopulating = false; protected UITabbedPane uiTabbedPane; @@ -192,6 +196,18 @@ public abstract class TemplateThemeEditorPane extends J }); uiTabbedPane.addTab(title, settingPane); } + + protected void addExtraEditPane() { + Set> providers = ExtraDesignClassManager.getInstance().getArray(TemplateThemePaneProvider.XML_TAG); + if (providers != null) { + for (TemplateThemePaneProvider provider : providers) { + BasicBeanPane tab = provider.getTab(); + extraPaneList.add(tab); + addCustomEditorPane(provider.getTabName(), tab); + } + } + } + protected JPanel createCellStyleSettingPane() { JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); cellStyleSettingPane = new CellStyleListEditPane(); @@ -223,6 +239,9 @@ public abstract class TemplateThemeEditorPane extends J colorListPane.populate(theme.getColorScheme().getColors()); populateBean4CustomEditors(theme); + for (BasicBeanPane pane : extraPaneList) { + pane.populateBean(theme); + } isPopulating = false; } @@ -243,7 +262,9 @@ public abstract class TemplateThemeEditorPane extends J theme.setColorScheme(colorScheme); updateBean4CustomEditors(theme); - + for (BasicBeanPane pane : extraPaneList) { + pane.updateBean(theme); + } return theme; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/processor/AbstractThemePreviewPaneProcessor.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/processor/AbstractThemePreviewPaneProcessor.java new file mode 100644 index 0000000000..839944d9fe --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/processor/AbstractThemePreviewPaneProcessor.java @@ -0,0 +1,23 @@ +package com.fr.design.mainframe.theme.processor; + +import com.fr.stable.fun.mark.API; + +/** + * @author Bruce.Deng + * @version 11.0 + * Created by Bruce.Deng on 2023/2/14 + */ +@API(level = ThemePreviewPaneProcessor.CURRENT_LEVEL) +public abstract class AbstractThemePreviewPaneProcessor implements ThemePreviewPaneProcessor { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public int layerIndex() { + return DEFAULT_LAYER_INDEX; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/processor/ThemePreviewPaneProcessor.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/processor/ThemePreviewPaneProcessor.java new file mode 100644 index 0000000000..93b17b8e92 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/processor/ThemePreviewPaneProcessor.java @@ -0,0 +1,35 @@ +package com.fr.design.mainframe.theme.processor; + +import com.fr.base.theme.FormTheme; +import com.fr.base.theme.ReportTheme; +import com.fr.design.mainframe.theme.TemplateThemePreviewPane; +import com.fr.stable.fun.mark.Immutable; + +/** + * 主题样式预览界面接口 + * + * @author Bruce.Deng + * @version 11.0 + * Created by Bruce.Deng on 2023/2/14 + */ +public interface ThemePreviewPaneProcessor extends Immutable { + + String XML_TAG = "ThemePreviewPaneProcessor"; + + int CURRENT_LEVEL = 1; + + /** + * 创建报表主题样式预览界面 + * + * @return 报表主题样式预览界面 + */ + TemplateThemePreviewPane createReportThemePreviewPane(); + + /** + * 创建决策报表主题样式预览界面 + * + * @return 决策报表主题样式预览界面 + */ + TemplateThemePreviewPane createFormThemePreviewPane(); + +} diff --git a/designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java b/designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java new file mode 100644 index 0000000000..9c5466abe2 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java @@ -0,0 +1,34 @@ +package com.fr.design.fun; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.designer.creator.XCreator; +import com.fr.stable.fun.mark.Mutable; + +/** + * 控件属性面板的高级设置项扩展 + * + * @author Bruce.Deng + * @version 11.0 + * Created by Bruce.Deng on 2023/2/15 + */ +public interface WidgetAdvancedPaneProvider extends Mutable { + + String XML_TAG = "WidgetAdvancedPaneProvider"; + + int CURRENT_LEVEL = 1; + + /** + * 是否需要处理 + * + * @param creator + * @return true:需要处理/false:不处理 + */ + boolean accept(XCreator creator); + + /** + * 创建控件高级设置项的追加面板 + * + * @return 高级设置项追加面板 + */ + BasicBeanPane createExtraAdvancedPane(); +} diff --git a/designer-form/src/main/java/com/fr/design/fun/impl/AbstractWidgetAdvancedPaneProvider.java b/designer-form/src/main/java/com/fr/design/fun/impl/AbstractWidgetAdvancedPaneProvider.java new file mode 100644 index 0000000000..2ceef7df53 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/fun/impl/AbstractWidgetAdvancedPaneProvider.java @@ -0,0 +1,25 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.WidgetAdvancedPaneProvider; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +/** + * @author Bruce.Deng + * @version 11.0 + * Created by Bruce.Deng on 2023/2/15 + */ +@API(level = WidgetAdvancedPaneProvider.CURRENT_LEVEL) +public abstract class AbstractWidgetAdvancedPaneProvider extends AbstractProvider implements WidgetAdvancedPaneProvider { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String mark4Provider() { + return getClass().getName(); + } + +} 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 9b4dfb4c44..e130d4f00c 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 @@ -2,6 +2,7 @@ package com.fr.design.parameter; import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.BasicBeanPane; import com.fr.design.data.DataCreatorUI; import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.CRPropertyDescriptor; @@ -13,6 +14,7 @@ import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.fit.common.TemplateTool; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.fun.ParameterExpandablePaneUIProvider; +import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; @@ -41,6 +43,8 @@ import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.List; import java.util.Set; /** @@ -59,6 +63,7 @@ public class RootDesignDefinePane extends AbstractDataModify { //是否是新设计模式下决策报表 private boolean newForm; private PropertyGroupPane extraPropertyGroupPane; + protected final List> extraPaneList = new ArrayList<>(); public RootDesignDefinePane(XCreator xCreator) { super(xCreator); @@ -144,7 +149,6 @@ public class RootDesignDefinePane extends AbstractDataModify { fireAfterEditor.setSelected(false); } }); - background = new AccessibleBackgroundEditor(); Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"),}; @@ -159,7 +163,7 @@ public class RootDesignDefinePane extends AbstractDataModify { int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; Component[][] components = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), background}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), getBackgroundPane()}, new Component[]{displayReport, null}, new Component[]{useParamsTemplate, null}, new Component[]{fireAfterEditor, null}, @@ -199,7 +203,6 @@ public class RootDesignDefinePane extends AbstractDataModify { fireAfterEditor.setSelected(false); } }); - background = new AccessibleBackgroundEditor(); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; @@ -208,7 +211,7 @@ public class RootDesignDefinePane extends AbstractDataModify { int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; Component[][] components = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), background}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), getBackgroundPane()}, new Component[]{displayReport, null}, new Component[]{useParamsTemplate, null}, new Component[]{fireAfterEditor, null}, @@ -229,7 +232,13 @@ public class RootDesignDefinePane extends AbstractDataModify { @Override public void populateBean(WParameterLayout ob) { labelNameTextField.setText(ob.getLabelName()); - background.setValue(ob.getBackground()); + if (extraPaneList.isEmpty()) { + background.setValue(ob.getBackground()); + } else { + for (BasicBeanPane pane : extraPaneList) { + pane.populateBean(ob); + } + } displayReport.setSelected(ob.isDelayDisplayContent()); useParamsTemplate.setSelected(ob.isUseParamsTemplate()); fireAfterEditor.setEnabled(ob.isUseParamsTemplate()); @@ -277,8 +286,14 @@ public class RootDesignDefinePane extends AbstractDataModify { wParameterLayout.setParamsFireStopEdit(fireAfterEditor.isSelected()); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected()); - wParameterLayout.setBackground((Background) background.getValue()); wParameterLayout.setPosition((Integer) hAlignmentPane.getSelectedItem()); + if (extraPaneList.isEmpty()) { + wParameterLayout.setBackground((Background) background.getValue()); + } else { + for (BasicBeanPane pane : extraPaneList) { + pane.updateBean(wParameterLayout); + } + } return wParameterLayout; } @@ -299,6 +314,13 @@ public class RootDesignDefinePane extends AbstractDataModify { JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected()); wParameterLayout.setBackground((Background) background.getValue()); + if (extraPaneList.isEmpty()) { + background.setValue(wParameterLayout.getBackground()); + } else { + for (BasicBeanPane pane : extraPaneList) { + pane.populateBean(wParameterLayout); + } + } //设置参数模板面板的高度 int height = (int) paraHeight.getTextField().getValue(); FormDesigner designer = TemplateTool.getCurrentEditingNewJForm().getFormDesign(); @@ -331,4 +353,19 @@ public class RootDesignDefinePane extends AbstractDataModify { public DataCreatorUI dataUI() { return null; } + + private Component getBackgroundPane() { + Set> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG); + if (providers != null) { + for (WidgetAdvancedPaneProvider provider : providers) { + if (provider.accept(creator)) { + BasicBeanPane extraAdvancedPane = provider.createExtraAdvancedPane(); + extraPaneList.add(extraAdvancedPane); + return extraAdvancedPane; + } + } + } + background = new AccessibleBackgroundEditor(); + return background; + } } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java index 4ee699e0fe..c3939db996 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java @@ -1,6 +1,7 @@ package com.fr.design.widget.ui.designer; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.ErrorMsgTextFieldAdapter; import com.fr.design.beans.UITextFieldAdapter; import com.fr.design.constants.LayoutConstants; @@ -12,6 +13,7 @@ import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.fun.TextFieldAdapterProvider; +import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; @@ -27,6 +29,9 @@ import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; public abstract class FieldEditorDefinePane extends AbstractDataModify { protected UICheckBox allowBlankCheckBox; @@ -35,7 +40,7 @@ public abstract class FieldEditorDefinePane extends Abstr protected JPanel validatePane; protected FontSizeComboPane fontSizePane; protected UITextField labelNameTextField; - + protected final List> extraPaneList = new ArrayList<>(); public FieldEditorDefinePane(XCreator xCreator) { super(xCreator); @@ -49,8 +54,9 @@ public abstract class FieldEditorDefinePane extends Abstr allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); fontSizePane = new FontSizeComboPane(); JPanel contentPane = this.setFirstContentPane(); - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - jPanel.add(contentPane, BorderLayout.CENTER); + JPanel jPanel = FRGUIPaneFactory.createYBoxEmptyBorderPane(); + jPanel.add(contentPane); + this.addExtraAdvancedPane(jPanel, creator); contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); if (contentPane != null) { UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, jPanel); @@ -59,12 +65,28 @@ public abstract class FieldEditorDefinePane extends Abstr this.addValidatePane(); } + protected void addExtraAdvancedPane(JPanel jPanel, XCreator xCreator) { + Set> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG); + if (providers != null) { + for (WidgetAdvancedPaneProvider provider : providers) { + if (provider.accept(xCreator)) { + BasicBeanPane extraAdvancedPane = provider.createExtraAdvancedPane(); + extraPaneList.add(extraAdvancedPane); + jPanel.add(extraAdvancedPane); + } + } + } + } + @Override public void populateBean(T ob) { this.allowBlankCheckBox.setSelected(ob.isAllowBlank()); this.errorMsgTextField.setText(ob.getErrorMessage()); this.fontSizePane.setValue(ob.getFontSize()); this.labelNameTextField.setText(ob.getLabelName()); + for (BasicBeanPane pane : extraPaneList) { + pane.populateBean(ob); + } populateSubFieldEditorBean(ob); } @@ -78,6 +100,9 @@ public abstract class FieldEditorDefinePane extends Abstr e.setErrorMessage(this.errorMsgTextField.getText()); e.setFontSize(fontSizePane.getValue()); e.setLabelName(labelNameTextField.getText()); + for (BasicBeanPane pane : extraPaneList) { + pane.updateBean(e); + } return e; } 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 cab4c6a185..d4fa7ed5cf 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 @@ -1311,6 +1311,7 @@ public class JWorkBook extends JTemplate { boolean shouldCreateUndoState = compatible == TemplateThemeCompatible.NONE && !StringUtils.equals(oldTheme.getName(), newTheme.getName()); getTarget().setTemplateTheme(newTheme, compatible); + getTarget().getReportParameterAttr().onTemplateUsingThemeChange(newTheme, compatible); setTarget((WorkBook) FineColorSynchronizer.flush(getTarget(), newTheme, compatible)); if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) { @@ -1318,6 +1319,8 @@ public class JWorkBook extends JTemplate { reportComposite.setSelectedIndex(reportComposite.getSelectedIndex()); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView(); DesignerContext.getDesignerFrame().resetToolkitByPlus(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); + // 刷新参数面板界面 + populateReportParameterAttr(); } super.setTemplateTheme(newTheme, compatible); From b53002904f2d4a0f3b401769983114cba13e853c Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Fri, 24 Feb 2023 12:23:24 +0800 Subject: [PATCH 06/33] =?UTF-8?q?REPORT-83259=20&=20REPORT-83263=20?= =?UTF-8?q?=E3=80=90=E6=9C=80=E5=BC=BA=E6=8E=A7=E4=BB=B6=E3=80=91=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E6=A0=B7=E5=BC=8F=E8=B7=9F=E9=9A=8F=E4=B8=BB=E9=A2=98?= =?UTF-8?q?&=E5=BC=80=E6=94=BE=E8=87=AA=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/fun/TemplateThemePaneProvider.java | 15 +++- .../AbstractTemplateThemePaneProvider.java | 3 +- .../mainframe/theme/FormThemeProfilePane.java | 2 +- .../theme/ReportThemeProfilePane.java | 2 +- .../theme/TemplateThemeEditorPane.java | 34 +++++++-- .../fun/WidgetAdvancedPaneProvider.java | 18 +++-- .../parameter/RootDesignDefinePane.java | 76 ++++++++++++++----- .../ui/designer/FieldEditorDefinePane.java | 54 ++++++++++--- 8 files changed, 159 insertions(+), 45 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/fun/TemplateThemePaneProvider.java b/designer-base/src/main/java/com/fr/design/fun/TemplateThemePaneProvider.java index e33cb4e302..f05d85318c 100644 --- a/designer-base/src/main/java/com/fr/design/fun/TemplateThemePaneProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/TemplateThemePaneProvider.java @@ -4,6 +4,8 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.stable.fun.mark.Mutable; /** + * 设计器模板主题管理-细节定制部分,支持添加tab + * * @author Bruce.Deng * @version 11.0 * Created by Bruce.Deng on 2023/2/7 @@ -14,9 +16,20 @@ public interface TemplateThemePaneProvider extends Mutable { int CURRENT_LEVEL = 1; - String getTabName(); + /** + * 插入tab的位置 + * + * @param total 已插入的tab数 + * @return 插入位置,如果想放到最后,则返回-1 + */ + int getInsertPosition(int total); + /** + * 获取tab对象 + * + * @return tab对象 + */ BasicBeanPane getTab(); } diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateThemePaneProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateThemePaneProvider.java index 5dd4387277..7e8fe617dc 100644 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateThemePaneProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateThemePaneProvider.java @@ -7,10 +7,11 @@ import com.fr.stable.fun.mark.API; /** * @author Bruce.Deng * @version 11.0 + * @see TemplateThemePaneProvider * Created by Bruce.Deng on 2023/2/7 */ @API(level = TemplateThemePaneProvider.CURRENT_LEVEL) -public abstract class AbstractTemplateThemePaneProvider extends AbstractProvider implements TemplateThemePaneProvider { +public abstract class AbstractTemplateThemePaneProvider extends AbstractProvider implements TemplateThemePaneProvider { @Override public int currentAPILevel() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java index d3807ffbbe..eb15a657f5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java @@ -67,7 +67,7 @@ public class FormThemeProfilePane extends TemplateThemeProfilePane { componentStyleSettingPane = new ComponentStyleEditPane(); addCustomEditorPane(i18nText("Fine-Design_Predefined_Component_Style"), componentStyleSettingPane); - addExtraEditPane(); + refreshExtraAdvancedPane(); } @Override diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java index 4d1e1b51e0..57e6ddf5f1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java @@ -49,7 +49,7 @@ public class ReportThemeProfilePane extends TemplateThemeProfilePane extends J uiTabbedPane = new UITabbedPane(); uiTabbedPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 1)); container.add(uiTabbedPane, BorderLayout.CENTER); - + initPluginListener(); return container; } @@ -197,15 +200,30 @@ public abstract class TemplateThemeEditorPane extends J uiTabbedPane.addTab(title, settingPane); } - protected void addExtraEditPane() { + protected void refreshExtraAdvancedPane() { + extraPaneList.clear(); Set> providers = ExtraDesignClassManager.getInstance().getArray(TemplateThemePaneProvider.XML_TAG); - if (providers != null) { - for (TemplateThemePaneProvider provider : providers) { - BasicBeanPane tab = provider.getTab(); - extraPaneList.add(tab); - addCustomEditorPane(provider.getTabName(), tab); - } + for (TemplateThemePaneProvider provider : providers) { + insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.getTab()); } + for (BasicBeanPane pane : extraPaneList) { + addCustomEditorPane(pane.getTitle(), pane); + } + } + + private void insertShortCut(int index, BasicBeanPane pane) { + int size = extraPaneList.size(); + index = Math.min(index, size); + extraPaneList.add(index, pane); + } + + private void initPluginListener() { + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + @Override + public void on(PluginEvent event) { + refreshExtraAdvancedPane(); + } + }, pluginContext -> pluginContext.getRuntime().contain(TemplateThemePaneProvider.XML_TAG)); } protected JPanel createCellStyleSettingPane() { diff --git a/designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java b/designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java index 9c5466abe2..3fcc8b6001 100644 --- a/designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java +++ b/designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java @@ -1,11 +1,11 @@ package com.fr.design.fun; -import com.fr.design.beans.BasicBeanPane; +import com.fr.design.beans.AbstractBasicBeanPane; import com.fr.design.designer.creator.XCreator; import com.fr.stable.fun.mark.Mutable; /** - * 控件属性面板的高级设置项扩展 + * 设计器控件的属性设置下“高级”设置项扩展,支持追加设置项 * * @author Bruce.Deng * @version 11.0 @@ -18,10 +18,18 @@ public interface WidgetAdvancedPaneProvider extends Mutable { int CURRENT_LEVEL = 1; /** - * 是否需要处理 + * 获取插入的位置 + * + * @param total 已插入的面板数 + * @return 插入位置,如果想放到最后,则返回-1 + */ + int getInsertPosition(int total); + + /** + * 根据XCreator判断是否需要处理 * * @param creator - * @return true:需要处理/false:不处理 + * @return true:需要处理;false:不处理 */ boolean accept(XCreator creator); @@ -30,5 +38,5 @@ public interface WidgetAdvancedPaneProvider extends Mutable { * * @return 高级设置项追加面板 */ - BasicBeanPane createExtraAdvancedPane(); + AbstractBasicBeanPane createExtraAdvancedPane(); } 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 e130d4f00c..86e3f49986 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 @@ -34,6 +34,9 @@ import com.fr.design.widget.ui.designer.AbstractDataModify; import com.fr.design.widget.ui.designer.component.UIBoundSpinner; import com.fr.form.ui.container.WParameterLayout; import com.fr.general.Background; +import com.fr.general.GeneralContext; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; import com.fr.report.stable.FormConstants; import javax.swing.BorderFactory; @@ -64,6 +67,7 @@ public class RootDesignDefinePane extends AbstractDataModify { private boolean newForm; private PropertyGroupPane extraPropertyGroupPane; protected final List> extraPaneList = new ArrayList<>(); + private JPanel backgroundPane; public RootDesignDefinePane(XCreator xCreator) { super(xCreator); @@ -156,6 +160,8 @@ public class RootDesignDefinePane extends AbstractDataModify { hAlignmentPane = new UIButtonGroup(hAlignmentIconArray, hAlignment); hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Left") , com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right")}); + backgroundPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.initExtraPane(); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {p, p, p, p, p, p}; @@ -163,7 +169,7 @@ public class RootDesignDefinePane extends AbstractDataModify { int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; Component[][] components = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), getBackgroundPane()}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), backgroundPane}, new Component[]{displayReport, null}, new Component[]{useParamsTemplate, null}, new Component[]{fireAfterEditor, null}, @@ -180,6 +186,54 @@ public class RootDesignDefinePane extends AbstractDataModify { return jPanel; } + private void initExtraPane() { + initPluginListener(); + refreshExtraAdvancedPane(); + } + + private void initPluginListener() { + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + @Override + public void on(PluginEvent event) { + refreshExtraAdvancedPane(); + } + }, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG)); + } + + private void refreshExtraAdvancedPane() { + extraPaneList.clear(); + backgroundPane.removeAll(); + Set> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG); + for (WidgetAdvancedPaneProvider provider : providers) { + if (!provider.accept(creator)) { + continue; + } + insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane()); + } + if (extraPaneList.isEmpty()) { + if (background == null) { + background = new AccessibleBackgroundEditor(); + } + backgroundPane.add(background); + } else { + for (BasicBeanPane pane : extraPaneList) { + backgroundPane.add(pane); + } + } + } + + /** + * 插入配置项面板 + * + * @param index 插入的位置 + * @param pane 配置项面板 + */ + public void insertShortCut(int index, BasicBeanPane pane) { + int size = extraPaneList.size(); + index = Math.min(index, size); + extraPaneList.add(index, pane); + } + /** * @param * @Description: 获取新决策报表的AdvancePane @@ -203,7 +257,8 @@ public class RootDesignDefinePane extends AbstractDataModify { fireAfterEditor.setSelected(false); } }); - + backgroundPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.initExtraPane(); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {p, p, p, p, p}; @@ -211,7 +266,7 @@ public class RootDesignDefinePane extends AbstractDataModify { int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; Component[][] components = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), getBackgroundPane()}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), backgroundPane}, new Component[]{displayReport, null}, new Component[]{useParamsTemplate, null}, new Component[]{fireAfterEditor, null}, @@ -353,19 +408,4 @@ public class RootDesignDefinePane extends AbstractDataModify { public DataCreatorUI dataUI() { return null; } - - private Component getBackgroundPane() { - Set> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG); - if (providers != null) { - for (WidgetAdvancedPaneProvider provider : providers) { - if (provider.accept(creator)) { - BasicBeanPane extraAdvancedPane = provider.createExtraAdvancedPane(); - extraPaneList.add(extraAdvancedPane); - return extraAdvancedPane; - } - } - } - background = new AccessibleBackgroundEditor(); - return background; - } } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java index c3939db996..1777a027ba 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java @@ -21,7 +21,10 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.ui.designer.component.FontSizeComboPane; import com.fr.form.ui.FieldEditor; +import com.fr.general.GeneralContext; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -40,7 +43,8 @@ public abstract class FieldEditorDefinePane extends Abstr protected JPanel validatePane; protected FontSizeComboPane fontSizePane; protected UITextField labelNameTextField; - protected final List> extraPaneList = new ArrayList<>(); + private final List> extraPaneList = new ArrayList<>(); + private JPanel extraPane; public FieldEditorDefinePane(XCreator xCreator) { super(xCreator); @@ -56,7 +60,9 @@ public abstract class FieldEditorDefinePane extends Abstr JPanel contentPane = this.setFirstContentPane(); JPanel jPanel = FRGUIPaneFactory.createYBoxEmptyBorderPane(); jPanel.add(contentPane); - this.addExtraAdvancedPane(jPanel, creator); + extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane(); + jPanel.add(extraPane); + this.initExtraPane(); contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); if (contentPane != null) { UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, jPanel); @@ -65,16 +71,23 @@ public abstract class FieldEditorDefinePane extends Abstr this.addValidatePane(); } - protected void addExtraAdvancedPane(JPanel jPanel, XCreator xCreator) { + private void initExtraPane() { + initPluginListener(); + refreshExtraAdvancedPane(); + } + + private void refreshExtraAdvancedPane() { + extraPaneList.clear(); + extraPane.removeAll(); Set> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG); - if (providers != null) { - for (WidgetAdvancedPaneProvider provider : providers) { - if (provider.accept(xCreator)) { - BasicBeanPane extraAdvancedPane = provider.createExtraAdvancedPane(); - extraPaneList.add(extraAdvancedPane); - jPanel.add(extraAdvancedPane); - } + for (WidgetAdvancedPaneProvider provider : providers) { + if (!provider.accept(creator)) { + continue; } + insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane()); + } + for (BasicBeanPane pane : extraPaneList) { + extraPane.add(pane); } } @@ -177,4 +190,25 @@ public abstract class FieldEditorDefinePane extends Abstr return null; } + /** + * 插入配置项面板 + * + * @param index 插入的位置 + * @param pane 配置项面板 + */ + private void insertShortCut(int index, BasicBeanPane pane) { + int size = extraPaneList.size(); + index = Math.min(index, size); + extraPaneList.add(index, pane); + } + + private void initPluginListener() { + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + @Override + public void on(PluginEvent event) { + refreshExtraAdvancedPane(); + } + }, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG)); + } + } From 12e1c1489fecdea9b25c8ea4024de4780b6aea1f Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Fri, 24 Feb 2023 12:40:14 +0800 Subject: [PATCH 07/33] =?UTF-8?q?REPORT-83259=20&=20REPORT-83263=20?= =?UTF-8?q?=E3=80=90=E6=9C=80=E5=BC=BA=E6=8E=A7=E4=BB=B6=E3=80=91=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E6=A0=B7=E5=BC=8F=E8=B7=9F=E9=9A=8F=E4=B8=BB=E9=A2=98?= =?UTF-8?q?&=E5=BC=80=E6=94=BE=E8=87=AA=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/fun/WidgetAdvancedPaneProvider.java | 4 ++-- .../design/fun/impl/AbstractWidgetAdvancedPaneProvider.java | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java b/designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java index 3fcc8b6001..eafa70b239 100644 --- a/designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java +++ b/designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java @@ -1,6 +1,6 @@ package com.fr.design.fun; -import com.fr.design.beans.AbstractBasicBeanPane; +import com.fr.design.beans.BasicBeanPane; import com.fr.design.designer.creator.XCreator; import com.fr.stable.fun.mark.Mutable; @@ -38,5 +38,5 @@ public interface WidgetAdvancedPaneProvider extends Mutable { * * @return 高级设置项追加面板 */ - AbstractBasicBeanPane createExtraAdvancedPane(); + BasicBeanPane createExtraAdvancedPane(); } diff --git a/designer-form/src/main/java/com/fr/design/fun/impl/AbstractWidgetAdvancedPaneProvider.java b/designer-form/src/main/java/com/fr/design/fun/impl/AbstractWidgetAdvancedPaneProvider.java index 2ceef7df53..6b60eb56a8 100644 --- a/designer-form/src/main/java/com/fr/design/fun/impl/AbstractWidgetAdvancedPaneProvider.java +++ b/designer-form/src/main/java/com/fr/design/fun/impl/AbstractWidgetAdvancedPaneProvider.java @@ -7,10 +7,11 @@ import com.fr.stable.fun.mark.API; /** * @author Bruce.Deng * @version 11.0 + * @see WidgetAdvancedPaneProvider * Created by Bruce.Deng on 2023/2/15 */ @API(level = WidgetAdvancedPaneProvider.CURRENT_LEVEL) -public abstract class AbstractWidgetAdvancedPaneProvider extends AbstractProvider implements WidgetAdvancedPaneProvider { +public abstract class AbstractWidgetAdvancedPaneProvider extends AbstractProvider implements WidgetAdvancedPaneProvider { @Override public int currentAPILevel() { From 3832ab0684f72568705a21611baa3e6275662db4 Mon Sep 17 00:00:00 2001 From: Maximus <49313791+num73@users.noreply.github.com> Date: Fri, 24 Feb 2023 16:21:15 +0800 Subject: [PATCH 08/33] =?UTF-8?q?REPORT-86502=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E4=B8=AD=E5=A2=9E=E5=8A=A0=E8=BF=9E=E6=8E=A5=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E6=97=B6=E6=98=BE=E7=A4=BA=E9=A9=B1=E5=8A=A8=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E8=B7=AF=E5=BE=84=E4=B8=8E=E6=A3=80=E6=B5=8B=E9=A9=B1?= =?UTF-8?q?=E5=8A=A8=E5=86=B2=E7=AA=81=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../connect/DatabaseConnectionPane.java | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index 4d5556ef95..9974c88107 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -3,6 +3,7 @@ */ package com.fr.design.data.datapane.connect; +import com.fr.data.driver.util.JarFileParseUtil; import com.fr.data.impl.Connection; import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JNDIDatabaseConnection; @@ -32,10 +33,12 @@ import com.fr.workspace.WorkContext; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JDialog; +import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.ScrollPaneConstants; +import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; import javax.swing.UIManager; @@ -55,6 +58,7 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import java.io.File; import java.net.URI; import java.util.concurrent.ExecutionException; @@ -190,6 +194,55 @@ public abstract class DatabaseConnectionPane Date: Fri, 24 Feb 2023 17:19:07 +0800 Subject: [PATCH 09/33] =?UTF-8?q?REPORT-86502=20SwingWorker=E5=A4=AA?= =?UTF-8?q?=E5=A4=A7=E4=BA=86=EF=BC=8C=E6=8B=86=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../connect/DatabaseConnectionPane.java | 351 ++++++++++-------- 1 file changed, 188 insertions(+), 163 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index 9974c88107..a0b651acbd 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -97,169 +97,7 @@ public abstract class DatabaseConnectionPane connectionThread = new SwingWorker() { - @Override - protected Void doInBackground() throws Exception { - Connection database = DatabaseConnectionPane.this.updateBean(); - // 返回连接结果 - DriverPage.updateCache(); - final Exception[] exception = new Exception[1]; - WorkContext.getCurrent().get(DataOperatorProvider.class, new ExceptionHandler() { - @Override - public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) { - // 正常调用发生的异常也会被捕获,因此需要对异常类型进行判断,如果是NoSuchMethodException 就要去调用 testConnection - // 如果不是 NoSuchMethodException 保存下异常上下文 - // 两种情况下异常都需要抛出 - if (exceptionInfo.getException() instanceof NoSuchMethodException) { - if (!WorkContext.getCurrent().get(DataOperatorProvider.class).testConnection(database)) { - exception[0] = new Exception(Toolkit.i18nText("Fine-Design_Description_Of_Test_Connection")); - } - } else { - exception[0] = exceptionInfo.getException(); - } - return null; - } - }).testConnectionWithException(database); - if (exception[0] != null) { - throw exception[0]; - } - return null; - } - - @Override - protected void done() { - try { - get(); - dialog.setSize(new Dimension(380, 125)); - okButton.setEnabled(true); - uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); - message.setText(Toolkit.i18nText("Fine-Design_Basic_Datasource_Connection_Successfully")); - } catch (InterruptedException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } catch (ExecutionException e) { - dialog.setSize(new Dimension(380, 142)); - midPane.setVisible(true); - hiddenPanel.setVisible(false); - okButton.setEnabled(true); - uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); - message.setText(Toolkit.i18nText("Fine-Design_Basic_Connection_Failed")); - Connection database = DatabaseConnectionPane.this.updateBean(); - SolutionProcessor select = ExceptionSolutionSelector.get().select(e, database); - if (select instanceof ClassNotFoundExceptionSolutionProcessor) { - JPanel gridJpanel = new JPanel(); - gridJpanel.setLayout(new GridLayout(5, 1, 0, 5)); - UILabel driverTips = new UILabel(); - driverTips.setText(Toolkit.i18nText("Fine_Designer_Not_Found_Driver")); - gridJpanel.add(driverTips); - UILabel deatail = new UILabel(); - String content = Toolkit.i18nText("Fine_Designer_Not_Found") + " " + select.getResultException().getDetailMessage() + " " + Toolkit.i18nText("Fine_Designer_Driver"); - deatail.setText(content); - deatail.setToolTipText(content); - gridJpanel.add(deatail); - String solution = select.getResultException().getSolution(); - UILabel redirect = new UILabel(); - if (solution != null) { - redirect.setText(Toolkit.i18nText("Fine_Designer_Download_Driver")); - redirect.setForeground(Color.BLUE); - redirect.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - try { - Desktop.getDesktop().browse(new URI(solution)); - } catch (Exception clickException) { - FineLoggerFactory.getLogger().warn("can not open browser with {}", solution); - } - } - - @Override - public void mouseEntered(MouseEvent e) { - redirect.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - } - - @Override - public void mouseExited(MouseEvent e) { - redirect.setCursor(Cursor.getDefaultCursor()); - } - }); - } else { - redirect.setText(Toolkit.i18nText("Fine_Designer_Not_Found_Driver_No_Solution")); - } - gridJpanel.add(redirect); - hiddenPanel.add(gridJpanel); - gridJpanel.setBackground(Color.WHITE); - } else { - JPanel borderPanel = new JPanel(); - borderPanel.setLayout(new BorderLayout()); - JTextArea jta = new JTextArea(); - JScrollPane jsp = new JScrollPane(jta); - jsp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - Connection con = DatabaseConnectionPane.this.updateBean(); - if(con instanceof JDBCDatabaseConnection) { - JPanel xBorderPanel = new JPanel(); - xBorderPanel.setLayout(new BorderLayout()); - UILabel driverTestTip = new UILabel(); - JLabel testResult = new JLabel(); - driverTestTip.setForeground(Color.BLUE); - driverTestTip.setVisible(true); - testResult.setVisible(false); - testResult.setHorizontalAlignment(SwingConstants.CENTER); - driverTestTip.setText(Toolkit.i18nText("Fine_Designer_Driver_Path_Test")); - xBorderPanel.add(driverTestTip, BorderLayout.WEST); - xBorderPanel.add(testResult, BorderLayout.CENTER); - String driverPath = JarFileParseUtil.getDriverClassPath((JDBCDatabaseConnection) con); - jta.append(Toolkit.i18nText("Fine_Designer_Current_Driver_Path") + ":" + driverPath + "\n"); - driverTestTip.addMouseListener(new MouseAdapter() { - @Override - public void mouseEntered(MouseEvent e) { - driverTestTip.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - } - - @Override - public void mouseExited(MouseEvent e) { - driverTestTip.setCursor(Cursor.getDefaultCursor()); - } - @Override - public void mouseClicked(MouseEvent e) { - try { - String path; - if(driverPath.endsWith(JarFileParseUtil.JAR_MARKER)) { - path = new File(driverPath).getParent(); - } else { - path = driverPath; - } - if(JarFileParseUtil.hasDuplicateDriver(con.getDriver(), path)) { - testResult.setForeground(Color.RED); - testResult.setText(Toolkit.i18nText("Fine_Designer_Driver_Conflict")); - } else { - testResult.setForeground(Color.BLACK); - testResult.setText(Toolkit.i18nText("Fine_Designer_Driver_No_Conflict")); - } - testResult.setVisible(true); - } catch (Exception clickException) { - FineLoggerFactory.getLogger().warn(clickException, "can not test driver conflict"); - } - } - }); - borderPanel.add(xBorderPanel, BorderLayout.NORTH); - } - jta.append(select.getResultException().getDetailMessage() + "\n"); - jta.append(select.getResultException().getSolution()); - jta.setCaretPosition(0); - jta.setEditable(false); - jta.getCaret().addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - jta.getCaret().setVisible(true); - } - }); - borderPanel.add(jsp, BorderLayout.CENTER); - hiddenPanel.add(borderPanel); - } - okButton.setEnabled(true); - } - } - }; + final SwingWorker connectionThread = new TestConnectionWorker(); midPane.setVisible(false); hiddenPanel.setVisible(false); initDialogPane(); @@ -583,4 +421,191 @@ public abstract class DatabaseConnectionPane { + @Override + protected Void doInBackground() throws Exception { + Connection database = DatabaseConnectionPane.this.updateBean(); + // 返回连接结果 + DriverPage.updateCache(); + final Exception[] exception = new Exception[1]; + WorkContext.getCurrent().get(DataOperatorProvider.class, new ExceptionHandler() { + @Override + public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) { + // 正常调用发生的异常也会被捕获,因此需要对异常类型进行判断,如果是NoSuchMethodException 就要去调用 testConnection + // 如果不是 NoSuchMethodException 保存下异常上下文 + // 两种情况下异常都需要抛出 + if (exceptionInfo.getException() instanceof NoSuchMethodException) { + if (!WorkContext.getCurrent().get(DataOperatorProvider.class).testConnection(database)) { + exception[0] = new Exception(Toolkit.i18nText("Fine-Design_Description_Of_Test_Connection")); + } + } else { + exception[0] = exceptionInfo.getException(); + } + return null; + } + }).testConnectionWithException(database); + if (exception[0] != null) { + throw exception[0]; + } + return null; + } + + @Override + protected void done() { + try { + get(); + dialog.setSize(new Dimension(380, 125)); + okButton.setEnabled(true); + uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); + message.setText(Toolkit.i18nText("Fine-Design_Basic_Datasource_Connection_Successfully")); + } catch (InterruptedException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } catch (ExecutionException e) { + dealWithException(e); + } + } + + private void dealWithException(ExecutionException e) { + dialog.setSize(new Dimension(380, 142)); + midPane.setVisible(true); + hiddenPanel.setVisible(false); + okButton.setEnabled(true); + uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); + message.setText(Toolkit.i18nText("Fine-Design_Basic_Connection_Failed")); + Connection database = DatabaseConnectionPane.this.updateBean(); + SolutionProcessor select = ExceptionSolutionSelector.get().select(e, database); + String detail = select.getResultException().getDetailMessage(); + String solution = select.getResultException().getSolution(); + if (select instanceof ClassNotFoundExceptionSolutionProcessor) { + showClassNotFoundUI(select.getResultException().getDetailMessage(), select.getResultException().getSolution()); + } else { + showExceptionMessageUI(detail, solution); + } + okButton.setEnabled(true); + } + + private void showClassNotFoundUI(String detailMessage, String solution) { + JPanel gridJpanel = new JPanel(); + gridJpanel.setLayout(new GridLayout(5, 1, 0, 5)); + UILabel driverTips = new UILabel(); + driverTips.setText(Toolkit.i18nText("Fine_Designer_Not_Found_Driver")); + gridJpanel.add(driverTips); + UILabel deatail = new UILabel(); + String content = Toolkit.i18nText("Fine_Designer_Not_Found") + " " + detailMessage+ " " + Toolkit.i18nText("Fine_Designer_Driver"); + deatail.setText(content); + deatail.setToolTipText(content); + gridJpanel.add(deatail); + UILabel redirect = new UILabel(); + if (solution != null) { + redirect.setText(Toolkit.i18nText("Fine_Designer_Download_Driver")); + redirect.setForeground(Color.BLUE); + redirect.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + try { + Desktop.getDesktop().browse(new URI(solution)); + } catch (Exception clickException) { + FineLoggerFactory.getLogger().warn("can not open browser with {}", solution); + } + } + + @Override + public void mouseEntered(MouseEvent e) { + redirect.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + } + + @Override + public void mouseExited(MouseEvent e) { + redirect.setCursor(Cursor.getDefaultCursor()); + } + }); + } else { + redirect.setText(Toolkit.i18nText("Fine_Designer_Not_Found_Driver_No_Solution")); + } + gridJpanel.add(redirect); + hiddenPanel.add(gridJpanel); + gridJpanel.setBackground(Color.WHITE); + } + + private void showExceptionMessageUI(String detail, String solution) { + JPanel borderPanel = new JPanel(); + borderPanel.setLayout(new BorderLayout()); + JTextArea jta = new JTextArea(); + JScrollPane jsp = new JScrollPane(jta); + jsp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + + Connection con = DatabaseConnectionPane.this.updateBean(); + if(con instanceof JDBCDatabaseConnection) { + String driverPath = JarFileParseUtil.getDriverClassPath((JDBCDatabaseConnection) con); + jta.append(Toolkit.i18nText("Fine_Designer_Current_Driver_Path") + ":" + driverPath + "\n"); + JPanel testDriverPanel = generateTestDriverPanel((JDBCDatabaseConnection) con, driverPath); + borderPanel.add(testDriverPanel, BorderLayout.NORTH); + } + jta.append(detail + "\n"); + jta.append(solution); + jta.setCaretPosition(0); + jta.setEditable(false); + jta.getCaret().addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + jta.getCaret().setVisible(true); + } + }); + borderPanel.add(jsp, BorderLayout.CENTER); + hiddenPanel.add(borderPanel); + } + + private JPanel generateTestDriverPanel(JDBCDatabaseConnection con, String driverPath) { + JPanel xBorderPanel = new JPanel(); + xBorderPanel.setLayout(new BorderLayout()); + UILabel driverTestTip = new UILabel(); + JLabel testResult = new JLabel(); + driverTestTip.setForeground(Color.BLUE); + driverTestTip.setVisible(true); + testResult.setVisible(false); + testResult.setHorizontalAlignment(SwingConstants.CENTER); + driverTestTip.setText(Toolkit.i18nText("Fine_Designer_Driver_Path_Test")); + xBorderPanel.add(driverTestTip, BorderLayout.WEST); + xBorderPanel.add(testResult, BorderLayout.CENTER); + + driverTestTip.addMouseListener(new MouseAdapter() { + @Override + public void mouseEntered(MouseEvent e) { + driverTestTip.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + } + + @Override + public void mouseExited(MouseEvent e) { + driverTestTip.setCursor(Cursor.getDefaultCursor()); + } + @Override + public void mouseClicked(MouseEvent e) { + try { + String path; + if(driverPath.endsWith(JarFileParseUtil.JAR_MARKER)) { + path = new File(driverPath).getParent(); + } else { + path = driverPath; + } + if(JarFileParseUtil.hasDuplicateDriver(con.getDriver(), path)) { + testResult.setForeground(Color.RED); + testResult.setText(Toolkit.i18nText("Fine_Designer_Driver_Conflict")); + } else { + testResult.setForeground(Color.BLACK); + testResult.setText(Toolkit.i18nText("Fine_Designer_Driver_No_Conflict")); + } + testResult.setVisible(true); + } catch (Exception clickException) { + FineLoggerFactory.getLogger().warn(clickException, "can not test driver conflict"); + } + } + }); + return xBorderPanel; + } + + + } + } From 830537e0363495381c9fb2f4e532264ccfb1c6e4 Mon Sep 17 00:00:00 2001 From: levy Date: Mon, 27 Feb 2023 14:30:28 +0800 Subject: [PATCH 10/33] =?UTF-8?q?REPORT-89007=20websocket=20url=20?= =?UTF-8?q?=E6=98=8E=E6=96=87=E4=BC=A0=E8=BE=93token=20-=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/socketio/AbstractSocketConfig.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/AbstractSocketConfig.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/AbstractSocketConfig.java index 2f86907763..b087ed0b7a 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/AbstractSocketConfig.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/AbstractSocketConfig.java @@ -1,6 +1,5 @@ package com.fr.design.mainframe.socketio; -import com.fr.decision.webservice.utils.DecisionServiceConstants; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.report.RemoteDesignConstants; @@ -14,6 +13,7 @@ import com.fr.workspace.Workspace; import com.fr.workspace.base.WorkspaceConstants; import com.fr.workspace.connect.WorkspaceConnection; import com.fr.workspace.connect.WorkspaceConnectionInfo; +import com.fr.workspace.server.socket.SocketVerifierOperator; import io.socket.client.IO; import io.socket.engineio.client.transports.Polling; import io.socket.engineio.client.transports.WebSocket; @@ -83,14 +83,17 @@ public abstract class AbstractSocketConfig { WorkspaceConnection connection = current.getConnection(); currentProtocol = getCurrentProtocolFromUrl(url); String[] result = new String[ports.length]; + // REPORT-89007: websocket 避免url明文传输token。兼容旧版本服务器:旧版传递token,新版传递加密后的wsid + String verifierPrefix = WorkContext.getCurrent().get(SocketVerifierOperator.class).getVerifierPrefix(); + String verifierCode = WorkContext.getCurrent().get(SocketVerifierOperator.class).getVerifierCode(connection.getToken()); for (int i = 0; i < ports.length; i++) { result[i] = String.format("%s://%s:%s%s?%s=%s&%s=%s", currentProtocol, url.getHost(), ports[i], WorkspaceConstants.WS_NAMESPACE, - DecisionServiceConstants.WEB_SOCKET_TOKEN_NAME, - connection.getToken(), + verifierPrefix, + verifierCode, RemoteDesignConstants.USER_LOCK_ID, connection.getId()); } From 8695f1157ca0db65fa38768ac82afab00faeb2fc Mon Sep 17 00:00:00 2001 From: levy Date: Mon, 27 Feb 2023 15:21:13 +0800 Subject: [PATCH 11/33] =?UTF-8?q?REPORT-89007=20websocket=20url=20?= =?UTF-8?q?=E6=98=8E=E6=96=87=E4=BC=A0=E8=BE=93token=20-=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/socketio/AbstractSocketConfig.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/AbstractSocketConfig.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/AbstractSocketConfig.java index b087ed0b7a..8562ccbbdb 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/AbstractSocketConfig.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/AbstractSocketConfig.java @@ -13,6 +13,7 @@ import com.fr.workspace.Workspace; import com.fr.workspace.base.WorkspaceConstants; import com.fr.workspace.connect.WorkspaceConnection; import com.fr.workspace.connect.WorkspaceConnectionInfo; +import com.fr.workspace.server.socket.SocketIOVerifier; import com.fr.workspace.server.socket.SocketVerifierOperator; import io.socket.client.IO; import io.socket.engineio.client.transports.Polling; @@ -84,16 +85,16 @@ public abstract class AbstractSocketConfig { currentProtocol = getCurrentProtocolFromUrl(url); String[] result = new String[ports.length]; // REPORT-89007: websocket 避免url明文传输token。兼容旧版本服务器:旧版传递token,新版传递加密后的wsid - String verifierPrefix = WorkContext.getCurrent().get(SocketVerifierOperator.class).getVerifierPrefix(); - String verifierCode = WorkContext.getCurrent().get(SocketVerifierOperator.class).getVerifierCode(connection.getToken()); + String token = connection.getToken(); + SocketIOVerifier verifier = WorkContext.getCurrent().get(SocketVerifierOperator.class).getVerifier(token); for (int i = 0; i < ports.length; i++) { result[i] = String.format("%s://%s:%s%s?%s=%s&%s=%s", currentProtocol, url.getHost(), ports[i], WorkspaceConstants.WS_NAMESPACE, - verifierPrefix, - verifierCode, + verifier.getVerifierPrefix(), + verifier.getVerifierCode(), RemoteDesignConstants.USER_LOCK_ID, connection.getId()); } From 37fadf6daa910d2daac79e397009f9630b1e6a6e Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 28 Feb 2023 09:45:01 +0800 Subject: [PATCH 12/33] =?UTF-8?q?REPORT-87135=20=E3=80=90=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E3=80=91=E8=B6=85=E7=BA=A7=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E7=9A=84=E9=93=BE=E6=8E=A5=E6=89=93=E5=BC=80=E4=BA=8E=E6=89=8B?= =?UTF-8?q?=E5=8A=A8=E4=BF=AE=E6=94=B9=E5=86=85=E5=AE=B9=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E5=8D=95=E5=85=83=E6=A0=BC=E5=86=8D=E6=AC=A1?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=BC=9A=E6=98=BE=E7=A4=BA=E4=B8=8A=E6=AC=A1?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/hyperlink/ReportletHyperNorthPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java index 8355d4f97f..8fa88e9293 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java @@ -342,7 +342,7 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane Date: Tue, 28 Feb 2023 15:55:15 +0800 Subject: [PATCH 13/33] =?UTF-8?q?REPORT-86430=20AlphaFine=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E5=BF=83tab=E9=A1=B5=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search/manager/impl/PluginSearchManager.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java index de8f468829..08eecdde2b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java @@ -44,6 +44,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider { private static final String TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; private static final String UPLOAD_TIME = "uploadTime"; + private static final String CURRENT_VERSION = "v11"; private PluginSearchManager() { @@ -218,8 +219,15 @@ public class PluginSearchManager implements AlphaFineSearchProvider { } catch (Exception e) { FineLoggerFactory.getLogger().error(e, e.getMessage()); } - for (int i = 0; i < DEFAULT_LIST_SIZE; i++) { - pluginModels.add(getPluginModel(new JSONObject(jsonObjects.get(i)), false)); + int pluginModelsCount = 0; + for (Map obj : jsonObjects) { + if (pluginModelsCount == DEFAULT_LIST_SIZE) { + break; + } + if (((Integer) obj.get(CURRENT_VERSION)) == 1) { + pluginModels.add(getPluginModel(new JSONObject(obj), false)); + pluginModelsCount++; + } } } return pluginModels; From c0c4f78e9fff0ad12f3c994c6fab19bcdeed1d0d Mon Sep 17 00:00:00 2001 From: Yann Date: Tue, 28 Feb 2023 16:52:47 +0800 Subject: [PATCH 14/33] =?UTF-8?q?REPORT-86430=20AlphaFine=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E5=BF=83tab=E9=A1=B5=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manager/impl/PluginSearchManager.java | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java index 08eecdde2b..fc39254cc8 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java @@ -29,7 +29,7 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Map; -import java.util.function.ToLongFunction; +import java.util.function.Function; /** * Created by XiaXiang on 2017/3/27. @@ -204,18 +204,16 @@ public class PluginSearchManager implements AlphaFineSearchProvider { if (!Collections.isEmpty(jsonObjects)) { SimpleDateFormat format = new SimpleDateFormat(TIME_FORMAT); try { - jsonObjects.sort(Comparator.comparingLong(new ToLongFunction() { - @Override - public long applyAsLong(Map value) { - long time = 0L; - try { - time = format.parse((String) value.get(UPLOAD_TIME)).getTime(); - } catch (ParseException e) { - FineLoggerFactory.getLogger().error(e, e.getMessage()); - } - return time; + jsonObjects.sort((v1, v2) -> { + try { + long t1 = format.parse((String) v1.get(UPLOAD_TIME)).getTime(); + long t2 = format.parse((String) v2.get(UPLOAD_TIME)).getTime(); + return Long.compare(t2, t1); + } catch (ParseException e) { + FineLoggerFactory.getLogger().error(e, e.getMessage()); } - }).reversed()); + return 0; + }); } catch (Exception e) { FineLoggerFactory.getLogger().error(e, e.getMessage()); } From 4059c001cfe8fb3dee311669b1bd27aa8e57252b Mon Sep 17 00:00:00 2001 From: Yann Date: Tue, 28 Feb 2023 17:54:12 +0800 Subject: [PATCH 15/33] =?UTF-8?q?REPORT-86430=20AlphaFine=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E5=BF=83tab=E9=A1=B5=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manager/impl/PluginSearchManager.java | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java index fc39254cc8..27ff9e925e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java @@ -20,16 +20,15 @@ import com.fr.plugin.basic.version.Version; import com.fr.plugin.basic.version.VersionIntervalFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; +import com.fr.stable.ProductConstants; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Comparator; import java.util.List; import java.util.Map; -import java.util.function.Function; /** * Created by XiaXiang on 2017/3/27. @@ -44,7 +43,6 @@ public class PluginSearchManager implements AlphaFineSearchProvider { private static final String TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; private static final String UPLOAD_TIME = "uploadTime"; - private static final String CURRENT_VERSION = "v11"; private PluginSearchManager() { @@ -121,7 +119,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider { return lessModelList; } SearchResult noConnectList = AlphaFineHelper.getNoConnectList(Holder.INSTANCE); - if(noConnectList != null){ + if (noConnectList != null) { return noConnectList; } for (int j = 0; j < searchText.length; j++) { @@ -185,7 +183,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider { List pluginModels = new ArrayList<>(); pluginModels.addAll(parseDefaultPluginModel(plugins)); - pluginModels.forEach(m->this.defaultModelList.add(m)); + pluginModels.forEach(m -> this.defaultModelList.add(m)); } catch (Exception e) { FineLoggerFactory.getLogger().error("plugin search error :" + e.getMessage()); @@ -197,32 +195,23 @@ public class PluginSearchManager implements AlphaFineSearchProvider { /** * 将jsonobject转化为PluginModel - * 并按照更新时间排序,取最新的10个 - * */ + * 并按照更新时间排序,取最新的10个,并过滤掉不是当前版本的 + */ List parseDefaultPluginModel(List jsonObjects) { List pluginModels = new ArrayList<>(); if (!Collections.isEmpty(jsonObjects)) { - SimpleDateFormat format = new SimpleDateFormat(TIME_FORMAT); try { - jsonObjects.sort((v1, v2) -> { - try { - long t1 = format.parse((String) v1.get(UPLOAD_TIME)).getTime(); - long t2 = format.parse((String) v2.get(UPLOAD_TIME)).getTime(); - return Long.compare(t2, t1); - } catch (ParseException e) { - FineLoggerFactory.getLogger().error(e, e.getMessage()); - } - return 0; - }); + jsonObjects.sort(PluginSearchManager::sortPluginByUploadTime); } catch (Exception e) { FineLoggerFactory.getLogger().error(e, e.getMessage()); } int pluginModelsCount = 0; + String version = "v" + ProductConstants.MAIN_VERSION; for (Map obj : jsonObjects) { if (pluginModelsCount == DEFAULT_LIST_SIZE) { break; } - if (((Integer) obj.get(CURRENT_VERSION)) == 1) { + if (((Integer) obj.get(version)) == 1) { pluginModels.add(getPluginModel(new JSONObject(obj), false)); pluginModelsCount++; } @@ -231,4 +220,20 @@ public class PluginSearchManager implements AlphaFineSearchProvider { return pluginModels; } + private static int sortPluginByUploadTime(Map v1, Map v2) { + SimpleDateFormat format = new SimpleDateFormat(TIME_FORMAT); + long t1 = 0L, t2 = 0L; + try { + t1 = format.parse((String) v1.get(UPLOAD_TIME)).getTime(); + } catch (ParseException e) { + FineLoggerFactory.getLogger().error(e, e.getMessage()); + } + try { + t2 = format.parse((String) v2.get(UPLOAD_TIME)).getTime(); + } catch (ParseException e) { + FineLoggerFactory.getLogger().error(e, e.getMessage()); + } + return Long.compare(t2, t1); + } + } From f180e4f8f543af1b428e179ff021bbd3eff9d7fb Mon Sep 17 00:00:00 2001 From: Yann Date: Tue, 28 Feb 2023 17:55:24 +0800 Subject: [PATCH 16/33] =?UTF-8?q?REPORT-86430=20AlphaFine=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E5=BF=83tab=E9=A1=B5=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/search/manager/impl/PluginSearchManager.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java index 27ff9e925e..9bf229f627 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java @@ -200,11 +200,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider { List parseDefaultPluginModel(List jsonObjects) { List pluginModels = new ArrayList<>(); if (!Collections.isEmpty(jsonObjects)) { - try { - jsonObjects.sort(PluginSearchManager::sortPluginByUploadTime); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e, e.getMessage()); - } + jsonObjects.sort(PluginSearchManager::sortPluginByUploadTime); int pluginModelsCount = 0; String version = "v" + ProductConstants.MAIN_VERSION; for (Map obj : jsonObjects) { From cdc73e4ec006fb42b3c7b05a3597a69deaea2f0f Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Wed, 1 Mar 2023 00:33:31 +0800 Subject: [PATCH 17/33] =?UTF-8?q?REPORT-83259=20&=20REPORT-83263=20?= =?UTF-8?q?=E3=80=90=E6=9C=80=E5=BC=BA=E6=8E=A7=E4=BB=B6=E3=80=91=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E6=A0=B7=E5=BC=8F=E8=B7=9F=E9=9A=8F=E4=B8=BB=E9=A2=98?= =?UTF-8?q?&=E5=BC=80=E6=94=BE=E8=87=AA=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/fun/TemplateThemePaneProvider.java | 2 +- .../mainframe/theme/TemplateThemeBlock.java | 19 +++++ .../fun/WidgetAdvancedPaneProvider.java | 2 +- .../ui/designer/CheckBoxDefinePane.java | 83 +++++++++++++++++-- .../ui/designer/DateEditorDefinePane.java | 50 +++++++++-- .../designer/DirectWriteEditorDefinePane.java | 51 ++++++++++-- .../ui/designer/FieldEditorDefinePane.java | 37 +++------ .../ui/designer/NumberEditorDefinePane.java | 42 +++++++++- .../designer/TextFieldEditorDefinePane.java | 40 +++++++-- .../designer/btn/ButtonGroupDefinePane.java | 43 ++++++++-- .../com/fr/design/mainframe/JWorkBook.java | 4 +- 11 files changed, 307 insertions(+), 66 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/fun/TemplateThemePaneProvider.java b/designer-base/src/main/java/com/fr/design/fun/TemplateThemePaneProvider.java index f05d85318c..4c91a18a87 100644 --- a/designer-base/src/main/java/com/fr/design/fun/TemplateThemePaneProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/TemplateThemePaneProvider.java @@ -20,7 +20,7 @@ public interface TemplateThemePaneProvider extends Mutable { * 插入tab的位置 * * @param total 已插入的tab数 - * @return 插入位置,如果想放到最后,则返回-1 + * @return 插入位置 */ int getInsertPosition(int total); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java index ea649033ea..388430261f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java @@ -6,11 +6,18 @@ import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.settings.ThemeThumbnail; import com.fr.design.designer.IntervalConstants; import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.fun.TemplateThemePaneProvider; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.theme.dialog.TemplateThemeProfileDialog; +import com.fr.event.Event; +import com.fr.event.EventDispatcher; +import com.fr.event.Listener; import com.fr.general.IOUtils; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.injectable.PluginModule; +import com.fr.plugin.observer.PluginEventType; import com.fr.stable.Constants; import com.fr.stable.StringUtils; @@ -95,6 +102,18 @@ public class TemplateThemeBlock extends JPanel { repaint(); } }); + initPluginListener(); + } + + private void initPluginListener() { + EventDispatcher.listen(PluginEventType.BeforeStop, new Listener() { + @Override + public void on(Event event, PluginContext pluginContext) { + // 重置参数面板和控件主题样式 + theme.setParamContainerStyle(null); + theme.setWidgetStyle(null); + } + }, pluginContext -> pluginContext.contain(PluginModule.ExtraDesign, TemplateThemePaneProvider.XML_TAG)); } private void initializePane() { diff --git a/designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java b/designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java index eafa70b239..7ba5a3c8c6 100644 --- a/designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java +++ b/designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java @@ -21,7 +21,7 @@ public interface WidgetAdvancedPaneProvider extends Mutable { * 获取插入的位置 * * @param total 已插入的面板数 - * @return 插入位置,如果想放到最后,则返回-1 + * @return 插入位置 */ int getInsertPosition(int total); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java index 339ff9baa8..7768402914 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java @@ -1,8 +1,11 @@ package com.fr.design.widget.ui.designer; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.BasicBeanPane; import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; @@ -11,18 +14,28 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.ui.designer.component.FontSizeComboPane; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.form.ui.CheckBox; - +import com.fr.general.GeneralContext; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingConstants; import java.awt.Component; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; public class CheckBoxDefinePane extends AbstractDataModify { private UITextField text; private FontSizeComboPane fontSizePane; private FormWidgetValuePane formWidgetValuePane; protected UITextField labelNameTextField; + protected final List> extraPaneList = new ArrayList<>(); + protected JPanel extraPane; + + protected static double F = TableLayout.FILL; + protected static double P = TableLayout.PREFERRED; public CheckBoxDefinePane(XCreator xCreator) { super(xCreator); @@ -37,16 +50,15 @@ public class CheckBoxDefinePane extends AbstractDataModify { UILabel widgetValueLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Estate_Widget_Value")); widgetValueLabel.setVerticalAlignment(SwingConstants.TOP); formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; + initExtraPane(); Component[][] components = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text")), text }, new Component[]{widgetValueLabel, formWidgetValuePane }, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane}, + new Component[]{extraPane, null}, }; - double[] rowSize = {p, p, p, p, p, p}; - double[] columnSize = {p, f}; + double[] rowSize = {P, P, P, P, P, P}; + double[] columnSize = {P, F}; int[][] rowCount = {{1, 1},{1, 1}, {1, 3},{1, 1}}; JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); @@ -56,6 +68,59 @@ public class CheckBoxDefinePane extends AbstractDataModify { this.add(uiExpandablePane); } + + protected void initExtraPane() { + initPluginListener(); + refreshExtraAdvancedPane(); + } + + protected void refreshExtraAdvancedPane() { + extraPaneList.clear(); + boolean containsExtraPane = false; + Set> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG); + for (WidgetAdvancedPaneProvider provider : providers) { + if (!provider.accept(creator)) { + continue; + } + insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane()); + containsExtraPane = true; + } + if (containsExtraPane) { + extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane(); + for (BasicBeanPane pane : extraPaneList) { + extraPane.add(pane); + } + } else { + Component[][] components = new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane} + }; + double[] rowSize = {P}; + double[] columnSize = {P, F}; + int[][] rowCount = {{1, 1}}; + extraPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); + } + } + + protected void initPluginListener() { + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + @Override + public void on(PluginEvent event) { + refreshExtraAdvancedPane(); + } + }, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG)); + } + + /** + * 插入配置项面板 + * + * @param index 插入的位置 + * @param pane 配置项面板 + */ + protected void insertShortCut(int index, BasicBeanPane pane) { + int size = extraPaneList.size(); + index = Math.min(index, size); + extraPaneList.add(index, pane); + } @Override public String title4PopupWindow() { @@ -68,6 +133,9 @@ public class CheckBoxDefinePane extends AbstractDataModify { fontSizePane.setValue(check.getFontSize()); formWidgetValuePane.populate(check); labelNameTextField.setText(check.getLabelName()); + for (BasicBeanPane pane : extraPaneList) { + pane.populateBean(check); + } } @Override @@ -77,6 +145,9 @@ public class CheckBoxDefinePane extends AbstractDataModify { box.setFontSize(fontSizePane.getValue()); formWidgetValuePane.update(box); box.setLabelName(labelNameTextField.getText()); + for (BasicBeanPane pane : extraPaneList) { + pane.updateBean(box); + } return box; } } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/DateEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/DateEditorDefinePane.java index 2d459bd1b4..7df1e90909 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/DateEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/DateEditorDefinePane.java @@ -2,15 +2,17 @@ package com.fr.design.widget.ui.designer; import com.fr.base.FRContext; import com.fr.data.core.FormatField; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.BasicBeanPane; import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.UIConstants; import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; +import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.component.DateValuePane; import com.fr.design.widget.component.UIComboBoxNoArrow; @@ -18,18 +20,23 @@ import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.design.widget.ui.designer.date.DateFormatCheckManager; import com.fr.design.widget.ui.designer.date.DateFormatCheckResult; import com.fr.form.ui.DateEditor; - import com.fr.stable.ArrayUtils; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.Set; public class DateEditorDefinePane extends DirectWriteEditorDefinePane { private UIButtonGroup returnTypeComboBox; @@ -68,8 +75,7 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG); + for (WidgetAdvancedPaneProvider provider : providers) { + if (!provider.accept(creator)) { + continue; + } + insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane()); + containsExtraPane = true; + } + if (containsExtraPane) { + extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane(); + for (BasicBeanPane pane : extraPaneList) { + extraPane.add(pane); + } + } else { + Component[][] components = new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane}, + }; + double[] rowSize = {P}; + double[] columnSize = {P, F}; + int[][] rowCount = {{1, 1}}; + extraPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); + } + } private JPanel createFormatPane(UIComboBox formatComboBox, UILabel sampleLabel){ JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/DirectWriteEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/DirectWriteEditorDefinePane.java index 46688b64d0..53c38b6421 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/DirectWriteEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/DirectWriteEditorDefinePane.java @@ -1,19 +1,26 @@ package com.fr.design.widget.ui.designer; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.BasicBeanPane; import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; +import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.form.ui.DirectWriteEditor; - -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.FlowLayout; +import java.util.Set; //richer:需要提供能否直接编辑的控件设置面板——下拉框、复选框、时间、日期、下拉树 public abstract class DirectWriteEditorDefinePane extends FieldEditorDefinePane { @@ -34,18 +41,17 @@ public abstract class DirectWriteEditorDefinePane e Component[] removeRepeatPane = new Component[]{createRepeatCheckBox(), null}; Component[] dicPane = createDictPane(); Component[] waterMarkComponent = createWaterMarkPane(); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; + initExtraPane(); Component[][] components = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, new Component[]{widgetValueLabel, formWidgetValuePane }, dicPane, removeRepeatPane, waterMarkComponent, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane} + new Component[]{extraPane, null} }; - double[] rowSize = {p, p, p, p, p, p, p, p}; - double[] columnSize = {p, f}; + double[] rowSize = {P, P, P, P, P, P, P, P}; + double[] columnSize = {P, F}; int[][] rowCount = {{1, 1},{1, 3},{1, 1},{1, 1},{1,1},{1,1}}; JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); // panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); @@ -58,6 +64,33 @@ public abstract class DirectWriteEditorDefinePane e return advancePane; } + protected void refreshExtraAdvancedPane() { + extraPaneList.clear(); + boolean containsExtraPane = false; + Set> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG); + for (WidgetAdvancedPaneProvider provider : providers) { + if (!provider.accept(creator)) { + continue; + } + insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane()); + containsExtraPane = true; + } + if (containsExtraPane) { + extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane(); + for (BasicBeanPane pane : extraPaneList) { + extraPane.add(pane); + } + } else { + Component[][] components = new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane} + }; + double[] rowSize = {P}; + double[] columnSize = {P, F}; + int[][] rowCount = {{1, 1}}; + extraPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); + } + } + public UICheckBox createRepeatCheckBox(){ return null; } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java index 1777a027ba..65aeec3a75 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java @@ -18,6 +18,7 @@ import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.ui.designer.component.FontSizeComboPane; import com.fr.form.ui.FieldEditor; @@ -34,7 +35,6 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.List; -import java.util.Set; public abstract class FieldEditorDefinePane extends AbstractDataModify { protected UICheckBox allowBlankCheckBox; @@ -43,8 +43,11 @@ public abstract class FieldEditorDefinePane extends Abstr protected JPanel validatePane; protected FontSizeComboPane fontSizePane; protected UITextField labelNameTextField; - private final List> extraPaneList = new ArrayList<>(); - private JPanel extraPane; + protected final List> extraPaneList = new ArrayList<>(); + protected JPanel extraPane; + + protected static double F = TableLayout.FILL; + protected static double P = TableLayout.PREFERRED; public FieldEditorDefinePane(XCreator xCreator) { super(xCreator); @@ -58,11 +61,8 @@ public abstract class FieldEditorDefinePane extends Abstr allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); fontSizePane = new FontSizeComboPane(); JPanel contentPane = this.setFirstContentPane(); - JPanel jPanel = FRGUIPaneFactory.createYBoxEmptyBorderPane(); - jPanel.add(contentPane); - extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane(); - jPanel.add(extraPane); - this.initExtraPane(); + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + jPanel.add(contentPane, BorderLayout.CENTER); contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); if (contentPane != null) { UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, jPanel); @@ -71,24 +71,13 @@ public abstract class FieldEditorDefinePane extends Abstr this.addValidatePane(); } - private void initExtraPane() { + protected void initExtraPane() { initPluginListener(); refreshExtraAdvancedPane(); } - private void refreshExtraAdvancedPane() { - extraPaneList.clear(); - extraPane.removeAll(); - Set> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG); - for (WidgetAdvancedPaneProvider provider : providers) { - if (!provider.accept(creator)) { - continue; - } - insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane()); - } - for (BasicBeanPane pane : extraPaneList) { - extraPane.add(pane); - } + protected void refreshExtraAdvancedPane() { + // do nothing } @Override @@ -196,13 +185,13 @@ public abstract class FieldEditorDefinePane extends Abstr * @param index 插入的位置 * @param pane 配置项面板 */ - private void insertShortCut(int index, BasicBeanPane pane) { + protected void insertShortCut(int index, BasicBeanPane pane) { int size = extraPaneList.size(); index = Math.min(index, size); extraPaneList.add(index, pane); } - private void initPluginListener() { + protected void initPluginListener() { GeneralContext.listenPluginRunningChanged(new PluginEventListener() { @Override public void on(PluginEvent event) { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/NumberEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/NumberEditorDefinePane.java index b1a2985194..95709c83cf 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/NumberEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/NumberEditorDefinePane.java @@ -1,7 +1,10 @@ package com.fr.design.widget.ui.designer; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.BasicBeanPane; import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; +import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.layout.FRGUIPaneFactory; @@ -11,9 +14,12 @@ import com.fr.design.widget.component.NumberEditorValidatePane; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.form.ui.NumberEditor; - -import javax.swing.*; -import java.awt.*; +import javax.swing.JComponent; +import javax.swing.JFormattedTextField; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.Component; +import java.util.Set; public class NumberEditorDefinePane extends FieldEditorDefinePane { public NumberEditorDefinePane(XCreator xCreator){ @@ -43,11 +49,12 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; + initExtraPane(); Component[][] components = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, new Component[]{widgetValueLabel, formWidgetValuePane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark")), waterMarkDictPane}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane} + new Component[]{extraPane, null} }; double[] rowSize = {p, p, p, p, p, p}; double[] columnSize = {p,f}; @@ -58,6 +65,33 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane return boundsPane; } + protected void refreshExtraAdvancedPane() { + extraPaneList.clear(); + boolean containsExtraPane = false; + Set> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG); + for (WidgetAdvancedPaneProvider provider : providers) { + if (!provider.accept(creator)) { + continue; + } + insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane()); + containsExtraPane = true; + } + if (containsExtraPane) { + extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane(); + for (BasicBeanPane pane : extraPaneList) { + extraPane.add(pane); + } + } else { + Component[][] components = new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane} + }; + double[] rowSize = {P}; + double[] columnSize = {P, F}; + int[][] rowCount = {{1, 1}}; + extraPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); + } + } + public JPanel setValidatePane() { numberEditorValidatePane = new NumberEditorValidatePane(); return numberEditorValidatePane; diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java index 6e6a2ff145..4dbc675f58 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java @@ -1,15 +1,16 @@ package com.fr.design.widget.ui.designer; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.BasicBeanPane; import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.fun.RegPaneProvider; +import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.frpane.RegFieldPane; import com.fr.design.gui.frpane.RegPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.form.ui.TextEditor; @@ -21,6 +22,7 @@ import javax.swing.SwingConstants; import java.awt.Component; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; +import java.util.Set; public class TextFieldEditorDefinePane extends FieldEditorDefinePane { protected RegFieldPane regPane; @@ -63,18 +65,17 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane }); formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; UILabel widgetValueLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Estate_Widget_Value"), SwingConstants.LEFT); widgetValueLabel.setVerticalAlignment(SwingConstants.TOP); + initExtraPane(); Component[][] components = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, new Component[]{widgetValueLabel, formWidgetValuePane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark"), SwingConstants.LEFT), waterMarkDictPane}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size"), SwingConstants.LEFT), fontSizePane} + new Component[]{extraPane, null} }; - double[] rowSize = {p, p, p, p, p, p}; - double[] columnSize = {p, f}; + double[] rowSize = {P, P, P, P, P}; + double[] columnSize = {P, F}; int[][] rowCount = {{1, 1}, {1, 3}, {1, 1}, {1, 1}}; final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); @@ -82,6 +83,33 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane return boundsPane; } + protected void refreshExtraAdvancedPane() { + extraPaneList.clear(); + boolean containsExtraPane = false; + Set> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG); + for (WidgetAdvancedPaneProvider provider : providers) { + if (!provider.accept(creator)) { + continue; + } + insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane()); + containsExtraPane = true; + } + if (containsExtraPane) { + extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane(); + for (BasicBeanPane pane : extraPaneList) { + extraPane.add(pane); + } + } else { + Component[][] components = new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size"), SwingConstants.LEFT), fontSizePane} + }; + double[] rowSize = {P}; + double[] columnSize = {P, F}; + int[][] rowCount = {{1, 1}}; + extraPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); + } + } + public JPanel setValidatePane() { return regPane; } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/btn/ButtonGroupDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/btn/ButtonGroupDefinePane.java index 7cc20dce7c..3176e198a8 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/btn/ButtonGroupDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/btn/ButtonGroupDefinePane.java @@ -1,8 +1,11 @@ package com.fr.design.widget.ui.designer.btn; import com.fr.data.Dictionary; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.BasicBeanPane; import com.fr.design.designer.IntervalConstants; -import com.fr.design.designer.creator.*; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; @@ -13,9 +16,11 @@ import com.fr.design.widget.ui.designer.FieldEditorDefinePane; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.form.ui.ButtonGroup; - -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Component; +import java.util.Set; /** * Created by ibm on 2017/8/5. @@ -40,11 +45,12 @@ public abstract class ButtonGroupDefinePane extends Field formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; + initExtraPane(); Component[][] components = new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, new Component[]{widgetValueLabel, formWidgetValuePane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_DS_Dictionary")), dictionaryEditor}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane}, + new Component[]{extraPane, null}, new Component[]{buttonGroupDictPane, null} }; double[] rowSize = {p, p, p, p, p, p, p}; @@ -60,6 +66,33 @@ public abstract class ButtonGroupDefinePane extends Field return advancePane; } + protected void refreshExtraAdvancedPane() { + extraPaneList.clear(); + boolean containsExtraPane = false; + Set> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG); + for (WidgetAdvancedPaneProvider provider : providers) { + if (!provider.accept(creator)) { + continue; + } + insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane()); + containsExtraPane = true; + } + if (containsExtraPane) { + extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane(); + for (BasicBeanPane pane : extraPaneList) { + extraPane.add(pane); + } + } else { + Component[][] components = new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane} + }; + double[] rowSize = {P}; + double[] columnSize = {P, F}; + int[][] rowCount = {{1, 1}}; + extraPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); + } + } + public JPanel createOtherPane() { return null; } 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 d4fa7ed5cf..5c316ef72b 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 @@ -1311,7 +1311,9 @@ public class JWorkBook extends JTemplate { boolean shouldCreateUndoState = compatible == TemplateThemeCompatible.NONE && !StringUtils.equals(oldTheme.getName(), newTheme.getName()); getTarget().setTemplateTheme(newTheme, compatible); - getTarget().getReportParameterAttr().onTemplateUsingThemeChange(newTheme, compatible); + if (getTarget().getReportParameterAttr() != null) { + getTarget().getReportParameterAttr().onTemplateUsingThemeChange(newTheme, compatible); + } setTarget((WorkBook) FineColorSynchronizer.flush(getTarget(), newTheme, compatible)); if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) { From 7ea3ff94ec6f73f7ac9f05c1aaf5b9d44c908934 Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Wed, 1 Mar 2023 00:35:44 +0800 Subject: [PATCH 18/33] =?UTF-8?q?REPORT-83259=20&=20REPORT-83263=20?= =?UTF-8?q?=E3=80=90=E6=9C=80=E5=BC=BA=E6=8E=A7=E4=BB=B6=E3=80=91=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E6=A0=B7=E5=BC=8F=E8=B7=9F=E9=9A=8F=E4=B8=BB=E9=A2=98?= =?UTF-8?q?&=E5=BC=80=E6=94=BE=E8=87=AA=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/theme/TemplateThemeBlock.java | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java index 388430261f..ea649033ea 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java @@ -6,18 +6,11 @@ import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.settings.ThemeThumbnail; import com.fr.design.designer.IntervalConstants; import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.fun.TemplateThemePaneProvider; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.theme.dialog.TemplateThemeProfileDialog; -import com.fr.event.Event; -import com.fr.event.EventDispatcher; -import com.fr.event.Listener; import com.fr.general.IOUtils; -import com.fr.plugin.context.PluginContext; -import com.fr.plugin.injectable.PluginModule; -import com.fr.plugin.observer.PluginEventType; import com.fr.stable.Constants; import com.fr.stable.StringUtils; @@ -102,18 +95,6 @@ public class TemplateThemeBlock extends JPanel { repaint(); } }); - initPluginListener(); - } - - private void initPluginListener() { - EventDispatcher.listen(PluginEventType.BeforeStop, new Listener() { - @Override - public void on(Event event, PluginContext pluginContext) { - // 重置参数面板和控件主题样式 - theme.setParamContainerStyle(null); - theme.setWidgetStyle(null); - } - }, pluginContext -> pluginContext.contain(PluginModule.ExtraDesign, TemplateThemePaneProvider.XML_TAG)); } private void initializePane() { From b3e723952d6b03dfd5e47f829f84ba8575784908 Mon Sep 17 00:00:00 2001 From: Yann Date: Wed, 1 Mar 2023 10:02:00 +0800 Subject: [PATCH 19/33] =?UTF-8?q?REPORT-86430=20AlphaFine=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E5=BF=83tab=E9=A1=B5=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manager/impl/PluginSearchManager.java | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java index 9bf229f627..ec5fedbf25 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java @@ -29,6 +29,7 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * Created by XiaXiang on 2017/3/27. @@ -199,18 +200,15 @@ public class PluginSearchManager implements AlphaFineSearchProvider { */ List parseDefaultPluginModel(List jsonObjects) { List pluginModels = new ArrayList<>(); + String version = "v" + ProductConstants.MAIN_VERSION; if (!Collections.isEmpty(jsonObjects)) { - jsonObjects.sort(PluginSearchManager::sortPluginByUploadTime); - int pluginModelsCount = 0; - String version = "v" + ProductConstants.MAIN_VERSION; - for (Map obj : jsonObjects) { - if (pluginModelsCount == DEFAULT_LIST_SIZE) { - break; - } - if (((Integer) obj.get(version)) == 1) { - pluginModels.add(getPluginModel(new JSONObject(obj), false)); - pluginModelsCount++; - } + jsonObjects = jsonObjects.stream() + .filter(o -> ((Integer) o.get(version)) == 1) + .sorted(PluginSearchManager::sortPluginByUploadTime) + .collect(Collectors.toList()); + int size = Math.min(DEFAULT_LIST_SIZE, jsonObjects.size()); + for (int i = 0; i < size; i++) { + pluginModels.add(getPluginModel(new JSONObject(jsonObjects.get(i)), false)); } } return pluginModels; From 61bfedc1dcf56e56eea9f63087da08430cab23d7 Mon Sep 17 00:00:00 2001 From: Yann Date: Wed, 1 Mar 2023 10:19:59 +0800 Subject: [PATCH 20/33] =?UTF-8?q?REPORT-86430=20AlphaFine=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E5=BF=83tab=E9=A1=B5=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manager/impl/PluginSearchManager.java | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java index ec5fedbf25..542c3dc05b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java @@ -27,6 +27,7 @@ import java.net.URLEncoder; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -204,30 +205,25 @@ public class PluginSearchManager implements AlphaFineSearchProvider { if (!Collections.isEmpty(jsonObjects)) { jsonObjects = jsonObjects.stream() .filter(o -> ((Integer) o.get(version)) == 1) - .sorted(PluginSearchManager::sortPluginByUploadTime) + .sorted(Comparator.comparingLong(PluginSearchManager::parseTime).reversed()) + .limit(DEFAULT_LIST_SIZE) .collect(Collectors.toList()); - int size = Math.min(DEFAULT_LIST_SIZE, jsonObjects.size()); - for (int i = 0; i < size; i++) { - pluginModels.add(getPluginModel(new JSONObject(jsonObjects.get(i)), false)); + for (Map jsonObject : jsonObjects) { + pluginModels.add(getPluginModel(new JSONObject(jsonObject), false)); } } return pluginModels; } - private static int sortPluginByUploadTime(Map v1, Map v2) { + private static long parseTime(Map value) { SimpleDateFormat format = new SimpleDateFormat(TIME_FORMAT); - long t1 = 0L, t2 = 0L; + long t = 0L; try { - t1 = format.parse((String) v1.get(UPLOAD_TIME)).getTime(); + t = format.parse((String) value.get(UPLOAD_TIME)).getTime(); } catch (ParseException e) { FineLoggerFactory.getLogger().error(e, e.getMessage()); } - try { - t2 = format.parse((String) v2.get(UPLOAD_TIME)).getTime(); - } catch (ParseException e) { - FineLoggerFactory.getLogger().error(e, e.getMessage()); - } - return Long.compare(t2, t1); + return t; } } From 5d9446e34182f768ae82788bc5fa22472ca54fc8 Mon Sep 17 00:00:00 2001 From: Yann Date: Wed, 1 Mar 2023 11:00:55 +0800 Subject: [PATCH 21/33] =?UTF-8?q?REPORT-86430=20AlphaFine=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E5=BF=83tab=E9=A1=B5=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search/manager/impl/PluginSearchManager.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java index 542c3dc05b..1cbc909d6c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java @@ -203,14 +203,12 @@ public class PluginSearchManager implements AlphaFineSearchProvider { List pluginModels = new ArrayList<>(); String version = "v" + ProductConstants.MAIN_VERSION; if (!Collections.isEmpty(jsonObjects)) { - jsonObjects = jsonObjects.stream() + pluginModels = jsonObjects.stream() .filter(o -> ((Integer) o.get(version)) == 1) - .sorted(Comparator.comparingLong(PluginSearchManager::parseTime).reversed()) + .sorted((Map map1, Map map2) -> Long.compare(parseTime(map2), parseTime(map1))) .limit(DEFAULT_LIST_SIZE) + .map(jsonObject -> getPluginModel(new JSONObject(jsonObject), false)) .collect(Collectors.toList()); - for (Map jsonObject : jsonObjects) { - pluginModels.add(getPluginModel(new JSONObject(jsonObject), false)); - } } return pluginModels; } From aeff582dcac4bbc8d9950a92fd9e33d61463d080 Mon Sep 17 00:00:00 2001 From: "Leo.Qin" Date: Thu, 2 Mar 2023 11:13:26 +0800 Subject: [PATCH 22/33] =?UTF-8?q?REPORT-90598=20=E9=A6=96=E6=AC=A1?= =?UTF-8?q?=E9=87=8D=E5=90=AF=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=96=B0=E5=BB=BA?= =?UTF-8?q?sql=20server=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E9=A6=96?= =?UTF-8?q?=E6=AC=A1=E4=BF=9D=E5=AD=98=E6=8A=A5=E9=94=99=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E9=99=90=E5=88=B6=20=E3=80=90=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=8E=9F=E5=9B=A0=E3=80=91=E9=A6=96=E6=AC=A1=E8=8E=B7=E5=8F=96?= =?UTF-8?q?lic=E4=B8=AD=E6=94=AF=E6=8C=81=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E7=B1=BB=E5=9E=8B=E6=97=B6=EF=BC=8C=E6=9E=9A=E4=B8=BE?= =?UTF-8?q?=E7=B1=BB=E6=9C=AA=E5=88=9D=E5=A7=8B=E5=8C=96=EF=BC=8C=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E8=8E=B7=E5=8F=96=E4=B8=BA=E7=A9=BA=20=E3=80=90?= =?UTF-8?q?=E6=94=B9=E5=8A=A8=E6=80=9D=E8=B7=AF=E3=80=91=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/datapane/connect/ConnectionListPane.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index f836757399..87b1c404f3 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -21,8 +21,8 @@ import com.fr.event.EventDispatcher; import com.fr.file.ConnectionConfig; import com.fr.file.ConnectionOperator; import com.fr.general.NameObject; -import com.fr.license.database.BaseDataBaseTypePoint; import com.fr.license.database.DBTypes; +import com.fr.license.database.DataBaseTypePointManager; import com.fr.license.exception.DataBaseNotSupportedException; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; @@ -279,8 +279,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh Connection connection = bean.getConnection(); // 仅校验jdbc连接,其他插件数据连接不进行校验 if (connection instanceof JDBCDatabaseConnection) { - BaseDataBaseTypePoint dataBaseTypePoint = BaseDataBaseTypePoint.getDataBaseTypePoint(connection.getDriver(), connection.feature()); - + DBTypes dataBaseTypePoint = DataBaseTypePointManager.getInstance().getDataBaseTypePoint(connection.getDriver(), connection.feature()); if (connectionIsNotSupported(connection, dataBaseTypePoint)) { notSupportedConnections.addAll(dataBaseTypePoint.getDataBaseType()); } @@ -296,9 +295,9 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh /** * 校验当前数据连接是否被限制 */ - private static boolean connectionIsNotSupported(Connection connection, BaseDataBaseTypePoint dataBaseTypePoint) { + private static boolean connectionIsNotSupported(Connection connection, DBTypes dataBaseTypePoint) { return !validateFRDemo(connection.getDriver(), connection.feature()) && - (dataBaseTypePoint != null && !supportedDatabaseTypes.containsAll(dataBaseTypePoint.getDatabaseType())); + (dataBaseTypePoint != null && !supportedDatabaseTypes.containsAll(dataBaseTypePoint.getDataBaseType())); } /** From 611e056f9a742fd0988a08656a2795f8bfbbec62 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Thu, 2 Mar 2023 16:22:34 +0800 Subject: [PATCH 23/33] =?UTF-8?q?REPORT-87567=20=E6=8B=96=E5=8A=A8?= =?UTF-8?q?=E4=B8=80=E5=BC=A0=E6=A8=A1=E6=9D=BF=E8=BF=9B=E5=85=A5=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=EF=BC=8C=E9=BC=A0=E6=A0=87=E5=8F=B3=E9=94=AE?= =?UTF-8?q?=E6=89=BE=E5=88=B0=E5=B7=A6=E4=BE=A7=E6=A8=A1=E6=9D=BF=E6=A0=91?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E4=BD=8D=E7=BD=AE=EF=BC=8C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=8F=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/file/MultiTemplateTabPane.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 646f0e517a..b506dd81c3 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 @@ -24,6 +24,7 @@ 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; @@ -282,7 +283,8 @@ public class MultiTemplateTabPane extends JComponent { private void locateTemplate(JTemplate template) { FILE currentTemplate = template.getEditingFILE(); //模板不属于当前环境,跟预览一样先提示保存,再定位模板 - if (!currentTemplate.exists()) { + //如果是拖拽进来的模板单单用exist不能判断,这边参考预览的判断逻辑(browserTemplate),补充一下 + if (!currentTemplate.exists() || !(currentTemplate instanceof FileNodeFILE)) { int selVal = showConfirmDialog( DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"), From 62e117dc9de526b06ae6dfc713b239bebe2d619f Mon Sep 17 00:00:00 2001 From: "Leo.Qin" Date: Fri, 3 Mar 2023 11:16:07 +0800 Subject: [PATCH 24/33] =?UTF-8?q?REPORT-67195=20FR11=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8-=E5=8D=95=E5=85=83=E6=A0=BC=E8=B6=85?= =?UTF-8?q?=E9=93=BE=E6=98=BE=E7=A4=BA=E2=80=9C=E5=BD=93=E5=89=8D=E5=86=B3?= =?UTF-8?q?=E7=AD=96=E6=8A=A5=E8=A1=A8=E5=AF=B9=E8=B1=A1=E2=80=9D=E4=BD=86?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=E2=80=9C=E5=9B=BE=E8=A1=A8=E8=B6=85?= =?UTF-8?q?=E9=93=BE-=E8=81=94=E5=8A=A8=E6=82=AC=E6=B5=AE=E5=85=83?= =?UTF-8?q?=E7=B4=A0=E2=80=9D=EF=BC=8C=E5=AE=89=E8=A3=85=E4=B8=AA=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E4=B8=8B=E8=BD=BD=E6=96=87=E4=BB=B6=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E8=B6=85=E9=93=BE=E6=98=BE=E7=A4=BA=E2=80=9C?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E8=B6=85=E9=93=BE-=E8=81=94=E5=8A=A8?= =?UTF-8?q?=E6=82=AC=E6=B5=AE=E5=85=83=E7=B4=A0=E2=80=9D=E4=BD=86=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E2=80=9C=E5=BD=93=E5=89=8D=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=AF=B9=E8=B1=A1=E2=80=9D=E4=BA=86=20?= =?UTF-8?q?=E3=80=90=E9=97=AE=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91=E6=AD=A4?= =?UTF-8?q?=E5=89=8D=E4=B8=8D=E5=90=8C=E9=9D=A2=E6=9D=BF=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E6=98=AF=E5=90=8C=E4=B8=80=E4=B8=AA=E8=B6=85=E9=93=BE?= =?UTF-8?q?filter=EF=BC=8C=E5=AF=BC=E8=87=B4=E8=8B=A5=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E6=89=93=E5=BC=80=E4=BA=86cpt=E3=80=81frm=E6=A8=A1=E7=89=88?= =?UTF-8?q?=EF=BC=8C=E5=86=8D=E5=AE=89=E8=A3=85=E4=BD=BF=E7=94=A8=E4=BA=86?= =?UTF-8?q?HyperlinkProvider=E6=8E=A5=E5=8F=A3=E7=9A=84=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E5=88=B7=E6=96=B0=E8=B6=85=E9=93=BE=E9=80=89=E9=A1=B9?= =?UTF-8?q?=EF=BC=8C=E6=89=80=E6=9C=89=E6=A8=A1=E7=89=88=E7=9A=84=E8=B6=85?= =?UTF-8?q?=E9=93=BE=E9=80=89=E9=A1=B9=E5=B0=86=E5=8F=98=E5=BE=97=E5=AE=8C?= =?UTF-8?q?=E5=85=A8=E7=9B=B8=E5=90=8C=20=E3=80=90=E6=94=B9=E5=8A=A8?= =?UTF-8?q?=E6=80=9D=E8=B7=AF=E3=80=91=E4=B8=BA=E4=B8=8D=E7=94=A8=E8=B6=85?= =?UTF-8?q?=E9=93=BE=E9=9D=A2=E6=9D=BF=E8=AE=BE=E7=BD=AE=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E7=9A=84filter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/controlpane/JControlPane.java | 24 ++++++++++++++-- .../shortcutfactory/ShortCutFactory.java | 4 --- .../component/VanChartHyperLinkPane.java | 25 ++++++++++++++++- .../gui/xpane/FormHyperlinkGroupPane.java | 13 ++++++++- .../mainframe/ReportHyperlinkGroupPane.java | 28 +++++++++---------- 5 files changed, 71 insertions(+), 23 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java index 0d01ddbdaa..37fef509db 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java @@ -9,10 +9,16 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.menu.ToolBarDef; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.ArrayUtils; +import com.fr.stable.Filter; import com.fr.stable.Nameable; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JSplitPane; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.util.Arrays; +import java.util.stream.Stream; /** * Coder: zack @@ -27,6 +33,8 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S ShortCut4JControlPane[] shorts; NameableCreator[] creators; + + protected Filter creatorsFilter; private ToolBarDef toolbarDef; UIToolbar toolBar; @@ -38,6 +46,7 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S JControlPane() { this.initShortCutFactory(); + this.initCreatorsFilter(); this.initComponentPane(); } @@ -106,6 +115,10 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S this.checkButtonEnabled(); } + protected void initCreatorsFilter() { + this.creatorsFilter = nameableCreator -> true; + } + protected void initCardPane() { this.controlUpdatePane = createControlUpdatePane(); @@ -183,7 +196,12 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S } public NameableCreator[] creators() { - return creators == null ? new NameableCreator[0] : creators; + if (creators == null) { + return new NameableCreator[0]; + } else { + Stream nameableCreatorStream = Arrays.stream(creators).filter(creator -> creatorsFilter.accept(creator)); + return nameableCreatorStream.toArray(NameableCreator[]::new); + } } /** diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/ShortCutFactory.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/ShortCutFactory.java index 7d16995435..da0b552682 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/ShortCutFactory.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/ShortCutFactory.java @@ -142,10 +142,6 @@ public class ShortCutFactory extends AbstractShortCutFactory { private void wrapActionListener(NameableCreator[] creators) { for (final NameableCreator creator : creators) { - Filter> filter = DesignModuleFactory.getHyperlinkGroupType().getFilter(); - if (!filter.accept(creator.getHyperlink())) { - continue; - } boolean isTrue = ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Datasource-Stored_Procedure")) || ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Relation_TableData")) || ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Multi_Dimensional_Database")); if (isTrue) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java index 7b74d1576a..6029b72fc1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java @@ -14,6 +14,7 @@ import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateCellLinkP import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateFloatLinkPane; import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane; import com.fr.design.designer.TargetComponent; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fun.HyperlinkProvider; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; @@ -22,7 +23,10 @@ import com.fr.design.hyperlink.ReportletHyperlinkPane; import com.fr.design.hyperlink.WebHyperlinkPane; import com.fr.design.javascript.JavaScriptImplPane; import com.fr.design.javascript.ParameterJavaScriptPane; +import com.fr.design.mainframe.BaseJForm; +import com.fr.design.mainframe.JTemplate; import com.fr.design.module.DesignModuleFactory; +import com.fr.general.ComparatorUtils; import com.fr.general.NameObject; import com.fr.js.EmailJavaScript; import com.fr.js.FormHyperlinkProvider; @@ -297,5 +301,24 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane { } } - + @Override + protected void initCreatorsFilter() { + this.creatorsFilter = nameableCreator -> { + Class clazz = nameableCreator.getHyperlink(); + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (template == null) { + return false; + } + Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class}; + for (Class aClass : classes) { + if (template.getEditingReportIndex() == BaseJForm.FORM_TAB) { + // 编辑的是决策报表中的图表,那么没有ChartHyperRelateFloatLink 和 ChartHyperRelateCellLink 选项,有FormHyperlink 选项 + if (ComparatorUtils.equals(aClass, clazz)) { + return false; + } + } + } + return true; + }; + } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java index 7afb15828e..4c3b769a38 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java @@ -1,13 +1,14 @@ package com.fr.design.gui.xpane; +import com.fr.chart.web.ChartHyperRelateFloatLink; import com.fr.design.form.javascript.FormEmailPane; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.general.ComparatorUtils; - import com.fr.js.EmailJavaScript; +import com.fr.js.JavaScript; public class FormHyperlinkGroupPane extends HyperlinkGroupPane { private static FormHyperlinkGroupPane singleton; @@ -23,6 +24,16 @@ public class FormHyperlinkGroupPane extends HyperlinkGroupPane { return singleton; } + @Override + protected void initCreatorsFilter() { + this.creatorsFilter = nameableCreator -> { + Class clazz = nameableCreator.getHyperlink(); + // 决策报表没有 ChartHyperRelateFloatLink + return !ComparatorUtils.equals(clazz, ChartHyperRelateFloatLink.class); + }; + } + + /** * 生成添加按钮的NameableCreator * 由于表单报表块的单元格超链和单元格条件属性超链中的emailPane都要用表单的emailPane,这里调整下 diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ReportHyperlinkGroupPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ReportHyperlinkGroupPane.java index 20886536ae..b190884a13 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ReportHyperlinkGroupPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ReportHyperlinkGroupPane.java @@ -1,21 +1,11 @@ package com.fr.design.mainframe; -import com.fr.base.Style; -import com.fr.design.actions.utils.ReportActionUtils; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; -import com.fr.general.FRFont; -import com.fr.grid.selection.CellSelection; -import com.fr.grid.selection.FloatSelection; -import com.fr.grid.selection.Selection; -import com.fr.js.NameJavaScriptGroup; -import com.fr.report.cell.CellElement; -import com.fr.report.cell.FloatElement; -import com.fr.report.elementcase.TemplateElementCase; -import com.fr.stable.Constants; - -import java.awt.*; +import com.fr.general.ComparatorUtils; +import com.fr.js.FormHyperlinkProvider; +import com.fr.stable.bridge.StableFactory; /** * Created by plough on 2017/7/21. @@ -37,10 +27,20 @@ public class ReportHyperlinkGroupPane extends HyperlinkGroupPane { } protected void refreshPane() { - ElementCasePane reportPane = ((JWorkBook)HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()).getEditingElementCasePane(); + ElementCasePane reportPane = ((JWorkBook) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()).getEditingElementCasePane(); if (reportPane == null) { return; } populate(reportPane); } + + + @Override + protected void initCreatorsFilter() { + this.creatorsFilter = nameableCreator -> { + // 如果是普通报表单元格,那么没有 FormHyperlink 选项 + FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); + return !ComparatorUtils.equals(nameableCreator.getHyperlink(), formHyperlink.getClass()); + }; + } } From 1acfa589e729250f17dca4a106231669bfadb0d4 Mon Sep 17 00:00:00 2001 From: "Leo.Qin" Date: Fri, 3 Mar 2023 13:56:38 +0800 Subject: [PATCH 25/33] =?UTF-8?q?REPORT-67195=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=A8=A1=E7=89=88=E5=88=A4=E6=96=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/van/chart/custom/component/VanChartHyperLinkPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java index 6029b72fc1..79303cee29 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java @@ -306,7 +306,7 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane { this.creatorsFilter = nameableCreator -> { Class clazz = nameableCreator.getHyperlink(); JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (template == null) { + if (JTemplate.isValid(template)) { return false; } Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class}; From 3c202e1338eebae72468ea88f2c5fd84919e9aed Mon Sep 17 00:00:00 2001 From: "Leo.Qin" Date: Fri, 3 Mar 2023 15:23:19 +0800 Subject: [PATCH 26/33] =?UTF-8?q?REPORT-67195=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/van/chart/custom/component/VanChartHyperLinkPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java index 79303cee29..75ec5d3ce2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java @@ -306,7 +306,7 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane { this.creatorsFilter = nameableCreator -> { Class clazz = nameableCreator.getHyperlink(); JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (JTemplate.isValid(template)) { + if (!JTemplate.isValid(template)) { return false; } Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class}; From 51d7274b56230d1d5253f9a4e4f1bd7105a2a3cf Mon Sep 17 00:00:00 2001 From: Maximus <49313791+num73@users.noreply.github.com> Date: Fri, 3 Mar 2023 16:02:47 +0800 Subject: [PATCH 27/33] =?UTF-8?q?REPORT-90800=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=A9=B1=E5=8A=A8=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/data/datapane/connect/DatabaseConnectionPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index a0b651acbd..0a00f37041 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -537,7 +537,7 @@ public abstract class DatabaseConnectionPane Date: Tue, 7 Mar 2023 10:27:44 +0800 Subject: [PATCH 28/33] =?UTF-8?q?REPORT-88335=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E6=9F=A5=E6=89=BE=E6=9B=BF=E6=8D=A2=E9=9D=A2=E6=9D=BF=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/replace/ui/ITReplaceMainDialog.java | 2 +- .../com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java index da5604bd70..0a49d5ba78 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java @@ -68,7 +68,7 @@ public class ITReplaceMainDialog extends UIDialog { private static final int FIRST_ROW = 0; private static final int NONE = 0; public static int selectCount = 0; - public static int MAIN_PANEL_WIDTH = 929; + public static int MAIN_PANEL_WIDTH = 800; public static int replaceContentNum = 0; public static int replaceSettingNum = 0; public static int contentReplaceCount = 0; diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java index 6739d3a42f..355f347df9 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java @@ -85,7 +85,7 @@ public class ITReplaceNorthPanel { private static final int BUTTON_WIDTH = 44; private static final int GAP = 20; private static final int BUTTON_GAP = 10; - private static final int MATCH_WIDTH = 70; + private static final int MATCH_WIDTH = limit_width; private static final int COMPONENT_HEIGHT = 25; private static final int FIRST_Y = 15, SECOND_Y = 50, THIRD_Y = 85, FOURTH_Y = 120; private static final int FIRST_X = 20, SECOND_X = 80; From 835d4134fc6a4737831cfe5c59aa1cc595a60e1b Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 7 Mar 2023 10:35:32 +0800 Subject: [PATCH 29/33] =?UTF-8?q?REPORT-88335=20=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E6=9F=A5=E6=89=BE=E6=9B=BF=E6=8D=A2=E9=9D=A2=E6=9D=BF=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../replace/ui/ITReplaceMainDialog.java | 2 +- .../replace/ui/ITReplaceNorthPanel.java | 19 ++++--------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java index 0a49d5ba78..cf9a5ca165 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java @@ -68,7 +68,7 @@ public class ITReplaceMainDialog extends UIDialog { private static final int FIRST_ROW = 0; private static final int NONE = 0; public static int selectCount = 0; - public static int MAIN_PANEL_WIDTH = 800; + public static final int MAIN_PANEL_WIDTH = 800; public static int replaceContentNum = 0; public static int replaceSettingNum = 0; public static int contentReplaceCount = 0; diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java index 355f347df9..8b7d865d22 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java @@ -18,7 +18,6 @@ import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.ComboBoxEditor; import javax.swing.Icon; -import javax.swing.JCheckBox; import javax.swing.JPanel; import javax.swing.ScrollPaneConstants; import javax.swing.event.PopupMenuEvent; @@ -80,12 +79,12 @@ public class ITReplaceNorthPanel { //存储的5次最近输入 private int maxItemCount = 5; - private static int limit_width = 800; + private static final int LIMIT_WIDTH = 800; private static final int HEIGHT = 161; private static final int BUTTON_WIDTH = 44; private static final int GAP = 20; private static final int BUTTON_GAP = 10; - private static final int MATCH_WIDTH = limit_width; + private static final int MATCH_WIDTH = 800; private static final int COMPONENT_HEIGHT = 25; private static final int FIRST_Y = 15, SECOND_Y = 50, THIRD_Y = 85, FOURTH_Y = 120; private static final int FIRST_X = 20, SECOND_X = 80; @@ -169,16 +168,6 @@ public class ITReplaceNorthPanel { cardPanel.add(settingScrollPane, CARD_SETTING); } - /** - * 限制尺寸 - * - * @param width - */ - public void setLimitSize(int width) { - upContentPanel.setMaximumSize(new Dimension(limit_width, HEIGHT)); - upContentPanel.setPreferredSize(new Dimension(limit_width, HEIGHT)); - } - /** * 初始化模板内容查找面板 */ @@ -212,7 +201,7 @@ public class ITReplaceNorthPanel { replaceButton = new UIButton(Toolkit.i18nText("Fine-Design_Replace_Button")); searchButton = new UIButton(Toolkit.i18nText("Fine-Design_Search_Button")); - upContentPanel.setPreferredSize(new Dimension(limit_width, HEIGHT)); + upContentPanel.setPreferredSize(new Dimension(LIMIT_WIDTH, HEIGHT)); contentScrollPane = new UIScrollPane(upContentPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); upContentPanel.add(findLabel); upContentPanel.add(rangeLabel); @@ -268,7 +257,7 @@ public class ITReplaceNorthPanel { replaceSettingButton = new UIButton(Toolkit.i18nText("Fine-Design_Replace_Button")); replaceSettingButton.setEnabled(false); - upSettingPanel.setPreferredSize(new Dimension(limit_width, HEIGHT)); + upSettingPanel.setPreferredSize(new Dimension(LIMIT_WIDTH, HEIGHT)); upSettingPanel.add(findSettingLabel); upSettingPanel.add(rangeSettingLabel); upSettingPanel.add(findSettingComboBox); From 895035b289540eac098946fd766744804790f545 Mon Sep 17 00:00:00 2001 From: "Bruce.Deng" Date: Thu, 9 Mar 2023 19:58:39 +0800 Subject: [PATCH 30/33] =?UTF-8?q?REPORT-83259=20&=20REPORT-83263=20?= =?UTF-8?q?=E3=80=90=E6=9C=80=E5=BC=BA=E6=8E=A7=E4=BB=B6=E3=80=91=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E6=A0=B7=E5=BC=8F=E8=B7=9F=E9=9A=8F=E4=B8=BB=E9=A2=98?= =?UTF-8?q?&=E5=BC=80=E6=94=BE=E8=87=AA=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/ui/designer/ButtonDefinePane.java | 124 ++++++++++++++---- .../widget/ui/designer/LabelDefinePane.java | 103 +++++++++++++-- 2 files changed, 192 insertions(+), 35 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonDefinePane.java index 6d8191c2f9..0b0f734751 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonDefinePane.java @@ -1,8 +1,11 @@ package com.fr.design.widget.ui.designer; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.BasicBeanPane; import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; @@ -11,18 +14,26 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.widget.accessibles.AccessibleIconEditor; import com.fr.design.widget.btn.ButtonConstants; import com.fr.form.ui.Button; - +import com.fr.general.GeneralContext; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.StableUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.Component; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; public abstract class ButtonDefinePane extends AbstractDataModify { private UITextField hotkeysTextField; private UITextField buttonNameTextField; private AccessibleIconEditor iconPane; protected UITextField labelNameTextField; - + private final List> extraPaneList = new ArrayList<>(); + private JPanel extraPane; public ButtonDefinePane(XCreator creator){ super(creator); @@ -31,36 +42,97 @@ public abstract class ButtonDefinePane extends AbstractDataMod private void initComponent() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double rowSize[] = {p, p, p, p, p, p, p, p}; - double columnSize[] = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; iconPane = new AccessibleIconEditor(); hotkeysTextField = new UITextField(); buttonNameTextField = new UITextField(); labelNameTextField = new UITextField(); - Component[] backgroundCompPane = createBackgroundComp(); - Component[] frFont = createFontPane(); UILabel backgroundLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")); backgroundLabel.setVerticalAlignment(SwingConstants.TOP); - Component[][] n_components = { - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")), buttonNameTextField}, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, - backgroundCompPane, - frFont, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon")), iconPane}, - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")), hotkeysTextField} - }; - hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ",")); - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); + initExtraPane(); JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - boundsPane.add(panel); + boundsPane.add(extraPane); UIExpandablePane advancedPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, boundsPane); this.add(advancedPane); } + private void initExtraPane() { + initPluginListener(); + refreshExtraAdvancedPane(); + } + + private void refreshExtraAdvancedPane() { + extraPaneList.clear(); + boolean containsExtraPane = false; + Set> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG); + for (WidgetAdvancedPaneProvider provider : providers) { + if (!provider.accept(creator)) { + continue; + } + insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane()); + containsExtraPane = true; + } + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + Component[] backgroundCompPane = createBackgroundComp(); + Component[] frFont = createFontPane(); + double rowSize[]; + double columnSize[]; + int[][] rowCount; + Component[][] n_components; + if (containsExtraPane) { + JPanel panel = FRGUIPaneFactory.createYBoxEmptyBorderPane(); + for (BasicBeanPane pane : extraPaneList) { + panel.add(pane); + } + rowSize = new double[]{p, p, p, p, p}; + columnSize = new double[]{p, f}; + rowCount = new int[][]{{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; + n_components = new Component[][]{ + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")), buttonNameTextField}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon")), iconPane}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")), hotkeysTextField}, + {panel, null} + }; + } else { + rowSize = new double[]{p, p, p, p, p, p, p, p}; + columnSize = new double[]{p, f}; + rowCount = new int[][]{{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; + n_components = new Component[][]{ + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")), buttonNameTextField}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, + backgroundCompPane, + frFont, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon")), iconPane}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")), hotkeysTextField} + }; + } + hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ",")); + extraPane = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); + extraPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + } + + protected void initPluginListener() { + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + @Override + public void on(PluginEvent event) { + refreshExtraAdvancedPane(); + } + }, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG)); + } + + /** + * 插入配置项面板 + * + * @param index 插入的位置 + * @param pane 配置项面板 + */ + protected void insertShortCut(int index, BasicBeanPane pane) { + int size = extraPaneList.size(); + index = Math.min(index, size); + extraPaneList.add(index, pane); + } + @Override public String title4PopupWindow() { return "Button"; @@ -80,6 +152,9 @@ public abstract class ButtonDefinePane extends AbstractDataMod buttonNameTextField.setText(btn.getText()); labelNameTextField.setText(btn.getLabelName()); iconPane.setValue(btn.getIconName()); + for (BasicBeanPane pane : extraPaneList) { + pane.populateBean(btn); + } populateSubButtonPane(btn); } @@ -94,6 +169,9 @@ public abstract class ButtonDefinePane extends AbstractDataMod btn.setLabelName(labelNameTextField.getText()); btn.setIconName((String)iconPane.getValue()); btn.setText(buttonNameTextField.getText()); + for (BasicBeanPane pane : extraPaneList) { + pane.updateBean(btn); + } return btn; } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java index 992ea9cfb5..040137141c 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java @@ -1,10 +1,13 @@ package com.fr.design.widget.ui.designer; import com.fr.base.BaseUtils; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.BasicBeanPane; import com.fr.design.constants.LayoutConstants; import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.fun.WidgetAdvancedPaneProvider; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; @@ -15,11 +18,20 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.form.ui.Label; - +import com.fr.general.GeneralContext; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.Constants; -import javax.swing.*; -import java.awt.*; +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.util.ArrayList; +import java.util.List; +import java.util.Set; /** @@ -33,6 +45,11 @@ public class LabelDefinePane extends AbstractDataModify