From 1251875ece187c7d47645d6e626e1bba5f974b2a Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Thu, 15 Jun 2017 11:47:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95=E5=87=A0=E4=B8=AA=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E6=8F=92=E4=BB=B6=EF=BC=8C=E6=8C=BA=E5=A4=9A?= =?UTF-8?q?=E5=9C=B0=E6=96=B9=E6=9C=89=E7=BC=93=E5=AD=98=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=9B=91=E5=90=AC=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/module/DesignerModule.java | 7 +++- .../tabledata/wrapper/TableDataFactory.java | 33 +++++++++++++------ ...AbstractServerTableDataDefineProvider.java | 8 ++++- .../impl/AbstractTableDataDefineProvider.java | 8 ++++- .../design/mainframe/AbstractAppProvider.java | 6 ++++ .../fr/design/mainframe/DesignerFrame.java | 7 ++++ 6 files changed, 56 insertions(+), 13 deletions(-) diff --git a/designer/src/com/fr/design/module/DesignerModule.java b/designer/src/com/fr/design/module/DesignerModule.java index 58e00fa0e..12ada2f02 100644 --- a/designer/src/com/fr/design/module/DesignerModule.java +++ b/designer/src/com/fr/design/module/DesignerModule.java @@ -212,7 +212,7 @@ public class DesignerModule extends DesignModule { } }); } - + private static abstract class AbstractWorkBookApp implements App { @Override @@ -234,6 +234,11 @@ public class DesignerModule extends DesignModule { public void process() { } + + @Override + public void undo() { + + } } @Override 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 bc414d1a9..ca118df76 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 @@ -5,20 +5,15 @@ import com.fr.base.TableData; import com.fr.data.TableDataSource; import com.fr.data.impl.*; import com.fr.data.impl.storeproc.StoreProcedure; -import com.fr.design.ExtraDesignClassManager; import com.fr.design.data.datapane.TableDataNameObjectCreator; import com.fr.design.data.tabledata.tabledatapane.*; -import com.fr.design.fun.TableDataCreatorProvider; import com.fr.file.DatasourceManagerProvider; import com.fr.general.ComparatorUtils; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; import java.lang.reflect.Constructor; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.Map.Entry; /** @@ -32,6 +27,8 @@ public abstract class TableDataFactory { * 有顺序的,用来排序用 */ private static Map map = new java.util.LinkedHashMap(); + + private static Map extraMap = new LinkedHashMap<>(); /** * 同一类型的只能加一次,就加最上层的类,因为要排序。如果将所有的 FileTableData都加进来,那么FileTableData的排序就不正确了 @@ -54,11 +51,27 @@ public abstract class TableDataFactory { * @param clazz 数据集类 * @param creator 组件 */ - public static void register(Class clazz, TableDataNameObjectCreator creator) { - map.put(clazz.getName(), creator); + public static void registerExtra(Class clazz, TableDataNameObjectCreator creator) { + + extraMap.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); + } + return creator; + } + + private static TableDataNameObjectCreator getFrom(TableData tabledata, Map map) { + TableDataNameObjectCreator tableDataNameObjectCreator = map.get(tabledata.getClass().getName()); if (tableDataNameObjectCreator == null) { tableDataNameObjectCreator = map.get(tabledata.getClass().getSuperclass().getName()); @@ -69,7 +82,7 @@ public abstract class TableDataFactory { } return tableDataNameObjectCreator; } - + /** * 获取数据集所对应的编辑面板 * diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractServerTableDataDefineProvider.java b/designer_base/src/com/fr/design/fun/impl/AbstractServerTableDataDefineProvider.java index de7be2750..c149d8f33 100644 --- a/designer_base/src/com/fr/design/fun/impl/AbstractServerTableDataDefineProvider.java +++ b/designer_base/src/com/fr/design/fun/impl/AbstractServerTableDataDefineProvider.java @@ -34,6 +34,12 @@ public abstract class AbstractServerTableDataDefineProvider extends AbstractProv classForInitTableData(), appearanceForTableData() ); - TableDataFactory.register(classForTableData(), creator); + TableDataFactory.registerExtra(classForTableData(), creator); + } + + @Override + public void undo() { + + TableDataFactory.removeExtra(classForTableData()); } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractTableDataDefineProvider.java b/designer_base/src/com/fr/design/fun/impl/AbstractTableDataDefineProvider.java index 42433a68b..187e7948c 100644 --- a/designer_base/src/com/fr/design/fun/impl/AbstractTableDataDefineProvider.java +++ b/designer_base/src/com/fr/design/fun/impl/AbstractTableDataDefineProvider.java @@ -34,6 +34,12 @@ public abstract class AbstractTableDataDefineProvider extends AbstractProvider i classForInitTableData(), appearanceForTableData() ); - TableDataFactory.register(classForTableData(), creator); + TableDataFactory.registerExtra(classForTableData(), creator); + } + + @Override + public void undo() { + + TableDataFactory.removeExtra(classForTableData()); } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/mainframe/AbstractAppProvider.java b/designer_base/src/com/fr/design/mainframe/AbstractAppProvider.java index f4f6bea97..25b0931f2 100644 --- a/designer_base/src/com/fr/design/mainframe/AbstractAppProvider.java +++ b/designer_base/src/com/fr/design/mainframe/AbstractAppProvider.java @@ -23,4 +23,10 @@ public abstract class AbstractAppProvider extends AbstractProv public void process() { DesignerFrame.registApp(this); } + + @Override + public void undo() { + + DesignerFrame.removeApp(this); + } } diff --git a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java index 385bbb60f..4fed8d2d9 100644 --- a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java +++ b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java @@ -149,6 +149,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta appList.add(app); } } + + public static void removeApp(App app) { + + if (app != null) { + appList.remove(app); + } + } protected DesktopCardPane getCenterTemplateCardPane() { return centerTemplateCardPane;