kerry
7 years ago
8 changed files with 150 additions and 118 deletions
@ -1,41 +1,41 @@ |
|||||||
package com.fr.design.mainframe.widget.accessibles; |
package com.fr.design.mainframe.widget.accessibles; |
||||||
|
|
||||||
import javax.swing.SwingUtilities; |
import javax.swing.SwingUtilities; |
||||||
|
|
||||||
import com.fr.design.mainframe.widget.wrappers.TreeModelWrapper; |
import com.fr.design.mainframe.widget.wrappers.TreeModelWrapper; |
||||||
import com.fr.design.dialog.BasicDialog; |
import com.fr.design.dialog.BasicDialog; |
||||||
import com.fr.design.dialog.DialogActionAdapter; |
import com.fr.design.dialog.DialogActionAdapter; |
||||||
import com.fr.design.gui.frpane.TreeSettingPane; |
import com.fr.design.gui.frpane.TreeSettingPane; |
||||||
|
|
||||||
|
|
||||||
/** |
/** |
||||||
* 用于TreeEdito和TreeComboBox的数据格式设置 |
* 用于TreeEdito和TreeComboBox的数据格式设置 |
||||||
* @since 6.5.3 |
* @since 6.5.3 |
||||||
*/ |
*/ |
||||||
public class AccessibleTreeModelEditor extends UneditableAccessibleEditor { |
public class AccessibleTreeModelEditor extends UneditableAccessibleEditor { |
||||||
|
|
||||||
private TreeSettingPane treeSettingPane; |
private TreeSettingPane treeSettingPane; |
||||||
|
|
||||||
public AccessibleTreeModelEditor() { |
public AccessibleTreeModelEditor() { |
||||||
super(new TreeModelWrapper()); |
super(new TreeModelWrapper()); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected void showEditorPane() { |
protected void showEditorPane() { |
||||||
if (treeSettingPane == null) { |
if (treeSettingPane == null) { |
||||||
treeSettingPane = new TreeSettingPane(false); |
treeSettingPane = new TreeSettingPane(false); |
||||||
} |
} |
||||||
BasicDialog dlg = treeSettingPane.showWindow(SwingUtilities.getWindowAncestor(this)); |
BasicDialog dlg = treeSettingPane.showWindow(SwingUtilities.getWindowAncestor(this)); |
||||||
treeSettingPane.populate(getValue()); |
treeSettingPane.populate(getValue()); |
||||||
dlg.addDialogActionListener(new DialogActionAdapter() { |
dlg.addDialogActionListener(new DialogActionAdapter() { |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void doOk() { |
public void doOk() { |
||||||
Object nodeOrDict = treeSettingPane.updateTreeNodeAttrs(); |
Object nodeOrDict = treeSettingPane.updateTreeNodeAttrs(); |
||||||
setValue(nodeOrDict); |
setValue(nodeOrDict); |
||||||
fireStateChanged(); |
fireStateChanged(); |
||||||
} |
} |
||||||
}); |
}); |
||||||
dlg.setVisible(true); |
dlg.setVisible(true); |
||||||
} |
} |
||||||
} |
} |
@ -1,40 +1,40 @@ |
|||||||
package com.fr.design.mainframe.widget.wrappers; |
package com.fr.design.mainframe.widget.wrappers; |
||||||
|
|
||||||
import com.fr.base.TemplateUtils; |
import com.fr.base.TemplateUtils; |
||||||
import com.fr.data.impl.TreeNodeAttr; |
import com.fr.data.impl.TreeNodeAttr; |
||||||
import com.fr.data.impl.TreeNodeWrapper; |
import com.fr.data.impl.TreeNodeWrapper; |
||||||
import com.fr.design.Exception.ValidationException; |
import com.fr.design.Exception.ValidationException; |
||||||
import com.fr.design.designer.properties.Decoder; |
import com.fr.design.designer.properties.Decoder; |
||||||
import com.fr.design.designer.properties.Encoder; |
import com.fr.design.designer.properties.Encoder; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.general.NameObject; |
import com.fr.general.NameObject; |
||||||
import com.fr.stable.StringUtils; |
import com.fr.stable.StringUtils; |
||||||
|
|
||||||
public class TreeModelWrapper implements Encoder, Decoder { |
public class TreeModelWrapper implements Encoder, Decoder { |
||||||
|
|
||||||
@Override |
@Override |
||||||
public String encode(Object v) { |
public String encode(Object v) { |
||||||
if (v == null) { |
if (v == null) { |
||||||
return StringUtils.EMPTY; |
return StringUtils.EMPTY; |
||||||
} |
} |
||||||
if (v instanceof TreeNodeAttr[]) { |
if (v instanceof TreeNodeAttr[]) { |
||||||
return TemplateUtils.render(Inter.getLocText("FR-Designer_Total_N_Grade"), new String[]{"N"}, new String[]{((TreeNodeAttr[]) v).length + ""}); |
return TemplateUtils.render(Inter.getLocText("FR-Designer_Total_N_Grade"), new String[]{"N"}, new String[]{((TreeNodeAttr[]) v).length + ""}); |
||||||
} else if (v instanceof TreeNodeWrapper) { |
} else if (v instanceof TreeNodeWrapper) { |
||||||
TreeNodeAttr[] treeNodeAttrs = ((TreeNodeWrapper) v).getTreeNodeAttrs(); |
TreeNodeAttr[] treeNodeAttrs = ((TreeNodeWrapper) v).getTreeNodeAttrs(); |
||||||
return TemplateUtils.render(Inter.getLocText("FR-Designer_Total_N_Grade"), new String[]{"N"}, new String[]{treeNodeAttrs.length + ""}); |
return TemplateUtils.render(Inter.getLocText("FR-Designer_Total_N_Grade"), new String[]{"N"}, new String[]{treeNodeAttrs.length + ""}); |
||||||
} else if (v instanceof NameObject) { |
} else if (v instanceof NameObject) { |
||||||
return Inter.getLocText("FR-Designer_DataTable-Build"); |
return Inter.getLocText("FR-Designer_DataTable-Build"); |
||||||
} else { |
} else { |
||||||
return Inter.getLocText("FR-Designer_Auto-Build"); |
return Inter.getLocText("FR-Designer_Auto-Build"); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public Object decode(String txt) { |
public Object decode(String txt) { |
||||||
return null; |
return null; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void validate(String txt) throws ValidationException { |
public void validate(String txt) throws ValidationException { |
||||||
} |
} |
||||||
} |
} |
Loading…
Reference in new issue