Browse Source

Merge pull request #971 in BA/design from ~JU/ba-9.0-design:9.0 to 9.0

* commit 'db6d3f36f81f3827f9058cfb5812dd9fb36debc6':
  PFC-607 插件安装删除更新不重启支持 fix
  PFC-607 插件安装删除更新不重启支持 1、修复bug 2、复用之前切换环境时设计器调整的代码,每次设计器插件变动时刷新
  PFC-607 插件安装删除更新不重启支持 1、修复bug 2、复用之前切换环境时设计器调整的代码,每次设计器插件变动时刷新
  PFC-607 插件安装删除更新不重启支持 1、修复bug 2、复用之前切换环境时设计器调整的代码,每次设计器插件变动时刷新
  PFC-607 插件安装删除更新不重启支持 修复已发现的问题
master
superman 8 years ago
parent
commit
858ce7d49e
  1. 19
      designer/src/com/fr/design/mainframe/CellElementPropertyPane.java
  2. 5
      designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java
  3. 42
      designer_base/src/com/fr/design/data/tabledata/wrapper/TableDataFactory.java
  4. 52
      designer_base/src/com/fr/design/mainframe/DesignerFrame.java
  5. 3
      designer_base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  6. 6
      designer_base/src/com/fr/design/mainframe/WestRegionContainerPane.java
  7. 19
      designer_base/src/com/fr/design/utils/DesignUtils.java
  8. 25
      designer_form/src/com/fr/design/mainframe/FormParaPane.java
  9. 27
      designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java

19
designer/src/com/fr/design/mainframe/CellElementPropertyPane.java

@ -3,17 +3,7 @@
*/ */
package com.fr.design.mainframe; 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.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.frpane.UITitlePanel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itabpane.TitleChangeListener; 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.cell.Elem;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import javax.swing.*;
import java.awt.*;
/** /**
* 所有组件一次全部加载不存在延迟加载 原因设计器打开第一张模板的时候会初始化许多许多东西这个过程需要很长时间快的3-5s * 所有组件一次全部加载不存在延迟加载 原因设计器打开第一张模板的时候会初始化许多许多东西这个过程需要很长时间快的3-5s
@ -50,7 +43,7 @@ public class CellElementPropertyPane extends DockingView {
public void on(PluginEvent event) { public void on(PluginEvent event) {
synchronized (CellElementPropertyPane.class) { synchronized (CellElementPropertyPane.class) {
singleton = new CellElementPropertyPane(); singleton = null;
} }
} }
}, new PluginFilter() { }, new PluginFilter() {
@ -58,13 +51,11 @@ public class CellElementPropertyPane extends DockingView {
@Override @Override
public boolean accept(PluginContext context) { public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, PresentKindProvider.MARK_STRING) || return context.contain(PluginModule.ExtraDesign);
context.contain(PluginModule.ExtraDesign, CellAttributeProvider.MARK_STRING);
} }
}); });
} }
public synchronized static CellElementPropertyPane getInstance() { public synchronized static CellElementPropertyPane getInstance() {
if (singleton == null) { if (singleton == null) {
singleton = new CellElementPropertyPane(); singleton = new CellElementPropertyPane();

5
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.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.fun.TableDataDefineProvider;
import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
@ -100,8 +99,8 @@ public class TableDataTreePane extends BasicTableDataTreePane {
@Override @Override
public boolean accept(PluginContext context) { public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, TableDataDefineProvider.XML_TAG); return context.contain(PluginModule.ExtraDesign);
} }
}); });

42
designer_base/src/com/fr/design/data/tabledata/wrapper/TableDataFactory.java

@ -26,23 +26,24 @@ public abstract class TableDataFactory {
/** /**
* 有顺序的,用来排序用 * 有顺序的,用来排序用
*/ */
private static Map<String, TableDataNameObjectCreator> map = new java.util.LinkedHashMap<String, TableDataNameObjectCreator>(); private static Map<String, TableDataNameObjectCreator> map = new java.util.LinkedHashMap<>();
private static Map<String, TableDataNameObjectCreator> extraMap = new LinkedHashMap<>(); private static Map<String, TableDataNameObjectCreator> defaultMap = new LinkedHashMap<>();
/** /**
* 同一类型的只能加一次,就加最上层的类,因为要排序如果将所有的 FileTableData都加进来那么FileTableData的排序就不正确了 * 同一类型的只能加一次,就加最上层的类,因为要排序如果将所有的 FileTableData都加进来那么FileTableData的排序就不正确了
*/ */
static { static {
map.put(DBTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/database.png", DBTableData.class, DBTableDataPane.class)); defaultMap.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)); defaultMap.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)); defaultMap.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)); defaultMap.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)); defaultMap.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)); defaultMap.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)); defaultMap.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)); defaultMap.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(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<? extends TableData> clazz, TableDataNameObjectCreator creator) { public static void registerExtra(Class<? extends TableData> clazz, TableDataNameObjectCreator creator) {
extraMap.put(clazz.getName(), creator); map.put(clazz.getName(), creator);
} }
public static void removeExtra(Class<? extends TableData> clazz) { public static void removeExtra(Class<? extends TableData> clazz) {
extraMap.remove(clazz.getName());
}
private static TableDataNameObjectCreator getTableDataNameObjectCreator(TableData tabledata) { String name = clazz.getName();
if (defaultMap.containsKey(name)) {
TableDataNameObjectCreator creator = getFrom(tabledata, extraMap); map.put(name, defaultMap.get(name));
if (creator == null) { } else {
creator = getFrom(tabledata, map); map.remove(name);
} }
return creator;
} }
private static TableDataNameObjectCreator getFrom(TableData tabledata, Map<String, TableDataNameObjectCreator> map) { private static TableDataNameObjectCreator getTableDataNameObjectCreator(TableData tabledata) {
TableDataNameObjectCreator tableDataNameObjectCreator = map.get(tabledata.getClass().getName()); TableDataNameObjectCreator tableDataNameObjectCreator = map.get(tabledata.getClass().getName());
if (tableDataNameObjectCreator == null) { if (tableDataNameObjectCreator == null) {
@ -83,6 +80,7 @@ public abstract class TableDataFactory {
return tableDataNameObjectCreator; return tableDataNameObjectCreator;
} }
/** /**
* 获取数据集所对应的编辑面板 * 获取数据集所对应的编辑面板
* *

52
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.ToolBarMenuDock;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.MenuManager; import com.fr.design.menu.MenuManager;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FILEFactory; import com.fr.file.FILEFactory;
@ -37,6 +38,7 @@ import com.fr.general.FRLogger;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventListener;
@ -171,15 +173,15 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
basePane.add(menuPane, BorderLayout.NORTH); basePane.add(menuPane, BorderLayout.NORTH);
this.resetToolkitByPlus(null); this.resetToolkitByPlus(null);
} }
/** /**
* @param ad * @param ad
* @return * @return
*/ */
protected JPanel initNorthEastPane(final ToolBarMenuDock ad){ protected JPanel initNorthEastPane(final ToolBarMenuDock ad) {
//hugh: private修改为protected方便oem的时候修改右上的组件构成 //hugh: private修改为protected方便oem的时候修改右上的组件构成
//顶部日志+登陆按钮 //顶部日志+登陆按钮
final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
GeneralContext.listenPluginRunningChanged(new PluginEventListener() { GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@ -187,13 +189,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
public void on(PluginEvent event) { public void on(PluginEvent event) {
refreshNorthEastPane(northEastPane, ad); refreshNorthEastPane(northEastPane, ad);
DesignUtils.refreshDesignerFrame(FRContext.getCurrentEnv());
} }
}, new PluginFilter() { }, new PluginFilter() {
@Override @Override
public boolean accept(PluginContext context) { public boolean accept(PluginContext context) {
return context.contain(TitlePlaceProcessor.MARK_STRING); return context.contain(PluginModule.ExtraDesign);
} }
}); });
refreshNorthEastPane(northEastPane, ad); refreshNorthEastPane(northEastPane, ad);
@ -662,19 +665,20 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
GUICoreUtils.setWindowFullScreen(this); GUICoreUtils.setWindowFullScreen(this);
} }
} }
/**
* 报表运行环境改变时,需要刷新某些面板 /**
* * 报表运行环境改变时,需要刷新某些面板
* @param env *
* 环境 * @param env 环境
*/ */
public void refreshEnv(Env env) { public void refreshEnv(Env env) {
this.setTitle();
DesignerFrameFileDealerPane.getInstance().refreshDockingView(); this.setTitle();
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); DesignerFrameFileDealerPane.getInstance().refreshDockingView();
TemplateTreePane.getInstance().refreshDockingView(); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
DesignTableDataManager.clearGlobalDs(); TemplateTreePane.getInstance().refreshDockingView();
DesignTableDataManager.clearGlobalDs();
EastRegionContainerPane.getInstance().refreshDownPane(); EastRegionContainerPane.getInstance().refreshDownPane();
} }

3
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 OpenFolderAction openFolderAction = new OpenFolderAction();
private RenameAction renameAction = new RenameAction(); private RenameAction renameAction = new RenameAction();
private DelFileAction delFileAction = new DelFileAction(); private DelFileAction delFileAction = new DelFileAction();
/** /**
* 刷新 * 刷新
*/ */

6
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.DesignModelAdapter;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.icontainer.UIResizableContainer; import com.fr.design.gui.icontainer.UIResizableContainer;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventListener;
@ -45,8 +45,8 @@ public class WestRegionContainerPane extends UIResizableContainer {
@Override @Override
public boolean accept(PluginContext context) { public boolean accept(PluginContext context) {
return context.contain(TableDataPaneProcessor.XML_TAG); return context.contain(PluginModule.ExtraDesign);
} }
}); });

19
designer_base/src/com/fr/design/utils/DesignUtils.java

@ -181,9 +181,18 @@ public class DesignUtils {
// 更新CurrentEnv于FRContext & DesignerEnvManager // 更新CurrentEnv于FRContext & DesignerEnvManager
FRContext.setCurrentEnv(env); 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; final Env run_env = env;
// 刷新DesignerFrame里面的面板 // 刷新DesignerFrame里面的面板
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@ -195,12 +204,8 @@ public class DesignUtils {
DesignerContext.getDesignerFrame().repaint();// kunsnat: 切换环境后 刷新下 报表. 比如图表某些风格改变. DesignerContext.getDesignerFrame().repaint();// kunsnat: 切换环境后 刷新下 报表. 比如图表某些风格改变.
} }
}); });
// 当换了运行环境,重置服务器,让它下次预览时重启
if (env instanceof LocalEnv && !ComparatorUtils.equals(env.getPath(), oldEnvPath)) {
StartServer.currentEnvChanged();
}
} }
/** /**
* p:初始化look and feel, 把一切放到这个里面.可以让多个地方调用. * p:初始化look and feel, 把一切放到这个里面.可以让多个地方调用.
*/ */

25
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.ExtraDesignClassManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.creator.XCreatorUtils; 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.UserDefinedWidgetOption;
import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOption;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.*; import com.fr.form.ui.*;
import com.fr.general.GeneralContext;
import com.fr.general.Inter; 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 com.fr.stable.ArrayUtils;
import javax.swing.*; import javax.swing.*;
@ -50,24 +43,6 @@ public class FormParaPane extends JPanel {
private FormDesigner designer; 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) { public static final FormParaPane getInstance(FormDesigner designer) {
if(THIS == null) { if(THIS == null) {
THIS = new FormParaPane(); THIS = new FormParaPane();

27
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.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreatorUtils; 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.FormWidgetOption;
import com.fr.design.gui.core.UserDefinedWidgetOption; import com.fr.design.gui.core.UserDefinedWidgetOption;
import com.fr.design.gui.core.WidgetOption; 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.design.utils.gui.LayoutUtils;
import com.fr.form.ui.*; import com.fr.form.ui.*;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.Inter; 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 com.fr.stable.ArrayUtils;
import javax.swing.*; import javax.swing.*;
@ -63,26 +56,6 @@ public class FormParaWidgetPane extends JPanel {
private FormDesigner designer; 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) { public static synchronized final FormParaWidgetPane getInstance(FormDesigner designer) {
if (THIS == null) { if (THIS == null) {
THIS = new FormParaWidgetPane(); THIS = new FormParaWidgetPane();

Loading…
Cancel
Save