X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=site%2Fj2s%2Fswingjs%2Fplaf%2FJSMenuItemUI.js;fp=site%2Fj2s%2Fswingjs%2Fplaf%2FJSMenuItemUI.js;h=f9d37b346d7339e3d82bedc64818e6e023fde8df;hb=4231d40261fef32ce4570a6bbad0d35df44e8baf;hp=0000000000000000000000000000000000000000;hpb=c07eb2c5794833bd0241000d6844d783fe10cb82;p=jalview.git diff --git a/site/j2s/swingjs/plaf/JSMenuItemUI.js b/site/j2s/swingjs/plaf/JSMenuItemUI.js new file mode 100644 index 0000000..f9d37b3 --- /dev/null +++ b/site/j2s/swingjs/plaf/JSMenuItemUI.js @@ -0,0 +1,75 @@ +Clazz.declarePackage ("swingjs.plaf"); +Clazz.load (["swingjs.plaf.JSButtonUI"], "swingjs.plaf.JSMenuItemUI", ["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, "JSMenuItemUI", swingjs.plaf.JSButtonUI); +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.overrideMethod (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.overrideMethod (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.overrideMethod (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.overrideMethod (c$, "installKeyboardActions", +function (b) { +var listener = this.getButtonListener (b); +if (listener != null) { +listener.installKeyboardActions (b); +}}, "javax.swing.AbstractButton"); +Clazz.overrideMethod (c$, "uninstallKeyboardActions", +function (b) { +var listener = this.getButtonListener (b); +if (listener != null) { +listener.uninstallKeyboardActions (b); +}}, "javax.swing.AbstractButton"); +Clazz.overrideMethod (c$, "getPropertyPrefix", +function () { +return "Button."; +}); +Clazz.overrideMethod (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"); +});