Normand Briere
2019-08-06 b3ae4e889872ca0b9ca76f1d17b2f0b961226729
cTreeModel.java
....@@ -8,101 +8,100 @@
88
99 public cTreeModel(Object3D owner)
1010 {
11
- root = owner;
11
+ root = owner;
1212 }
1313
1414 public void addTreeModelListener(TreeModelListener l)
1515 {
1616 }
1717
18
- public Object getChild(Object parent, int index)
18
+ public Object getChild(Object parent, int index)
1919 {
20
- Object3D /*Composite*/ group = (Object3D /*Composite*/) parent;
20
+ Object3D /*Composite*/ group = (Object3D /*Composite*/) parent;
2121
22
- return group./*children.*/get(index);
22
+ return group./*children.*/get(index);
2323 }
2424
25
- public int getChildCount(Object parent)
25
+ public int getChildCount(Object parent)
2626 {
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
+ }
3131
32
- //return 0;
32
+ //return 0;
3333 }
3434
35
- public int getIndexOfChild(Object parent, Object child)
35
+ public int getIndexOfChild(Object parent, Object child)
3636 {
37
- Object3D /*Composite*/ group = (Object3D /*Composite*/) parent;
37
+ Object3D /*Composite*/ group = (Object3D /*Composite*/) parent;
3838
39
- return group./*GetObject().*/indexOf(child);
39
+ return group./*GetObject().*/indexOf(child);
4040 }
4141
42
- public Object getRoot()
42
+ public Object getRoot()
4343 {
44
- return root;
44
+ return root;
4545 }
4646
47
- public boolean isLeaf(Object node)
47
+ public boolean isLeaf(Object node)
4848 {
49
- return ((Object3D)node).Size() == 0; // !(node instanceof Composite);
49
+ return ((Object3D) node).Size() == 0; // !(node instanceof Composite);
5050 }
5151
52
- public void removeTreeModelListener(TreeModelListener l)
52
+ public void removeTreeModelListener(TreeModelListener l)
5353 {
5454 }
5555
56
- public void valueForPathChanged(TreePath path, Object newValue)
56
+ public void valueForPathChanged(TreePath path, Object newValue)
5757 {
5858 }
5959
6060 static class Renderer extends DefaultTreeCellRenderer
6161 {
62
- public Renderer() {
62
+ public Renderer()
63
+ {
6364 }
6465
6566 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)
7374 {
7475 //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);
8180
82
- //this.tree = tree;
83
- this.hasFocus = hasFocus;
84
- setText(stringValue);
81
+ //this.tree = tree;
82
+ this.hasFocus = hasFocus;
83
+ setText(stringValue);
8584
86
- Object3D obj = (Object3D) value;
87
-
88
- int r = 0, g = 0, b = 0;
85
+ Object3D obj = (Object3D) value;
8986
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);
106105
107106 // isDropCell = false;
108107 // JTree.DropLocation dropLocation = tree.getDropLocation();
....@@ -126,9 +125,9 @@
126125 // }
127126
128127 // setBackground(fg);
129
- setForeground(fg);
128
+ setForeground(fg);
130129
131
- // There needs to be a way to specify disabled icons.
130
+ // There needs to be a way to specify disabled icons.
132131 // if (!tree.isEnabled()) {
133132 // setEnabled(false);
134133 //
....@@ -152,20 +151,22 @@
152151 // }
153152 // }
154153
155
- setComponentOrientation(tree.getComponentOrientation());
154
+ setComponentOrientation(tree.getComponentOrientation());
156155
157
- selected = sel;
156
+ selected = sel;
158157
159158 //Object3D obj = (Object3D) value;
160
-
161
- if(obj.material == null)
159
+
160
+ if (obj.material == null)
161
+ {
162162 setIcon(null);
163
-
163
+ }
164
+
164165 setToolTipText("This book is in the Tutorial series.");
165166
166167 return this;
167168 }
168
-
169
+
169170 public void setText(String text)
170171 {
171172 //System.out.println(text);