|
|
|
@ -26,12 +26,18 @@ import java.awt.event.ItemListener;
|
|
|
|
|
import java.util.Arrays; |
|
|
|
|
|
|
|
|
|
public class TreeSettingPane extends BasicPane implements DataCreatorUI { |
|
|
|
|
/** |
|
|
|
|
* 普通分层构建方式 |
|
|
|
|
*/ |
|
|
|
|
private JTreeControlPane controlPane; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 自动构建方式 |
|
|
|
|
*/ |
|
|
|
|
private JTreeAutoBuildPane autoBuildPane; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 新的分层构建方式 |
|
|
|
|
* 急速分层构建方式 |
|
|
|
|
*/ |
|
|
|
|
private LayerDataControlPane layerDataControlPane; |
|
|
|
|
|
|
|
|
@ -43,15 +49,15 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
|
|
|
|
|
private static final long serialVersionUID = 1762889323082827111L; |
|
|
|
|
|
|
|
|
|
private String[] buildWay = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DataTable_Build"), |
|
|
|
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Auto_Build"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Layer_Build")}; |
|
|
|
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Auto_Build"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Layer_Build")}; |
|
|
|
|
|
|
|
|
|
public TreeSettingPane(boolean isEditor) { |
|
|
|
|
this.initComponents(isEditor); |
|
|
|
|
public TreeSettingPane() { |
|
|
|
|
this.initComponents(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void initComponents(boolean isEditor) { |
|
|
|
|
private void initComponents() { |
|
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
|
JPanel buildWayPanel= FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); |
|
|
|
|
JPanel buildWayPanel = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); |
|
|
|
|
buildWayPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
|
|
|
|
UILabel buildWayLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Build_Way") + " :"); |
|
|
|
|
buildWayPanel.add(buildWayLabel); |
|
|
|
@ -65,8 +71,8 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
|
|
|
|
|
}); |
|
|
|
|
buildWayPanel.add(buildBox); |
|
|
|
|
|
|
|
|
|
controlPane = new JTreeControlPane(new NameableCreator[] { treeNode }, |
|
|
|
|
new TreeDataCardPane(), isEditor); |
|
|
|
|
controlPane = new JTreeControlPane(new NameableCreator[]{treeNode}, |
|
|
|
|
new TreeDataCardPane()); |
|
|
|
|
autoBuildPane = new JTreeAutoBuildPane(); |
|
|
|
|
layerDataControlPane = new LayerDataControlPane(); |
|
|
|
|
this.add(buildWayPanel, BorderLayout.NORTH); |
|
|
|
@ -108,87 +114,14 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
NameableCreator treeNode = new NameObjectCreator( |
|
|
|
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Gradation"), |
|
|
|
|
"/com/fr/design/images/data/source/jdbcTableData.png", |
|
|
|
|
TreeNodeAttr.class); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
* @param treeEditor |
|
|
|
|
*/ |
|
|
|
|
public void populate(TreeEditor treeEditor) { |
|
|
|
|
boolean isAutoBuild = treeEditor.isAutoBuild(); |
|
|
|
|
TreeAttr treeAttr = treeEditor.getTreeAttr(); |
|
|
|
|
if (treeAttr != null) { |
|
|
|
|
NameObject no = new NameObject("name", treeEditor); |
|
|
|
|
controlPane.populate(no); |
|
|
|
|
} |
|
|
|
|
if (isAutoBuild) { |
|
|
|
|
buildBox.setSelectedIndex(1); |
|
|
|
|
TableDataDictionary dictionary = treeEditor.getDictionary(); |
|
|
|
|
autoBuildPane.populate(dictionary); |
|
|
|
|
} else if (treeEditor.isFastLayerBuild()) { |
|
|
|
|
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 Layer Data", layerConfigs)); |
|
|
|
|
} else { |
|
|
|
|
buildBox.setSelectedIndex(2); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Gradation"), |
|
|
|
|
"/com/fr/design/images/data/source/jdbcTableData.png", |
|
|
|
|
TreeNodeAttr.class); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 视图树的update |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public TreeEditor updateTreeEditor() { |
|
|
|
|
// NameObject no = this.controlPane.update();
|
|
|
|
|
// if (no != null) {
|
|
|
|
|
// return ((TreeEditor) no.getObject());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// return null;
|
|
|
|
|
TreeEditor te = new TreeEditor(); |
|
|
|
|
if (buildBox.getSelectedIndex() == 1) { |
|
|
|
|
TableDataDictionary dictionary = this.autoBuildPane.update(); |
|
|
|
|
te.setAutoBuild(true); |
|
|
|
|
te.setFastLayerBuild(false); |
|
|
|
|
te.setDictionary(dictionary); |
|
|
|
|
te.setNodeOrDict(dictionary); |
|
|
|
|
} else if (buildBox.getSelectedIndex() == 2) { |
|
|
|
|
te.setAutoBuild(false); |
|
|
|
|
te.setFastLayerBuild(false); |
|
|
|
|
NameObject no = this.controlPane.update(); |
|
|
|
|
if (no != null) { |
|
|
|
|
TreeEditor editor = (TreeEditor) no.getObject(); |
|
|
|
|
te.setAllowBlank(editor.isAllowBlank()); |
|
|
|
|
te.setEnabled(editor.isEnabled()); |
|
|
|
|
te.setDirectEdit(editor.isDirectEdit()); |
|
|
|
|
te.setErrorMessage(editor.getErrorMessage()); |
|
|
|
|
te.setWidgetName(editor.getWidgetName()); |
|
|
|
|
te.setVisible(editor.isVisible()); |
|
|
|
|
te.setWaterMark(editor.getWaterMark()); |
|
|
|
|
te.setRemoveRepeat(editor.isRemoveRepeat()); |
|
|
|
|
te.setTreeAttr(editor.getTreeAttr()); |
|
|
|
|
te.setTreeNodeAttr(editor.getTreeNodeAttr()); |
|
|
|
|
te.setNodeOrDict(editor.getTreeNodeAttr()); |
|
|
|
|
te.setPerformanceFirst(editor.isPerformanceFirst()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
LayerConfig[] configs = (LayerConfig[]) layerDataControlPane.update().getObject(); |
|
|
|
|
te.setAutoBuild(false); |
|
|
|
|
te.setFastLayerBuild(true); |
|
|
|
|
te.setLayerConfigs(Arrays.asList(configs)); |
|
|
|
|
} |
|
|
|
|
return te; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 树节点属性的update |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public Object updateTreeNodeAttrs() { |
|
|
|
@ -207,64 +140,19 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 下拉树的update |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public TreeComboBoxEditor updateTreeComboBox() { |
|
|
|
|
TreeComboBoxEditor tcb = new TreeComboBoxEditor(); |
|
|
|
|
if (buildBox.getSelectedIndex() == 1) { |
|
|
|
|
TableDataDictionary dictionary = this.autoBuildPane.update(); |
|
|
|
|
tcb.setAutoBuild(true); |
|
|
|
|
tcb.setFastLayerBuild(false); |
|
|
|
|
tcb.setDictionary(dictionary); |
|
|
|
|
tcb.setNodeOrDict(dictionary); |
|
|
|
|
} else if (buildBox.getSelectedIndex() == 2) { |
|
|
|
|
tcb.setAutoBuild(false); |
|
|
|
|
tcb.setFastLayerBuild(false); |
|
|
|
|
NameObject no = this.controlPane.update(); |
|
|
|
|
if (no != null) { |
|
|
|
|
if (no.getObject() instanceof TreeComboBoxEditor) { |
|
|
|
|
return (TreeComboBoxEditor) no.getObject(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TreeEditor editor = (TreeEditor) no.getObject(); |
|
|
|
|
tcb.setAllowBlank(editor.isAllowBlank()); |
|
|
|
|
tcb.setEnabled(editor.isEnabled()); |
|
|
|
|
tcb.setDirectEdit(editor.isDirectEdit()); |
|
|
|
|
tcb.setErrorMessage(editor.getErrorMessage()); |
|
|
|
|
tcb.setWidgetName(editor.getWidgetName()); |
|
|
|
|
tcb.setVisible(editor.isVisible()); |
|
|
|
|
tcb.setWaterMark(editor.getWaterMark()); |
|
|
|
|
tcb.setRemoveRepeat(editor.isRemoveRepeat()); |
|
|
|
|
tcb.setTreeAttr(editor.getTreeAttr()); |
|
|
|
|
tcb.setTreeNodeAttr(editor.getTreeNodeAttr()); |
|
|
|
|
tcb.setNodeOrDict(editor.getTreeNodeAttr()); |
|
|
|
|
tcb.setPerformanceFirst(editor.isPerformanceFirst()); |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
LayerConfig[] configs = (LayerConfig[]) layerDataControlPane.update().getObject(); |
|
|
|
|
tcb.setAutoBuild(false); |
|
|
|
|
tcb.setFastLayerBuild(true); |
|
|
|
|
tcb.setLayerConfigs(Arrays.asList(configs)); |
|
|
|
|
} |
|
|
|
|
return tcb; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
* @param nodeOrDict |
|
|
|
|
*/ |
|
|
|
|
public void populate(Object nodeOrDict) { |
|
|
|
|
if(nodeOrDict instanceof TreeNodeAttr[] || nodeOrDict instanceof TreeNodeWrapper) { |
|
|
|
|
if (nodeOrDict instanceof TreeNodeAttr[] || nodeOrDict instanceof TreeNodeWrapper) { |
|
|
|
|
buildBox.setSelectedIndex(2); |
|
|
|
|
NameObject no = new NameObject("name", nodeOrDict); |
|
|
|
|
controlPane.populate(no); |
|
|
|
|
} else if(nodeOrDict instanceof TableDataDictionary) { |
|
|
|
|
} else if (nodeOrDict instanceof TableDataDictionary) { |
|
|
|
|
buildBox.setSelectedIndex(1); |
|
|
|
|
autoBuildPane.populate((TableDataDictionary)nodeOrDict); |
|
|
|
|
} else if (nodeOrDict instanceof NameObject) { |
|
|
|
|
autoBuildPane.populate((TableDataDictionary) nodeOrDict); |
|
|
|
|
} else if (nodeOrDict instanceof LayerConfig[]) { |
|
|
|
|
buildBox.setSelectedIndex(0); |
|
|
|
|
layerDataControlPane.populate((NameObject) nodeOrDict); |
|
|
|
|
layerDataControlPane.populate((LayerConfig[]) nodeOrDict); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |