01: package org.swingml.treetablebrowser.ext;
02:
03: import java.awt.*;
04: import java.util.List;
05:
06: import org.swingml.*;
07:
08: public class TreeTableBrowserDataModel extends SwingMLModel {
09:
10: private String alignment = Constants.LEFT;
11: private boolean autoSelect = true;
12: private boolean dirty = false;
13: public String displayValue = null;
14: private boolean editable = true;
15:
16: public TreeTableBrowserDataModel(Container aContainer) {
17: super ();
18: }
19:
20: public String getAlignment() {
21: return alignment;
22: }
23:
24: public String getDisplayValue() {
25: return displayValue;
26: }
27:
28: public List getIcons() {
29: return getChildren();
30: }
31:
32: public boolean hasIcons() {
33: return (this .getChildren() != null && !this .getChildren()
34: .isEmpty());
35: }
36:
37: public boolean isDirty() {
38: return dirty;
39: }
40:
41: /**
42: * @return Returns the editable.
43: */
44: public boolean isEditable() {
45: return editable;
46: }
47:
48: public void setAlignment(String align) {
49: // ignore anything not Center, Left or Right
50: if (align.equalsIgnoreCase(Constants.CENTER)
51: || align.equalsIgnoreCase(Constants.LEFT)
52: || align.equalsIgnoreCase(Constants.RIGHT)) {
53: this .alignment = align;
54: } else {
55: this .alignment = Constants.LEFT;
56: }
57: }
58:
59: public void setAutoSelect(boolean shouldAutoSelect) {
60: this .autoSelect = shouldAutoSelect;
61: }
62:
63: public void setDirty(boolean isDirty) {
64: this .dirty = isDirty;
65: }
66:
67: /**
68: * @param value
69: * The displayValue to set.
70: */
71: public void setDisplayValue(String value) {
72: this .displayValue = value;
73: }
74:
75: /**
76: * @param isEditable
77: * The editable to set.
78: */
79: public void setEditable(boolean isEditable) {
80: this .editable = isEditable;
81: }
82:
83: public boolean shouldAutoSelectOnCellEdit() {
84: return autoSelect;
85: }
86:
87: public String toString() {
88: // apply type converter is present...
89: return getDisplayValue() == null ? getText()
90: : getDisplayValue();
91: }
92: }
|