1 Clazz.declarePackage ("swingjs.plaf");
\r
2 Clazz.load (["swingjs.plaf.JSComponentUI"], "swingjs.plaf.JSButtonUI", ["javax.swing.LookAndFeel", "$.UIManager", "javax.swing.plaf.UIResource", "swingjs.api.DOMNode", "swingjs.plaf.JSButtonListener"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
5 this.shiftOffset = 0;
\r
6 this.defaultTextShiftOffset = 0;
\r
7 Clazz.instantialize (this, arguments);
\r
8 }, swingjs.plaf, "JSButtonUI", swingjs.plaf.JSComponentUI);
\r
9 Clazz.overrideMethod (c$, "getDOMObject",
\r
11 if (this.domNode == null) this.domBtn = this.enableNode = this.valueNode = this.domNode = this.createDOMObject ("input", this.id, ["type", "button"]);
\r
12 this.setCssFont (swingjs.api.DOMNode.setAttr (this.domNode, "value", (this.c).getText ()), this.c.getFont ());
\r
13 return this.domNode;
\r
15 Clazz.defineMethod (c$, "verifyButtonClick",
\r
16 function (isRelease) {
\r
19 Clazz.overrideMethod (c$, "installJSUI",
\r
21 this.installDefaults (this.c);
\r
22 this.installListeners (this.c);
\r
23 this.installKeyboardActions (this.c);
\r
25 Clazz.overrideMethod (c$, "uninstallJSUI",
\r
27 this.uninstallKeyboardActions (this.c);
\r
28 this.uninstallListeners (this.c);
\r
30 Clazz.defineMethod (c$, "installListeners",
\r
32 var listener = new swingjs.plaf.JSButtonListener (b);
\r
33 if (listener != null) {
\r
34 b.addMouseListener (listener);
\r
35 b.addMouseMotionListener (listener);
\r
36 b.addFocusListener (listener);
\r
37 b.addPropertyChangeListener (listener);
\r
38 b.addChangeListener (listener);
\r
39 }}, "javax.swing.AbstractButton");
\r
40 Clazz.defineMethod (c$, "uninstallListeners",
\r
42 var listener = this.getButtonListener (b);
\r
43 if (listener != null) {
\r
44 b.removeMouseListener (listener);
\r
45 b.removeMouseMotionListener (listener);
\r
46 b.removeFocusListener (listener);
\r
47 b.removeChangeListener (listener);
\r
48 b.removePropertyChangeListener (listener);
\r
49 }}, "javax.swing.AbstractButton");
\r
50 Clazz.defineMethod (c$, "installKeyboardActions",
\r
52 var listener = this.getButtonListener (b);
\r
53 if (listener != null) {
\r
54 listener.installKeyboardActions (b);
\r
55 }}, "javax.swing.AbstractButton");
\r
56 Clazz.defineMethod (c$, "uninstallKeyboardActions",
\r
58 var listener = this.getButtonListener (b);
\r
59 if (listener != null) {
\r
60 listener.uninstallKeyboardActions (b);
\r
61 }}, "javax.swing.AbstractButton");
\r
62 Clazz.defineMethod (c$, "getButtonListener",
\r
64 var listeners = b.getMouseMotionListeners ();
\r
65 if (listeners != null) {
\r
66 for (var counter = 0; counter < listeners.length; counter++) {
\r
67 if (Clazz.instanceOf (listeners[counter], swingjs.plaf.JSButtonListener)) {
\r
68 return listeners[counter];
\r
71 }, "javax.swing.AbstractButton");
\r
72 Clazz.defineMethod (c$, "getPropertyPrefix",
\r
76 Clazz.defineMethod (c$, "installDefaults",
\r
78 var pp = this.getPropertyPrefix ();
\r
79 this.defaultTextShiftOffset = javax.swing.UIManager.getInt (pp + "textShiftOffset");
\r
80 if (b.getMargin () == null || (Clazz.instanceOf (b.getMargin (), javax.swing.plaf.UIResource))) {
\r
81 b.setMargin (javax.swing.UIManager.getInsets (pp + "margin"));
\r
82 }javax.swing.LookAndFeel.installColorsAndFont (b, pp + "background", pp + "foreground", pp + "font");
\r
83 javax.swing.LookAndFeel.installProperty (b, "iconTextGap", new Integer (4));
\r
84 }, "javax.swing.AbstractButton");
\r