1 Clazz.declarePackage ("javax.swing.tree");
2 Clazz.load (["javax.swing.JLabel", "javax.swing.tree.TreeCellRenderer"], "javax.swing.tree.DefaultTreeCellRenderer", ["java.awt.Dimension", "javax.swing.border.EmptyBorder", "javax.swing.plaf.ColorUIResource", "$.FontUIResource", "jssun.swing.DefaultLookup"], function () {
3 c$ = Clazz.decorateAsClass (function () {
6 this.$hasFocus = false;
7 this.drawsFocusBorderAroundIcon = false;
8 this.drawDashedFocusIndicator = false;
9 this.treeBGColor = null;
10 this.focusBGColor = null;
11 this.closedIcon = null;
14 this.textSelectionColor = null;
15 this.textNonSelectionColor = null;
16 this.backgroundSelectionColor = null;
17 this.backgroundNonSelectionColor = null;
18 this.borderSelectionColor = null;
19 this.isDropCell = false;
20 this.fillBackground = true;
21 Clazz.instantialize (this, arguments);
22 }, javax.swing.tree, "DefaultTreeCellRenderer", javax.swing.JLabel, javax.swing.tree.TreeCellRenderer);
23 Clazz.makeConstructor (c$,
25 Clazz.superConstructor (this, javax.swing.tree.DefaultTreeCellRenderer, []);
26 this.setLeafIcon (jssun.swing.DefaultLookup.getIcon (this, this.ui, "Tree.leafIcon"));
27 this.setClosedIcon (jssun.swing.DefaultLookup.getIcon (this, this.ui, "Tree.closedIcon"));
28 this.setOpenIcon (jssun.swing.DefaultLookup.getIcon (this, this.ui, "Tree.openIcon"));
29 this.setTextSelectionColor (jssun.swing.DefaultLookup.getColor (this, this.ui, "Tree.selectionForeground"));
30 this.setTextNonSelectionColor (jssun.swing.DefaultLookup.getColor (this, this.ui, "Tree.textForeground"));
31 this.setBackgroundSelectionColor (jssun.swing.DefaultLookup.getColor (this, this.ui, "Tree.selectionBackground"));
32 this.setBackgroundNonSelectionColor (jssun.swing.DefaultLookup.getColor (this, this.ui, "Tree.textBackground"));
33 this.setBorderSelectionColor (jssun.swing.DefaultLookup.getColor (this, this.ui, "Tree.selectionBorderColor"));
34 this.drawsFocusBorderAroundIcon = jssun.swing.DefaultLookup.getBoolean (this, this.ui, "Tree.drawsFocusBorderAroundIcon", false);
35 this.drawDashedFocusIndicator = jssun.swing.DefaultLookup.getBoolean (this, this.ui, "Tree.drawDashedFocusIndicator", false);
36 this.fillBackground = jssun.swing.DefaultLookup.getBoolean (this, this.ui, "Tree.rendererFillBackground", true);
37 var margins = jssun.swing.DefaultLookup.getInsets (this, this.ui, "Tree.rendererMargins");
38 if (margins != null) {
39 this.setBorder ( new javax.swing.border.EmptyBorder (margins.top, margins.left, margins.bottom, margins.right));
40 }this.setName ("Tree.cellRenderer");
42 Clazz.defineMethod (c$, "getDefaultOpenIcon",
44 return jssun.swing.DefaultLookup.getIcon (this, this.ui, "Tree.openIcon");
46 Clazz.defineMethod (c$, "getDefaultClosedIcon",
48 return jssun.swing.DefaultLookup.getIcon (this, this.ui, "Tree.closedIcon");
50 Clazz.defineMethod (c$, "getDefaultLeafIcon",
52 return jssun.swing.DefaultLookup.getIcon (this, this.ui, "Tree.leafIcon");
54 Clazz.defineMethod (c$, "setOpenIcon",
56 this.openIcon = newIcon;
57 }, "javax.swing.Icon");
58 Clazz.defineMethod (c$, "getOpenIcon",
62 Clazz.defineMethod (c$, "setClosedIcon",
64 this.closedIcon = newIcon;
65 }, "javax.swing.Icon");
66 Clazz.defineMethod (c$, "getClosedIcon",
68 return this.closedIcon;
70 Clazz.defineMethod (c$, "setLeafIcon",
72 this.leafIcon = newIcon;
73 }, "javax.swing.Icon");
74 Clazz.defineMethod (c$, "getLeafIcon",
78 Clazz.defineMethod (c$, "setTextSelectionColor",
80 this.textSelectionColor = newColor;
82 Clazz.defineMethod (c$, "getTextSelectionColor",
84 return this.textSelectionColor;
86 Clazz.defineMethod (c$, "setTextNonSelectionColor",
88 this.textNonSelectionColor = newColor;
90 Clazz.defineMethod (c$, "getTextNonSelectionColor",
92 return this.textNonSelectionColor;
94 Clazz.defineMethod (c$, "setBackgroundSelectionColor",
96 this.backgroundSelectionColor = newColor;
98 Clazz.defineMethod (c$, "getBackgroundSelectionColor",
100 return this.backgroundSelectionColor;
102 Clazz.defineMethod (c$, "setBackgroundNonSelectionColor",
103 function (newColor) {
104 this.backgroundNonSelectionColor = newColor;
105 }, "java.awt.Color");
106 Clazz.defineMethod (c$, "getBackgroundNonSelectionColor",
108 return this.backgroundNonSelectionColor;
110 Clazz.defineMethod (c$, "setBorderSelectionColor",
111 function (newColor) {
112 this.borderSelectionColor = newColor;
113 }, "java.awt.Color");
114 Clazz.defineMethod (c$, "getBorderSelectionColor",
116 return this.borderSelectionColor;
118 Clazz.defineMethod (c$, "setFont",
120 if (Clazz.instanceOf (font, javax.swing.plaf.FontUIResource)) font = null;
121 Clazz.superCall (this, javax.swing.tree.DefaultTreeCellRenderer, "setFont", [font]);
123 Clazz.defineMethod (c$, "getFont",
125 var font = Clazz.superCall (this, javax.swing.tree.DefaultTreeCellRenderer, "getFont", []);
126 if (font == null && this.tree != null) {
127 font = this.tree.getFont ();
130 Clazz.defineMethod (c$, "setBackground",
132 if (Clazz.instanceOf (color, javax.swing.plaf.ColorUIResource)) color = null;
133 Clazz.superCall (this, javax.swing.tree.DefaultTreeCellRenderer, "setBackground", [color]);
134 }, "java.awt.Color");
135 Clazz.overrideMethod (c$, "getTreeCellRendererComponent",
136 function (tree, value, sel, expanded, leaf, row, hasFocus) {
137 var stringValue = tree.convertValueToText (value, sel, expanded, leaf, row, hasFocus);
139 this.$hasFocus = hasFocus;
140 this.setText (stringValue);
142 this.isDropCell = false;
144 fg = this.getTextSelectionColor ();
146 fg = this.getTextNonSelectionColor ();
147 }this.setForeground (fg);
150 icon = this.getLeafIcon ();
151 } else if (expanded) {
152 icon = this.getOpenIcon ();
154 icon = this.getClosedIcon ();
155 }if (!tree.isEnabled ()) {
156 this.setEnabled (false);
157 this.setDisabledIcon (icon);
159 this.setEnabled (true);
161 }this.setComponentOrientation (tree.getComponentOrientation ());
164 }, "javax.swing.JTree,~O,~B,~B,~B,~N,~B");
165 Clazz.defineMethod (c$, "paint",
168 if (this.isDropCell) {
169 bColor = jssun.swing.DefaultLookup.getColor (this, this.ui, "Tree.dropCellBackground");
170 if (bColor == null) {
171 bColor = this.getBackgroundSelectionColor ();
172 }} else if (this.selected) {
173 bColor = this.getBackgroundSelectionColor ();
175 bColor = this.getBackgroundNonSelectionColor ();
176 if (bColor == null) {
177 bColor = this.getBackground ();
178 }}var imageOffset = -1;
179 if (bColor != null && this.fillBackground) {
180 imageOffset = this.getLabelStart ();
182 if (this.getComponentOrientation ().isLeftToRight ()) {
183 g.fillRect (imageOffset, 0, this.getWidth () - imageOffset, this.getHeight ());
185 g.fillRect (0, 0, this.getWidth () - imageOffset, this.getHeight ());
186 }}if (this.$hasFocus) {
187 if (this.drawsFocusBorderAroundIcon) {
189 } else if (imageOffset == -1) {
190 imageOffset = this.getLabelStart ();
191 }if (this.getComponentOrientation ().isLeftToRight ()) {
192 this.paintFocus (g, imageOffset, 0, this.getWidth () - imageOffset, this.getHeight (), bColor);
194 this.paintFocus (g, 0, 0, this.getWidth () - imageOffset, this.getHeight (), bColor);
195 }}Clazz.superCall (this, javax.swing.tree.DefaultTreeCellRenderer, "paint", [g]);
196 }, "java.awt.Graphics");
197 Clazz.defineMethod (c$, "paintFocus",
198 function (g, x, y, w, h, notColor) {
199 var bsColor = this.getBorderSelectionColor ();
200 if (bsColor != null && (this.selected || !this.drawDashedFocusIndicator)) {
201 g.setColor (bsColor);
202 g.drawRect (x, y, w - 1, h - 1);
203 }}, "java.awt.Graphics,~N,~N,~N,~N,java.awt.Color");
204 Clazz.defineMethod (c$, "getLabelStart",
206 var currentI = this.getIcon ();
207 if (currentI != null && this.getText () != null) {
208 return currentI.getIconWidth () + Math.max (0, this.getIconTextGap () - 1);
211 Clazz.overrideMethod (c$, "getPreferredSize",
213 var retDimension = this.getPrefSizeJComp ();
214 return (retDimension == null ? null : new java.awt.Dimension (retDimension.width + 3, retDimension.height));
216 Clazz.overrideMethod (c$, "validate",
219 Clazz.overrideMethod (c$, "invalidate",
222 Clazz.overrideMethod (c$, "revalidate",
225 Clazz.defineMethod (c$, "repaint",
226 function (tm, x, y, width, height) {
227 }, "~N,~N,~N,~N,~N");
228 Clazz.defineMethod (c$, "repaint",
230 }, "java.awt.Rectangle");
231 Clazz.defineMethod (c$, "repaint",
234 Clazz.overrideMethod (c$, "firePropertyChangeObject",
235 function (propertyName, oldValue, newValue) {
237 Clazz.defineMethod (c$, "firePropertyChange",
238 function (propertyName, oldValue, newValue) {
240 Clazz.defineMethod (c$, "firePropertyChange",
241 function (propertyName, oldValue, newValue) {
243 Clazz.defineMethod (c$, "firePropertyChange",
244 function (propertyName, oldValue, newValue) {
246 Clazz.overrideMethod (c$, "firePropertyChangeInt",
247 function (propertyName, oldValue, newValue) {
249 Clazz.defineMethod (c$, "firePropertyChange",
250 function (propertyName, oldValue, newValue) {
252 Clazz.defineMethod (c$, "firePropertyChange",
253 function (propertyName, oldValue, newValue) {
255 Clazz.defineMethod (c$, "firePropertyChange",
256 function (propertyName, oldValue, newValue) {
258 Clazz.overrideMethod (c$, "firePropertyChangeBool",
259 function (propertyName, oldValue, newValue) {