.. | .. |
---|
8 | 8 | |
---|
9 | 9 | public cTreeModel(Object3D owner) |
---|
10 | 10 | { |
---|
11 | | - root = owner; |
---|
| 11 | + root = owner; |
---|
12 | 12 | } |
---|
13 | 13 | |
---|
14 | 14 | public void addTreeModelListener(TreeModelListener l) |
---|
15 | 15 | { |
---|
16 | 16 | } |
---|
17 | 17 | |
---|
18 | | - public Object getChild(Object parent, int index) |
---|
| 18 | + public Object getChild(Object parent, int index) |
---|
19 | 19 | { |
---|
20 | | - Object3D /*Composite*/ group = (Object3D /*Composite*/) parent; |
---|
| 20 | + Object3D /*Composite*/ group = (Object3D /*Composite*/) parent; |
---|
21 | 21 | |
---|
22 | | - return group./*children.*/get(index); |
---|
| 22 | + return group./*children.*/get(index); |
---|
23 | 23 | } |
---|
24 | 24 | |
---|
25 | | - public int getChildCount(Object parent) |
---|
| 25 | + public int getChildCount(Object parent) |
---|
26 | 26 | { |
---|
27 | | - //if (parent instanceof Composite) |
---|
28 | | - { |
---|
29 | | - return ((Object3D /*Composite*/) parent)/*.children*/.Size(); |
---|
30 | | - } |
---|
| 27 | + //if (parent instanceof Composite) |
---|
| 28 | + { |
---|
| 29 | + return ((Object3D /*Composite*/) parent)/*.children*/.Size(); |
---|
| 30 | + } |
---|
31 | 31 | |
---|
32 | | - //return 0; |
---|
| 32 | + //return 0; |
---|
33 | 33 | } |
---|
34 | 34 | |
---|
35 | | - public int getIndexOfChild(Object parent, Object child) |
---|
| 35 | + public int getIndexOfChild(Object parent, Object child) |
---|
36 | 36 | { |
---|
37 | | - Object3D /*Composite*/ group = (Object3D /*Composite*/) parent; |
---|
| 37 | + Object3D /*Composite*/ group = (Object3D /*Composite*/) parent; |
---|
38 | 38 | |
---|
39 | | - return group./*GetObject().*/indexOf(child); |
---|
| 39 | + return group./*GetObject().*/indexOf(child); |
---|
40 | 40 | } |
---|
41 | 41 | |
---|
42 | | - public Object getRoot() |
---|
| 42 | + public Object getRoot() |
---|
43 | 43 | { |
---|
44 | | - return root; |
---|
| 44 | + return root; |
---|
45 | 45 | } |
---|
46 | 46 | |
---|
47 | | - public boolean isLeaf(Object node) |
---|
| 47 | + public boolean isLeaf(Object node) |
---|
48 | 48 | { |
---|
49 | | - return ((Object3D)node).Size() == 0; // !(node instanceof Composite); |
---|
| 49 | + return ((Object3D) node).Size() == 0; // !(node instanceof Composite); |
---|
50 | 50 | } |
---|
51 | 51 | |
---|
52 | | - public void removeTreeModelListener(TreeModelListener l) |
---|
| 52 | + public void removeTreeModelListener(TreeModelListener l) |
---|
53 | 53 | { |
---|
54 | 54 | } |
---|
55 | 55 | |
---|
56 | | - public void valueForPathChanged(TreePath path, Object newValue) |
---|
| 56 | + public void valueForPathChanged(TreePath path, Object newValue) |
---|
57 | 57 | { |
---|
58 | 58 | } |
---|
59 | 59 | |
---|
60 | 60 | static class Renderer extends DefaultTreeCellRenderer |
---|
61 | 61 | { |
---|
62 | | - public Renderer() { |
---|
| 62 | + public Renderer() |
---|
| 63 | + { |
---|
63 | 64 | } |
---|
64 | 65 | |
---|
65 | 66 | public java.awt.Component getTreeCellRendererComponent( |
---|
66 | | - javax.swing.JTree tree, |
---|
67 | | - Object value, |
---|
68 | | - boolean sel, |
---|
69 | | - boolean expanded, |
---|
70 | | - boolean leaf, |
---|
71 | | - int row, |
---|
72 | | - boolean hasFocus) |
---|
| 67 | + javax.swing.JTree tree, |
---|
| 68 | + Object value, |
---|
| 69 | + boolean sel, |
---|
| 70 | + boolean expanded, |
---|
| 71 | + boolean leaf, |
---|
| 72 | + int row, |
---|
| 73 | + boolean hasFocus) |
---|
73 | 74 | { |
---|
74 | 75 | //System.out.println(value.getClass()); |
---|
75 | | - super.getTreeCellRendererComponent( |
---|
76 | | - tree, value, sel, |
---|
77 | | - expanded, leaf, row, |
---|
78 | | - hasFocus); |
---|
79 | | - String stringValue = tree.convertValueToText(value, sel, |
---|
80 | | - expanded, leaf, row, hasFocus); |
---|
| 76 | + super.getTreeCellRendererComponent(tree, value, sel, |
---|
| 77 | + expanded, leaf, row, hasFocus); |
---|
| 78 | + String stringValue = tree.convertValueToText(value, sel, |
---|
| 79 | + expanded, leaf, row, hasFocus); |
---|
81 | 80 | |
---|
82 | | - //this.tree = tree; |
---|
83 | | - this.hasFocus = hasFocus; |
---|
84 | | - setText(stringValue); |
---|
| 81 | + //this.tree = tree; |
---|
| 82 | + this.hasFocus = hasFocus; |
---|
| 83 | + setText(stringValue); |
---|
85 | 84 | |
---|
86 | | - Object3D obj = (Object3D) value; |
---|
87 | | - |
---|
88 | | - int r = 0, g = 0, b = 0; |
---|
| 85 | + Object3D obj = (Object3D) value; |
---|
89 | 86 | |
---|
90 | | - if (obj.live) |
---|
91 | | - { |
---|
92 | | - g = 192; |
---|
93 | | - } |
---|
94 | | - |
---|
95 | | - if (obj.hide) |
---|
96 | | - { |
---|
97 | | - r = 192; |
---|
98 | | - } |
---|
99 | | - |
---|
100 | | - if (obj.link2master) |
---|
101 | | - { |
---|
102 | | - b = 192; |
---|
103 | | - } |
---|
104 | | - |
---|
105 | | - java.awt.Color fg = new java.awt.Color(r,g,b); |
---|
| 87 | + int r = 0, g = 0, b = 0; |
---|
| 88 | + |
---|
| 89 | + if (obj.live) |
---|
| 90 | + { |
---|
| 91 | + g = 192; |
---|
| 92 | + } |
---|
| 93 | + |
---|
| 94 | + if (obj.hide) |
---|
| 95 | + { |
---|
| 96 | + r = 192; |
---|
| 97 | + } |
---|
| 98 | + |
---|
| 99 | + if (obj.link2master) |
---|
| 100 | + { |
---|
| 101 | + b = 192; |
---|
| 102 | + } |
---|
| 103 | + |
---|
| 104 | + java.awt.Color fg = new java.awt.Color(r, g, b); |
---|
106 | 105 | |
---|
107 | 106 | // isDropCell = false; |
---|
108 | 107 | // JTree.DropLocation dropLocation = tree.getDropLocation(); |
---|
.. | .. |
---|
126 | 125 | // } |
---|
127 | 126 | |
---|
128 | 127 | // setBackground(fg); |
---|
129 | | - setForeground(fg); |
---|
| 128 | + setForeground(fg); |
---|
130 | 129 | |
---|
131 | | - // There needs to be a way to specify disabled icons. |
---|
| 130 | + // There needs to be a way to specify disabled icons. |
---|
132 | 131 | // if (!tree.isEnabled()) { |
---|
133 | 132 | // setEnabled(false); |
---|
134 | 133 | // |
---|
.. | .. |
---|
152 | 151 | // } |
---|
153 | 152 | // } |
---|
154 | 153 | |
---|
155 | | - setComponentOrientation(tree.getComponentOrientation()); |
---|
| 154 | + setComponentOrientation(tree.getComponentOrientation()); |
---|
156 | 155 | |
---|
157 | | - selected = sel; |
---|
| 156 | + selected = sel; |
---|
158 | 157 | |
---|
159 | 158 | //Object3D obj = (Object3D) value; |
---|
160 | | - |
---|
161 | | - if(obj.material == null) |
---|
| 159 | + |
---|
| 160 | + if (obj.material == null) |
---|
| 161 | + { |
---|
162 | 162 | setIcon(null); |
---|
163 | | - |
---|
| 163 | + } |
---|
| 164 | + |
---|
164 | 165 | setToolTipText("This book is in the Tutorial series."); |
---|
165 | 166 | |
---|
166 | 167 | return this; |
---|
167 | 168 | } |
---|
168 | | - |
---|
| 169 | + |
---|
169 | 170 | public void setText(String text) |
---|
170 | 171 | { |
---|
171 | 172 | //System.out.println(text); |
---|