Browse Source

Merge pull request #446 in BA/design from ~JU/master-design:master to master

* commit 'bc9e4fd235d715a035930cb3c5c1649a98250881':
  回退主干上的下拉树极速构建
master
superman 8 years ago
parent
commit
19433affc9
  1. 79
      designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java

79
designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java

@ -1,48 +1,40 @@
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_DataTable-Build"),
Inter.getLocText("FR-Designer_Auto-Build"), Inter.getLocText("FR-Designer_Layer-Build")};
private String[] buildWay = new String[] { Inter.getLocText("FR-Designer_Layer-Build"),
Inter.getLocText("FR-Designer_Auto-Build") };
public TreeSettingPane(boolean isEditor) {
this.initComponents(isEditor);
@ -66,30 +58,14 @@ 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.remove(layerDataControlPane);
switch (index) {
case 0:
this.add(layerDataControlPane);
break;
case 1:
this.add(autoBuildPane);
break;
case 2:
this.add(controlPane);
break;
default:
break;
}
this.add(index == 0 ? controlPane : autoBuildPane, BorderLayout.CENTER);
validate();
repaint();
revalidate();
@ -125,17 +101,8 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
buildBox.setSelectedIndex(1);
TableDataDictionary dictionary = treeEditor.getDictionary();
autoBuildPane.populate(dictionary);
} else if (treeEditor.isLayerBuild()) {
buildBox.setSelectedIndex(0);
java.util.List<LayerConfig> 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);
buildBox.setSelectedIndex(0);
}
}
@ -156,7 +123,7 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
te.setAutoBuild(true);
te.setDictionary(dictionary);
te.setNodeOrDict(dictionary);
} else if (buildBox.getSelectedIndex() == 2) {
} else {
te.setAutoBuild(false);
NameObject no = this.controlPane.update();
if (no != null) {
@ -183,14 +150,11 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
* @return
*/
public Object updateTreeNodeAttrs() {
if (buildBox.getSelectedIndex() == 2) {
if(buildBox.getSelectedIndex() == 0) {
NameObject no = controlPane.update();
if (no != null) {
return no.getObject();
}
} else if (buildBox.getSelectedIndex() == 0) {
return layerDataControlPane.update();
} else {
return autoBuildPane.update();
}
@ -208,7 +172,7 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
tcb.setAutoBuild(true);
tcb.setDictionary(dictionary);
tcb.setNodeOrDict(dictionary);
} else if (buildBox.getSelectedIndex() == 2) {
} else {
tcb.setAutoBuild(false);
NameObject no = this.controlPane.update();
if (no != null) {
@ -240,15 +204,12 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
*/
public void populate(Object nodeOrDict) {
if(nodeOrDict instanceof TreeNodeAttr[] || nodeOrDict instanceof TreeNodeWrapper) {
buildBox.setSelectedIndex(2);
buildBox.setSelectedIndex(0);
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);
}
}
}
Loading…
Cancel
Save