|
|
@ -1,48 +1,40 @@ |
|
|
|
package com.fr.design.gui.frpane; |
|
|
|
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.TableDataDictionary; |
|
|
|
import com.fr.data.impl.TreeAttr; |
|
|
|
import com.fr.data.impl.TreeAttr; |
|
|
|
import com.fr.data.impl.TreeNodeAttr; |
|
|
|
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.NameObjectCreator; |
|
|
|
import com.fr.design.gui.controlpane.NameableCreator; |
|
|
|
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.icombobox.UIComboBox; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
|
|
|
import com.fr.design.gui.itree.refreshabletree.TreeDataCardPane; |
|
|
|
import com.fr.design.gui.itree.refreshabletree.TreeDataCardPane; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
|
|
|
|
import com.fr.design.dialog.BasicPane; |
|
|
|
import com.fr.form.ui.TreeComboBoxEditor; |
|
|
|
import com.fr.form.ui.TreeComboBoxEditor; |
|
|
|
import com.fr.form.ui.TreeEditor; |
|
|
|
import com.fr.form.ui.TreeEditor; |
|
|
|
import com.fr.form.ui.tree.LayerConfig; |
|
|
|
|
|
|
|
import com.fr.general.Inter; |
|
|
|
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 { |
|
|
|
public class TreeSettingPane extends BasicPane implements DataCreatorUI { |
|
|
|
private JTreeControlPane controlPane; |
|
|
|
private JTreeControlPane controlPane; |
|
|
|
|
|
|
|
|
|
|
|
private JTreeAutoBuildPane autoBuildPane; |
|
|
|
private JTreeAutoBuildPane autoBuildPane; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 新的分层构建方式 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private LayerDataControlPane layerDataControlPane; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private UIComboBox buildBox; |
|
|
|
private UIComboBox buildBox; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private static final long serialVersionUID = 1762889323082827111L; |
|
|
|
private static final long serialVersionUID = 1762889323082827111L; |
|
|
|
|
|
|
|
|
|
|
|
private String[] buildWay = new String[]{Inter.getLocText("FR-Designer_DataTable-Build"), |
|
|
|
private String[] buildWay = new String[] { Inter.getLocText("FR-Designer_Layer-Build"), |
|
|
|
Inter.getLocText("FR-Designer_Auto-Build"), Inter.getLocText("FR-Designer_Layer-Build")}; |
|
|
|
Inter.getLocText("FR-Designer_Auto-Build") }; |
|
|
|
|
|
|
|
|
|
|
|
public TreeSettingPane(boolean isEditor) { |
|
|
|
public TreeSettingPane(boolean isEditor) { |
|
|
|
this.initComponents(isEditor); |
|
|
|
this.initComponents(isEditor); |
|
|
@ -66,30 +58,14 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { |
|
|
|
controlPane = new JTreeControlPane(new NameableCreator[] { treeNode }, |
|
|
|
controlPane = new JTreeControlPane(new NameableCreator[] { treeNode }, |
|
|
|
new TreeDataCardPane(), isEditor); |
|
|
|
new TreeDataCardPane(), isEditor); |
|
|
|
autoBuildPane = new JTreeAutoBuildPane(); |
|
|
|
autoBuildPane = new JTreeAutoBuildPane(); |
|
|
|
layerDataControlPane = new LayerDataControlPane(); |
|
|
|
|
|
|
|
this.add(buildWayPanel, BorderLayout.NORTH); |
|
|
|
this.add(buildWayPanel, BorderLayout.NORTH); |
|
|
|
cardChanged(0); |
|
|
|
cardChanged(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void cardChanged(int index) { |
|
|
|
private void cardChanged(int index) { |
|
|
|
|
|
|
|
|
|
|
|
this.remove(controlPane); |
|
|
|
this.remove(controlPane); |
|
|
|
this.remove(autoBuildPane); |
|
|
|
this.remove(autoBuildPane); |
|
|
|
this.remove(layerDataControlPane); |
|
|
|
this.add(index == 0 ? controlPane : autoBuildPane, BorderLayout.CENTER); |
|
|
|
switch (index) { |
|
|
|
|
|
|
|
case 0: |
|
|
|
|
|
|
|
this.add(layerDataControlPane); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 1: |
|
|
|
|
|
|
|
this.add(autoBuildPane); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 2: |
|
|
|
|
|
|
|
this.add(controlPane); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
validate(); |
|
|
|
validate(); |
|
|
|
repaint(); |
|
|
|
repaint(); |
|
|
|
revalidate(); |
|
|
|
revalidate(); |
|
|
@ -125,17 +101,8 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { |
|
|
|
buildBox.setSelectedIndex(1); |
|
|
|
buildBox.setSelectedIndex(1); |
|
|
|
TableDataDictionary dictionary = treeEditor.getDictionary(); |
|
|
|
TableDataDictionary dictionary = treeEditor.getDictionary(); |
|
|
|
autoBuildPane.populate(dictionary); |
|
|
|
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 { |
|
|
|
} else { |
|
|
|
buildBox.setSelectedIndex(2); |
|
|
|
buildBox.setSelectedIndex(0); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -156,7 +123,7 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { |
|
|
|
te.setAutoBuild(true); |
|
|
|
te.setAutoBuild(true); |
|
|
|
te.setDictionary(dictionary); |
|
|
|
te.setDictionary(dictionary); |
|
|
|
te.setNodeOrDict(dictionary); |
|
|
|
te.setNodeOrDict(dictionary); |
|
|
|
} else if (buildBox.getSelectedIndex() == 2) { |
|
|
|
} else { |
|
|
|
te.setAutoBuild(false); |
|
|
|
te.setAutoBuild(false); |
|
|
|
NameObject no = this.controlPane.update(); |
|
|
|
NameObject no = this.controlPane.update(); |
|
|
|
if (no != null) { |
|
|
|
if (no != null) { |
|
|
@ -183,14 +150,11 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public Object updateTreeNodeAttrs() { |
|
|
|
public Object updateTreeNodeAttrs() { |
|
|
|
|
|
|
|
if(buildBox.getSelectedIndex() == 0) { |
|
|
|
if (buildBox.getSelectedIndex() == 2) { |
|
|
|
|
|
|
|
NameObject no = controlPane.update(); |
|
|
|
NameObject no = controlPane.update(); |
|
|
|
if (no != null) { |
|
|
|
if (no != null) { |
|
|
|
return no.getObject(); |
|
|
|
return no.getObject(); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (buildBox.getSelectedIndex() == 0) { |
|
|
|
|
|
|
|
return layerDataControlPane.update(); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return autoBuildPane.update(); |
|
|
|
return autoBuildPane.update(); |
|
|
|
} |
|
|
|
} |
|
|
@ -208,7 +172,7 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { |
|
|
|
tcb.setAutoBuild(true); |
|
|
|
tcb.setAutoBuild(true); |
|
|
|
tcb.setDictionary(dictionary); |
|
|
|
tcb.setDictionary(dictionary); |
|
|
|
tcb.setNodeOrDict(dictionary); |
|
|
|
tcb.setNodeOrDict(dictionary); |
|
|
|
} else if (buildBox.getSelectedIndex() == 2) { |
|
|
|
} else { |
|
|
|
tcb.setAutoBuild(false); |
|
|
|
tcb.setAutoBuild(false); |
|
|
|
NameObject no = this.controlPane.update(); |
|
|
|
NameObject no = this.controlPane.update(); |
|
|
|
if (no != null) { |
|
|
|
if (no != null) { |
|
|
@ -240,15 +204,12 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void populate(Object nodeOrDict) { |
|
|
|
public void populate(Object nodeOrDict) { |
|
|
|
if(nodeOrDict instanceof TreeNodeAttr[] || nodeOrDict instanceof TreeNodeWrapper) { |
|
|
|
if(nodeOrDict instanceof TreeNodeAttr[] || nodeOrDict instanceof TreeNodeWrapper) { |
|
|
|
buildBox.setSelectedIndex(2); |
|
|
|
buildBox.setSelectedIndex(0); |
|
|
|
NameObject no = new NameObject("name", nodeOrDict); |
|
|
|
NameObject no = new NameObject("name", nodeOrDict); |
|
|
|
controlPane.populate(no); |
|
|
|
controlPane.populate(no); |
|
|
|
} else if(nodeOrDict instanceof TableDataDictionary) { |
|
|
|
} else if(nodeOrDict instanceof TableDataDictionary) { |
|
|
|
buildBox.setSelectedIndex(1); |
|
|
|
buildBox.setSelectedIndex(1); |
|
|
|
autoBuildPane.populate((TableDataDictionary)nodeOrDict); |
|
|
|
autoBuildPane.populate((TableDataDictionary)nodeOrDict); |
|
|
|
} else if (nodeOrDict instanceof NameObject) { |
|
|
|
|
|
|
|
buildBox.setSelectedIndex(0); |
|
|
|
|
|
|
|
layerDataControlPane.populate((NameObject) nodeOrDict); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |