From 69ab5a54ce5c1309d31232d13c6d6a11ddb36594 Mon Sep 17 00:00:00 2001 From: neil Date: Mon, 11 Jul 2016 10:52:10 +0800 Subject: [PATCH] npe --- designer_base/src/com/fr/design/module/DesignModuleFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/module/DesignModuleFactory.java b/designer_base/src/com/fr/design/module/DesignModuleFactory.java index 1cd8c13b80..b21d206c99 100644 --- a/designer_base/src/com/fr/design/module/DesignModuleFactory.java +++ b/designer_base/src/com/fr/design/module/DesignModuleFactory.java @@ -1 +1 @@ -package com.fr.design.module; import com.fr.base.FRContext; import com.fr.base.chart.BaseChartCollection; import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.gui.chart.MiddleChartDialog; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.frpane.BaseHyperlinkGroup; import com.fr.design.gui.frpane.HyperlinkGroupType; import com.fr.design.mainframe.BaseFormDesigner; import com.fr.design.mainframe.BaseWidgetPropertyPane; import com.fr.design.parameter.HierarchyTreePane; import com.fr.design.parameter.ParameterDesignerProvider; import com.fr.design.parameter.ParameterReader; import com.fr.form.ui.Widget; import com.fr.stable.StableUtils; import java.awt.*; import java.lang.reflect.Constructor; import java.util.ArrayList; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-7-8 * Time: 下午1:57 */ public class DesignModuleFactory { private static DesignModuleFactory instance = new DesignModuleFactory(); private DesignModuleFactory() { } private HyperlinkGroupType hyperlinkGroupType = new BaseHyperlinkGroup(); private NameableCreator[] creators4Hyperlink; private WidgetOption[] extraOptions; private Class chartEditorClass; private Class chartComponentClass; private Class chartDialogClass; private Class chartPropertyPaneClass; private Class newFormAction; private Class formParaDesigner; private Class paraPropertyPane; private Class formHierarchyPaneCls; private Class chartWidgetPropertyPaneCls; private Class widgetPropertyPane; private Class buttonDetailPaneClass; private java.util.List parameterReaderList; public static void registerHyperlinkGroupType(HyperlinkGroupType hyperlinkGroupType) { instance.hyperlinkGroupType = hyperlinkGroupType; } public static HyperlinkGroupType getHyperlinkGroupType() { return instance.hyperlinkGroupType; } public static void registerCreators4Hyperlink(NameableCreator[] nameableCreators) { instance.creators4Hyperlink = nameableCreators; } public static NameableCreator[] getCreators4Hyperlink() { return instance.creators4Hyperlink; } public static void registerExtraWidgetOptions(WidgetOption[] options) { instance.extraOptions = options; } public static WidgetOption[] getExtraWidgetOptions() { return instance.extraOptions; } public static void registerChartEditorClass(Class cls) { instance.chartEditorClass = cls; } public static Class getChartEditorClass() { return instance.chartEditorClass; } public static void registerChartComponentClass(Class bcc) { instance.chartComponentClass = bcc; } public static void registerChartDialogClass(Class cd) { instance.chartDialogClass = cd; } public static void registerChartAndWidgetPropertyPane(Class p) { instance.chartWidgetPropertyPaneCls = p; } public static void registerChartPropertyPaneClass(Class p) { instance.chartPropertyPaneClass = p; } public static BaseChartPropertyPane getChartWidgetPropertyPane(BaseFormDesigner fd) { BaseChartPropertyPane p = null; if (instance.chartWidgetPropertyPaneCls != null) { p = StableUtils.getInstance(instance.chartWidgetPropertyPaneCls); p.setWidgetPropertyPane(DesignModuleFactory.getWidgetPropertyPane(fd)); p.setSureProperty(); } return p; } public static void registerNewFormActionClass(Class f) { instance.newFormAction = f; } public static Class getNewFormAction() { return instance.newFormAction; } public static void registerParaPropertyPaneClass(Class p) { instance.paraPropertyPane = p; } /** * 获取参数属性界面 * * @return 参数属性界面. */ public static Object getParaPropertyPane() { if (instance.paraPropertyPane != null) { try { return instance.paraPropertyPane.newInstance(); } catch (Exception e) { FRContext.getLogger().error("Error in Para PropertyPane"); } } return null; } public static void registerFormParaDesignerClass(Class f) { instance.formParaDesigner = f; } public static ParameterDesignerProvider getFormParaDesigner() { if (instance.formParaDesigner != null) { try { return (ParameterDesignerProvider) instance.formParaDesigner.newInstance(); } catch (Exception e) { FRContext.getLogger().error("error in form para designer"); } } return null; } public static void registerFormHierarchyPaneClass(Class fClass) { instance.formHierarchyPaneCls = fClass; } public static HierarchyTreePane getFormHierarchyPane() { return StableUtils.getInstance(instance.formHierarchyPaneCls); } public static void registerWidgetPropertyPaneClass(Class wp) { instance.widgetPropertyPane = wp; } public static BaseWidgetPropertyPane getWidgetPropertyPane(BaseFormDesigner fd) { BaseWidgetPropertyPane wp = null; if (instance.widgetPropertyPane != null) { wp = StableUtils.getInstance(instance.widgetPropertyPane); wp.setEditingFormDesigner(fd); wp.refreshDockingView(); } return wp; } public static MiddleChartComponent getChartComponent(BaseChartCollection collection) { MiddleChartComponent bcc = null; if (instance.chartComponentClass != null) { try { bcc = instance.chartComponentClass.newInstance(); bcc.populate(collection); } catch (InstantiationException e) { FRContext.getLogger().error("Error in ChartComponent instant", e); } catch (IllegalAccessException e) { FRContext.getLogger().error("Error in Access", e); } } return bcc; } /** * kunsnat: 初始化图表向导对话框, 调用静态方法showWindow, 参数window. * * @return 返回调出的ChartDailog */ public static MiddleChartDialog getChartDialog(Window window) { try { Constructor c; if (window instanceof Frame) { c = instance.chartDialogClass.getConstructor(Frame.class); } else { c = instance.chartDialogClass.getConstructor(Dialog.class); } return c.newInstance(window); } catch (Exception e) { FRContext.getLogger().error(e.getMessage(), e); } return null; } /** * kunsnat: 获取图表属性界面 * * @return 返回界面. */ public static BaseChartPropertyPane getChartPropertyPane() { BaseChartPropertyPane bp = null; if (instance.chartPropertyPaneClass != null) { bp = StableUtils.getInstance(instance.chartPropertyPaneClass); bp.setSureProperty(); } return bp; } public static void registerButtonDetailPaneClass(Class clazz) { instance.buttonDetailPaneClass = clazz; } public static Class getButtonDetailPaneClass() { return instance.buttonDetailPaneClass; } public static void registerParameterReader(ParameterReader reader) { if (instance.parameterReaderList == null) { instance.parameterReaderList = new ArrayList(); } instance.parameterReaderList.add(reader); } public static ParameterReader[] getParameterReaders() { if (instance.parameterReaderList == null) { return new ParameterReader[0]; } return instance.parameterReaderList.toArray(new ParameterReader[instance.parameterReaderList.size()]); } } \ No newline at end of file +package com.fr.design.module; import com.fr.base.FRContext; import com.fr.base.chart.BaseChartCollection; import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.gui.chart.MiddleChartDialog; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.frpane.BaseHyperlinkGroup; import com.fr.design.gui.frpane.HyperlinkGroupType; import com.fr.design.mainframe.BaseFormDesigner; import com.fr.design.mainframe.BaseWidgetPropertyPane; import com.fr.design.parameter.HierarchyTreePane; import com.fr.design.parameter.ParameterDesignerProvider; import com.fr.design.parameter.ParameterReader; import com.fr.form.ui.Widget; import com.fr.stable.StableUtils; import java.awt.*; import java.lang.reflect.Constructor; import java.util.ArrayList; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-7-8 * Time: 下午1:57 */ public class DesignModuleFactory { private static DesignModuleFactory instance = new DesignModuleFactory(); private DesignModuleFactory() { } private HyperlinkGroupType hyperlinkGroupType = new BaseHyperlinkGroup(); private NameableCreator[] creators4Hyperlink; private WidgetOption[] extraOptions; private Class chartEditorClass; private Class chartComponentClass; private Class chartDialogClass; private Class chartPropertyPaneClass; private Class newFormAction; private Class formParaDesigner; private Class paraPropertyPane; private Class formHierarchyPaneCls; private Class chartWidgetPropertyPaneCls; private Class widgetPropertyPane; private Class buttonDetailPaneClass; private java.util.List parameterReaderList; public static void registerHyperlinkGroupType(HyperlinkGroupType hyperlinkGroupType) { instance.hyperlinkGroupType = hyperlinkGroupType; } public static HyperlinkGroupType getHyperlinkGroupType() { return instance.hyperlinkGroupType; } public static void registerCreators4Hyperlink(NameableCreator[] nameableCreators) { instance.creators4Hyperlink = nameableCreators; } public static NameableCreator[] getCreators4Hyperlink() { return instance.creators4Hyperlink; } public static void registerExtraWidgetOptions(WidgetOption[] options) { instance.extraOptions = options; } public static WidgetOption[] getExtraWidgetOptions() { if (instance.extraOptions == null) { instance.extraOptions = new WidgetOption[0]; } return instance.extraOptions; } public static void registerChartEditorClass(Class cls) { instance.chartEditorClass = cls; } public static Class getChartEditorClass() { return instance.chartEditorClass; } public static void registerChartComponentClass(Class bcc) { instance.chartComponentClass = bcc; } public static void registerChartDialogClass(Class cd) { instance.chartDialogClass = cd; } public static void registerChartAndWidgetPropertyPane(Class p) { instance.chartWidgetPropertyPaneCls = p; } public static void registerChartPropertyPaneClass(Class p) { instance.chartPropertyPaneClass = p; } public static BaseChartPropertyPane getChartWidgetPropertyPane(BaseFormDesigner fd) { BaseChartPropertyPane p = null; if (instance.chartWidgetPropertyPaneCls != null) { p = StableUtils.getInstance(instance.chartWidgetPropertyPaneCls); p.setWidgetPropertyPane(DesignModuleFactory.getWidgetPropertyPane(fd)); p.setSureProperty(); } return p; } public static void registerNewFormActionClass(Class f) { instance.newFormAction = f; } public static Class getNewFormAction() { return instance.newFormAction; } public static void registerParaPropertyPaneClass(Class p) { instance.paraPropertyPane = p; } /** * 获取参数属性界面 * * @return 参数属性界面. */ public static Object getParaPropertyPane() { if (instance.paraPropertyPane != null) { try { return instance.paraPropertyPane.newInstance(); } catch (Exception e) { FRContext.getLogger().error("Error in Para PropertyPane"); } } return null; } public static void registerFormParaDesignerClass(Class f) { instance.formParaDesigner = f; } public static ParameterDesignerProvider getFormParaDesigner() { if (instance.formParaDesigner != null) { try { return (ParameterDesignerProvider) instance.formParaDesigner.newInstance(); } catch (Exception e) { FRContext.getLogger().error("error in form para designer"); } } return null; } public static void registerFormHierarchyPaneClass(Class fClass) { instance.formHierarchyPaneCls = fClass; } public static HierarchyTreePane getFormHierarchyPane() { return StableUtils.getInstance(instance.formHierarchyPaneCls); } public static void registerWidgetPropertyPaneClass(Class wp) { instance.widgetPropertyPane = wp; } public static BaseWidgetPropertyPane getWidgetPropertyPane(BaseFormDesigner fd) { BaseWidgetPropertyPane wp = null; if (instance.widgetPropertyPane != null) { wp = StableUtils.getInstance(instance.widgetPropertyPane); wp.setEditingFormDesigner(fd); wp.refreshDockingView(); } return wp; } public static MiddleChartComponent getChartComponent(BaseChartCollection collection) { MiddleChartComponent bcc = null; if (instance.chartComponentClass != null) { try { bcc = instance.chartComponentClass.newInstance(); bcc.populate(collection); } catch (InstantiationException e) { FRContext.getLogger().error("Error in ChartComponent instant", e); } catch (IllegalAccessException e) { FRContext.getLogger().error("Error in Access", e); } } return bcc; } /** * kunsnat: 初始化图表向导对话框, 调用静态方法showWindow, 参数window. * * @return 返回调出的ChartDailog */ public static MiddleChartDialog getChartDialog(Window window) { try { Constructor c; if (window instanceof Frame) { c = instance.chartDialogClass.getConstructor(Frame.class); } else { c = instance.chartDialogClass.getConstructor(Dialog.class); } return c.newInstance(window); } catch (Exception e) { FRContext.getLogger().error(e.getMessage(), e); } return null; } /** * kunsnat: 获取图表属性界面 * * @return 返回界面. */ public static BaseChartPropertyPane getChartPropertyPane() { BaseChartPropertyPane bp = null; if (instance.chartPropertyPaneClass != null) { bp = StableUtils.getInstance(instance.chartPropertyPaneClass); bp.setSureProperty(); } return bp; } public static void registerButtonDetailPaneClass(Class clazz) { instance.buttonDetailPaneClass = clazz; } public static Class getButtonDetailPaneClass() { return instance.buttonDetailPaneClass; } public static void registerParameterReader(ParameterReader reader) { if (instance.parameterReaderList == null) { instance.parameterReaderList = new ArrayList(); } instance.parameterReaderList.add(reader); } public static ParameterReader[] getParameterReaders() { if (instance.parameterReaderList == null) { return new ParameterReader[0]; } return instance.parameterReaderList.toArray(new ParameterReader[instance.parameterReaderList.size()]); } } \ No newline at end of file