From d9dcb7f4f0c497cc464390fec4ff1db80df0e27c Mon Sep 17 00:00:00 2001 From: Yann Date: Tue, 28 Feb 2023 15:55:15 +0800 Subject: [PATCH 01/14] =?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 02/14] =?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 03/14] =?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 04/14] =?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 05/14] =?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 06/14] =?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 07/14] =?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 08/14] =?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 09/14] =?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 10/14] =?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 11/14] =?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 12/14] =?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 13/14] =?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 14/14] =?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};