Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / awt / event / MouseEvent.js
index 1218e80..8738dbe 100644 (file)
-Clazz.declarePackage ("java.awt.event");\r
-Clazz.load (["java.awt.event.InputEvent"], "java.awt.event.MouseEvent", ["java.lang.IllegalArgumentException", "$.StringBuilder", "java.awt.Point", "$.Toolkit"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.x = 0;\r
-this.y = 0;\r
-this.xAbs = 0;\r
-this.yAbs = 0;\r
-this.clickCount = 0;\r
-this.button = 0;\r
-this.popupTrigger = false;\r
-Clazz.instantialize (this, arguments);\r
-}, java.awt.event, "MouseEvent", java.awt.event.InputEvent);\r
-Clazz.defineMethod (c$, "getLocationOnScreen", \r
-function () {\r
-return  new java.awt.Point (this.xAbs, this.yAbs);\r
-});\r
-Clazz.defineMethod (c$, "getXOnScreen", \r
-function () {\r
-return this.xAbs;\r
-});\r
-Clazz.defineMethod (c$, "getYOnScreen", \r
-function () {\r
-return this.yAbs;\r
-});\r
-Clazz.makeConstructor (c$, \r
-function (source, id, when, modifiers, x, y, clickCount, popupTrigger, button) {\r
-this.construct (source, id, when, modifiers, x, y, 0, 0, clickCount, popupTrigger, button);\r
-var eventLocationOnScreen =  new java.awt.Point (0, 0);\r
-try {\r
-eventLocationOnScreen = source.getLocationOnScreen ();\r
-this.xAbs = eventLocationOnScreen.x + x;\r
-this.yAbs = eventLocationOnScreen.y + y;\r
-} catch (e) {\r
-if (Clazz.exceptionOf (e, java.awt.IllegalComponentStateException)) {\r
-this.xAbs = 0;\r
-this.yAbs = 0;\r
-} else {\r
-throw e;\r
-}\r
-}\r
-}, "java.awt.Component,~N,~N,~N,~N,~N,~N,~B,~N");\r
-Clazz.makeConstructor (c$, \r
-function (source, id, when, modifiers, x, y, clickCount, popupTrigger) {\r
-this.construct (source, id, when, modifiers, x, y, clickCount, popupTrigger, 0);\r
-}, "java.awt.Component,~N,~N,~N,~N,~N,~N,~B");\r
-Clazz.makeConstructor (c$, \r
-function (source, id, when, modifiers, x, y, xAbs, yAbs, clickCount, popupTrigger, button) {\r
-Clazz.superConstructor (this, java.awt.event.MouseEvent, [source, id, when, modifiers]);\r
-this.x = x;\r
-this.y = y;\r
-this.xAbs = xAbs;\r
-this.yAbs = yAbs;\r
-this.clickCount = clickCount;\r
-this.popupTrigger = popupTrigger;\r
-if (button < 0 || button > 3) {\r
-throw  new IllegalArgumentException ("Invalid button value");\r
-}this.button = button;\r
-if ((this.getModifiers () != 0) && (this.getModifiersEx () == 0)) {\r
-this.setNewModifiers ();\r
-} else if ((this.getModifiers () == 0) && (this.getModifiersEx () != 0 || button != 0)) {\r
-this.setOldModifiers ();\r
-}}, "java.awt.Component,~N,~N,~N,~N,~N,~N,~N,~N,~B,~N");\r
-Clazz.defineMethod (c$, "getX", \r
-function () {\r
-return this.x;\r
-});\r
-Clazz.defineMethod (c$, "getY", \r
-function () {\r
-return this.y;\r
-});\r
-Clazz.defineMethod (c$, "getPoint", \r
-function () {\r
-var x;\r
-var y;\r
-{\r
-x = this.x;\r
-y = this.y;\r
-}return  new java.awt.Point (x, y);\r
-});\r
-Clazz.defineMethod (c$, "translatePoint", \r
-function (x, y) {\r
-this.x += x;\r
-this.y += y;\r
-}, "~N,~N");\r
-Clazz.defineMethod (c$, "getClickCount", \r
-function () {\r
-return this.clickCount;\r
-});\r
-Clazz.defineMethod (c$, "getButton", \r
-function () {\r
-return this.button;\r
-});\r
-Clazz.defineMethod (c$, "isPopupTrigger", \r
-function () {\r
-return this.popupTrigger;\r
-});\r
-c$.getMouseModifiersText = Clazz.defineMethod (c$, "getMouseModifiersText", \r
-function (modifiers) {\r
-var buf =  new StringBuilder ();\r
-if ((modifiers & 8) != 0) {\r
-buf.append (java.awt.Toolkit.getProperty ("AWT.alt", "Alt"));\r
-buf.append ("+");\r
-}if ((modifiers & 4) != 0) {\r
-buf.append (java.awt.Toolkit.getProperty ("AWT.meta", "Meta"));\r
-buf.append ("+");\r
-}if ((modifiers & 2) != 0) {\r
-buf.append (java.awt.Toolkit.getProperty ("AWT.control", "Ctrl"));\r
-buf.append ("+");\r
-}if ((modifiers & 1) != 0) {\r
-buf.append (java.awt.Toolkit.getProperty ("AWT.shift", "Shift"));\r
-buf.append ("+");\r
-}if ((modifiers & 32) != 0) {\r
-buf.append (java.awt.Toolkit.getProperty ("AWT.altGraph", "Alt Graph"));\r
-buf.append ("+");\r
-}if ((modifiers & 16) != 0) {\r
-buf.append (java.awt.Toolkit.getProperty ("AWT.button1", "Button1"));\r
-buf.append ("+");\r
-}if ((modifiers & 8) != 0) {\r
-buf.append (java.awt.Toolkit.getProperty ("AWT.button2", "Button2"));\r
-buf.append ("+");\r
-}if ((modifiers & 4) != 0) {\r
-buf.append (java.awt.Toolkit.getProperty ("AWT.button3", "Button3"));\r
-buf.append ("+");\r
-}if (buf.length () > 0) {\r
-buf.setLength (buf.length () - 1);\r
-}return buf.toString ();\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "paramString", \r
-function () {\r
-var str =  new StringBuilder (80);\r
-str.append (java.awt.event.MouseEvent.getIdString (this.id));\r
-str.append (",(" + this.x).append ("," + this.y).append ("," + this.when).append (")");\r
-str.append (",absolute(").append ("" + this.xAbs).append (",").append ("" + this.yAbs).append (")");\r
-str.append (",button=").append ("" + this.getButton ());\r
-if (this.getModifiers () != 0) {\r
-str.append (",modifiers=").append (java.awt.event.MouseEvent.getMouseModifiersText (this.modifiers));\r
-}if (this.getModifiersEx () != 0) {\r
-str.append (",extModifiers=").append (java.awt.event.InputEvent.getModifiersExText (this.modifiers));\r
-}str.append (",clickCount=").append ("" + this.clickCount);\r
-return str.toString ();\r
-});\r
-c$.getIdString = Clazz.defineMethod (c$, "getIdString", \r
-function (id) {\r
-switch (id) {\r
-case 501:\r
-return "MOUSE_PRESSED";\r
-case 502:\r
-return "MOUSE_RELEASED";\r
-case 500:\r
-return "MOUSE_CLICKED";\r
-case 504:\r
-return "MOUSE_ENTERED";\r
-case 505:\r
-return "MOUSE_EXITED";\r
-case 503:\r
-return "MOUSE_MOVED";\r
-case 506:\r
-return "MOUSE_DRAGGED";\r
-case 507:\r
-return "MOUSE_WHEEL";\r
-default:\r
-return "unknown type";\r
-}\r
-}, "~N");\r
-Clazz.defineMethod (c$, "setNewModifiers", \r
- function () {\r
-if ((this.modifiers & 16) != 0) {\r
-this.modifiers |= 1024;\r
-}if ((this.modifiers & 8) != 0) {\r
-this.modifiers |= 2048;\r
-}if ((this.modifiers & 4) != 0) {\r
-this.modifiers |= 4096;\r
-}if (this.id == 501 || this.id == 502 || this.id == 500) {\r
-if ((this.modifiers & 16) != 0) {\r
-this.button = 1;\r
-this.modifiers &= -13;\r
-if (this.id != 501) {\r
-this.modifiers &= -1025;\r
-}} else if ((this.modifiers & 8) != 0) {\r
-this.button = 2;\r
-this.modifiers &= -21;\r
-if (this.id != 501) {\r
-this.modifiers &= -2049;\r
-}} else if ((this.modifiers & 4) != 0) {\r
-this.button = 3;\r
-this.modifiers &= -25;\r
-if (this.id != 501) {\r
-this.modifiers &= -4097;\r
-}}}if ((this.modifiers & 8) != 0) {\r
-this.modifiers |= 512;\r
-}if ((this.modifiers & 4) != 0) {\r
-this.modifiers |= 256;\r
-}if ((this.modifiers & 1) != 0) {\r
-this.modifiers |= 64;\r
-}if ((this.modifiers & 2) != 0) {\r
-this.modifiers |= 128;\r
-}if ((this.modifiers & 32) != 0) {\r
-this.modifiers |= 8192;\r
-}});\r
-Clazz.defineMethod (c$, "setOldModifiers", \r
- function () {\r
-if (this.id == 501 || this.id == 502 || this.id == 500) {\r
-switch (this.button) {\r
-case 1:\r
-this.modifiers |= 16;\r
-break;\r
-case 2:\r
-this.modifiers |= 8;\r
-break;\r
-case 3:\r
-this.modifiers |= 4;\r
-break;\r
-}\r
-} else {\r
-if ((this.modifiers & 1024) != 0) {\r
-this.modifiers |= 16;\r
-}if ((this.modifiers & 2048) != 0) {\r
-this.modifiers |= 8;\r
-}if ((this.modifiers & 4096) != 0) {\r
-this.modifiers |= 4;\r
-}}if ((this.modifiers & 512) != 0) {\r
-this.modifiers |= 8;\r
-}if ((this.modifiers & 256) != 0) {\r
-this.modifiers |= 4;\r
-}if ((this.modifiers & 64) != 0) {\r
-this.modifiers |= 1;\r
-}if ((this.modifiers & 128) != 0) {\r
-this.modifiers |= 2;\r
-}if ((this.modifiers & 8192) != 0) {\r
-this.modifiers |= 32;\r
-}});\r
-Clazz.defineStatics (c$,\r
-"MOUSE_FIRST", 500,\r
-"MOUSE_LAST", 507,\r
-"MOUSE_CLICKED", 500,\r
-"MOUSE_PRESSED", 501,\r
-"MOUSE_RELEASED", 502,\r
-"MOUSE_MOVED", 503,\r
-"MOUSE_ENTERED", 504,\r
-"MOUSE_EXITED", 505,\r
-"MOUSE_DRAGGED", 506,\r
-"MOUSE_WHEEL", 507,\r
-"NOBUTTON", 0,\r
-"BUTTON1", 1,\r
-"BUTTON2", 2,\r
-"BUTTON3", 3);\r
-});\r
+Clazz.declarePackage ("java.awt.event");
+Clazz.load (["java.awt.event.InputEvent"], "java.awt.event.MouseEvent", ["java.lang.IllegalArgumentException", "$.StringBuilder", "java.awt.Point", "$.Toolkit"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.x = 0;
+this.y = 0;
+this.xAbs = 0;
+this.yAbs = 0;
+this.clickCount = 0;
+this.button = 0;
+this.popupTrigger = false;
+Clazz.instantialize (this, arguments);
+}, java.awt.event, "MouseEvent", java.awt.event.InputEvent);
+Clazz.defineMethod (c$, "getLocationOnScreen", 
+function () {
+return  new java.awt.Point (this.xAbs, this.yAbs);
+});
+Clazz.defineMethod (c$, "getXOnScreen", 
+function () {
+return this.xAbs;
+});
+Clazz.defineMethod (c$, "getYOnScreen", 
+function () {
+return this.yAbs;
+});
+Clazz.makeConstructor (c$, 
+function (source, id, when, modifiers, x, y, clickCount, popupTrigger, button) {
+this.construct (source, id, when, modifiers, x, y, 0, 0, clickCount, popupTrigger, button);
+var eventLocationOnScreen =  new java.awt.Point (0, 0);
+try {
+eventLocationOnScreen = source.getLocationOnScreen ();
+this.xAbs = eventLocationOnScreen.x + x;
+this.yAbs = eventLocationOnScreen.y + y;
+} catch (e) {
+if (Clazz.exceptionOf (e, java.awt.IllegalComponentStateException)) {
+this.xAbs = 0;
+this.yAbs = 0;
+} else {
+throw e;
+}
+}
+}, "java.awt.Component,~N,~N,~N,~N,~N,~N,~B,~N");
+Clazz.makeConstructor (c$, 
+function (source, id, when, modifiers, x, y, clickCount, popupTrigger) {
+this.construct (source, id, when, modifiers, x, y, clickCount, popupTrigger, 0);
+}, "java.awt.Component,~N,~N,~N,~N,~N,~N,~B");
+Clazz.makeConstructor (c$, 
+function (source, id, when, modifiers, x, y, xAbs, yAbs, clickCount, popupTrigger, button) {
+Clazz.superConstructor (this, java.awt.event.MouseEvent, [source, id, when, modifiers]);
+this.x = x;
+this.y = y;
+this.xAbs = xAbs;
+this.yAbs = yAbs;
+this.clickCount = clickCount;
+this.popupTrigger = popupTrigger;
+if (button < 0 || button > 3) {
+throw  new IllegalArgumentException ("Invalid button value");
+}this.button = button;
+if ((this.getModifiers () != 0) && (this.getModifiersEx () == 0)) {
+this.setNewModifiers ();
+} else if ((this.getModifiers () == 0) && (this.getModifiersEx () != 0 || button != 0)) {
+this.setOldModifiers ();
+}}, "java.awt.Component,~N,~N,~N,~N,~N,~N,~N,~N,~B,~N");
+Clazz.defineMethod (c$, "getX", 
+function () {
+return this.x;
+});
+Clazz.defineMethod (c$, "getY", 
+function () {
+return this.y;
+});
+Clazz.defineMethod (c$, "getPoint", 
+function () {
+var x;
+var y;
+{
+x = this.x;
+y = this.y;
+}return  new java.awt.Point (x, y);
+});
+Clazz.defineMethod (c$, "translatePoint", 
+function (x, y) {
+this.x += x;
+this.y += y;
+}, "~N,~N");
+Clazz.defineMethod (c$, "getClickCount", 
+function () {
+return this.clickCount;
+});
+Clazz.defineMethod (c$, "getButton", 
+function () {
+return this.button;
+});
+Clazz.defineMethod (c$, "isPopupTrigger", 
+function () {
+return this.popupTrigger;
+});
+c$.getMouseModifiersText = Clazz.defineMethod (c$, "getMouseModifiersText", 
+function (modifiers) {
+var buf =  new StringBuilder ();
+if ((modifiers & 8) != 0) {
+buf.append (java.awt.Toolkit.getProperty ("AWT.alt", "Alt"));
+buf.append ("+");
+}if ((modifiers & 4) != 0) {
+buf.append (java.awt.Toolkit.getProperty ("AWT.meta", "Meta"));
+buf.append ("+");
+}if ((modifiers & 2) != 0) {
+buf.append (java.awt.Toolkit.getProperty ("AWT.control", "Ctrl"));
+buf.append ("+");
+}if ((modifiers & 1) != 0) {
+buf.append (java.awt.Toolkit.getProperty ("AWT.shift", "Shift"));
+buf.append ("+");
+}if ((modifiers & 32) != 0) {
+buf.append (java.awt.Toolkit.getProperty ("AWT.altGraph", "Alt Graph"));
+buf.append ("+");
+}if ((modifiers & 16) != 0) {
+buf.append (java.awt.Toolkit.getProperty ("AWT.button1", "Button1"));
+buf.append ("+");
+}if ((modifiers & 8) != 0) {
+buf.append (java.awt.Toolkit.getProperty ("AWT.button2", "Button2"));
+buf.append ("+");
+}if ((modifiers & 4) != 0) {
+buf.append (java.awt.Toolkit.getProperty ("AWT.button3", "Button3"));
+buf.append ("+");
+}if (buf.length () > 0) {
+buf.setLength (buf.length () - 1);
+}return buf.toString ();
+}, "~N");
+Clazz.overrideMethod (c$, "paramString", 
+function () {
+var str =  new StringBuilder (80);
+str.append (java.awt.event.MouseEvent.getIdString (this.id));
+str.append (",(" + this.x).append ("," + this.y).append ("," + this.when).append (")");
+str.append (",absolute(").append ("" + this.xAbs).append (",").append ("" + this.yAbs).append (")");
+str.append (",button=").append ("" + this.getButton ());
+if (this.getModifiers () != 0) {
+str.append (",modifiers=").append (java.awt.event.MouseEvent.getMouseModifiersText (this.modifiers));
+}if (this.getModifiersEx () != 0) {
+str.append (",extModifiers=").append (java.awt.event.InputEvent.getModifiersExText (this.modifiers));
+}str.append (",clickCount=").append ("" + this.clickCount);
+return str.toString ();
+});
+c$.getIdString = Clazz.defineMethod (c$, "getIdString", 
+function (id) {
+switch (id) {
+case 501:
+return "MOUSE_PRESSED";
+case 502:
+return "MOUSE_RELEASED";
+case 500:
+return "MOUSE_CLICKED";
+case 504:
+return "MOUSE_ENTERED";
+case 505:
+return "MOUSE_EXITED";
+case 503:
+return "MOUSE_MOVED";
+case 506:
+return "MOUSE_DRAGGED";
+case 507:
+return "MOUSE_WHEEL";
+default:
+return "unknown type";
+}
+}, "~N");
+Clazz.defineMethod (c$, "setNewModifiers", 
+ function () {
+if ((this.modifiers & 16) != 0) {
+this.modifiers |= 1024;
+}if ((this.modifiers & 8) != 0) {
+this.modifiers |= 2048;
+}if ((this.modifiers & 4) != 0) {
+this.modifiers |= 4096;
+}if (this.id == 501 || this.id == 502 || this.id == 500) {
+if ((this.modifiers & 16) != 0) {
+this.button = 1;
+this.modifiers &= -13;
+if (this.id != 501) {
+this.modifiers &= -1025;
+}} else if ((this.modifiers & 8) != 0) {
+this.button = 2;
+this.modifiers &= -21;
+if (this.id != 501) {
+this.modifiers &= -2049;
+}} else if ((this.modifiers & 4) != 0) {
+this.button = 3;
+this.modifiers &= -25;
+if (this.id != 501) {
+this.modifiers &= -4097;
+}}}if ((this.modifiers & 8) != 0) {
+this.modifiers |= 512;
+}if ((this.modifiers & 4) != 0) {
+this.modifiers |= 256;
+}if ((this.modifiers & 1) != 0) {
+this.modifiers |= 64;
+}if ((this.modifiers & 2) != 0) {
+this.modifiers |= 128;
+}if ((this.modifiers & 32) != 0) {
+this.modifiers |= 8192;
+}});
+Clazz.defineMethod (c$, "setOldModifiers", 
+ function () {
+if (this.id == 501 || this.id == 502 || this.id == 500) {
+switch (this.button) {
+case 1:
+this.modifiers |= 16;
+break;
+case 2:
+this.modifiers |= 8;
+break;
+case 3:
+this.modifiers |= 4;
+break;
+}
+} else {
+if ((this.modifiers & 1024) != 0) {
+this.modifiers |= 16;
+}if ((this.modifiers & 2048) != 0) {
+this.modifiers |= 8;
+}if ((this.modifiers & 4096) != 0) {
+this.modifiers |= 4;
+}}if ((this.modifiers & 512) != 0) {
+this.modifiers |= 8;
+}if ((this.modifiers & 256) != 0) {
+this.modifiers |= 4;
+}if ((this.modifiers & 64) != 0) {
+this.modifiers |= 1;
+}if ((this.modifiers & 128) != 0) {
+this.modifiers |= 2;
+}if ((this.modifiers & 8192) != 0) {
+this.modifiers |= 32;
+}});
+Clazz.defineStatics (c$,
+"MOUSE_FIRST", 500,
+"MOUSE_LAST", 507,
+"MOUSE_CLICKED", 500,
+"MOUSE_PRESSED", 501,
+"MOUSE_RELEASED", 502,
+"MOUSE_MOVED", 503,
+"MOUSE_ENTERED", 504,
+"MOUSE_EXITED", 505,
+"MOUSE_DRAGGED", 506,
+"MOUSE_WHEEL", 507,
+"NOBUTTON", 0,
+"BUTTON1", 1,
+"BUTTON2", 2,
+"BUTTON3", 3);
+});