X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=bin%2Fjalview%2Fappletgui%2FIdwidthAdjuster.js;h=e7b92f74f987dde2faf83a638e83d23db817c33d;hp=80a0c59af7e2a84a2dd83557e177e6c5e48a00a1;hb=7301a2415adab88038b291fc54caeeb3a5a47a44;hpb=6154cb57a6eac3bb1344b8342495f5bb701ee921 diff --git a/bin/jalview/appletgui/IdwidthAdjuster.js b/bin/jalview/appletgui/IdwidthAdjuster.js index 80a0c59..e7b92f7 100644 --- a/bin/jalview/appletgui/IdwidthAdjuster.js +++ b/bin/jalview/appletgui/IdwidthAdjuster.js @@ -1,66 +1,66 @@ -Clazz.declarePackage ("jalview.appletgui"); -Clazz.load (["awt2swing.Panel", "java.awt.event.MouseListener", "$.MouseMotionListener"], "jalview.appletgui.IdwidthAdjuster", ["java.awt.Color", "$.Toolkit"], function () { -c$ = Clazz.decorateAsClass (function () { -this.active = false; -this.oldX = 0; -this.image = null; -this.ap = null; -Clazz.instantialize (this, arguments); -}, jalview.appletgui, "IdwidthAdjuster", awt2swing.Panel, [java.awt.event.MouseListener, java.awt.event.MouseMotionListener]); -Clazz.makeConstructor (c$, -function (ap) { -Clazz.superConstructor (this, jalview.appletgui.IdwidthAdjuster, []); -this.setName ("IdwidthAdjuster"); -this.setLayout (null); -this.ap = ap; -var url = this.getClass ().getResource ("/images/idwidth.gif"); -if (url != null) { -this.image = java.awt.Toolkit.getDefaultToolkit ().getImage (url); -}this.addMouseListener (this); -this.addMouseMotionListener (this); -}, "jalview.appletgui.AlignmentPanel"); -Clazz.overrideMethod (c$, "mousePressed", -function (evt) { -this.oldX = evt.getX (); -}, "java.awt.event.MouseEvent"); -Clazz.overrideMethod (c$, "mouseReleased", -function (evt) { -this.active = false; -this.repaint (); -}, "java.awt.event.MouseEvent"); -Clazz.overrideMethod (c$, "mouseEntered", -function (evt) { -this.active = true; -this.repaint (); -}, "java.awt.event.MouseEvent"); -Clazz.overrideMethod (c$, "mouseExited", -function (evt) { -this.active = false; -this.repaint (); -}, "java.awt.event.MouseEvent"); -Clazz.overrideMethod (c$, "mouseDragged", -function (evt) { -this.active = true; -var d = this.ap.idPanel.idCanvas.getSize (); -var dif = evt.getX () - this.oldX; -var newWidth = d.width + dif; -if (newWidth > 20 || dif > 0) { -this.ap.setIdWidth (newWidth, d.height); -this.setSize (newWidth, this.getSize ().height); -this.oldX = evt.getX (); -}}, "java.awt.event.MouseEvent"); -Clazz.overrideMethod (c$, "mouseMoved", -function (evt) { -}, "java.awt.event.MouseEvent"); -Clazz.overrideMethod (c$, "mouseClicked", -function (evt) { -}, "java.awt.event.MouseEvent"); -Clazz.defineMethod (c$, "PaintComponent", -function (g) { -g.setColor (java.awt.Color.white); -g.fillRect (0, 0, this.getSize ().width, this.getSize ().height); -if (this.active) { -if (this.image != null) { -g.drawImage (this.image, this.getSize ().width - 20, 2, this); -}}}, "java.awt.Graphics"); -}); +Clazz.declarePackage ("jalview.appletgui"); +Clazz.load (["awt2swing.Panel", "java.awt.event.MouseListener", "$.MouseMotionListener"], "jalview.appletgui.IdwidthAdjuster", ["java.awt.Color", "$.Toolkit"], function () { +c$ = Clazz.decorateAsClass (function () { +this.active = false; +this.oldX = 0; +this.image = null; +this.ap = null; +Clazz.instantialize (this, arguments); +}, jalview.appletgui, "IdwidthAdjuster", awt2swing.Panel, [java.awt.event.MouseListener, java.awt.event.MouseMotionListener]); +Clazz.makeConstructor (c$, +function (ap) { +Clazz.superConstructor (this, jalview.appletgui.IdwidthAdjuster, []); +this.setName ("IdwidthAdjuster"); +this.setLayout (null); +this.ap = ap; +var url = this.getClass ().getResource ("/images/idwidth.gif"); +if (url != null) { +this.image = java.awt.Toolkit.getDefaultToolkit ().getImage (url); +}this.addMouseListener (this); +this.addMouseMotionListener (this); +}, "jalview.appletgui.AlignmentPanel"); +Clazz.overrideMethod (c$, "mousePressed", +function (evt) { +this.oldX = evt.getX (); +}, "java.awt.event.MouseEvent"); +Clazz.overrideMethod (c$, "mouseReleased", +function (evt) { +this.active = false; +this.repaint (); +}, "java.awt.event.MouseEvent"); +Clazz.overrideMethod (c$, "mouseEntered", +function (evt) { +this.active = true; +this.repaint (); +}, "java.awt.event.MouseEvent"); +Clazz.overrideMethod (c$, "mouseExited", +function (evt) { +this.active = false; +this.repaint (); +}, "java.awt.event.MouseEvent"); +Clazz.overrideMethod (c$, "mouseDragged", +function (evt) { +this.active = true; +var d = this.ap.idPanel.idCanvas.getSize (); +var dif = evt.getX () - this.oldX; +var newWidth = d.width + dif; +if (newWidth > 20 || dif > 0) { +this.ap.setIdWidth (newWidth, d.height); +this.setSize (newWidth, this.getSize ().height); +this.oldX = evt.getX (); +}}, "java.awt.event.MouseEvent"); +Clazz.overrideMethod (c$, "mouseMoved", +function (evt) { +}, "java.awt.event.MouseEvent"); +Clazz.overrideMethod (c$, "mouseClicked", +function (evt) { +}, "java.awt.event.MouseEvent"); +Clazz.defineMethod (c$, "PaintComponent", +function (g) { +g.setColor (java.awt.Color.white); +g.fillRect (0, 0, this.getSize ().width, this.getSize ().height); +if (this.active) { +if (this.image != null) { +g.drawImage (this.image, this.getSize ().width - 20, 2, this); +}}}, "java.awt.Graphics"); +});