Browse Source

调试几个设计器插件,挺多地方有缓存需要添加监听的

master
juhaoyu 8 years ago
parent
commit
1251875ece
  1. 7
      designer/src/com/fr/design/module/DesignerModule.java
  2. 33
      designer_base/src/com/fr/design/data/tabledata/wrapper/TableDataFactory.java
  3. 8
      designer_base/src/com/fr/design/fun/impl/AbstractServerTableDataDefineProvider.java
  4. 8
      designer_base/src/com/fr/design/fun/impl/AbstractTableDataDefineProvider.java
  5. 6
      designer_base/src/com/fr/design/mainframe/AbstractAppProvider.java
  6. 7
      designer_base/src/com/fr/design/mainframe/DesignerFrame.java

7
designer/src/com/fr/design/module/DesignerModule.java

@ -212,7 +212,7 @@ public class DesignerModule extends DesignModule {
} }
}); });
} }
private static abstract class AbstractWorkBookApp implements App<WorkBook> { private static abstract class AbstractWorkBookApp implements App<WorkBook> {
@Override @Override
@ -234,6 +234,11 @@ public class DesignerModule extends DesignModule {
public void process() { public void process() {
} }
@Override
public void undo() {
}
} }
@Override @Override

33
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.TableDataSource;
import com.fr.data.impl.*; import com.fr.data.impl.*;
import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.data.datapane.TableDataNameObjectCreator; import com.fr.design.data.datapane.TableDataNameObjectCreator;
import com.fr.design.data.tabledata.tabledatapane.*; import com.fr.design.data.tabledata.tabledatapane.*;
import com.fr.design.fun.TableDataCreatorProvider;
import com.fr.file.DatasourceManagerProvider; import com.fr.file.DatasourceManagerProvider;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.ArrayList; import java.util.*;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
/** /**
@ -32,6 +27,8 @@ 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<String, TableDataNameObjectCreator>();
private static Map<String, TableDataNameObjectCreator> extraMap = new LinkedHashMap<>();
/** /**
* 同一类型的只能加一次,就加最上层的类,因为要排序如果将所有的 FileTableData都加进来那么FileTableData的排序就不正确了 * 同一类型的只能加一次,就加最上层的类,因为要排序如果将所有的 FileTableData都加进来那么FileTableData的排序就不正确了
@ -54,11 +51,27 @@ public abstract class TableDataFactory {
* @param clazz 数据集类 * @param clazz 数据集类
* @param creator 组件 * @param creator 组件
*/ */
public static void register(Class<? extends TableData> clazz, TableDataNameObjectCreator creator) { public static void registerExtra(Class<? extends TableData> clazz, TableDataNameObjectCreator creator) {
map.put(clazz.getName(), creator);
extraMap.put(clazz.getName(), creator);
} }
public static void removeExtra(Class<? extends TableData> clazz) {
extraMap.remove(clazz.getName());
}
private static TableDataNameObjectCreator getTableDataNameObjectCreator(TableData tabledata) { 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<String, TableDataNameObjectCreator> map) {
TableDataNameObjectCreator tableDataNameObjectCreator = map.get(tabledata.getClass().getName()); TableDataNameObjectCreator tableDataNameObjectCreator = map.get(tabledata.getClass().getName());
if (tableDataNameObjectCreator == null) { if (tableDataNameObjectCreator == null) {
tableDataNameObjectCreator = map.get(tabledata.getClass().getSuperclass().getName()); tableDataNameObjectCreator = map.get(tabledata.getClass().getSuperclass().getName());
@ -69,7 +82,7 @@ public abstract class TableDataFactory {
} }
return tableDataNameObjectCreator; return tableDataNameObjectCreator;
} }
/** /**
* 获取数据集所对应的编辑面板 * 获取数据集所对应的编辑面板
* *

8
designer_base/src/com/fr/design/fun/impl/AbstractServerTableDataDefineProvider.java

@ -34,6 +34,12 @@ public abstract class AbstractServerTableDataDefineProvider extends AbstractProv
classForInitTableData(), classForInitTableData(),
appearanceForTableData() appearanceForTableData()
); );
TableDataFactory.register(classForTableData(), creator); TableDataFactory.registerExtra(classForTableData(), creator);
}
@Override
public void undo() {
TableDataFactory.removeExtra(classForTableData());
} }
} }

8
designer_base/src/com/fr/design/fun/impl/AbstractTableDataDefineProvider.java

@ -34,6 +34,12 @@ public abstract class AbstractTableDataDefineProvider extends AbstractProvider i
classForInitTableData(), classForInitTableData(),
appearanceForTableData() appearanceForTableData()
); );
TableDataFactory.register(classForTableData(), creator); TableDataFactory.registerExtra(classForTableData(), creator);
}
@Override
public void undo() {
TableDataFactory.removeExtra(classForTableData());
} }
} }

6
designer_base/src/com/fr/design/mainframe/AbstractAppProvider.java

@ -23,4 +23,10 @@ public abstract class AbstractAppProvider<T extends IOFile> extends AbstractProv
public void process() { public void process() {
DesignerFrame.registApp(this); DesignerFrame.registApp(this);
} }
@Override
public void undo() {
DesignerFrame.removeApp(this);
}
} }

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

@ -149,6 +149,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
appList.add(app); appList.add(app);
} }
} }
public static void removeApp(App<?> app) {
if (app != null) {
appList.remove(app);
}
}
protected DesktopCardPane getCenterTemplateCardPane() { protected DesktopCardPane getCenterTemplateCardPane() {
return centerTemplateCardPane; return centerTemplateCardPane;

Loading…
Cancel
Save