Browse Source

还原

research/11.0
白岳 5 years ago
parent
commit
336322a093
  1. 7
      designer-chart/src/main/java/com/fr/design/chart/javascript/ChartEmailPane.java
  2. 131
      designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java

7
designer-chart/src/main/java/com/fr/design/chart/javascript/ChartEmailPane.java

@ -87,11 +87,4 @@ public class ChartEmailPane extends EmailPane{
super.updateBean(email); super.updateBean(email);
} }
//邮箱
public static class NoRename extends ChartEmailPane {
@Override
protected boolean needRenamePane() {
return false;
}
}
} }

131
designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java

@ -2,23 +2,40 @@ package com.fr.van.chart.custom.component;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
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.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chart.javascript.ChartEmailPane; 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.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.fun.HyperlinkProvider; import com.fr.design.fun.HyperlinkProvider;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.i18n.Toolkit; import com.fr.design.gui.imenutable.UIMenuNameableCreator;
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.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.js.EmailJavaScript; import com.fr.js.EmailJavaScript;
import com.fr.js.FormHyperlinkProvider;
import com.fr.js.JavaScript; import com.fr.js.JavaScript;
import com.fr.js.JavaScriptImpl;
import com.fr.js.NameJavaScript; import com.fr.js.NameJavaScript;
import com.fr.js.NameJavaScriptGroup; 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.log.FineLoggerFactory;
import com.fr.stable.ListMap; import com.fr.stable.ListMap;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.bridge.StableFactory;
import com.fr.van.chart.designer.component.VanChartUIListControlPane; import com.fr.van.chart.designer.component.VanChartUIListControlPane;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
@ -39,16 +56,13 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane {
@Override @Override
public NameableCreator[] createNameableCreators() { public NameableCreator[] createNameableCreators() {
//面板初始化
//面板初始化,需要在populate的时候更新
Map<String, NameableCreator> nameCreators = new ListMap<>(); Map<String, NameableCreator> nameCreators = new ListMap<>();
NameableCreator[] creators = DesignModuleFactory.getHyperlinkGroupType().getHyperlinkCreators(); NameableCreator[] creators = DesignModuleFactory.getHyperlinkGroupType().getHyperlinkCreators();
for (NameableCreator creator : creators) { for (NameableCreator creator : creators) {
nameCreators.put(creator.menuName(), creator); nameCreators.put(creator.menuName(), creator);
} }
//使用chart的email替换掉报表的email
String email = Toolkit.i18nText("Fine-Design_Basic_Email");
nameCreators.put(email, new NameObjectCreator(email, EmailJavaScript.class, ChartEmailPane.NoRename.class));
Set<HyperlinkProvider> providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG); Set<HyperlinkProvider> providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG);
for (HyperlinkProvider provider : providers) { for (HyperlinkProvider provider : providers) {
NameableCreator nc = provider.createHyperlinkCreator(); NameableCreator nc = provider.createHyperlinkCreator();
@ -114,8 +128,42 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane {
//populate //populate
} }
/**
* updateJs的Group
*
* @return 返回NameJavaScriptGroup
*/
public NameJavaScriptGroup updateJSGroup() {
Nameable[] res = this.update();
NameJavaScript[] res_array = new NameJavaScript[res.length];
for (int i = 0; i < res.length; i++) {
NameObject no = (NameObject) res[i];
res_array[i] = new NameJavaScript(no.getName(), (JavaScript) no.getObject());
}
return new NameJavaScriptGroup(res_array);
}
public void populate(Plot plot) { public void populate(Plot plot) {
setPlot(plot); setPlot(plot);
HashMap paneMap = getHyperlinkMap(plot);
//安装平台内打开插件时,添加相应按钮
Set<HyperlinkProvider> providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG);
for (HyperlinkProvider provider : providers) {
NameableCreator nc = provider.createHyperlinkCreator();
paneMap.put(nc.getHyperlink(), nc.getUpdatePane());
}
java.util.List<UIMenuNameableCreator> 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);
java.util.List<NameObject> nameObjects = new ArrayList<NameObject>(); java.util.List<NameObject> nameObjects = new ArrayList<NameObject>();
@ -124,7 +172,9 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane {
NameJavaScript javaScript = nameGroup.getNameHyperlink(i); NameJavaScript javaScript = nameGroup.getNameHyperlink(i);
if (javaScript != null && javaScript.getJavaScript() != null) { if (javaScript != null && javaScript.getJavaScript() != null) {
JavaScript script = javaScript.getJavaScript(); JavaScript script = javaScript.getJavaScript();
nameObjects.add(new NameObject(javaScript.getName(), script)); UIMenuNameableCreator uiMenuNameableCreator = new UIMenuNameableCreator(javaScript.getName(), script, getUseMap(paneMap, script.getClass()));
nameObjects.add(new NameObject(uiMenuNameableCreator.getName(), uiMenuNameableCreator.getObj()));
} }
} }
@ -136,6 +186,23 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane {
return plot.getHotHyperLink(); return plot.getHotHyperLink();
} }
protected HashMap getHyperlinkMap(Plot plot) {
HashMap<Class, Class> map = new HashMap<Class, Class>();
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;
}
public void update(Plot plot) { public void update(Plot plot) {
NameJavaScriptGroup nameGroup = updateNameGroup(); NameJavaScriptGroup nameGroup = updateNameGroup();
@ -162,4 +229,54 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane {
return nameGroup; return nameGroup;
} }
protected java.util.List<UIMenuNameableCreator> refreshList(HashMap map) {
java.util.List<UIMenuNameableCreator> list = new ArrayList<UIMenuNameableCreator>();
list.add(new UIMenuNameableCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Link_Reportlet"),
new ReportletHyperlink(), getUseMap(map, ReportletHyperlink.class)));
list.add(new UIMenuNameableCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Link_Mail"), new EmailJavaScript(), VanChartEmailPane.class));
list.add(new UIMenuNameableCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Link_Web"),
new WebHyperlink(), getUseMap(map, WebHyperlink.class)));
list.add(new UIMenuNameableCreator(com.fr.design.i18n.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(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Float_Chart"),
new ChartHyperPoplink(), getUseMap(map, ChartHyperPoplink.class)));
list.add(new UIMenuNameableCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Link_Cell"),
new ChartHyperRelateCellLink(), getUseMap(map, ChartHyperRelateCellLink.class)));
list.add(new UIMenuNameableCreator(com.fr.design.i18n.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(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Link_Form"),
hyperlink, getUseMap(map, FormHyperlinkProvider.class)));
return list;
}
protected Class<? extends BasicBeanPane> getUseMap(HashMap map, Object key) {
if (map.get(key) != null) {
return (Class<? extends BasicBeanPane>) map.get(key);
}
//引擎在这边放了个provider,当前表单对象
for (Object tempKey : map.keySet()) {
if (((Class) tempKey).isAssignableFrom((Class) key)) {
return (Class<? extends BasicBeanPane>) map.get(tempKey);
}
}
return null;
}
//邮箱
public static class VanChartEmailPane extends ChartEmailPane {
@Override
protected boolean needRenamePane() {
return false;
}
}
} }
Loading…
Cancel
Save