1d3a8d3ae2079ecc94e8a4bd2d2dbf15cde2dc75
[jalviewjs.git] / site / swingjs / j2s / javax / swing / DefaultListCellRenderer.js
1 Clazz.declarePackage ("javax.swing");\r
2 Clazz.load (["javax.swing.JLabel", "$.ListCellRenderer", "javax.swing.plaf.UIResource", "javax.swing.border.EmptyBorder"], "javax.swing.DefaultListCellRenderer", ["javax.swing.Icon", "jssun.swing.DefaultLookup"], function () {\r
3 c$ = Clazz.declareType (javax.swing, "DefaultListCellRenderer", javax.swing.JLabel, javax.swing.ListCellRenderer);\r
4 Clazz.makeConstructor (c$, \r
5 function () {\r
6 Clazz.superConstructor (this, javax.swing.DefaultListCellRenderer);\r
7 this.setOpaque (true);\r
8 this.setBorder (this.getNoFocusBorder ());\r
9 this.setName ("List.cellRenderer");\r
10 });\r
11 Clazz.defineMethod (c$, "getNoFocusBorder", \r
12  function () {\r
13 var border = jssun.swing.DefaultLookup.getBorder (this, this.ui, "List.cellNoFocusBorder");\r
14 if (System.getSecurityManager () != null) {\r
15 if (border != null) return border;\r
16 return javax.swing.DefaultListCellRenderer.SAFE_NO_FOCUS_BORDER;\r
17 } else {\r
18 if (border != null && (javax.swing.DefaultListCellRenderer.noFocusBorder == null || javax.swing.DefaultListCellRenderer.noFocusBorder === javax.swing.DefaultListCellRenderer.DEFAULT_NO_FOCUS_BORDER)) {\r
19 return border;\r
20 }return javax.swing.DefaultListCellRenderer.noFocusBorder;\r
21 }});\r
22 Clazz.overrideMethod (c$, "getListCellRendererComponent", \r
23 function (list, value, index, isSelected, cellHasFocus) {\r
24 this.setComponentOrientation (list.getComponentOrientation ());\r
25 var bg = null;\r
26 var fg = null;\r
27 if (isSelected) {\r
28 this.setBackground (bg == null ? list.getSelectionBackground () : bg);\r
29 this.setForeground (fg == null ? list.getSelectionForeground () : fg);\r
30 } else {\r
31 this.setBackground (list.getBackground ());\r
32 this.setForeground (list.getForeground ());\r
33 }if (Clazz.instanceOf (value, javax.swing.Icon)) {\r
34 this.setIcon (value);\r
35 this.setText ("");\r
36 } else {\r
37 this.setIcon (null);\r
38 this.setText ((value == null) ? "" : value.toString ());\r
39 }this.setEnabled (list.isEnabled ());\r
40 this.setFont (list.getFont ());\r
41 var border = null;\r
42 if (cellHasFocus) {\r
43 if (isSelected) {\r
44 border = jssun.swing.DefaultLookup.getBorder (this, this.ui, "List.focusSelectedCellHighlightBorder");\r
45 }if (border == null) {\r
46 border = jssun.swing.DefaultLookup.getBorder (this, this.ui, "List.focusCellHighlightBorder");\r
47 }} else {\r
48 border = this.getNoFocusBorder ();\r
49 }this.setBorder (border);\r
50 return this;\r
51 }, "javax.swing.JList,~O,~N,~B,~B");\r
52 Clazz.defineMethod (c$, "isOpaque", \r
53 function () {\r
54 var back = this.getBackground ();\r
55 var p = this.getParent ();\r
56 if (p != null) {\r
57 p = p.getParent ();\r
58 }var colorMatch = (back != null) && (p != null) && back.equals (p.getBackground ()) && p.isOpaque ();\r
59 return !colorMatch && Clazz.superCall (this, javax.swing.DefaultListCellRenderer, "isOpaque", []);\r
60 });\r
61 Clazz.overrideMethod (c$, "validate", \r
62 function () {\r
63 });\r
64 Clazz.overrideMethod (c$, "invalidate", \r
65 function () {\r
66 });\r
67 Clazz.defineMethod (c$, "repaint", \r
68 function () {\r
69 });\r
70 Clazz.overrideMethod (c$, "revalidate", \r
71 function () {\r
72 });\r
73 Clazz.defineMethod (c$, "repaint", \r
74 function (tm, x, y, width, height) {\r
75 }, "~N,~N,~N,~N,~N");\r
76 Clazz.defineMethod (c$, "repaint", \r
77 function (r) {\r
78 }, "java.awt.Rectangle");\r
79 Clazz.overrideMethod (c$, "firePropertyChangeObject", \r
80 function (propertyName, oldValue, newValue) {\r
81 }, "~S,~O,~O");\r
82 Clazz.overrideMethod (c$, "firePropertyChangeByte", \r
83 function (propertyName, oldValue, newValue) {\r
84 }, "~S,~N,~N");\r
85 Clazz.overrideMethod (c$, "firePropertyChangeChar", \r
86 function (propertyName, oldValue, newValue) {\r
87 }, "~S,~S,~S");\r
88 Clazz.overrideMethod (c$, "firePropertyChangeShort", \r
89 function (propertyName, oldValue, newValue) {\r
90 }, "~S,~N,~N");\r
91 Clazz.overrideMethod (c$, "firePropertyChangeInt", \r
92 function (propertyName, oldValue, newValue) {\r
93 }, "~S,~N,~N");\r
94 Clazz.overrideMethod (c$, "firePropertyChangeLong", \r
95 function (propertyName, oldValue, newValue) {\r
96 }, "~S,~N,~N");\r
97 Clazz.overrideMethod (c$, "firePropertyChangeFloat", \r
98 function (propertyName, oldValue, newValue) {\r
99 }, "~S,~N,~N");\r
100 Clazz.overrideMethod (c$, "firePropertyChangeDouble", \r
101 function (propertyName, oldValue, newValue) {\r
102 }, "~S,~N,~N");\r
103 Clazz.overrideMethod (c$, "firePropertyChangeBool", \r
104 function (propertyName, oldValue, newValue) {\r
105 }, "~S,~B,~B");\r
106 Clazz.pu$h(self.c$);\r
107 c$ = Clazz.declareType (javax.swing.DefaultListCellRenderer, "UIResource", javax.swing.DefaultListCellRenderer, javax.swing.plaf.UIResource);\r
108 c$ = Clazz.p0p ();\r
109 c$.SAFE_NO_FOCUS_BORDER = c$.prototype.SAFE_NO_FOCUS_BORDER =  new javax.swing.border.EmptyBorder (1, 1, 1, 1);\r
110 c$.DEFAULT_NO_FOCUS_BORDER = c$.prototype.DEFAULT_NO_FOCUS_BORDER =  new javax.swing.border.EmptyBorder (1, 1, 1, 1);\r
111 c$.noFocusBorder = c$.prototype.noFocusBorder = javax.swing.DefaultListCellRenderer.DEFAULT_NO_FOCUS_BORDER;\r
112 });\r