From 0b25393c94764082187e6aa17a41070bbd03794b Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 24 Aug 2017 11:29:04 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-3789=20[9.0=E4=B8=80=E8=BD=AE=E5=9B=9E?= =?UTF-8?q?=E5=BD=92]=E4=B8=8B=E6=8B=89=E6=A0=91=E3=80=81=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E6=A0=91=E6=8E=A7=E4=BB=B6=E6=97=A0=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E6=A0=91=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/DirectWriteEditorDefinePane.java | 2 +- .../ui/TreeComboBoxEditorDefinePane.java | 32 ++++++-- .../widget/ui/TreeEditorDefinePane.java | 25 +++--- .../design/widget/ui/WaterMarkDictPane.java | 9 +-- .../AccessibleTreeModelEditor.java | 80 +++++++++---------- .../widget/wrappers/TreeModelWrapper.java | 78 +++++++++--------- .../TreeComboBoxEditorDefinePane.java | 12 ++- .../ui/designer/TreeEditorDefinePane.java | 30 ++++--- 8 files changed, 150 insertions(+), 118 deletions(-) rename {designer_form => designer_base}/src/com/fr/design/mainframe/widget/accessibles/AccessibleTreeModelEditor.java (96%) rename {designer_form => designer_base}/src/com/fr/design/mainframe/widget/wrappers/TreeModelWrapper.java (97%) diff --git a/designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java index 3d7e33510..2cdc0bc84 100644 --- a/designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java @@ -24,7 +24,7 @@ public abstract class DirectWriteEditorDefinePane e JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); directWriteCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_Edit"), false); - directWriteCheckBox.setPreferredSize(new Dimension(100, 30)); + directWriteCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); waterMarkDictPane = new WaterMarkDictPane(); contentPane.add(waterMarkDictPane, BorderLayout.NORTH); diff --git a/designer/src/com/fr/design/widget/ui/TreeComboBoxEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/TreeComboBoxEditorDefinePane.java index 3570cc66a..2a63a5b86 100644 --- a/designer/src/com/fr/design/widget/ui/TreeComboBoxEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/TreeComboBoxEditorDefinePane.java @@ -1,19 +1,23 @@ package com.fr.design.widget.ui; -import java.awt.BorderLayout; +import java.awt.*; import javax.swing.BorderFactory; import javax.swing.JPanel; +import com.fr.data.Dictionary; import com.fr.design.data.DataCreatorUI; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itree.refreshabletree.TreeRootPane; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.gui.frpane.TreeSettingPane; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.widget.accessibles.AccessibleTreeModelEditor; import com.fr.form.ui.TreeComboBoxEditor; import com.fr.form.ui.TreeEditor; +import com.fr.general.Inter; public class TreeComboBoxEditorDefinePane extends CustomWritableRepeatEditorPane { - protected TreeSettingPane treeSettingPane; + protected AccessibleTreeModelEditor treeSettingPane; protected TreeRootPane treeRootPane; public TreeComboBoxEditorDefinePane() { @@ -27,9 +31,22 @@ public class TreeComboBoxEditorDefinePane extends CustomWritableRepeatEditorPane content.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); treeRootPane = new TreeRootPane(); content.add(treeRootPane, BorderLayout.NORTH); - treeSettingPane = new TreeSettingPane(true); return content; } + + @Override + protected JPanel setFirstContentPane() { + treeSettingPane = new AccessibleTreeModelEditor(); + JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + JPanel north = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Create_Tree")), treeSettingPane}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7); + north.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + JPanel center = super.setFirstContentPane(); + jPanel.add(north, BorderLayout.NORTH); + jPanel.add(center, BorderLayout.CENTER); + return jPanel; + } + + @Override protected String title4PopupWindow() { @@ -38,19 +55,20 @@ public class TreeComboBoxEditorDefinePane extends CustomWritableRepeatEditorPane @Override protected void populateSubCustomWritableRepeatEditorBean(TreeEditor e) { - treeSettingPane.populate(e); + treeSettingPane.setValue(e.getDictionary()); treeRootPane.populate(e.getTreeAttr()); } @Override protected TreeComboBoxEditor updateSubCustomWritableRepeatEditorBean() { - TreeComboBoxEditor editor = treeSettingPane.updateTreeComboBox(); + TreeComboBoxEditor editor = new TreeComboBoxEditor(); + editor.setDictionary((Dictionary)treeSettingPane.getValue()); editor.setTreeAttr(treeRootPane.update()); return editor; } @Override public DataCreatorUI dataUI() { - return treeSettingPane; + return null; } } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java index d5bdb2255..96d83b7b6 100644 --- a/designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java @@ -1,10 +1,13 @@ package com.fr.design.widget.ui; +import com.fr.data.Dictionary; import com.fr.design.data.DataCreatorUI; -import com.fr.design.gui.frpane.TreeSettingPane; import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itree.refreshabletree.TreeRootPane; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.widget.accessibles.AccessibleTreeModelEditor; import com.fr.form.ui.TreeEditor; import com.fr.general.Inter; @@ -16,8 +19,8 @@ import java.awt.*; * richer:tree editor */ public class TreeEditorDefinePane extends FieldEditorDefinePane { - protected TreeSettingPane treeSettingPane; protected TreeRootPane treeRootPane; + private AccessibleTreeModelEditor accessibleTreeModelEditor; private UICheckBox removeRepeatCheckBox; @@ -27,7 +30,7 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane { @Override protected void populateSubFieldEditorBean(TreeEditor e) { - this.treeSettingPane.populate(e); + this.accessibleTreeModelEditor.setValue(e.getDictionary()); treeRootPane.populate(e.getTreeAttr()); if (this.removeRepeatCheckBox != null) { this.removeRepeatCheckBox.setSelected(e.isRemoveRepeat()); @@ -36,7 +39,8 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane { @Override protected TreeEditor updateSubFieldEditorBean() { - TreeEditor editor = treeSettingPane.updateTreeEditor(); + TreeEditor editor = new TreeEditor(); + editor.setDictionary((Dictionary) accessibleTreeModelEditor.getValue()); editor.setTreeAttr(treeRootPane.update()); if (this.removeRepeatCheckBox != null) { editor.setRemoveRepeat(this.removeRepeatCheckBox.isSelected()); @@ -50,13 +54,17 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane { } protected JPanel setSecondContentPane() { + accessibleTreeModelEditor = new AccessibleTreeModelEditor(); + JPanel createTree = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{new UILabel(Inter.getLocText("FR-Designer_Create_Tree")), accessibleTreeModelEditor}}, TableLayoutHelper.FILL_LASTCOLUMN, 18, 7); + createTree.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - JPanel contenter = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane_First0(); + JPanel contenter = FRGUIPaneFactory.createBorderLayout_S_Pane(); contentPane.add(contenter,BorderLayout.NORTH); removeRepeatCheckBox = new UICheckBox(Inter.getLocText("Form-Remove_Repeat_Data"), false); - contenter.add(removeRepeatCheckBox); + removeRepeatCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + contenter.add(createTree, BorderLayout.NORTH); + contenter.add(removeRepeatCheckBox, BorderLayout.CENTER); JPanel otherContentPane = this.setThirdContentPane(); if (otherContentPane != null) { contentPane.add(otherContentPane,BorderLayout.CENTER); @@ -69,7 +77,6 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane { content.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); treeRootPane = new TreeRootPane(); content.add(treeRootPane, BorderLayout.NORTH); - treeSettingPane = new TreeSettingPane(true); return content; } @@ -80,6 +87,6 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane { @Override public DataCreatorUI dataUI() { - return treeSettingPane; + return null; } } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java b/designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java index b0668db16..1bfcb0633 100644 --- a/designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java +++ b/designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java @@ -20,18 +20,15 @@ public class WaterMarkDictPane extends JPanel { waterMarkTextField = new UITextField(); - UILabel emptyLabel = new UILabel(); - emptyLabel.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); - double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), emptyLabel, waterMarkTextField}, + new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), waterMarkTextField}, }; double[] rowSize = {p}; - double[] columnSize = {p, p, f}; + double[] columnSize = {p, f}; int[][] rowCount = {{1, 1}}; - JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 18, 7); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); this.add(panel, BorderLayout.CENTER); } diff --git a/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleTreeModelEditor.java b/designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleTreeModelEditor.java similarity index 96% rename from designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleTreeModelEditor.java rename to designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleTreeModelEditor.java index ef02c9f34..5ce099c91 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleTreeModelEditor.java +++ b/designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleTreeModelEditor.java @@ -1,41 +1,41 @@ -package com.fr.design.mainframe.widget.accessibles; - -import javax.swing.SwingUtilities; - -import com.fr.design.mainframe.widget.wrappers.TreeModelWrapper; -import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.gui.frpane.TreeSettingPane; - - -/** - * 用于TreeEdito和TreeComboBox的数据格式设置 - * @since 6.5.3 - */ -public class AccessibleTreeModelEditor extends UneditableAccessibleEditor { - - private TreeSettingPane treeSettingPane; - - public AccessibleTreeModelEditor() { - super(new TreeModelWrapper()); - } - - @Override - protected void showEditorPane() { - if (treeSettingPane == null) { - treeSettingPane = new TreeSettingPane(false); - } - BasicDialog dlg = treeSettingPane.showWindow(SwingUtilities.getWindowAncestor(this)); - treeSettingPane.populate(getValue()); - dlg.addDialogActionListener(new DialogActionAdapter() { - - @Override - public void doOk() { - Object nodeOrDict = treeSettingPane.updateTreeNodeAttrs(); - setValue(nodeOrDict); - fireStateChanged(); - } - }); - dlg.setVisible(true); - } +package com.fr.design.mainframe.widget.accessibles; + +import javax.swing.SwingUtilities; + +import com.fr.design.mainframe.widget.wrappers.TreeModelWrapper; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.gui.frpane.TreeSettingPane; + + +/** + * 用于TreeEdito和TreeComboBox的数据格式设置 + * @since 6.5.3 + */ +public class AccessibleTreeModelEditor extends UneditableAccessibleEditor { + + private TreeSettingPane treeSettingPane; + + public AccessibleTreeModelEditor() { + super(new TreeModelWrapper()); + } + + @Override + protected void showEditorPane() { + if (treeSettingPane == null) { + treeSettingPane = new TreeSettingPane(false); + } + BasicDialog dlg = treeSettingPane.showWindow(SwingUtilities.getWindowAncestor(this)); + treeSettingPane.populate(getValue()); + dlg.addDialogActionListener(new DialogActionAdapter() { + + @Override + public void doOk() { + Object nodeOrDict = treeSettingPane.updateTreeNodeAttrs(); + setValue(nodeOrDict); + fireStateChanged(); + } + }); + dlg.setVisible(true); + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/widget/wrappers/TreeModelWrapper.java b/designer_base/src/com/fr/design/mainframe/widget/wrappers/TreeModelWrapper.java similarity index 97% rename from designer_form/src/com/fr/design/mainframe/widget/wrappers/TreeModelWrapper.java rename to designer_base/src/com/fr/design/mainframe/widget/wrappers/TreeModelWrapper.java index 17f9d0c89..1127c2503 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/wrappers/TreeModelWrapper.java +++ b/designer_base/src/com/fr/design/mainframe/widget/wrappers/TreeModelWrapper.java @@ -1,40 +1,40 @@ -package com.fr.design.mainframe.widget.wrappers; - -import com.fr.base.TemplateUtils; -import com.fr.data.impl.TreeNodeAttr; -import com.fr.data.impl.TreeNodeWrapper; -import com.fr.design.Exception.ValidationException; -import com.fr.design.designer.properties.Decoder; -import com.fr.design.designer.properties.Encoder; -import com.fr.general.Inter; -import com.fr.general.NameObject; -import com.fr.stable.StringUtils; - -public class TreeModelWrapper implements Encoder, Decoder { - - @Override - public String encode(Object v) { - if (v == null) { - return StringUtils.EMPTY; - } - if (v instanceof TreeNodeAttr[]) { - return TemplateUtils.render(Inter.getLocText("FR-Designer_Total_N_Grade"), new String[]{"N"}, new String[]{((TreeNodeAttr[]) v).length + ""}); - } else if (v instanceof TreeNodeWrapper) { - TreeNodeAttr[] treeNodeAttrs = ((TreeNodeWrapper) v).getTreeNodeAttrs(); - return TemplateUtils.render(Inter.getLocText("FR-Designer_Total_N_Grade"), new String[]{"N"}, new String[]{treeNodeAttrs.length + ""}); - } else if (v instanceof NameObject) { - return Inter.getLocText("FR-Designer_DataTable-Build"); - } else { - return Inter.getLocText("FR-Designer_Auto-Build"); - } - } - - @Override - public Object decode(String txt) { - return null; - } - - @Override - public void validate(String txt) throws ValidationException { - } +package com.fr.design.mainframe.widget.wrappers; + +import com.fr.base.TemplateUtils; +import com.fr.data.impl.TreeNodeAttr; +import com.fr.data.impl.TreeNodeWrapper; +import com.fr.design.Exception.ValidationException; +import com.fr.design.designer.properties.Decoder; +import com.fr.design.designer.properties.Encoder; +import com.fr.general.Inter; +import com.fr.general.NameObject; +import com.fr.stable.StringUtils; + +public class TreeModelWrapper implements Encoder, Decoder { + + @Override + public String encode(Object v) { + if (v == null) { + return StringUtils.EMPTY; + } + if (v instanceof TreeNodeAttr[]) { + return TemplateUtils.render(Inter.getLocText("FR-Designer_Total_N_Grade"), new String[]{"N"}, new String[]{((TreeNodeAttr[]) v).length + ""}); + } else if (v instanceof TreeNodeWrapper) { + TreeNodeAttr[] treeNodeAttrs = ((TreeNodeWrapper) v).getTreeNodeAttrs(); + return TemplateUtils.render(Inter.getLocText("FR-Designer_Total_N_Grade"), new String[]{"N"}, new String[]{treeNodeAttrs.length + ""}); + } else if (v instanceof NameObject) { + return Inter.getLocText("FR-Designer_DataTable-Build"); + } else { + return Inter.getLocText("FR-Designer_Auto-Build"); + } + } + + @Override + public Object decode(String txt) { + return null; + } + + @Override + public void validate(String txt) throws ValidationException { + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/widget/ui/designer/TreeComboBoxEditorDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/TreeComboBoxEditorDefinePane.java index baabdac70..fd26c6934 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/TreeComboBoxEditorDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/TreeComboBoxEditorDefinePane.java @@ -27,15 +27,13 @@ public class TreeComboBoxEditorDefinePane extends TreeEditorDefinePane { return "treecombobox"; } - protected void populateSubDictionaryEditorBean(TreeEditor ob){ - super.populateSubDictionaryEditorBean(ob); - formWidgetValuePane.populate(ob); + protected void populateSubCustomWritableRepeatEditorBean(TreeEditor ob){ + super.populateSubCustomWritableRepeatEditorBean(ob); waterMarkDictPane.setText(ob.getWaterMark()); } - protected TreeEditor updateSubDictionaryEditorBean(){ - TreeEditor editor = super.updateSubDictionaryEditorBean(); - formWidgetValuePane.update(editor); + protected TreeEditor updateSubCustomWritableRepeatEditorBean(){ + TreeEditor editor = super.updateSubCustomWritableRepeatEditorBean(); editor.setWaterMark(waterMarkDictPane.getText()); return editor; } @@ -44,6 +42,6 @@ public class TreeComboBoxEditorDefinePane extends TreeEditorDefinePane { @Override public DataCreatorUI dataUI() { - return treeSettingPane; + return null; } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/widget/ui/designer/TreeEditorDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/TreeEditorDefinePane.java index 6edfe78c7..100fb2800 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/TreeEditorDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/TreeEditorDefinePane.java @@ -1,14 +1,16 @@ package com.fr.design.widget.ui.designer; +import com.fr.data.Dictionary; import com.fr.design.data.DataCreatorUI; import com.fr.design.designer.creator.XCreator; -import com.fr.design.gui.frpane.TreeSettingPane; import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itree.refreshabletree.TreeRootPane; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.widget.accessibles.AccessibleTreeModelEditor; import com.fr.form.ui.TreeEditor; import com.fr.general.Inter; @@ -19,20 +21,21 @@ import java.awt.*; /* * richer:tree editor */ -public class TreeEditorDefinePane extends DictEditorDefinePane { - protected TreeSettingPane treeSettingPane; +public class TreeEditorDefinePane extends CustomWritableRepeatEditorPane { protected TreeRootPane treeRootPane; private UICheckBox mutiSelect; private UICheckBox loadAsync; private UICheckBox returnLeaf; private UICheckBox returnPath; + private AccessibleTreeModelEditor accessibleTreeModelEditor; public TreeEditorDefinePane(XCreator xCreator) { super(xCreator); treeRootPane = new TreeRootPane(); - treeSettingPane = new TreeSettingPane(true); } + + public JPanel createOtherPane() { mutiSelect = new UICheckBox(Inter.getLocText("Tree-Mutiple_Selection_Or_Not")); loadAsync = new UICheckBox(Inter.getLocText("Widget-Load_By_Async")); @@ -58,9 +61,16 @@ public class TreeEditorDefinePane extends DictEditorDefinePane { return "tree"; } - protected void populateSubDictionaryEditorBean(TreeEditor e){ + + protected Component[] createDictPane(){ + accessibleTreeModelEditor = new AccessibleTreeModelEditor(); + return new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS-Dictionary")), accessibleTreeModelEditor}; + } + + @Override + protected void populateSubCustomWritableRepeatEditorBean(TreeEditor e) { + accessibleTreeModelEditor.setValue(e.getDictionary()); formWidgetValuePane.populate(e); - treeSettingPane.populate(e); treeRootPane.populate(e.getTreeAttr()); mutiSelect.setSelected(e.isMultipleSelection()); loadAsync.setSelected(e.isAjax()); @@ -68,7 +78,9 @@ public class TreeEditorDefinePane extends DictEditorDefinePane { returnPath.setSelected(e.isReturnFullPath()); } - protected TreeEditor updateSubDictionaryEditorBean(){ + + @Override + protected TreeEditor updateSubCustomWritableRepeatEditorBean() { TreeEditor editor = (TreeEditor)creator.toData(); formWidgetValuePane.update(editor); editor.setTreeAttr(treeRootPane.update()); @@ -76,12 +88,12 @@ public class TreeEditorDefinePane extends DictEditorDefinePane { editor.setAjax(loadAsync.isSelected()); editor.setSelectLeafOnly(returnLeaf.isSelected()); editor.setReturnFullPath(returnPath.isSelected()); + editor.setDictionary((Dictionary) accessibleTreeModelEditor.getValue()); return editor; } - @Override public DataCreatorUI dataUI() { - return treeSettingPane; + return null; } } \ No newline at end of file