Browse Source

Merge pull request #1112 in BA/design from ~KERRY/design:release/9.0 to release/9.0

* commit 'c432e66f1b5d95aebabed67a3547d38a79354a23':
  REPORT-3789 [9.0一轮回归]下拉树、视图树控件无构建树设置
master
superman 7 years ago
parent
commit
c6b871a8d1
  1. 2
      designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java
  2. 32
      designer/src/com/fr/design/widget/ui/TreeComboBoxEditorDefinePane.java
  3. 25
      designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java
  4. 9
      designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java
  5. 80
      designer_base/src/com/fr/design/mainframe/widget/accessibles/AccessibleTreeModelEditor.java
  6. 78
      designer_base/src/com/fr/design/mainframe/widget/wrappers/TreeModelWrapper.java
  7. 12
      designer_form/src/com/fr/design/widget/ui/designer/TreeComboBoxEditorDefinePane.java
  8. 30
      designer_form/src/com/fr/design/widget/ui/designer/TreeEditorDefinePane.java

2
designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java

@ -24,7 +24,7 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> 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);

32
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<TreeEditor> {
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;
}
}

25
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<TreeEditor> {
protected TreeSettingPane treeSettingPane;
protected TreeRootPane treeRootPane;
private AccessibleTreeModelEditor accessibleTreeModelEditor;
private UICheckBox removeRepeatCheckBox;
@ -27,7 +30,7 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane<TreeEditor> {
@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<TreeEditor> {
@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<TreeEditor> {
}
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<TreeEditor> {
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<TreeEditor> {
@Override
public DataCreatorUI dataUI() {
return treeSettingPane;
return null;
}
}

9
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);
}

80
designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleTreeModelEditor.java → 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);
}
}

78
designer_form/src/com/fr/design/mainframe/widget/wrappers/TreeModelWrapper.java → 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 {
}
}

12
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;
}
}

30
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<TreeEditor> {
protected TreeSettingPane treeSettingPane;
public class TreeEditorDefinePane extends CustomWritableRepeatEditorPane<TreeEditor> {
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<TreeEditor> {
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<TreeEditor> {
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<TreeEditor> {
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;
}
}
Loading…
Cancel
Save