From d37fb6df92afd28b2d1cd4f7fc812b8ba66cb341 Mon Sep 17 00:00:00 2001 From: Yann Date: Wed, 1 Mar 2023 15:12:27 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-86430=20AlphaFine=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E5=BF=83tab=E9=A1=B5=E6=98=BE=E7=A4=BA=E5=86=85?= =?UTF-8?q?=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 | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 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 520d396f1e..685645c22e 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,6 +20,7 @@ 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; @@ -29,7 +30,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.stream.Collectors; /** * Created by XiaXiang on 2017/3/27. @@ -120,7 +121,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++) { @@ -184,7 +185,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()); @@ -196,33 +197,31 @@ public class PluginSearchManager implements AlphaFineSearchProvider { /** * 将jsonobject转化为PluginModel - * 并按照更新时间排序,取最新的10个 - * */ + * 并按照更新时间排序,取最新的10个,并过滤掉不是当前版本的 + */ List parseDefaultPluginModel(List jsonObjects) { List pluginModels = new ArrayList<>(); + String version = "v" + ProductConstants.MAIN_VERSION; 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; - } - })); - } 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)); - } + pluginModels = jsonObjects.stream() + .filter(o -> ((Integer) o.get(version)) == 1) + .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()); } return pluginModels; } + private static long parseTime(Map value) { + SimpleDateFormat format = new SimpleDateFormat(TIME_FORMAT); + long t = 0L; + try { + t = format.parse((String) value.get(UPLOAD_TIME)).getTime(); + } catch (ParseException e) { + FineLoggerFactory.getLogger().error(e, e.getMessage()); + } + return t; + } + } From cafde4b16d49b326b143e57e2d3d1281ddadc507 Mon Sep 17 00:00:00 2001 From: "Leo.Qin" Date: Fri, 3 Mar 2023 15:54:30 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-67195=20=E5=86=B3=E7=AD=96=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8-=E5=8D=95=E5=85=83=E6=A0=BC=E8=B6=85=E9=93=BE?= =?UTF-8?q?=E9=80=89=E9=A1=B9=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8=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, 72 insertions(+), 22 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 7137c180a2..f80bf08d5a 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 @@ -13,6 +13,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; @@ -21,7 +22,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; @@ -281,4 +285,25 @@ 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()); + }; + } }