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