From 7437f96267eec11191f5d5a77f65a8ae32667ee6 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Mon, 7 Nov 2016 09:56:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=8Ddev=E4=B8=AD=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A0=91=E6=9E=81=E9=80=9F=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=EF=BC=88=E4=B9=8B=E5=89=8Dmaster=E5=9B=9E=E9=80=80=E4=B9=8B?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=8F=88=E8=87=AA=E5=8A=A8=E6=8A=8Adev?= =?UTF-8?q?=E5=9B=9E=E9=80=80=E4=BA=86=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/frpane/TreeSettingPane.java | 79 ++++++++++++++----- 1 file changed, 59 insertions(+), 20 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java b/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java index f0a94f3050..65df6f0625 100644 --- a/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java @@ -1,40 +1,48 @@ package com.fr.design.gui.frpane; -import java.awt.BorderLayout; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; - -import com.fr.data.impl.TreeNodeWrapper; -import com.fr.design.data.DataCreatorUI; -import com.fr.design.gui.ilable.UILabel; - -import javax.swing.*; - -import com.fr.general.NameObject; import com.fr.data.impl.TableDataDictionary; import com.fr.data.impl.TreeAttr; import com.fr.data.impl.TreeNodeAttr; +import com.fr.data.impl.TreeNodeWrapper; +import com.fr.design.data.DataCreatorUI; +import com.fr.design.dialog.BasicPane; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; +import com.fr.design.gui.frpane.tree.layer.config.LayerDataControlPane; import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itree.refreshabletree.TreeDataCardPane; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.dialog.BasicPane; import com.fr.form.ui.TreeComboBoxEditor; import com.fr.form.ui.TreeEditor; +import com.fr.form.ui.tree.LayerConfig; import com.fr.general.Inter; +import com.fr.general.NameObject; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; public class TreeSettingPane extends BasicPane implements DataCreatorUI { private JTreeControlPane controlPane; + private JTreeAutoBuildPane autoBuildPane; + + /** + * 新的分层构建方式 + */ + private LayerDataControlPane layerDataControlPane; + private UIComboBox buildBox; + /** * */ private static final long serialVersionUID = 1762889323082827111L; - private String[] buildWay = new String[] { Inter.getLocText("FR-Designer_Layer-Build"), - Inter.getLocText("FR-Designer_Auto-Build") }; + private String[] buildWay = new String[]{Inter.getLocText("FR-Designer_DataTable-Build"), + Inter.getLocText("FR-Designer_Auto-Build"), Inter.getLocText("FR-Designer_Layer-Build")}; public TreeSettingPane(boolean isEditor) { this.initComponents(isEditor); @@ -58,14 +66,30 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { controlPane = new JTreeControlPane(new NameableCreator[] { treeNode }, new TreeDataCardPane(), isEditor); autoBuildPane = new JTreeAutoBuildPane(); + layerDataControlPane = new LayerDataControlPane(); this.add(buildWayPanel, BorderLayout.NORTH); cardChanged(0); } private void cardChanged(int index) { + this.remove(controlPane); this.remove(autoBuildPane); - this.add(index == 0 ? controlPane : autoBuildPane, BorderLayout.CENTER); + this.remove(layerDataControlPane); + switch (index) { + case 0: + this.add(layerDataControlPane); + break; + case 1: + this.add(autoBuildPane); + break; + case 2: + this.add(controlPane); + + break; + default: + break; + } validate(); repaint(); revalidate(); @@ -101,8 +125,17 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { buildBox.setSelectedIndex(1); TableDataDictionary dictionary = treeEditor.getDictionary(); autoBuildPane.populate(dictionary); - } else { + } else if (treeEditor.isLayerBuild()) { buildBox.setSelectedIndex(0); + java.util.List layerConfigList = treeEditor.getLayerConfigs(); + LayerConfig[] layerConfigs = new LayerConfig[layerConfigList.size()]; + int i = 0; + for (LayerConfig layerConfig : layerConfigList) { + layerConfigs[i++] = layerConfig; + } + this.layerDataControlPane.populate(new NameObject("tree", layerConfigs)); + } else { + buildBox.setSelectedIndex(2); } } @@ -123,7 +156,7 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { te.setAutoBuild(true); te.setDictionary(dictionary); te.setNodeOrDict(dictionary); - } else { + } else if (buildBox.getSelectedIndex() == 2) { te.setAutoBuild(false); NameObject no = this.controlPane.update(); if (no != null) { @@ -150,11 +183,14 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { * @return */ public Object updateTreeNodeAttrs() { - if(buildBox.getSelectedIndex() == 0) { + + if (buildBox.getSelectedIndex() == 2) { NameObject no = controlPane.update(); if (no != null) { return no.getObject(); } + } else if (buildBox.getSelectedIndex() == 0) { + return layerDataControlPane.update(); } else { return autoBuildPane.update(); } @@ -172,7 +208,7 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { tcb.setAutoBuild(true); tcb.setDictionary(dictionary); tcb.setNodeOrDict(dictionary); - } else { + } else if (buildBox.getSelectedIndex() == 2) { tcb.setAutoBuild(false); NameObject no = this.controlPane.update(); if (no != null) { @@ -204,12 +240,15 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { */ public void populate(Object nodeOrDict) { if(nodeOrDict instanceof TreeNodeAttr[] || nodeOrDict instanceof TreeNodeWrapper) { - buildBox.setSelectedIndex(0); + buildBox.setSelectedIndex(2); NameObject no = new NameObject("name", nodeOrDict); controlPane.populate(no); } else if(nodeOrDict instanceof TableDataDictionary) { buildBox.setSelectedIndex(1); autoBuildPane.populate((TableDataDictionary)nodeOrDict); + } else if (nodeOrDict instanceof NameObject) { + buildBox.setSelectedIndex(0); + layerDataControlPane.populate((NameObject) nodeOrDict); } } } \ No newline at end of file