From 3c28ceda91422a74ffb70d4166b77848d55294df Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Fri, 28 Sep 2018 16:17:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E5=A4=8D=E7=94=A8=E5=8E=9F=E6=9C=89=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shortcutfactory/OldShortCutFactory.java | 7 +++--- .../shortcutfactory/ShortCutFactory.java | 7 +++--- .../design/gui/frpane/BaseHyperlinkGroup.java | 14 ++++++++---- .../gui/frpane/HyperLinkGroupFilter.java | 22 ------------------- .../design/gui/frpane/HyperlinkGroupType.java | 16 +++++++++++++- .../gui/frpane/UICorrelationComboBoxPane.java | 5 +++-- .../fr/design/module/ChartHyperlinkGroup.java | 22 +++++++++---------- 7 files changed, 46 insertions(+), 47 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/gui/frpane/HyperLinkGroupFilter.java diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/OldShortCutFactory.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/OldShortCutFactory.java index 9ea8bb8fc..d0cf10f7e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/OldShortCutFactory.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/OldShortCutFactory.java @@ -5,13 +5,14 @@ import com.fr.design.actions.UpdateAction; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.ShortCut4JControlPane; import com.fr.design.gui.controlpane.ShortCutListenerProvider; -import com.fr.design.gui.frpane.HyperLinkGroupFilter; import com.fr.design.menu.LineSeparator; import com.fr.design.menu.MenuDef; import com.fr.design.menu.ShortCut; import com.fr.design.module.DesignModuleFactory; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; +import com.fr.js.JavaScript; +import com.fr.stable.Filter; import javax.swing.Icon; import java.awt.event.ActionEvent; @@ -84,8 +85,8 @@ public class OldShortCutFactory extends AbstractShortCutFactory { private void wrapActionListener(NameableCreator[] creators) { for (final NameableCreator creator : creators) { - HyperLinkGroupFilter filter = DesignModuleFactory.getHyperlinkGroupType().getFilter(); - if (!filter.filter(creator.getHyperlink())) { + Filter> filter = DesignModuleFactory.getHyperlinkGroupType().getFilter(); + if (!filter.accept(creator.getHyperlink())) { continue; } boolean isTrue = ComparatorUtils.equals(creator.menuName(), Inter.getLocText("Datasource-Stored_Procedure")) || 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 a09d859f6..7d1699543 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 @@ -6,13 +6,14 @@ import com.fr.design.actions.core.ActionFactory; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.ShortCut4JControlPane; import com.fr.design.gui.controlpane.ShortCutListenerProvider; -import com.fr.design.gui.frpane.HyperLinkGroupFilter; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.menu.LineSeparator; import com.fr.design.menu.MenuDef; import com.fr.design.menu.ShortCut; import com.fr.design.module.DesignModuleFactory; import com.fr.general.ComparatorUtils; +import com.fr.js.JavaScript; +import com.fr.stable.Filter; import com.fr.stable.StringUtils; import javax.swing.AbstractButton; @@ -141,8 +142,8 @@ public class ShortCutFactory extends AbstractShortCutFactory { private void wrapActionListener(NameableCreator[] creators) { for (final NameableCreator creator : creators) { - HyperLinkGroupFilter filter = DesignModuleFactory.getHyperlinkGroupType().getFilter(); - if (!filter.filter(creator.getHyperlink())) { + 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")) || diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/BaseHyperlinkGroup.java b/designer-base/src/main/java/com/fr/design/gui/frpane/BaseHyperlinkGroup.java index f971e9ae2..898101698 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/BaseHyperlinkGroup.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/BaseHyperlinkGroup.java @@ -3,6 +3,7 @@ package com.fr.design.gui.frpane; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.module.DesignModuleFactory; import com.fr.js.JavaScript; +import com.fr.stable.Filter; /** * 基础的超级链接类型, 不包括图表相关超链. @@ -22,15 +23,20 @@ public class BaseHyperlinkGroup implements HyperlinkGroupType { } @Override - public HyperLinkGroupFilter getFilter() { - return new HyperLinkGroupFilter() { + public Filter> getFilter() { + return new Filter>() { @Override - public boolean filter(Class clazz) { + public boolean accept(Class aClass) { return true; } + }; + } + @Override + public Filter getOldFilter() { + return new Filter() { @Override - public boolean filter(Object object) { + public boolean accept(Object object) { return true; } }; diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/HyperLinkGroupFilter.java b/designer-base/src/main/java/com/fr/design/gui/frpane/HyperLinkGroupFilter.java deleted file mode 100644 index cb4096574..000000000 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/HyperLinkGroupFilter.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.fr.design.gui.frpane; - -import com.fr.js.JavaScript; - -public interface HyperLinkGroupFilter { - - /** - * @param clazz clazz - * @return 是否可用,返回true表示可用,返回false表示不可用 - */ - boolean filter(Class clazz); - - /** - * 兼容老图表 - * - * @param object object - * @return 是否可用,返回true表示可用,返回false表示不可用 - * @see HyperLinkGroupFilter#filter(Class) - */ - boolean filter(Object object); - -} diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupType.java b/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupType.java index 48b5c1282..8db0b9b94 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupType.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupType.java @@ -1,6 +1,8 @@ package com.fr.design.gui.frpane; import com.fr.design.gui.controlpane.NameableCreator; +import com.fr.js.JavaScript; +import com.fr.stable.Filter; /** * 超级链接 支持的类型 种类. @@ -18,6 +20,18 @@ public interface HyperlinkGroupType { NameableCreator[] getHyperlinkCreators(); - HyperLinkGroupFilter getFilter(); + /** + * 图表超链过滤 + * + * @return 图表超链过滤 + */ + Filter> getFilter(); + + /** + * 老图表超链的过滤 + * + * @return 老图表超链的过滤 + */ + Filter getOldFilter(); } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java index 5bf504444..79dece505 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java @@ -23,6 +23,7 @@ import com.fr.js.EmailJavaScript; import com.fr.js.ReportletHyperlink; import com.fr.js.WebHyperlink; import com.fr.stable.ArrayUtils; +import com.fr.stable.Filter; import com.fr.stable.StringUtils; import javax.swing.JFrame; @@ -95,8 +96,8 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver { if (values.size() > 1) { for (UIMenuNameableCreator value : values) { final String itemName = value.getName(); - HyperLinkGroupFilter filter = DesignModuleFactory.getHyperlinkGroupType().getFilter(); - if (!filter.filter(value.getObj())) { + Filter filter = DesignModuleFactory.getHyperlinkGroupType().getOldFilter(); + if (!filter.accept(value.getObj())) { continue; } UIMenuItem item = new UIMenuItem(itemName); diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java b/designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java index 33d15367d..4e5037109 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java @@ -11,13 +11,13 @@ import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.frpane.BaseHyperlinkGroup; -import com.fr.design.gui.frpane.HyperLinkGroupFilter; import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.JTemplate; import com.fr.general.ComparatorUtils; import com.fr.js.FormHyperlinkProvider; import com.fr.js.JavaScript; import com.fr.stable.ArrayUtils; +import com.fr.stable.Filter; import com.fr.stable.bridge.StableFactory; /** @@ -46,10 +46,10 @@ public class ChartHyperlinkGroup extends BaseHyperlinkGroup { } @Override - public HyperLinkGroupFilter getFilter() { - return new HyperLinkGroupFilter() { + public Filter> getFilter() { + return new Filter>() { @Override - public boolean filter(Class clazz) { + public boolean accept(Class clazz) { JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); if (template == null) { return false; @@ -78,25 +78,23 @@ public class ChartHyperlinkGroup extends BaseHyperlinkGroup { } return true; } + }; + } - /** - * 兼容老图表 - * @param object - * @return - */ + @Override + public Filter getOldFilter() { + return new Filter() { @Override - public boolean filter(Object object) { + public boolean accept(Object object) { JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); if (template == null) { return false; } - if (template.isJWorkBook()) { // 如果是普通报表单元格,那么没有 FormHyperlink 选项 FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); //返回true表示可用,返回false表示不可用 return !ComparatorUtils.equals(object.getClass(), formHyperlink.getClass()); - } else { // 如果是决策报表 Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class};