From 1cc8fb3a0cddf8d42298bf5fcd4bbf16850b1b9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 30 Sep 2019 15:45:35 +0800 Subject: [PATCH 1/6] =?UTF-8?q?CHART-10233=20=E8=B6=85=E9=93=BE=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chartx/component/HyperLinkPane.java | 274 ++++++++++++++++++ 1 file changed, 274 insertions(+) create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java new file mode 100644 index 0000000000..b3236fd6a0 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java @@ -0,0 +1,274 @@ +package com.fr.design.chartx.component; + +import com.fr.base.BaseFormula; +import com.fr.chart.web.ChartHyperPoplink; +import com.fr.chart.web.ChartHyperRelateCellLink; +import com.fr.chart.web.ChartHyperRelateFloatLink; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.javascript.ChartEmailPane; +import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperPoplinkPane; +import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateCellLinkPane; +import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateFloatLinkPane; +import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.fun.HyperlinkProvider; +import com.fr.design.gui.controlpane.NameObjectCreator; +import com.fr.design.gui.controlpane.NameableCreator; +import com.fr.design.gui.controlpane.UIListControlPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.imenutable.UIMenuNameableCreator; +import com.fr.design.gui.itoolbar.UIToolbar; +import com.fr.design.hyperlink.ReportletHyperlinkPane; +import com.fr.design.hyperlink.WebHyperlinkPane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.javascript.JavaScriptImplPane; +import com.fr.design.javascript.ParameterJavaScriptPane; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.module.DesignModuleFactory; +import com.fr.general.NameObject; +import com.fr.js.EmailJavaScript; +import com.fr.js.FormHyperlinkProvider; +import com.fr.js.JavaScript; +import com.fr.js.JavaScriptImpl; +import com.fr.js.NameJavaScript; +import com.fr.js.NameJavaScriptGroup; +import com.fr.js.ParameterJavaScript; +import com.fr.js.ReportletHyperlink; +import com.fr.js.WebHyperlink; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.ListMap; +import com.fr.stable.Nameable; +import com.fr.stable.bridge.StableFactory; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.JPanel; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.awt.Component; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2019-09-25 + */ +public class HyperLinkPane extends UIListControlPane implements UIObserver { + + NameJavaScriptGroup nameGroup; + + HashMap hyperLinkEditorMap; + + private UIObserverListener uiObserverListener; + + public HyperLinkPane() { + super(); + this.setBorder(null); + } + + @Override + public NameableCreator[] createNameableCreators() { + //面板初始化,需要在populate的时候更新 + Map nameCreators = new ListMap(); + NameableCreator[] creators = DesignModuleFactory.getHyperlinkGroupType().getHyperlinkCreators(); + for (NameableCreator creator : creators) { + nameCreators.put(creator.menuName(), creator); + } + Set providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG); + for (HyperlinkProvider provider : providers) { + NameableCreator nc = provider.createHyperlinkCreator(); + nameCreators.put(nc.menuName(), nc); + } + return nameCreators.values().toArray(new NameableCreator[nameCreators.size()]); + } + + public BasicBeanPane createPaneByCreators(NameableCreator creator) { + Constructor constructor; + try { + constructor = creator.getUpdatePane().getConstructor(HashMap.class, boolean.class); + return constructor.newInstance(hyperLinkEditorMap, false); + + } catch (InstantiationException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } catch (IllegalAccessException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } catch (NoSuchMethodException e) { + return super.createPaneByCreators(creator); + } catch (InvocationTargetException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return null; + } + + @Override + public void registerChangeListener(UIObserverListener listener) { + uiObserverListener = listener; + } + + @Override + public boolean shouldResponseChangeListener() { + return true; + } + + @Override + protected JPanel getLeftTopPane(UIToolbar topToolBar) { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double[] columnSize = {f, e}; + double[] rowSize = {p}; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(getAddItemText()), topToolBar}, + }; + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + + @Override + public void saveSettings() { + if (isPopulating) { + return; + } + uiObserverListener.doChange(); + } + + public void update(NameJavaScriptGroup nameGroup) { + + Nameable[] nameables = update(); + + nameGroup.clear(); + + for (int i = 0; i < nameables.length; i++) { + JavaScript javaScript = (JavaScript) ((NameObject) nameables[i]).getObject(); + String name = nameables[i].getName(); + NameJavaScript nameJava = new NameJavaScript(name, javaScript); + nameGroup.addNameHyperlink(nameJava); + } + + } + + public void populate(NameJavaScriptGroup nameGroup, HashMap hyperLinkEditorMap) { + this.nameGroup = nameGroup; + if (this.hyperLinkEditorMap == null) { + this.hyperLinkEditorMap = hyperLinkEditorMap; + } + + HashMap paneMap = getHyperlinkMap(); + + //安装平台内打开插件时,添加相应按钮 + Set providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG); + for (HyperlinkProvider provider : providers) { + NameableCreator nc = provider.createHyperlinkCreator(); + paneMap.put(nc.getHyperlink(), nc.getUpdatePane()); + } + + List list = refreshList(paneMap); + NameObjectCreator[] creators = new NameObjectCreator[list.size()]; + for (int i = 0; list != null && i < list.size(); i++) { + UIMenuNameableCreator uiMenuNameableCreator = list.get(i); + creators[i] = new NameObjectCreator(uiMenuNameableCreator.getName(), uiMenuNameableCreator.getObj().getClass(), uiMenuNameableCreator.getPaneClazz()); + + } + + refreshNameableCreator(creators); + + List nameObjects = new ArrayList(); + + for (int i = 0; nameGroup != null && i < nameGroup.size(); i++) { + NameJavaScript javaScript = nameGroup.getNameHyperlink(i); + if (javaScript != null && javaScript.getJavaScript() != null) { + JavaScript script = javaScript.getJavaScript(); + UIMenuNameableCreator uiMenuNameableCreator = new UIMenuNameableCreator(javaScript.getName(), script, getUseMap(paneMap, script.getClass())); + nameObjects.add(new NameObject(uiMenuNameableCreator.getName(), uiMenuNameableCreator.getObj())); + + } + } + + this.populate(nameObjects.toArray(new NameObject[nameObjects.size()])); + doLayout(); + } + + private HashMap getHyperlinkMap() { + HashMap map = new HashMap(); + + map.put(ReportletHyperlink.class, ReportletHyperlinkPane.class); + map.put(EmailJavaScript.class, ChartEmailPane.class); + map.put(WebHyperlink.class, WebHyperlinkPane.class); + map.put(ParameterJavaScript.class, ParameterJavaScriptPane.class); + + map.put(JavaScriptImpl.class, JavaScriptImplPane.class); + map.put(ChartHyperPoplink.class, ChartHyperPoplinkPane.class); + map.put(ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.class); + map.put(ChartHyperRelateFloatLink.class, ChartHyperRelateFloatLinkPane.class); + + map.put(FormHyperlinkProvider.class, FormHyperlinkPane.class); + return map; + } + + private List refreshList(HashMap map) { + List list = new ArrayList(); + + list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Reportlet"), + new ReportletHyperlink(), getUseMap(map, ReportletHyperlink.class))); + list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Mail"), new EmailJavaScript(), NewChartEmailPane.class)); + list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Web"), + new WebHyperlink(), getUseMap(map, WebHyperlink.class))); + list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Dynamic_Parameters"), + new ParameterJavaScript(), getUseMap(map, ParameterJavaScript.class))); + list.add(new UIMenuNameableCreator("JavaScript", new JavaScriptImpl(), getUseMap(map, JavaScriptImpl.class))); + + list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Float_Chart"), + new ChartHyperPoplink(), getUseMap(map, ChartHyperPoplink.class))); + list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Cell"), + new ChartHyperRelateCellLink(), getUseMap(map, ChartHyperRelateCellLink.class))); + list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Float"), + new ChartHyperRelateFloatLink(), getUseMap(map, ChartHyperRelateFloatLink.class))); + + FormHyperlinkProvider hyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); + list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Form"), + hyperlink, getUseMap(map, FormHyperlinkProvider.class))); + + return list; + } + + private Class getUseMap(HashMap map, Object key) { + if (map.get(key) != null) { + return (Class) map.get(key); + } + //引擎在这边放了个provider,当前表单对象 + for (Object tempKey : map.keySet()) { + if (((Class) tempKey).isAssignableFrom((Class) key)) { + return (Class) map.get(tempKey); + } + } + return null; + } + + /** + * 弹出列表的标题. + * + * @return 返回标题字符串. + */ + @Override + public String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Report_Hyperlink"); + } + + @Override + protected String getAddItemText() { + return Toolkit.i18nText("Fine-Design_Basic_Add_Hyperlink"); + } + + //邮箱 + public static class NewChartEmailPane extends ChartEmailPane { + @Override + protected boolean needRenamePane() { + return false; + } + } +} From 743b4fb1aa45b01697e920c1ab1bead6768f7ee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 8 Oct 2019 11:22:49 +0800 Subject: [PATCH 2/6] =?UTF-8?q?CHART-10233=20=E4=BB=A3=E7=A0=81=E8=B4=A8?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chartx/component/HyperLinkPane.java | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java index b3236fd6a0..4b737fbd5b 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java @@ -61,9 +61,7 @@ import java.awt.Component; */ public class HyperLinkPane extends UIListControlPane implements UIObserver { - NameJavaScriptGroup nameGroup; - - HashMap hyperLinkEditorMap; + private Map hyperLinkEditorMap; private UIObserverListener uiObserverListener; @@ -152,13 +150,11 @@ public class HyperLinkPane extends UIListControlPane implements UIObserver { } - public void populate(NameJavaScriptGroup nameGroup, HashMap hyperLinkEditorMap) { - this.nameGroup = nameGroup; - if (this.hyperLinkEditorMap == null) { - this.hyperLinkEditorMap = hyperLinkEditorMap; - } + public void populate(NameJavaScriptGroup nameGroup, Map hyperLinkEditorMap) { + + this.hyperLinkEditorMap = hyperLinkEditorMap; - HashMap paneMap = getHyperlinkMap(); + Map paneMap = getHyperlinkMap(); //安装平台内打开插件时,添加相应按钮 Set providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG); @@ -193,8 +189,8 @@ public class HyperLinkPane extends UIListControlPane implements UIObserver { doLayout(); } - private HashMap getHyperlinkMap() { - HashMap map = new HashMap(); + private Map getHyperlinkMap() { + Map map = new HashMap(); map.put(ReportletHyperlink.class, ReportletHyperlinkPane.class); map.put(EmailJavaScript.class, ChartEmailPane.class); @@ -210,7 +206,7 @@ public class HyperLinkPane extends UIListControlPane implements UIObserver { return map; } - private List refreshList(HashMap map) { + private List refreshList(Map map) { List list = new ArrayList(); list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Reportlet"), @@ -236,7 +232,7 @@ public class HyperLinkPane extends UIListControlPane implements UIObserver { return list; } - private Class getUseMap(HashMap map, Object key) { + private Class getUseMap(Map map, Object key) { if (map.get(key) != null) { return (Class) map.get(key); } From aacf3ce359f58ed8db807425d79c5a764253b3ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 8 Oct 2019 14:15:16 +0800 Subject: [PATCH 3/6] =?UTF-8?q?CHART-10233=20=E4=BB=A3=E7=A0=81=E8=B4=A8?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/chartx/component/HyperLinkPane.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java index 4b737fbd5b..470e98a345 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java @@ -154,7 +154,7 @@ public class HyperLinkPane extends UIListControlPane implements UIObserver { this.hyperLinkEditorMap = hyperLinkEditorMap; - Map paneMap = getHyperlinkMap(); + Map paneMap = getHyperlinkMap(); //安装平台内打开插件时,添加相应按钮 Set providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG); @@ -189,7 +189,7 @@ public class HyperLinkPane extends UIListControlPane implements UIObserver { doLayout(); } - private Map getHyperlinkMap() { + private Map getHyperlinkMap() { Map map = new HashMap(); map.put(ReportletHyperlink.class, ReportletHyperlinkPane.class); @@ -206,7 +206,7 @@ public class HyperLinkPane extends UIListControlPane implements UIObserver { return map; } - private List refreshList(Map map) { + private List refreshList(Map map) { List list = new ArrayList(); list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Reportlet"), @@ -232,7 +232,7 @@ public class HyperLinkPane extends UIListControlPane implements UIObserver { return list; } - private Class getUseMap(Map map, Object key) { + private Class getUseMap(Map map, Object key) { if (map.get(key) != null) { return (Class) map.get(key); } From 8ce3644d2866f2dfa1779f2ee2834a3175cb5b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 8 Oct 2019 15:37:50 +0800 Subject: [PATCH 4/6] =?UTF-8?q?CHART-10233=20=E8=B6=85=E9=93=BE=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chartx/component/HyperLinkPane.java | 95 ++++--------------- 1 file changed, 18 insertions(+), 77 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java index 470e98a345..770f06e456 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java @@ -4,7 +4,6 @@ import com.fr.base.BaseFormula; import com.fr.chart.web.ChartHyperPoplink; import com.fr.chart.web.ChartHyperRelateCellLink; import com.fr.chart.web.ChartHyperRelateFloatLink; -import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; import com.fr.design.chart.javascript.ChartEmailPane; import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperPoplinkPane; @@ -13,7 +12,6 @@ import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateFloatLink import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; -import com.fr.design.fun.HyperlinkProvider; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.UIListControlPane; @@ -27,7 +25,6 @@ import com.fr.design.javascript.JavaScriptImplPane; import com.fr.design.javascript.ParameterJavaScriptPane; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.module.DesignModuleFactory; import com.fr.general.NameObject; import com.fr.js.EmailJavaScript; import com.fr.js.FormHyperlinkProvider; @@ -39,7 +36,6 @@ import com.fr.js.ParameterJavaScript; import com.fr.js.ReportletHyperlink; import com.fr.js.WebHyperlink; import com.fr.log.FineLoggerFactory; -import com.fr.stable.ListMap; import com.fr.stable.Nameable; import com.fr.stable.bridge.StableFactory; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -51,7 +47,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; import java.awt.Component; /** @@ -72,18 +67,15 @@ public class HyperLinkPane extends UIListControlPane implements UIObserver { @Override public NameableCreator[] createNameableCreators() { - //面板初始化,需要在populate的时候更新 - Map nameCreators = new ListMap(); - NameableCreator[] creators = DesignModuleFactory.getHyperlinkGroupType().getHyperlinkCreators(); - for (NameableCreator creator : creators) { - nameCreators.put(creator.menuName(), creator); - } - Set providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG); - for (HyperlinkProvider provider : providers) { - NameableCreator nc = provider.createHyperlinkCreator(); - nameCreators.put(nc.menuName(), nc); + + List list = createMenuList(); + NameObjectCreator[] creators = new NameObjectCreator[list.size()]; + for (int i = 0; list != null && i < list.size(); i++) { + UIMenuNameableCreator uiMenuNameableCreator = list.get(i); + creators[i] = new NameObjectCreator(uiMenuNameableCreator.getName(), uiMenuNameableCreator.getObj().getClass(), uiMenuNameableCreator.getPaneClazz()); + } - return nameCreators.values().toArray(new NameableCreator[nameCreators.size()]); + return creators; } public BasicBeanPane createPaneByCreators(NameableCreator creator) { @@ -154,34 +146,13 @@ public class HyperLinkPane extends UIListControlPane implements UIObserver { this.hyperLinkEditorMap = hyperLinkEditorMap; - Map paneMap = getHyperlinkMap(); - - //安装平台内打开插件时,添加相应按钮 - Set providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG); - for (HyperlinkProvider provider : providers) { - NameableCreator nc = provider.createHyperlinkCreator(); - paneMap.put(nc.getHyperlink(), nc.getUpdatePane()); - } - - List list = refreshList(paneMap); - NameObjectCreator[] creators = new NameObjectCreator[list.size()]; - for (int i = 0; list != null && i < list.size(); i++) { - UIMenuNameableCreator uiMenuNameableCreator = list.get(i); - creators[i] = new NameObjectCreator(uiMenuNameableCreator.getName(), uiMenuNameableCreator.getObj().getClass(), uiMenuNameableCreator.getPaneClazz()); - - } - - refreshNameableCreator(creators); - List nameObjects = new ArrayList(); for (int i = 0; nameGroup != null && i < nameGroup.size(); i++) { NameJavaScript javaScript = nameGroup.getNameHyperlink(i); if (javaScript != null && javaScript.getJavaScript() != null) { JavaScript script = javaScript.getJavaScript(); - UIMenuNameableCreator uiMenuNameableCreator = new UIMenuNameableCreator(javaScript.getName(), script, getUseMap(paneMap, script.getClass())); - nameObjects.add(new NameObject(uiMenuNameableCreator.getName(), uiMenuNameableCreator.getObj())); - + nameObjects.add(new NameObject(javaScript.getName(), script)); } } @@ -189,62 +160,32 @@ public class HyperLinkPane extends UIListControlPane implements UIObserver { doLayout(); } - private Map getHyperlinkMap() { - Map map = new HashMap(); - - map.put(ReportletHyperlink.class, ReportletHyperlinkPane.class); - map.put(EmailJavaScript.class, ChartEmailPane.class); - map.put(WebHyperlink.class, WebHyperlinkPane.class); - map.put(ParameterJavaScript.class, ParameterJavaScriptPane.class); - - map.put(JavaScriptImpl.class, JavaScriptImplPane.class); - map.put(ChartHyperPoplink.class, ChartHyperPoplinkPane.class); - map.put(ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.class); - map.put(ChartHyperRelateFloatLink.class, ChartHyperRelateFloatLinkPane.class); - - map.put(FormHyperlinkProvider.class, FormHyperlinkPane.class); - return map; - } - - private List refreshList(Map map) { + private List createMenuList() { List list = new ArrayList(); list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Reportlet"), - new ReportletHyperlink(), getUseMap(map, ReportletHyperlink.class))); + new ReportletHyperlink(), ReportletHyperlinkPane.class)); list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Mail"), new EmailJavaScript(), NewChartEmailPane.class)); list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Web"), - new WebHyperlink(), getUseMap(map, WebHyperlink.class))); + new WebHyperlink(), WebHyperlinkPane.class)); list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Dynamic_Parameters"), - new ParameterJavaScript(), getUseMap(map, ParameterJavaScript.class))); - list.add(new UIMenuNameableCreator("JavaScript", new JavaScriptImpl(), getUseMap(map, JavaScriptImpl.class))); + new ParameterJavaScript(), ParameterJavaScriptPane.class)); + list.add(new UIMenuNameableCreator("JavaScript", new JavaScriptImpl(), JavaScriptImplPane.class)); list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Float_Chart"), - new ChartHyperPoplink(), getUseMap(map, ChartHyperPoplink.class))); + new ChartHyperPoplink(), ChartHyperPoplinkPane.class)); list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Cell"), - new ChartHyperRelateCellLink(), getUseMap(map, ChartHyperRelateCellLink.class))); + new ChartHyperRelateCellLink(), ChartHyperRelateCellLinkPane.class)); list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Float"), - new ChartHyperRelateFloatLink(), getUseMap(map, ChartHyperRelateFloatLink.class))); + new ChartHyperRelateFloatLink(), ChartHyperRelateFloatLinkPane.class)); FormHyperlinkProvider hyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Form"), - hyperlink, getUseMap(map, FormHyperlinkProvider.class))); + hyperlink, FormHyperlinkPane.class)); return list; } - private Class getUseMap(Map map, Object key) { - if (map.get(key) != null) { - return (Class) map.get(key); - } - //引擎在这边放了个provider,当前表单对象 - for (Object tempKey : map.keySet()) { - if (((Class) tempKey).isAssignableFrom((Class) key)) { - return (Class) map.get(tempKey); - } - } - return null; - } - /** * 弹出列表的标题. * From 5add30400339ee3ff4b48e5bbde30c08ff14ae14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 8 Oct 2019 16:10:46 +0800 Subject: [PATCH 5/6] CHART-10233 --- .../chartx/component/HyperLinkPane.java | 55 +++++++------------ 1 file changed, 21 insertions(+), 34 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java index 770f06e456..7b5a6f8000 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java @@ -16,7 +16,6 @@ import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.UIListControlPane; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.imenutable.UIMenuNameableCreator; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.hyperlink.ReportletHyperlinkPane; import com.fr.design.hyperlink.WebHyperlinkPane; @@ -67,15 +66,29 @@ public class HyperLinkPane extends UIListControlPane implements UIObserver { @Override public NameableCreator[] createNameableCreators() { + List creators = new ArrayList(); + + creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Reportlet"), + ReportletHyperlink.class, ReportletHyperlinkPane.class)); + creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Mail"), EmailJavaScript.class, NewChartEmailPane.class)); + creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Web"), + WebHyperlink.class, WebHyperlinkPane.class)); + creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Dynamic_Parameters"), + ParameterJavaScript.class, ParameterJavaScriptPane.class)); + creators.add(new NameObjectCreator("JavaScript", JavaScriptImpl.class, JavaScriptImplPane.class)); + + creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Float_Chart"), + ChartHyperPoplink.class, ChartHyperPoplinkPane.class)); + creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Cell"), + ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.class)); + creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Float"), + ChartHyperRelateFloatLink.class, ChartHyperRelateFloatLinkPane.class)); - List list = createMenuList(); - NameObjectCreator[] creators = new NameObjectCreator[list.size()]; - for (int i = 0; list != null && i < list.size(); i++) { - UIMenuNameableCreator uiMenuNameableCreator = list.get(i); - creators[i] = new NameObjectCreator(uiMenuNameableCreator.getName(), uiMenuNameableCreator.getObj().getClass(), uiMenuNameableCreator.getPaneClazz()); + FormHyperlinkProvider hyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); + creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Form"), + hyperlink.getClass(), FormHyperlinkPane.class)); - } - return creators; + return creators.toArray(new NameObjectCreator[creators.size()]); } public BasicBeanPane createPaneByCreators(NameableCreator creator) { @@ -160,32 +173,6 @@ public class HyperLinkPane extends UIListControlPane implements UIObserver { doLayout(); } - private List createMenuList() { - List list = new ArrayList(); - - list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Reportlet"), - new ReportletHyperlink(), ReportletHyperlinkPane.class)); - list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Mail"), new EmailJavaScript(), NewChartEmailPane.class)); - list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Web"), - new WebHyperlink(), WebHyperlinkPane.class)); - list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Dynamic_Parameters"), - new ParameterJavaScript(), ParameterJavaScriptPane.class)); - list.add(new UIMenuNameableCreator("JavaScript", new JavaScriptImpl(), JavaScriptImplPane.class)); - - list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Float_Chart"), - new ChartHyperPoplink(), ChartHyperPoplinkPane.class)); - list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Cell"), - new ChartHyperRelateCellLink(), ChartHyperRelateCellLinkPane.class)); - list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Float"), - new ChartHyperRelateFloatLink(), ChartHyperRelateFloatLinkPane.class)); - - FormHyperlinkProvider hyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); - list.add(new UIMenuNameableCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Form"), - hyperlink, FormHyperlinkPane.class)); - - return list; - } - /** * 弹出列表的标题. * From 7def8afd8fed562a752fe72b8927116546eb46e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 8 Oct 2019 16:49:17 +0800 Subject: [PATCH 6/6] =?UTF-8?q?CHART-10233=20=E6=8F=92=E4=BB=B6=E8=B6=85?= =?UTF-8?q?=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/chartx/component/HyperLinkPane.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java index 7b5a6f8000..c1ff699742 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/HyperLinkPane.java @@ -4,6 +4,7 @@ import com.fr.base.BaseFormula; import com.fr.chart.web.ChartHyperPoplink; import com.fr.chart.web.ChartHyperRelateCellLink; import com.fr.chart.web.ChartHyperRelateFloatLink; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; import com.fr.design.chart.javascript.ChartEmailPane; import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperPoplinkPane; @@ -12,6 +13,7 @@ import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateFloatLink import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; +import com.fr.design.fun.HyperlinkProvider; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.UIListControlPane; @@ -46,6 +48,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import java.awt.Component; /** @@ -66,7 +69,7 @@ public class HyperLinkPane extends UIListControlPane implements UIObserver { @Override public NameableCreator[] createNameableCreators() { - List creators = new ArrayList(); + List creators = new ArrayList(); creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Reportlet"), ReportletHyperlink.class, ReportletHyperlinkPane.class)); @@ -88,7 +91,13 @@ public class HyperLinkPane extends UIListControlPane implements UIObserver { creators.add(new NameObjectCreator(Toolkit.i18nText("Fine-Design_Chart_Link_Form"), hyperlink.getClass(), FormHyperlinkPane.class)); - return creators.toArray(new NameObjectCreator[creators.size()]); + Set providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG); + for (HyperlinkProvider provider : providers) { + NameableCreator nc = provider.createHyperlinkCreator(); + creators.add(nc); + } + + return creators.toArray(new NameableCreator[creators.size()]); } public BasicBeanPane createPaneByCreators(NameableCreator creator) {