diff --git a/designer/src/com/fr/design/mainframe/CellElementPropertyPane.java b/designer/src/com/fr/design/mainframe/CellElementPropertyPane.java index 27e7e22ced..55235c5c98 100644 --- a/designer/src/com/fr/design/mainframe/CellElementPropertyPane.java +++ b/designer/src/com/fr/design/mainframe/CellElementPropertyPane.java @@ -3,17 +3,7 @@ */ package com.fr.design.mainframe; -import java.awt.BorderLayout; -import java.awt.Dimension; - -import javax.swing.BorderFactory; -import javax.swing.Icon; -import javax.swing.JPanel; -import javax.swing.SwingConstants; - import com.fr.base.BaseUtils; -import com.fr.design.fun.CellAttributeProvider; -import com.fr.design.fun.PresentKindProvider; import com.fr.design.gui.frpane.UITitlePanel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itabpane.TitleChangeListener; @@ -32,6 +22,9 @@ import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.Elem; import com.fr.report.elementcase.TemplateElementCase; +import javax.swing.*; +import java.awt.*; + /** * 所有组件一次全部加载,不存在延迟加载。 原因:设计器打开第一张模板的时候,会初始化许多许多东西。这个过程需要很长时间(快的3-5s)。 @@ -50,7 +43,7 @@ public class CellElementPropertyPane extends DockingView { public void on(PluginEvent event) { synchronized (CellElementPropertyPane.class) { - singleton = new CellElementPropertyPane(); + singleton = null; } } }, new PluginFilter() { @@ -58,13 +51,11 @@ public class CellElementPropertyPane extends DockingView { @Override public boolean accept(PluginContext context) { - return context.contain(PluginModule.ExtraDesign, PresentKindProvider.MARK_STRING) || - context.contain(PluginModule.ExtraDesign, CellAttributeProvider.MARK_STRING); + return context.contain(PluginModule.ExtraDesign); } }); } - public synchronized static CellElementPropertyPane getInstance() { if (singleton == null) { singleton = new CellElementPropertyPane(); diff --git a/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java b/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java index 1507d77b5a..a781497ebc 100644 --- a/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java @@ -14,7 +14,6 @@ import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.fun.TableDataDefineProvider; import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icontainer.UIScrollPane; @@ -100,8 +99,8 @@ public class TableDataTreePane extends BasicTableDataTreePane { @Override public boolean accept(PluginContext context) { - - return context.contain(PluginModule.ExtraDesign, TableDataDefineProvider.XML_TAG); + + return context.contain(PluginModule.ExtraDesign); } }); diff --git a/designer_base/src/com/fr/design/data/tabledata/wrapper/TableDataFactory.java b/designer_base/src/com/fr/design/data/tabledata/wrapper/TableDataFactory.java index ca118df761..ae74667532 100644 --- a/designer_base/src/com/fr/design/data/tabledata/wrapper/TableDataFactory.java +++ b/designer_base/src/com/fr/design/data/tabledata/wrapper/TableDataFactory.java @@ -26,23 +26,24 @@ public abstract class TableDataFactory { /** * 有顺序的,用来排序用 */ - private static Map map = new java.util.LinkedHashMap(); + private static Map map = new java.util.LinkedHashMap<>(); - private static Map extraMap = new LinkedHashMap<>(); + private static Map defaultMap = new LinkedHashMap<>(); /** * 同一类型的只能加一次,就加最上层的类,因为要排序。如果将所有的 FileTableData都加进来,那么FileTableData的排序就不正确了 */ static { - map.put(DBTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/database.png", DBTableData.class, DBTableDataPane.class)); - map.put(ClassTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/source/classTableData.png", ClassTableData.class, ClassTableDataPane.class)); - map.put(EmbeddedTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/dataTable.png", EmbeddedTableData.class, EmbeddedTableDataPane.class)); - map.put(DecoratedTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/multi.png", DecoratedTableData.class, DecoratedTableDataPane.class)); - map.put(StoreProcedure.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/store_procedure.png", StoreProcedure.class, ProcedureDataPane.class)); - map.put(MultiTDTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/multi.png", MultiTDTableData.class, MultiTDTableDataPane.class)); - map.put(FileTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/file.png", FileTableData.class, FileTableDataPane.class)); - map.put(RecursionTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/tree.png", RecursionTableData.class, TreeTableDataPane.class)); - map.put(MultiFieldTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/database.png", MultiFieldTableData.class, null)); + defaultMap.put(DBTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/database.png", DBTableData.class, DBTableDataPane.class)); + defaultMap.put(ClassTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/source/classTableData.png", ClassTableData.class, ClassTableDataPane.class)); + defaultMap.put(EmbeddedTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/dataTable.png", EmbeddedTableData.class, EmbeddedTableDataPane.class)); + defaultMap.put(DecoratedTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/multi.png", DecoratedTableData.class, DecoratedTableDataPane.class)); + defaultMap.put(StoreProcedure.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/store_procedure.png", StoreProcedure.class, ProcedureDataPane.class)); + defaultMap.put(MultiTDTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/multi.png", MultiTDTableData.class, MultiTDTableDataPane.class)); + defaultMap.put(FileTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/file.png", FileTableData.class, FileTableDataPane.class)); + defaultMap.put(RecursionTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/tree.png", RecursionTableData.class, TreeTableDataPane.class)); + defaultMap.put(MultiFieldTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/database.png", MultiFieldTableData.class, null)); + map.putAll(defaultMap); } /** @@ -53,24 +54,20 @@ public abstract class TableDataFactory { */ public static void registerExtra(Class clazz, TableDataNameObjectCreator creator) { - extraMap.put(clazz.getName(), creator); + map.put(clazz.getName(), creator); } public static void removeExtra(Class clazz) { - - extraMap.remove(clazz.getName()); - } - private static TableDataNameObjectCreator getTableDataNameObjectCreator(TableData tabledata) { - - TableDataNameObjectCreator creator = getFrom(tabledata, extraMap); - if (creator == null) { - creator = getFrom(tabledata, map); + String name = clazz.getName(); + if (defaultMap.containsKey(name)) { + map.put(name, defaultMap.get(name)); + } else { + map.remove(name); } - return creator; } - private static TableDataNameObjectCreator getFrom(TableData tabledata, Map map) { + private static TableDataNameObjectCreator getTableDataNameObjectCreator(TableData tabledata) { TableDataNameObjectCreator tableDataNameObjectCreator = map.get(tabledata.getClass().getName()); if (tableDataNameObjectCreator == null) { @@ -83,6 +80,7 @@ public abstract class TableDataFactory { return tableDataNameObjectCreator; } + /** * 获取数据集所对应的编辑面板 * diff --git a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java index 717674f223..737fdcab27 100644 --- a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java +++ b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java @@ -27,6 +27,7 @@ import com.fr.design.mainframe.loghandler.LogMessageBar; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.menu.MenuManager; +import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.file.FILE; import com.fr.file.FILEFactory; @@ -37,6 +38,7 @@ import com.fr.general.FRLogger; import com.fr.general.GeneralContext; import com.fr.general.Inter; import com.fr.plugin.context.PluginContext; +import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; @@ -171,15 +173,15 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta basePane.add(menuPane, BorderLayout.NORTH); this.resetToolkitByPlus(null); } - - /** - * @param ad - * @return - */ - protected JPanel initNorthEastPane(final ToolBarMenuDock ad){ - //hugh: private修改为protected方便oem的时候修改右上的组件构成 - //顶部日志+登陆按钮 - final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + + /** + * @param ad + * @return + */ + protected JPanel initNorthEastPane(final ToolBarMenuDock ad) { + //hugh: private修改为protected方便oem的时候修改右上的组件构成 + //顶部日志+登陆按钮 + final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); GeneralContext.listenPluginRunningChanged(new PluginEventListener() { @@ -187,13 +189,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta public void on(PluginEvent event) { refreshNorthEastPane(northEastPane, ad); + DesignUtils.refreshDesignerFrame(FRContext.getCurrentEnv()); } }, new PluginFilter() { @Override public boolean accept(PluginContext context) { - - return context.contain(TitlePlaceProcessor.MARK_STRING); + + return context.contain(PluginModule.ExtraDesign); } }); refreshNorthEastPane(northEastPane, ad); @@ -662,19 +665,20 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta GUICoreUtils.setWindowFullScreen(this); } } - - /** - * 报表运行环境改变时,需要刷新某些面板 - * - * @param env - * 环境 - */ - public void refreshEnv(Env env) { - this.setTitle(); - DesignerFrameFileDealerPane.getInstance().refreshDockingView(); - TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); - TemplateTreePane.getInstance().refreshDockingView(); - DesignTableDataManager.clearGlobalDs(); + + + /** + * 报表运行环境改变时,需要刷新某些面板 + * + * @param env 环境 + */ + public void refreshEnv(Env env) { + + this.setTitle(); + DesignerFrameFileDealerPane.getInstance().refreshDockingView(); + TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); + TemplateTreePane.getInstance().refreshDockingView(); + DesignTableDataManager.clearGlobalDs(); EastRegionContainerPane.getInstance().refreshDownPane(); } diff --git a/designer_base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer_base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 60f5067f11..89901ac540 100644 --- a/designer_base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer_base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -60,7 +60,8 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt private OpenFolderAction openFolderAction = new OpenFolderAction(); private RenameAction renameAction = new RenameAction(); private DelFileAction delFileAction = new DelFileAction(); - + + /** * 刷新 */ diff --git a/designer_base/src/com/fr/design/mainframe/WestRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/WestRegionContainerPane.java index e2a6d64d53..f0b646808a 100644 --- a/designer_base/src/com/fr/design/mainframe/WestRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/WestRegionContainerPane.java @@ -3,10 +3,10 @@ package com.fr.design.mainframe; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignerEnvManager; import com.fr.design.data.datapane.TableDataTreePane; -import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.gui.icontainer.UIResizableContainer; import com.fr.general.GeneralContext; import com.fr.plugin.context.PluginContext; +import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; @@ -45,8 +45,8 @@ public class WestRegionContainerPane extends UIResizableContainer { @Override public boolean accept(PluginContext context) { - - return context.contain(TableDataPaneProcessor.XML_TAG); + + return context.contain(PluginModule.ExtraDesign); } }); diff --git a/designer_base/src/com/fr/design/utils/DesignUtils.java b/designer_base/src/com/fr/design/utils/DesignUtils.java index 8ed8aa6175..82a8f6b535 100644 --- a/designer_base/src/com/fr/design/utils/DesignUtils.java +++ b/designer_base/src/com/fr/design/utils/DesignUtils.java @@ -181,9 +181,18 @@ public class DesignUtils { // 更新CurrentEnv于FRContext & DesignerEnvManager FRContext.setCurrentEnv(env); - + + refreshDesignerFrame(env); + // 当换了运行环境,重置服务器,让它下次预览时重启 + if (env instanceof LocalEnv && !ComparatorUtils.equals(env.getPath(), oldEnvPath)) { + StartServer.currentEnvChanged(); + } + } + + public static void refreshDesignerFrame(Env env) { + final Env run_env = env; - + // 刷新DesignerFrame里面的面板 SwingUtilities.invokeLater(new Runnable() { @@ -195,12 +204,8 @@ public class DesignUtils { DesignerContext.getDesignerFrame().repaint();// kunsnat: 切换环境后 刷新下 报表. 比如图表某些风格改变. } }); - // 当换了运行环境,重置服务器,让它下次预览时重启 - if (env instanceof LocalEnv && !ComparatorUtils.equals(env.getPath(), oldEnvPath)) { - StartServer.currentEnvChanged(); - } } - + /** * p:初始化look and feel, 把一切放到这个里面.可以让多个地方调用. */ diff --git a/designer_form/src/com/fr/design/mainframe/FormParaPane.java b/designer_form/src/com/fr/design/mainframe/FormParaPane.java index 732d5632ec..755deec3b0 100644 --- a/designer_form/src/com/fr/design/mainframe/FormParaPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormParaPane.java @@ -3,20 +3,13 @@ package com.fr.design.mainframe; import com.fr.design.ExtraDesignClassManager; import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreatorUtils; -import com.fr.design.fun.CellWidgetOptionProvider; import com.fr.design.gui.core.UserDefinedWidgetOption; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.*; -import com.fr.general.GeneralContext; import com.fr.general.Inter; -import com.fr.plugin.context.PluginContext; -import com.fr.plugin.injectable.PluginModule; -import com.fr.plugin.manage.PluginFilter; -import com.fr.plugin.observer.PluginEvent; -import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.ArrayUtils; import javax.swing.*; @@ -50,24 +43,6 @@ public class FormParaPane extends JPanel { private FormDesigner designer; - static { - GeneralContext.listenPluginRunningChanged(new PluginEventListener() { - - @Override - public void on(PluginEvent event) { - - THIS = null; - } - }, new PluginFilter() { - - @Override - public boolean accept(PluginContext context) { - - return context.contain(PluginModule.ExtraDesign, CellWidgetOptionProvider.XML_TAG); - } - }); - } - public static final FormParaPane getInstance(FormDesigner designer) { if(THIS == null) { THIS = new FormParaPane(); diff --git a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java index c3855c3c9c..10d90d4cad 100644 --- a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java @@ -6,7 +6,6 @@ import com.fr.design.constants.UIConstants; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreatorUtils; -import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.gui.core.FormWidgetOption; import com.fr.design.gui.core.UserDefinedWidgetOption; import com.fr.design.gui.core.WidgetOption; @@ -17,13 +16,7 @@ import com.fr.design.module.DesignModuleFactory; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.*; import com.fr.general.ComparatorUtils; -import com.fr.general.GeneralContext; import com.fr.general.Inter; -import com.fr.plugin.context.PluginContext; -import com.fr.plugin.injectable.PluginModule; -import com.fr.plugin.manage.PluginFilter; -import com.fr.plugin.observer.PluginEvent; -import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.ArrayUtils; import javax.swing.*; @@ -63,26 +56,6 @@ public class FormParaWidgetPane extends JPanel { private FormDesigner designer; - static { - GeneralContext.listenPluginRunningChanged(new PluginEventListener() { - - @Override - public void on(PluginEvent event) { - - synchronized (FormParaWidgetPane.class) { - THIS = null; - } - } - }, new PluginFilter() { - - @Override - public boolean accept(PluginContext context) { - - return context.contain(PluginModule.ExtraDesign, FormWidgetOptionProvider.XML_TAG); - } - }); - } - public static synchronized final FormParaWidgetPane getInstance(FormDesigner designer) { if (THIS == null) { THIS = new FormParaWidgetPane();