X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fj2s%2Fswingjs%2Fplaf%2FJSButtonUI.js;fp=site%2Fj2s%2Fswingjs%2Fplaf%2FJSButtonUI.js;h=fa14ce0ab5936b63fb331f27cbcc8501977b5b1b;hp=cabcf156e199fd4fb78787fd5562b77fc360bdf5;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44 diff --git a/site/j2s/swingjs/plaf/JSButtonUI.js b/site/j2s/swingjs/plaf/JSButtonUI.js index cabcf15..fa14ce0 100644 --- a/site/j2s/swingjs/plaf/JSButtonUI.js +++ b/site/j2s/swingjs/plaf/JSButtonUI.js @@ -1,85 +1,85 @@ -Clazz.declarePackage ("swingjs.plaf"); -Clazz.load (["swingjs.plaf.JSComponentUI"], "swingjs.plaf.JSButtonUI", ["javax.swing.LookAndFeel", "$.UIManager", "javax.swing.plaf.UIResource", "swingjs.api.DOMNode", "swingjs.plaf.JSButtonListener"], function () { -c$ = Clazz.decorateAsClass (function () { -this.domBtn = null; -this.shiftOffset = 0; -this.defaultTextShiftOffset = 0; -Clazz.instantialize (this, arguments); -}, swingjs.plaf, "JSButtonUI", swingjs.plaf.JSComponentUI); -Clazz.overrideMethod (c$, "getDOMObject", -function () { -if (this.domNode == null) this.domBtn = this.enableNode = this.valueNode = this.domNode = this.createDOMObject ("input", this.id, ["type", "button"]); -this.setCssFont (swingjs.api.DOMNode.setAttr (this.domNode, "value", (this.c).getText ()), this.c.getFont ()); -return this.domNode; -}); -Clazz.defineMethod (c$, "verifyButtonClick", -function (isRelease) { -return true; -}, "~B"); -Clazz.overrideMethod (c$, "installJSUI", -function () { -this.installDefaults (this.c); -this.installListeners (this.c); -this.installKeyboardActions (this.c); -}); -Clazz.overrideMethod (c$, "uninstallJSUI", -function () { -this.uninstallKeyboardActions (this.c); -this.uninstallListeners (this.c); -}); -Clazz.defineMethod (c$, "installListeners", -function (b) { -var listener = new swingjs.plaf.JSButtonListener (b); -if (listener != null) { -b.addMouseListener (listener); -b.addMouseMotionListener (listener); -b.addFocusListener (listener); -b.addPropertyChangeListener (listener); -b.addChangeListener (listener); -}}, "javax.swing.AbstractButton"); -Clazz.defineMethod (c$, "uninstallListeners", -function (b) { -var listener = this.getButtonListener (b); -if (listener != null) { -b.removeMouseListener (listener); -b.removeMouseMotionListener (listener); -b.removeFocusListener (listener); -b.removeChangeListener (listener); -b.removePropertyChangeListener (listener); -}}, "javax.swing.AbstractButton"); -Clazz.defineMethod (c$, "installKeyboardActions", -function (b) { -var listener = this.getButtonListener (b); -if (listener != null) { -listener.installKeyboardActions (b); -}}, "javax.swing.AbstractButton"); -Clazz.defineMethod (c$, "uninstallKeyboardActions", -function (b) { -var listener = this.getButtonListener (b); -if (listener != null) { -listener.uninstallKeyboardActions (b); -}}, "javax.swing.AbstractButton"); -Clazz.defineMethod (c$, "getButtonListener", -function (b) { -var listeners = b.getMouseMotionListeners (); -if (listeners != null) { -for (var counter = 0; counter < listeners.length; counter++) { -if (Clazz.instanceOf (listeners[counter], swingjs.plaf.JSButtonListener)) { -return listeners[counter]; -}} -}return null; -}, "javax.swing.AbstractButton"); -Clazz.defineMethod (c$, "getPropertyPrefix", -function () { -return "Button."; -}); -Clazz.defineMethod (c$, "installDefaults", -function (b) { -var pp = this.getPropertyPrefix (); -this.defaultTextShiftOffset = javax.swing.UIManager.getInt (pp + "textShiftOffset"); -if (b.getMargin () == null || (Clazz.instanceOf (b.getMargin (), javax.swing.plaf.UIResource))) { -b.setMargin (javax.swing.UIManager.getInsets (pp + "margin")); -}javax.swing.LookAndFeel.installColorsAndFont (b, pp + "background", pp + "foreground", pp + "font"); -javax.swing.LookAndFeel.installProperty (b, "iconTextGap", new Integer (4)); -}, "javax.swing.AbstractButton"); -}); +Clazz.declarePackage ("swingjs.plaf"); +Clazz.load (["swingjs.plaf.JSComponentUI"], "swingjs.plaf.JSButtonUI", ["javax.swing.LookAndFeel", "$.UIManager", "javax.swing.plaf.UIResource", "swingjs.api.DOMNode", "swingjs.plaf.JSButtonListener"], function () { +c$ = Clazz.decorateAsClass (function () { +this.domBtn = null; +this.shiftOffset = 0; +this.defaultTextShiftOffset = 0; +Clazz.instantialize (this, arguments); +}, swingjs.plaf, "JSButtonUI", swingjs.plaf.JSComponentUI); +Clazz.overrideMethod (c$, "getDOMObject", +function () { +if (this.domNode == null) this.domBtn = this.enableNode = this.valueNode = this.domNode = this.createDOMObject ("input", this.id, ["type", "button"]); +this.setCssFont (swingjs.api.DOMNode.setAttr (this.domNode, "value", (this.c).getText ()), this.c.getFont ()); +return this.domNode; +}); +Clazz.defineMethod (c$, "verifyButtonClick", +function (isRelease) { +return true; +}, "~B"); +Clazz.overrideMethod (c$, "installJSUI", +function () { +this.installDefaults (this.c); +this.installListeners (this.c); +this.installKeyboardActions (this.c); +}); +Clazz.overrideMethod (c$, "uninstallJSUI", +function () { +this.uninstallKeyboardActions (this.c); +this.uninstallListeners (this.c); +}); +Clazz.defineMethod (c$, "installListeners", +function (b) { +var listener = new swingjs.plaf.JSButtonListener (b); +if (listener != null) { +b.addMouseListener (listener); +b.addMouseMotionListener (listener); +b.addFocusListener (listener); +b.addPropertyChangeListener (listener); +b.addChangeListener (listener); +}}, "javax.swing.AbstractButton"); +Clazz.defineMethod (c$, "uninstallListeners", +function (b) { +var listener = this.getButtonListener (b); +if (listener != null) { +b.removeMouseListener (listener); +b.removeMouseMotionListener (listener); +b.removeFocusListener (listener); +b.removeChangeListener (listener); +b.removePropertyChangeListener (listener); +}}, "javax.swing.AbstractButton"); +Clazz.defineMethod (c$, "installKeyboardActions", +function (b) { +var listener = this.getButtonListener (b); +if (listener != null) { +listener.installKeyboardActions (b); +}}, "javax.swing.AbstractButton"); +Clazz.defineMethod (c$, "uninstallKeyboardActions", +function (b) { +var listener = this.getButtonListener (b); +if (listener != null) { +listener.uninstallKeyboardActions (b); +}}, "javax.swing.AbstractButton"); +Clazz.defineMethod (c$, "getButtonListener", +function (b) { +var listeners = b.getMouseMotionListeners (); +if (listeners != null) { +for (var counter = 0; counter < listeners.length; counter++) { +if (Clazz.instanceOf (listeners[counter], swingjs.plaf.JSButtonListener)) { +return listeners[counter]; +}} +}return null; +}, "javax.swing.AbstractButton"); +Clazz.defineMethod (c$, "getPropertyPrefix", +function () { +return "Button."; +}); +Clazz.defineMethod (c$, "installDefaults", +function (b) { +var pp = this.getPropertyPrefix (); +this.defaultTextShiftOffset = javax.swing.UIManager.getInt (pp + "textShiftOffset"); +if (b.getMargin () == null || (Clazz.instanceOf (b.getMargin (), javax.swing.plaf.UIResource))) { +b.setMargin (javax.swing.UIManager.getInsets (pp + "margin")); +}javax.swing.LookAndFeel.installColorsAndFont (b, pp + "background", pp + "foreground", pp + "font"); +javax.swing.LookAndFeel.installProperty (b, "iconTextGap", new Integer (4)); +}, "javax.swing.AbstractButton"); +});