Browse Source

减少环状依赖

release/10.0
Joe.Jiang 4 years ago committed by Joe.Jiang
parent
commit
2263aec317
  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; protected EventConfigPane eventConfigPane;
private T target; private T target;
/**
* 模板方法
*
* @param container
*/
@Override @Override
protected void initComponents(JPanel container) { protected void initComponents(JPanel container) {
initData(target); 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) { public void setTarget(T target) {
this.target = 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"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Plugin_Event_Manager_Title");
} }
/**
* 初始化数据
*
* @param target
*/
protected abstract void initData(T target);
public void update() { public void update() {
eventConfigPane.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; private final int ABSOLUTE_AS_BODY_NOT_FOUND = -1;
/**
* 先调用super.initComponents()执行initData()
* 之后tree已经被初始化了
*
* @param container
*/
@Override @Override
protected void initComponents(JPanel container) { protected void initData(FormDesigner target) {
super.initComponents(container);
container.setLayout(FRGUIPaneFactory.createBorderLayout());
eventConfigPane = new EventConfigPane(tree, true);
container.add(eventConfigPane, BorderLayout.CENTER);
}
@Override
public void initData(FormDesigner target) {
tree = new MyTree(); tree = new MyTree();
Component root = target.getTopContainer(); Component root = target.getTopContainer();
traversalComponent(root); traversalComponent(root);
filterWidget(tree); filterWidget(tree);
} }
@Override
protected void createComponents(JPanel container) {
container.setLayout(FRGUIPaneFactory.createBorderLayout());
eventConfigPane = new EventConfigPane(tree, true);
container.add(eventConfigPane, BorderLayout.CENTER);
}
/** /**
* 当initComponents执行完后调用 * 当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; private CellWidgetPane cellWidgetPane;
@Override @Override
protected void initComponents(JPanel container) { protected void initData(TemplateWorkBook target) {
super.initComponents(container); parameterTree = new MyTree();
initParaWidget(target);
cellWidgetTrees = new ArrayList<>();
initCellWidget(target);
}
@Override
protected void createComponents(JPanel container) {
tabbedPane = new UITabbedPane(); tabbedPane = new UITabbedPane();
cellWidgetPane = new CellWidgetPane(cellWidgetTrees); cellWidgetPane = new CellWidgetPane(cellWidgetTrees);
eventConfigPane = new EventConfigPane(parameterTree, true); 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