forked from fanruan/design
Browse Source
* commit 'c432e66f1b5d95aebabed67a3547d38a79354a23': REPORT-3789 [9.0一轮回归]下拉树、视图树控件无构建树设置master
superman
7 years ago
8 changed files with 150 additions and 118 deletions
@ -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); |
||||
} |
||||
} |
@ -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 { |
||||
} |
||||
} |
Loading…
Reference in new issue