diff --git a/designer-base/src/main/java/com/fr/design/fun/HyperlinkProvider.java b/designer-base/src/main/java/com/fr/design/fun/HyperlinkProvider.java index 448a120fea..9b58b96898 100644 --- a/designer-base/src/main/java/com/fr/design/fun/HyperlinkProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/HyperlinkProvider.java @@ -1,21 +1,44 @@ package com.fr.design.fun; +import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.controlpane.NameableCreator; -import com.fr.stable.fun.Level; +import com.fr.js.Hyperlink; import com.fr.stable.fun.mark.Mutable; /** * Created by zack on 2016/1/20. */ -public interface HyperlinkProvider extends Mutable { +public interface HyperlinkProvider extends Mutable { String XML_TAG = "HyperlinkProvider"; int CURRENT_LEVEL = 2; /** - * 创建一个超级连接类型 - * @return NameableCreator + * 超级链接的描述信息,如果是实现类中重载了这个方法,就不需要再实现下面的三个方法: + * @see HyperlinkProvider#text() + * @see HyperlinkProvider#target() + * @see HyperlinkProvider#appearance() + * 如果并不重载,就需要分别实现上面的三个方法,不推荐重载这个方法 + * @return 描述信息 */ NameableCreator createHyperlinkCreator(); + + /** + * 超级链接的名字 + * @return 名字 + */ + String text(); + + /** + * 超级链接的实现类 + * @return 实现类 + */ + Class target(); + + /** + * 超级链接的界面配置类 + * @return 配置类 + */ + Class> appearance(); } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/fun/JavaScriptActionProvider.java b/designer-base/src/main/java/com/fr/design/fun/JavaScriptActionProvider.java index 754bdaeb4a..5f1f1aa5aa 100644 --- a/designer-base/src/main/java/com/fr/design/fun/JavaScriptActionProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/JavaScriptActionProvider.java @@ -2,11 +2,12 @@ package com.fr.design.fun; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.javascript.JavaScriptActionPane; +import com.fr.design.mainframe.JTemplate; import com.fr.js.JavaScript; import com.fr.stable.fun.mark.Mutable; /** - * Created by zack on 2015/8/14. + * 控件的事件扩展接口 */ public interface JavaScriptActionProvider extends Mutable{ @@ -14,10 +15,21 @@ public interface JavaScriptActionProvider extends Mutable{ int CURRENT_LEVEL = 1; + /** + * 事件的界面 + */ FurtherBasicBeanPane getJavaScriptActionPane(); + /** + * 这个界面在哪些类型模板设计的时候会出现 + * @see com.fr.design.mainframe.JWorkBook + * @see com.fr.design.mainframe.JForm + */ + boolean accept(JTemplate template); + + @Deprecated FurtherBasicBeanPane getJavaScriptActionPane(JavaScriptActionPane pane); + @Deprecated boolean isSupportType(); - } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractHyperlinkProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractHyperlinkProvider.java index bc5d5115a8..9c74795d8e 100644 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractHyperlinkProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractHyperlinkProvider.java @@ -1,6 +1,10 @@ package com.fr.design.fun.impl; +import com.fr.design.beans.BasicBeanPane; import com.fr.design.fun.HyperlinkProvider; +import com.fr.design.gui.controlpane.NameObjectCreator; +import com.fr.design.gui.controlpane.NameableCreator; +import com.fr.stable.StringUtils; import com.fr.stable.fun.impl.AbstractProvider; import com.fr.stable.fun.mark.API; @@ -18,4 +22,24 @@ public abstract class AbstractHyperlinkProvider extends AbstractProvider impleme public String mark4Provider() { return getClass().getName(); } + + @Override + public NameableCreator createHyperlinkCreator() { + return new NameObjectCreator(text(), target(), appearance()); + } + + @Override + public String text() { + return StringUtils.EMPTY; + } + + @Override + public Class target() { + return null; + } + + @Override + public Class appearance() { + return null; + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractJavaScriptActionProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractJavaScriptActionProvider.java index 4640eaf4fa..7f57f35a5d 100644 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractJavaScriptActionProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractJavaScriptActionProvider.java @@ -3,6 +3,8 @@ package com.fr.design.fun.impl; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.fun.JavaScriptActionProvider; import com.fr.design.javascript.JavaScriptActionPane; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; import com.fr.js.JavaScript; import com.fr.stable.fun.impl.AbstractProvider; import com.fr.stable.fun.mark.API; @@ -27,10 +29,16 @@ public abstract class AbstractJavaScriptActionProvider extends AbstractProvider return getJavaScriptActionPane(); } - /** - * 判断是否是支持的类型(cpt,frm),默认是 - * @return - */ + @Override + public boolean accept(JTemplate template) { + // 这里只是为了兼容原来的isSupportType方法 + boolean result = isSupportType(); + if (result) { + return true; + } + return true; + } + @Override public boolean isSupportType(){ return true; diff --git a/designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java b/designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java index 05208762e3..3b025ae1fa 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java @@ -7,6 +7,7 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.fun.JavaScriptActionProvider; import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.write.submit.DBManipulationPane; import com.fr.form.ui.WebContentUtils; import com.fr.js.JavaScript; @@ -45,7 +46,7 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane { Set javaScriptActionProviders = ExtraDesignClassManager.getInstance().getArray(JavaScriptActionProvider.XML_TAG); if (javaScriptActionProviders != null) { for (JavaScriptActionProvider jsp : javaScriptActionProviders) { - if(jsp.isSupportType()){ + if(jsp.accept(DesignerContext.getDesignerFrame().getSelectedJTemplate())){ paneList.add(jsp.getJavaScriptActionPane(this)); } } diff --git a/designer-base/src/main/java/com/fr/start/ServerStarter.java b/designer-base/src/main/java/com/fr/start/ServerStarter.java index 3115730d17..6d20cf12a5 100644 --- a/designer-base/src/main/java/com/fr/start/ServerStarter.java +++ b/designer-base/src/main/java/com/fr/start/ServerStarter.java @@ -5,18 +5,11 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.utils.BrowseUtils; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; -import com.fr.log.FineLoggerFactory; -import com.fr.stable.OperatingSystem; import com.fr.stable.StableUtils; import com.fr.start.server.FineEmbedServer; import com.fr.start.server.FineEmbedServerMonitor; import com.fr.workspace.WorkContext; -import javax.swing.JOptionPane; -import java.awt.Desktop; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -66,7 +59,11 @@ public class ServerStarter { @Override public void run() { - FineEmbedServer.start(); + try { + FineEmbedServer.start(); + } finally { + FineEmbedServerMonitor.getInstance().setComplete(); + } BrowseUtils.browser(url); } }); diff --git a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java index 982b3633dc..2d08b286d5 100644 --- a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java +++ b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java @@ -49,7 +49,7 @@ public class FineEmbedServerActivator extends Activator { stopSpring(); stopServerActivator(); stopTomcat(); - } catch (LifecycleException e) { + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } diff --git a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java index 154f4c0976..3a8abb56e5 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -121,12 +121,17 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr return classManager; } - + static { readDefault(); readVanChart(); PluginModule.registerAgent(PluginModule.ExtraChartDesign, classManager); + } + + //安装插件,图表类型热更新。 + //不在static原因:放在static,启动过程中图表插件init也会触发(不需要) + public static void addPluginChangedListener() { GeneralContext.listenPluginRunningChanged(new PluginEventListener() { @Override @@ -151,42 +156,21 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; - final Chart[][] allCharts = new Chart[typeName.length][]; - for (int i = 0; i < typeName.length; i++) { - String plotID = typeName[i].getPlotID(); + int index = 0; + for (ChartInternationalNameContentBean bean : typeName) { + String plotID = bean.getPlotID(); Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); - if (ArrayUtils.isEmpty(rowChart)) { + if (ArrayUtils.isEmpty(rowChart) && !ChartTypeManager.innerChart(plotID)) { continue; } String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); Icon icon = IOUtils.readIcon(iconPath); - child[i] = new ChartWidgetOption(com.fr.design.i18n.Toolkit.i18nText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); - - allCharts[i] = rowChart; + child[index] = new ChartWidgetOption(com.fr.design.i18n.Toolkit.i18nText(bean.getName()), icon, ChartEditor.class, plotID); + index++; } return child; } - - //加载所有图表图片 - private static void initAllChartsDemoImage(Chart[][] allCharts) { - - for (Chart[] rowChart : allCharts) { - if (rowChart == null) { - continue; - } - //加载初始化图表模型图片 - initChartsDemoImage(rowChart); - } - } - - private static void initChartsDemoImage(Chart[] rowChart) { - - for (Chart aRowChart : rowChart) { - //此时,为图片生成模型数据 - aRowChart.createSlotImage(); - } - } private static void readVanChart() { @@ -252,7 +236,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr } } - private static IndependentChartUIProvider getChartTypeInterface(String plotID) { + private IndependentChartUIProvider getChartTypeInterface(String plotID) { if (idAndPriorityMap.containsKey(plotID)) { String priority = idAndPriorityMap.get(plotID); if (chartTypeInterfaces.containsKey(priority)) { @@ -303,7 +287,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr } } - private static String getChartName(String plotID, IndependentChartUIProvider provider) { + private String getChartName(String plotID, IndependentChartUIProvider provider) { String name = provider.getPlotTypeTitle4PopupWindow(); if (StringUtils.isEmpty(name)) { name = ChartTypeManager.getInstance().getChartName(plotID); diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java index de7e5ec8a4..c3213c10ba 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java @@ -52,6 +52,8 @@ public class ChartDesignerActivator extends Activator implements Prepare { DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance()); DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); + + ChartTypeInterfaceManager.addPluginChangedListener(); } @Override diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java index b4efa05a4f..5cc3c8d50c 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java @@ -15,25 +15,32 @@ import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; - import com.fr.license.exception.RegistEditionException; import com.fr.license.function.VT4FR; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.DefaultListCellRenderer; +import javax.swing.DefaultListModel; +import javax.swing.JList; +import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import javax.swing.JSplitPane; +import javax.swing.ListCellRenderer; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -import java.awt.*; +import java.awt.Color; +import java.awt.Component; public class ChartTypePane extends ChartCommonWizardPane { private static final long serialVersionUID = -1175602484968520546L; - private ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); + private ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstanceWithCheck().getAllChartBaseNames(); private Chart[][] charts4Icon = null; { charts4Icon = new Chart[this.typeName.length][]; for (int i = 0; i < this.typeName.length; i++) { - Chart[] rowCharts = ChartTypeManager.getInstance().getChartTypes(this.typeName[i].getPlotID()); + Chart[] rowCharts = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.typeName[i].getPlotID()); int rowChartsCount = rowCharts.length; charts4Icon[i] = new Chart[rowChartsCount]; for (int j = 0; j < rowChartsCount; j++) { @@ -137,7 +144,7 @@ public class ChartTypePane extends ChartCommonWizardPane { int subIndex = 0; for (int i = 0; i < typeName.length; i++) { - Chart [] charts = ChartTypeManager.getInstance().getChartTypes(typeName[i].getPlotID()); + Chart[] charts = ChartTypeManager.getInstanceWithCheck().getChartTypes(typeName[i].getPlotID()); for (int j = 0; j < charts.length; j++) { if (charts[j].getPlot().match4GUI(plot)) { mainIndex = i; @@ -154,7 +161,7 @@ public class ChartTypePane extends ChartCommonWizardPane { public void update(Chart oldChart) { String plotID = typeName[mainTypeList.getSelectedIndex()].getPlotID(); - Chart chart = ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()]; + Chart chart = ChartTypeManager.getInstanceWithCheck().getChartTypes(plotID)[iconViewList.getSelectedIndex()]; if(chart.getPlot() != null){ if(chart.getPlot() instanceof MapPlot && !supportMap()){ JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Not_Supported")); diff --git a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java index c87a7a8ed4..783bfdd6a6 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java +++ b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java @@ -2,11 +2,12 @@ package com.fr.design.chart.gui; import com.fr.base.FRContext; import com.fr.chart.chartattr.Chart; +import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.gui.core.WidgetOption; import com.fr.form.ui.ChartEditor; import com.fr.form.ui.Widget; -import javax.swing.*; +import javax.swing.Icon; /** * 表单中 图表控件信息, 名称, class, form中通过XcreatorUtils反射类 实现XChartEditor的初始化. @@ -19,13 +20,13 @@ public class ChartWidgetOption extends WidgetOption { private String optionName; private Icon optionIcon; private Class widgetClass; - private Chart chart; + private String chartID; - public ChartWidgetOption(String optionName, Icon optionIcon, Class widgetClass, Chart chart) { + public ChartWidgetOption(String optionName, Icon optionIcon, Class widgetClass, String chartID) { this.optionName = optionName; this.optionIcon = optionIcon; this.widgetClass = widgetClass; - this.chart = chart; + this.chartID = chartID; } /** @@ -37,6 +38,7 @@ public class ChartWidgetOption extends WidgetOption { Class clz = widgetClass(); try { ChartEditor widget = clz.newInstance(); + Chart chart = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.chartID)[0]; widget.addChart((Chart) chart.clone()); return widget; } catch (InstantiationException e) { diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java index f66bc11617..c3db9b7ef3 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java @@ -15,8 +15,8 @@ import com.fr.design.module.DesignModuleFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; - -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Dimension; import java.util.HashMap; /** @@ -66,7 +66,7 @@ public class ChartHyperPoplinkPane extends AbstractHyperLinkPane