Browse Source

PFC-607 插件安装删除更新不重启支持

1、修复bug
2、复用之前切换环境时设计器调整的代码,每次设计器插件变动时刷新
master
juhaoyu 8 years ago
parent
commit
c61a837086
  1. 41
      designer/src/com/fr/design/mainframe/CellElementPropertyPane.java
  2. 3
      designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java
  3. 42
      designer_base/src/com/fr/design/data/tabledata/wrapper/TableDataFactory.java
  4. 44
      designer_base/src/com/fr/design/mainframe/DesignerFrame.java
  5. 23
      designer_base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  6. 4
      designer_base/src/com/fr/design/mainframe/WestRegionContainerPane.java
  7. 25
      designer_form/src/com/fr/design/mainframe/FormParaPane.java
  8. 27
      designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java

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

@ -3,35 +3,22 @@
*/
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;
import com.fr.design.mainframe.cell.CellElementEditPane;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection;
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.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.Elem;
import com.fr.report.elementcase.TemplateElementCase;
import javax.swing.*;
import java.awt.*;
/**
* 所有组件一次全部加载不存在延迟加载 原因设计器打开第一张模板的时候会初始化许多许多东西这个过程需要很长时间快的3-5s
@ -43,28 +30,6 @@ import com.fr.report.elementcase.TemplateElementCase;
*/
public class CellElementPropertyPane extends DockingView {
static {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
synchronized (CellElementPropertyPane.class) {
singleton = new CellElementPropertyPane();
}
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, PresentKindProvider.MARK_STRING) ||
context.contain(PluginModule.ExtraDesign, CellAttributeProvider.MARK_STRING);
}
});
}
public synchronized static CellElementPropertyPane getInstance() {
if (singleton == null) {
singleton = new CellElementPropertyPane();

3
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;
@ -101,7 +100,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
@Override
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的排序就不正确了
*/
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<? extends TableData> clazz, TableDataNameObjectCreator creator) {
extraMap.put(clazz.getName(), creator);
map.put(clazz.getName(), creator);
}
public static void removeExtra(Class<? extends TableData> 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<String, TableDataNameObjectCreator> 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;
}
/**
* 获取数据集所对应的编辑面板
*

44
designer_base/src/com/fr/design/mainframe/DesignerFrame.java

@ -37,6 +37,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;
@ -663,18 +664,37 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
}
/**
* 报表运行环境改变时,需要刷新某些面板
*
* @param env
* 环境
*/
public void refreshEnv(Env env) {
this.setTitle();
DesignerFrameFileDealerPane.getInstance().refreshDockingView();
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
TemplateTreePane.getInstance().refreshDockingView();
DesignTableDataManager.clearGlobalDs();
{
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
DesignerContext.getDesignerFrame().refreshEnv(FRContext.getCurrentEnv());
DesignerContext.getDesignerFrame().repaint();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign);
}
});
}
/**
* 报表运行环境改变时,需要刷新某些面板
*
* @param env 环境
*/
public void refreshEnv(Env env) {
this.setTitle();
DesignerFrameFileDealerPane.getInstance().refreshDockingView();
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
TemplateTreePane.getInstance().refreshDockingView();
DesignTableDataManager.clearGlobalDs();
EastRegionContainerPane.getInstance().refreshDownPane();
}

23
designer_base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -27,13 +27,7 @@ import com.fr.file.FILE;
import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode;
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.CoreConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants;
@ -67,23 +61,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
private RenameAction renameAction = new RenameAction();
private DelFileAction delFileAction = new DelFileAction();
static {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
THIS.refreshDockingView();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, ShortCut.TEMPLATE_TREE);
}
});
}
/**
* 刷新

4
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;
@ -46,7 +46,7 @@ public class WestRegionContainerPane extends UIResizableContainer {
@Override
public boolean accept(PluginContext context) {
return context.contain(TableDataPaneProcessor.XML_TAG);
return context.contain(PluginModule.ExtraDesign);
}
});

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.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();

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.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();

Loading…
Cancel
Save