Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / swingjs / plaf / JSTextUI.js
index e7a341f..d60041e 100644 (file)
-Clazz.declarePackage ("swingjs.plaf");\r
-Clazz.load (["javax.swing.AbstractAction", "javax.swing.text.TextAction", "swingjs.plaf.JSComponentUI", "javax.swing.text.DefaultEditorKit"], "swingjs.plaf.JSTextUI", ["javax.swing.SwingUtilities", "$.UIManager", "javax.swing.plaf.ActionMapUIResource", "$.InputMapUIResource", "$.UIResource", "swingjs.JSToolkit", "swingjs.api.DOMNode", "swingjs.plaf.JSCaret", "$.TextListener"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.updateHandler = null;\r
-this.editor = null;\r
-this.editable = true;\r
-if (!Clazz.isClassDefined ("swingjs.plaf.JSTextUI.TextActionWrapper")) {\r
-swingjs.plaf.JSTextUI.$JSTextUI$TextActionWrapper$ ();\r
-}\r
-if (!Clazz.isClassDefined ("swingjs.plaf.JSTextUI.FocusAction")) {\r
-swingjs.plaf.JSTextUI.$JSTextUI$FocusAction$ ();\r
-}\r
-this.bgcolor0 = null;\r
-Clazz.instantialize (this, arguments);\r
-}, swingjs.plaf, "JSTextUI", swingjs.plaf.JSComponentUI);\r
-Clazz.defineMethod (c$, "setFocusable", \r
-function () {\r
-var node = this.$ (this.focusNode);\r
-var me = this;\r
-{\r
-node.focus(function() {me.notifyFocus(true)});\r
-node.blur(function() {me.notifyFocus(false)});\r
-}});\r
-Clazz.defineMethod (c$, "getComponentText", \r
-function () {\r
-return this.currentText = (this.c).getText ();\r
-});\r
-Clazz.defineMethod (c$, "bindKeys", \r
-function (domNode) {\r
-var f = null;\r
-var me = this;\r
-if (!(this.c).isEditable ()) return;\r
-{\r
-f = function(event) { me.handleJSEvent(me.domNode, 401, event)\r
-}\r
-}this.$ (domNode).bind ("keydown keypress keyup", f);\r
-}, "swingjs.api.DOMNode");\r
-Clazz.defineMethod (c$, "installDefaults", \r
-function () {\r
-});\r
-Clazz.defineMethod (c$, "installDefaults2", \r
- function () {\r
-var caret = this.editor.getCaret ();\r
-if (caret == null || Clazz.instanceOf (caret, javax.swing.plaf.UIResource)) {\r
-this.editor.setCaret ( new swingjs.plaf.JSCaret ());\r
-}});\r
-Clazz.overrideMethod (c$, "handleJSEvent", \r
-function (target, eventType, jQueryEvent) {\r
-System.out.println ("Handling for " + this.id + " " + eventType + " " + jQueryEvent);\r
-return this.updateHandler.handleJSEvent (this, eventType, jQueryEvent);\r
-}, "~O,~N,~O");\r
-Clazz.defineMethod (c$, "uninstallDefaults", \r
-function () {\r
-if (Clazz.instanceOf (this.editor.getCaretColor (), javax.swing.plaf.UIResource)) {\r
-this.editor.setCaretColor (null);\r
-}if (Clazz.instanceOf (this.editor.getSelectionColor (), javax.swing.plaf.UIResource)) {\r
-this.editor.setSelectionColor (null);\r
-}if (Clazz.instanceOf (this.editor.getDisabledTextColor (), javax.swing.plaf.UIResource)) {\r
-this.editor.setDisabledTextColor (null);\r
-}if (Clazz.instanceOf (this.editor.getSelectedTextColor (), javax.swing.plaf.UIResource)) {\r
-this.editor.setSelectedTextColor (null);\r
-}if (Clazz.instanceOf (this.editor.getBorder (), javax.swing.plaf.UIResource)) {\r
-this.editor.setBorder (null);\r
-}if (Clazz.instanceOf (this.editor.getMargin (), javax.swing.plaf.UIResource)) {\r
-this.editor.setMargin (null);\r
-}});\r
-Clazz.defineMethod (c$, "installKeyboardActions", \r
-function () {\r
-var km = this.getInputMap ();\r
-if (km != null) {\r
-javax.swing.SwingUtilities.replaceUIInputMap (this.editor, 0, km);\r
-}var map = this.getActionMap ();\r
-if (map != null) {\r
-javax.swing.SwingUtilities.replaceUIActionMap (this.editor, map);\r
-}});\r
-Clazz.defineMethod (c$, "getInputMap", \r
-function () {\r
-var map =  new javax.swing.plaf.InputMapUIResource ();\r
-return map;\r
-});\r
-Clazz.defineMethod (c$, "getActionMap", \r
-function () {\r
-var mapName = this.classID + ".actionMap";\r
-var map = javax.swing.UIManager.get (mapName);\r
-if (map == null) {\r
-map = this.createActionMap ();\r
-if (map != null) {\r
-javax.swing.UIManager.getLookAndFeelDefaults ().put (mapName, map);\r
-}}return map;\r
-});\r
-Clazz.defineMethod (c$, "createActionMap", \r
-function () {\r
-var map =  new javax.swing.plaf.ActionMapUIResource ();\r
-var actions = this.editor.getActions ();\r
-var n = (actions == null ? 0 : actions.length);\r
-for (var i = 0; i < n; i++) {\r
-var a = actions[i];\r
-map.put (a.getValue ("Name"), a);\r
-}\r
-return map;\r
-});\r
-Clazz.defineMethod (c$, "uninstallKeyboardActions", \r
-function () {\r
-this.editor.setKeymap (null);\r
-javax.swing.SwingUtilities.replaceUIInputMap (this.editor, 2, null);\r
-javax.swing.SwingUtilities.replaceUIActionMap (this.editor, null);\r
-});\r
-Clazz.defineMethod (c$, "getComponent", \r
-function () {\r
-return this.editor;\r
-});\r
-Clazz.overrideMethod (c$, "installJSUI", \r
-function () {\r
-this.editor = this.c;\r
-this.updateHandler =  new swingjs.plaf.TextListener (this, this.editor);\r
-this.installDefaults ();\r
-this.installDefaults2 ();\r
-this.installListeners (this.editor);\r
-this.installKeyboardActions ();\r
-});\r
-Clazz.overrideMethod (c$, "uninstallJSUI", \r
-function () {\r
-this.uninstallDefaults ();\r
-this.c.removeAll ();\r
-var lm = this.c.getLayout ();\r
-if (Clazz.instanceOf (lm, javax.swing.plaf.UIResource)) {\r
-this.c.setLayout (null);\r
-}this.uninstallKeyboardActions ();\r
-this.uninstallListeners (this.editor);\r
-this.editor = null;\r
-this.updateHandler = null;\r
-});\r
-Clazz.defineMethod (c$, "installListeners", \r
-function (b) {\r
-var listener = this.updateHandler;\r
-b.addMouseListener (listener);\r
-b.addMouseMotionListener (listener);\r
-b.addFocusListener (listener);\r
-b.addPropertyChangeListener (listener);\r
-}, "javax.swing.text.JTextComponent");\r
-Clazz.defineMethod (c$, "uninstallListeners", \r
-function (b) {\r
-var listener = this.updateHandler;\r
-b.removeMouseListener (listener);\r
-b.removeMouseMotionListener (listener);\r
-b.removeFocusListener (listener);\r
-b.removePropertyChangeListener (listener);\r
-b.getDocument ().removeDocumentListener (listener);\r
-}, "javax.swing.text.JTextComponent");\r
-Clazz.defineMethod (c$, "getMinimumSize", \r
-function (c) {\r
-var d = this.getPreferredSize ();\r
-var i = c.getInsets ();\r
-d.width += i.left + i.right;\r
-d.height += i.top + i.bottom;\r
-return d;\r
-}, "javax.swing.JComponent");\r
-Clazz.overrideMethod (c$, "getMaximumSize", \r
-function (c) {\r
-return this.getMinimumSize (c);\r
-}, "javax.swing.JComponent");\r
-Clazz.defineMethod (c$, "getEditorKit", \r
-function (tc) {\r
-return swingjs.plaf.JSTextUI.defaultKit;\r
-}, "javax.swing.text.JTextComponent");\r
-Clazz.defineMethod (c$, "handleEnter", \r
-function (eventType) {\r
-return false;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "setEditable", \r
-function (editable) {\r
-this.editable = editable;\r
-if (this.domNode == null) return;\r
-if (this.c.isBackgroundSet ()) this.bgcolor0 = swingjs.JSToolkit.getCSSColor (this.c.getBackground ());\r
-if (editable) {\r
-this.domNode.removeAttribute ("readOnly");\r
-if (this.bgcolor0 != null) swingjs.api.DOMNode.setStyles (this.domNode, ["background-color", this.bgcolor0]);\r
-} else {\r
-swingjs.api.DOMNode.setAttr (this.domNode, "readOnly", "true");\r
-if (this.c.isBackgroundSet ()) {\r
-this.bgcolor0 = swingjs.JSToolkit.getCSSColor (this.c.getBackground ());\r
-} else {\r
-if (this.bgcolor0 == null) this.bgcolor0 = this.domNode.getStyle ("background-color");\r
-}swingjs.api.DOMNode.setStyles (this.domNode, ["background-color", "rgba(0,0,0,0)"]);\r
-}}, "~B");\r
-c$.$JSTextUI$TextActionWrapper$ = function () {\r
-Clazz.pu$h(self.c$);\r
-c$ = Clazz.decorateAsClass (function () {\r
-Clazz.prepareCallback (this, arguments);\r
-this.action = null;\r
-Clazz.instantialize (this, arguments);\r
-}, swingjs.plaf.JSTextUI, "TextActionWrapper", javax.swing.text.TextAction);\r
-Clazz.makeConstructor (c$, \r
-function (a) {\r
-Clazz.superConstructor (this, swingjs.plaf.JSTextUI.TextActionWrapper, [a.getValue ("Name")]);\r
-this.action = a;\r
-}, "javax.swing.text.TextAction");\r
-Clazz.defineMethod (c$, "actionPerformed", \r
-function (a) {\r
-this.action.actionPerformed (a);\r
-}, "java.awt.event.ActionEvent");\r
-Clazz.defineMethod (c$, "isEnabled", \r
-function () {\r
-return (this.b$["swingjs.plaf.JSTextUI"].editor == null || this.b$["swingjs.plaf.JSTextUI"].editor.isEditable ()) ? this.action.isEnabled () : false;\r
-});\r
-c$ = Clazz.p0p ();\r
-};\r
-c$.$JSTextUI$FocusAction$ = function () {\r
-Clazz.pu$h(self.c$);\r
-c$ = Clazz.decorateAsClass (function () {\r
-Clazz.prepareCallback (this, arguments);\r
-Clazz.instantialize (this, arguments);\r
-}, swingjs.plaf.JSTextUI, "FocusAction", javax.swing.AbstractAction);\r
-Clazz.overrideMethod (c$, "actionPerformed", \r
-function (a) {\r
-this.b$["swingjs.plaf.JSTextUI"].editor.requestFocus ();\r
-}, "java.awt.event.ActionEvent");\r
-Clazz.overrideMethod (c$, "isEnabled", \r
-function () {\r
-return this.b$["swingjs.plaf.JSTextUI"].editor.isEditable ();\r
-});\r
-c$ = Clazz.p0p ();\r
-};\r
-c$.defaultKit = c$.prototype.defaultKit =  new javax.swing.text.DefaultEditorKit ();\r
-});\r
+Clazz.declarePackage ("swingjs.plaf");
+Clazz.load (["javax.swing.AbstractAction", "javax.swing.text.TextAction", "swingjs.plaf.JSComponentUI", "javax.swing.text.DefaultEditorKit"], "swingjs.plaf.JSTextUI", ["javax.swing.SwingUtilities", "$.UIManager", "javax.swing.plaf.ActionMapUIResource", "$.InputMapUIResource", "$.UIResource", "swingjs.JSToolkit", "swingjs.api.DOMNode", "swingjs.plaf.JSCaret", "$.TextListener"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.updateHandler = null;
+this.editor = null;
+this.editable = true;
+if (!Clazz.isClassDefined ("swingjs.plaf.JSTextUI.TextActionWrapper")) {
+swingjs.plaf.JSTextUI.$JSTextUI$TextActionWrapper$ ();
+}
+if (!Clazz.isClassDefined ("swingjs.plaf.JSTextUI.FocusAction")) {
+swingjs.plaf.JSTextUI.$JSTextUI$FocusAction$ ();
+}
+this.bgcolor0 = null;
+Clazz.instantialize (this, arguments);
+}, swingjs.plaf, "JSTextUI", swingjs.plaf.JSComponentUI);
+Clazz.defineMethod (c$, "setFocusable", 
+function () {
+var node = this.$ (this.focusNode);
+var me = this;
+{
+node.focus(function() {me.notifyFocus(true)});
+node.blur(function() {me.notifyFocus(false)});
+}});
+Clazz.defineMethod (c$, "getComponentText", 
+function () {
+return this.currentText = (this.c).getText ();
+});
+Clazz.defineMethod (c$, "bindKeys", 
+function (domNode) {
+var f = null;
+var me = this;
+if (!(this.c).isEditable ()) return;
+{
+f = function(event) { me.handleJSEvent(me.domNode, 401, event)
+}
+}this.$ (domNode).bind ("keydown keypress keyup", f);
+}, "swingjs.api.DOMNode");
+Clazz.defineMethod (c$, "installDefaults", 
+function () {
+});
+Clazz.defineMethod (c$, "installDefaults2", 
+ function () {
+var caret = this.editor.getCaret ();
+if (caret == null || Clazz.instanceOf (caret, javax.swing.plaf.UIResource)) {
+this.editor.setCaret ( new swingjs.plaf.JSCaret ());
+}});
+Clazz.overrideMethod (c$, "handleJSEvent", 
+function (target, eventType, jQueryEvent) {
+System.out.println ("Handling for " + this.id + " " + eventType + " " + jQueryEvent);
+return this.updateHandler.handleJSEvent (this, eventType, jQueryEvent);
+}, "~O,~N,~O");
+Clazz.defineMethod (c$, "uninstallDefaults", 
+function () {
+if (Clazz.instanceOf (this.editor.getCaretColor (), javax.swing.plaf.UIResource)) {
+this.editor.setCaretColor (null);
+}if (Clazz.instanceOf (this.editor.getSelectionColor (), javax.swing.plaf.UIResource)) {
+this.editor.setSelectionColor (null);
+}if (Clazz.instanceOf (this.editor.getDisabledTextColor (), javax.swing.plaf.UIResource)) {
+this.editor.setDisabledTextColor (null);
+}if (Clazz.instanceOf (this.editor.getSelectedTextColor (), javax.swing.plaf.UIResource)) {
+this.editor.setSelectedTextColor (null);
+}if (Clazz.instanceOf (this.editor.getBorder (), javax.swing.plaf.UIResource)) {
+this.editor.setBorder (null);
+}if (Clazz.instanceOf (this.editor.getMargin (), javax.swing.plaf.UIResource)) {
+this.editor.setMargin (null);
+}});
+Clazz.defineMethod (c$, "installKeyboardActions", 
+function () {
+var km = this.getInputMap ();
+if (km != null) {
+javax.swing.SwingUtilities.replaceUIInputMap (this.editor, 0, km);
+}var map = this.getActionMap ();
+if (map != null) {
+javax.swing.SwingUtilities.replaceUIActionMap (this.editor, map);
+}});
+Clazz.defineMethod (c$, "getInputMap", 
+function () {
+var map =  new javax.swing.plaf.InputMapUIResource ();
+return map;
+});
+Clazz.defineMethod (c$, "getActionMap", 
+function () {
+var mapName = this.classID + ".actionMap";
+var map = javax.swing.UIManager.get (mapName);
+if (map == null) {
+map = this.createActionMap ();
+if (map != null) {
+javax.swing.UIManager.getLookAndFeelDefaults ().put (mapName, map);
+}}return map;
+});
+Clazz.defineMethod (c$, "createActionMap", 
+function () {
+var map =  new javax.swing.plaf.ActionMapUIResource ();
+var actions = this.editor.getActions ();
+var n = (actions == null ? 0 : actions.length);
+for (var i = 0; i < n; i++) {
+var a = actions[i];
+map.put (a.getValue ("Name"), a);
+}
+return map;
+});
+Clazz.defineMethod (c$, "uninstallKeyboardActions", 
+function () {
+this.editor.setKeymap (null);
+javax.swing.SwingUtilities.replaceUIInputMap (this.editor, 2, null);
+javax.swing.SwingUtilities.replaceUIActionMap (this.editor, null);
+});
+Clazz.defineMethod (c$, "getComponent", 
+function () {
+return this.editor;
+});
+Clazz.overrideMethod (c$, "installJSUI", 
+function () {
+this.editor = this.c;
+this.updateHandler =  new swingjs.plaf.TextListener (this, this.editor);
+this.installDefaults ();
+this.installDefaults2 ();
+this.installListeners (this.editor);
+this.installKeyboardActions ();
+});
+Clazz.overrideMethod (c$, "uninstallJSUI", 
+function () {
+this.uninstallDefaults ();
+this.c.removeAll ();
+var lm = this.c.getLayout ();
+if (Clazz.instanceOf (lm, javax.swing.plaf.UIResource)) {
+this.c.setLayout (null);
+}this.uninstallKeyboardActions ();
+this.uninstallListeners (this.editor);
+this.editor = null;
+this.updateHandler = null;
+});
+Clazz.defineMethod (c$, "installListeners", 
+function (b) {
+var listener = this.updateHandler;
+b.addMouseListener (listener);
+b.addMouseMotionListener (listener);
+b.addFocusListener (listener);
+b.addPropertyChangeListener (listener);
+}, "javax.swing.text.JTextComponent");
+Clazz.defineMethod (c$, "uninstallListeners", 
+function (b) {
+var listener = this.updateHandler;
+b.removeMouseListener (listener);
+b.removeMouseMotionListener (listener);
+b.removeFocusListener (listener);
+b.removePropertyChangeListener (listener);
+b.getDocument ().removeDocumentListener (listener);
+}, "javax.swing.text.JTextComponent");
+Clazz.defineMethod (c$, "getMinimumSize", 
+function (c) {
+var d = this.getPreferredSize ();
+var i = c.getInsets ();
+d.width += i.left + i.right;
+d.height += i.top + i.bottom;
+return d;
+}, "javax.swing.JComponent");
+Clazz.overrideMethod (c$, "getMaximumSize", 
+function (c) {
+return this.getMinimumSize (c);
+}, "javax.swing.JComponent");
+Clazz.defineMethod (c$, "getEditorKit", 
+function (tc) {
+return swingjs.plaf.JSTextUI.defaultKit;
+}, "javax.swing.text.JTextComponent");
+Clazz.defineMethod (c$, "handleEnter", 
+function (eventType) {
+return false;
+}, "~N");
+Clazz.defineMethod (c$, "setEditable", 
+function (editable) {
+this.editable = editable;
+if (this.domNode == null) return;
+if (this.c.isBackgroundSet ()) this.bgcolor0 = swingjs.JSToolkit.getCSSColor (this.c.getBackground ());
+if (editable) {
+this.domNode.removeAttribute ("readOnly");
+if (this.bgcolor0 != null) swingjs.api.DOMNode.setStyles (this.domNode, ["background-color", this.bgcolor0]);
+} else {
+swingjs.api.DOMNode.setAttr (this.domNode, "readOnly", "true");
+if (this.c.isBackgroundSet ()) {
+this.bgcolor0 = swingjs.JSToolkit.getCSSColor (this.c.getBackground ());
+} else {
+if (this.bgcolor0 == null) this.bgcolor0 = this.domNode.getStyle ("background-color");
+}swingjs.api.DOMNode.setStyles (this.domNode, ["background-color", "rgba(0,0,0,0)"]);
+}}, "~B");
+c$.$JSTextUI$TextActionWrapper$ = function () {
+Clazz.pu$h(self.c$);
+c$ = Clazz.decorateAsClass (function () {
+Clazz.prepareCallback (this, arguments);
+this.action = null;
+Clazz.instantialize (this, arguments);
+}, swingjs.plaf.JSTextUI, "TextActionWrapper", javax.swing.text.TextAction);
+Clazz.makeConstructor (c$, 
+function (a) {
+Clazz.superConstructor (this, swingjs.plaf.JSTextUI.TextActionWrapper, [a.getValue ("Name")]);
+this.action = a;
+}, "javax.swing.text.TextAction");
+Clazz.defineMethod (c$, "actionPerformed", 
+function (a) {
+this.action.actionPerformed (a);
+}, "java.awt.event.ActionEvent");
+Clazz.defineMethod (c$, "isEnabled", 
+function () {
+return (this.b$["swingjs.plaf.JSTextUI"].editor == null || this.b$["swingjs.plaf.JSTextUI"].editor.isEditable ()) ? this.action.isEnabled () : false;
+});
+c$ = Clazz.p0p ();
+};
+c$.$JSTextUI$FocusAction$ = function () {
+Clazz.pu$h(self.c$);
+c$ = Clazz.decorateAsClass (function () {
+Clazz.prepareCallback (this, arguments);
+Clazz.instantialize (this, arguments);
+}, swingjs.plaf.JSTextUI, "FocusAction", javax.swing.AbstractAction);
+Clazz.overrideMethod (c$, "actionPerformed", 
+function (a) {
+this.b$["swingjs.plaf.JSTextUI"].editor.requestFocus ();
+}, "java.awt.event.ActionEvent");
+Clazz.overrideMethod (c$, "isEnabled", 
+function () {
+return this.b$["swingjs.plaf.JSTextUI"].editor.isEditable ();
+});
+c$ = Clazz.p0p ();
+};
+c$.defaultKit = c$.prototype.defaultKit =  new javax.swing.text.DefaultEditorKit ();
+});