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. 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. 46
      designer_base/src/com/fr/design/mainframe/DesignerFrame.java
  5. 1
      designer_base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  6. 4
      designer_base/src/com/fr/design/mainframe/WestRegionContainerPane.java
  7. 13
      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;
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();

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;
}
/**
* 获取数据集所对应的编辑面板
*

46
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;
@ -172,14 +174,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
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);
@ -663,18 +666,19 @@ 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();
/**
* 报表运行环境改变时,需要刷新某些面板
*
* @param env 环境
*/
public void refreshEnv(Env env) {
this.setTitle();
DesignerFrameFileDealerPane.getInstance().refreshDockingView();
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
TemplateTreePane.getInstance().refreshDockingView();
DesignTableDataManager.clearGlobalDs();
EastRegionContainerPane.getInstance().refreshDownPane();
}

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

@ -61,6 +61,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
private RenameAction renameAction = new RenameAction();
private DelFileAction delFileAction = new DelFileAction();
/**
* 刷新
*/

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);
}
});

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

@ -182,6 +182,15 @@ 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里面的面板
@ -195,10 +204,6 @@ public class DesignUtils {
DesignerContext.getDesignerFrame().repaint();// kunsnat: 切换环境后 刷新下 报表. 比如图表某些风格改变.
}
});
// 当换了运行环境,重置服务器,让它下次预览时重启
if (env instanceof LocalEnv && !ComparatorUtils.equals(env.getPath(), oldEnvPath)) {
StartServer.currentEnvChanged();
}
}
/**

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