Compare commits

...

2 Commits

  1. 27
      src/main/java/com/fr/plugin/event/manager/ui/EventManagerPane.java
  2. 23
      src/main/java/com/fr/plugin/event/manager/ui/FormEventManagerPane.java
  3. 19
      src/main/java/com/fr/plugin/event/manager/ui/WorkbookEventManagerPane.java

27
src/main/java/com/fr/plugin/event/manager/ui/EventManagerPane.java

@ -13,11 +13,31 @@ public abstract class EventManagerPane<T> extends LoadingBasicPane {
protected EventConfigPane eventConfigPane;
private T target;
/**
* 模板方法
*
* @param container
*/
@Override
protected void initComponents(JPanel container) {
initData(target);
createComponents(container);
}
/**
* 初始化数据
*
* @param target
*/
protected abstract void initData(T target);
/**
* 初始化面板
*
* @param container
*/
protected abstract void createComponents(JPanel container);
public void setTarget(T target) {
this.target = target;
}
@ -27,13 +47,6 @@ public abstract class EventManagerPane<T> extends LoadingBasicPane {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Plugin_Event_Manager_Title");
}
/**
* 初始化数据
*
* @param target
*/
protected abstract void initData(T target);
public void update() {
eventConfigPane.update();
}

23
src/main/java/com/fr/plugin/event/manager/ui/FormEventManagerPane.java

@ -24,28 +24,21 @@ public class FormEventManagerPane extends EventManagerPane<FormDesigner> {
private final int ABSOLUTE_AS_BODY_NOT_FOUND = -1;
/**
* 先调用super.initComponents()执行initData()
* 之后tree已经被初始化了
*
* @param container
*/
@Override
protected void initComponents(JPanel container) {
super.initComponents(container);
container.setLayout(FRGUIPaneFactory.createBorderLayout());
eventConfigPane = new EventConfigPane(tree, true);
container.add(eventConfigPane, BorderLayout.CENTER);
}
@Override
public void initData(FormDesigner target) {
protected void initData(FormDesigner target) {
tree = new MyTree();
Component root = target.getTopContainer();
traversalComponent(root);
filterWidget(tree);
}
@Override
protected void createComponents(JPanel container) {
container.setLayout(FRGUIPaneFactory.createBorderLayout());
eventConfigPane = new EventConfigPane(tree, true);
container.add(eventConfigPane, BorderLayout.CENTER);
}
/**
* 当initComponents执行完后调用
*/

19
src/main/java/com/fr/plugin/event/manager/ui/WorkbookEventManagerPane.java

@ -40,8 +40,15 @@ public class WorkbookEventManagerPane extends EventManagerPane<TemplateWorkBook>
private CellWidgetPane cellWidgetPane;
@Override
protected void initComponents(JPanel container) {
super.initComponents(container);
protected void initData(TemplateWorkBook target) {
parameterTree = new MyTree();
initParaWidget(target);
cellWidgetTrees = new ArrayList<>();
initCellWidget(target);
}
@Override
protected void createComponents(JPanel container) {
tabbedPane = new UITabbedPane();
cellWidgetPane = new CellWidgetPane(cellWidgetTrees);
eventConfigPane = new EventConfigPane(parameterTree, true);
@ -75,14 +82,6 @@ public class WorkbookEventManagerPane extends EventManagerPane<TemplateWorkBook>
});
}
@Override
public void initData(TemplateWorkBook target) {
parameterTree = new MyTree();
initParaWidget(target);
cellWidgetTrees = new ArrayList<>();
initCellWidget(target);
}
/**
* 初始化参数面板组件树
*

Loading…
Cancel
Save