Browse Source

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

master
juhaoyu 8 years ago
parent
commit
1251875ece
  1. 5
      designer/src/com/fr/design/module/DesignerModule.java
  2. 29
      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

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

@ -234,6 +234,11 @@ public class DesignerModule extends DesignModule {
public void process() { public void process() {
} }
@Override
public void undo() {
}
} }
@Override @Override

29
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;
/** /**
@ -33,6 +28,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());

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

@ -150,6 +150,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
} }
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