From 272fa2236e105e72be45dabecf5ea7fe10444bf3 Mon Sep 17 00:00:00 2001 From: eason-skx Date: Thu, 28 Jul 2016 15:11:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?exe=E5=90=AF=E5=8A=A8=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E8=A2=AB=E7=A6=81=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 500ece8b45..dd272644a1 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -5,6 +5,7 @@ import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chart.charttypes.ChartTypeManager; +import com.fr.chart.fun.IndependentChartProvider; import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.chart.fun.IndependentChartUIProvider; @@ -58,7 +59,6 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh if (classManager == null) { classManager = new ChartTypeInterfaceManager(); chartTypeInterfaces.clear(); - classManager.readXMLFile(); } return classManager; } @@ -75,11 +75,9 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh GeneralContext.addPluginReadListener(new PluginReadListener() { @Override public void success() { - if (chartTypeInterfaces != null) { - readDefault(); - //重新注册designModuleFactory - DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption()); - } + ChartTypeInterfaceManager.getInstance().readDefault(); + //重新注册designModuleFactory + DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption()); } }); } @@ -101,7 +99,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh } private synchronized static void envChanged() { - chartTypeInterfaces.clear(); + classManager = null; } private static void readDefault() { @@ -132,6 +130,12 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh } } + public static void addChartTypeInterface(IndependentChartUIProvider provider, String plotID) { + if (chartTypeInterfaces != null && !chartTypeInterfaces.containsKey(plotID)) { + chartTypeInterfaces.put(plotID, provider); + } + } + /** * 增加界面接口定义 * @@ -141,7 +145,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh public void addChartInterface(String className, String plotID, PluginSimplify simplify) { if (StringUtils.isNotBlank(className)) { try { - Class clazz = loader.loadClass(className); + Class clazz = Class.forName(className); Authorize authorize = clazz.getAnnotation(Authorize.class); if (authorize != null) { PluginLicenseManager.getInstance().registerPaid(authorize, simplify); @@ -149,8 +153,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh IndependentChartUIProvider provider = (IndependentChartUIProvider) clazz.newInstance(); if (PluginCollector.getCollector().isError(provider, IndependentChartUIProvider.CURRENT_API_LEVEL, simplify.getPluginName()) || !containsChart(plotID)) { PluginMessage.remindUpdate(className); - } else if (!chartTypeInterfaces.containsKey(plotID)) { - chartTypeInterfaces.put(plotID, provider); + } else { + ChartTypeInterfaceManager.getInstance().addChartTypeInterface(provider, plotID); } } catch (ClassNotFoundException e) { FRLogger.getLogger().error("class not found:" + e.getMessage()); From f85be59351daeb78e9781df5bdba2e70214c5b7e Mon Sep 17 00:00:00 2001 From: eason-skx Date: Thu, 28 Jul 2016 15:21:11 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=A9=BAimport?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index dd272644a1..64a4d18084 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -5,7 +5,6 @@ import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chart.charttypes.ChartTypeManager; -import com.fr.chart.fun.IndependentChartProvider; import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.chart.fun.IndependentChartUIProvider;