Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / org / uwi / BoltzCanvas.js
index a47bb63..a31d96c 100644 (file)
@@ -1,59 +1,59 @@
-Clazz.declarePackage ("org.uwi");\r
-Clazz.load (["javax.swing.JPanel"], "org.uwi.BoltzCanvas", ["java.awt.Color", "$.Point", "$.Rectangle"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.maxEnergy = 0;\r
-this.energyLevels = null;\r
-this.xFactor = 0;\r
-this.boltzmann = null;\r
-Clazz.instantialize (this, arguments);\r
-}, org.uwi, "BoltzCanvas", javax.swing.JPanel);\r
-Clazz.makeConstructor (c$, \r
-function (boltzmann) {\r
-Clazz.superConstructor (this, org.uwi.BoltzCanvas);\r
-this.boltzmann = boltzmann;\r
-}, "org.uwi.Boltzmann");\r
-Clazz.overrideMethod (c$, "paintComponent", \r
-function (g) {\r
-g.setColor (this.getForeground ());\r
-g.setPaintMode ();\r
-this.displayBoltz (g);\r
-}, "java.awt.Graphics");\r
-Clazz.defineMethod (c$, "displayBoltz", \r
-function (g) {\r
-var i;\r
-org.uwi.BoltzCanvas.nPaint++;\r
-var r = this.getBounds ();\r
-g.setColor (java.awt.Color.black);\r
-g.drawString ("A Boltzmann Simulation (" + this.boltzmann.numOfCollisions + ")", r.x + 110, r.y + 10);\r
-g.drawString ("E", r.x + 5, r.y + 145);\r
-g.drawString ("No. of Particles", r.x + 110, r.y + 286);\r
-var graphRec =  new java.awt.Rectangle (r.x + 20, r.y + 20, r.width - 40, r.height - 40);\r
-g.clearRect (graphRec.x - 1, graphRec.y - 1, graphRec.width + 3, graphRec.height + 2);\r
-g.drawRect (graphRec.x - 2, graphRec.y - 2, graphRec.width + 4, graphRec.height + 3);\r
-var bottomRight =  new java.awt.Point (graphRec.x + graphRec.width, graphRec.y + graphRec.height);\r
-for (i = this.maxEnergy; i > 0; i--) {\r
-if (this.energyLevels[i] >= 1) break;\r
-this.maxEnergy--;\r
-}\r
-this.xFactor = 0;\r
-for (i = 1; i <= (this.maxEnergy); i++) {\r
-if (this.energyLevels[i] > this.xFactor) {\r
-this.xFactor = this.energyLevels[i];\r
-if (i == this.maxEnergy) this.maxEnergy = 2 * this.maxEnergy;\r
-}}\r
-var xScale = (graphRec.width) / this.xFactor;\r
-var yScale = (graphRec.height) / (this.maxEnergy + 1);\r
-g.setColor (java.awt.Color.red);\r
-var curY = 0;\r
-for (i = 0; i <= this.maxEnergy; i++) {\r
-curY = (bottomRight.y - 1) - (Clazz.doubleToInt (yScale * (i + 1)));\r
-if (this.energyLevels[i] > 0) {\r
-var isMax = (this.energyLevels[i] == this.xFactor);\r
-if (isMax) g.setColor (java.awt.Color.BLUE);\r
-g.drawLine (graphRec.x, curY, graphRec.x + (Clazz.doubleToInt (xScale * this.energyLevels[i])), curY);\r
-if (isMax) g.setColor (java.awt.Color.RED);\r
-}}\r
-}, "java.awt.Graphics");\r
-Clazz.defineStatics (c$,\r
-"nPaint", 0);\r
-});\r
+Clazz.declarePackage ("org.uwi");
+Clazz.load (["javax.swing.JPanel"], "org.uwi.BoltzCanvas", ["java.awt.Color", "$.Point", "$.Rectangle"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.maxEnergy = 0;
+this.energyLevels = null;
+this.xFactor = 0;
+this.boltzmann = null;
+Clazz.instantialize (this, arguments);
+}, org.uwi, "BoltzCanvas", javax.swing.JPanel);
+Clazz.makeConstructor (c$, 
+function (boltzmann) {
+Clazz.superConstructor (this, org.uwi.BoltzCanvas);
+this.boltzmann = boltzmann;
+}, "org.uwi.Boltzmann");
+Clazz.overrideMethod (c$, "paintComponent", 
+function (g) {
+g.setColor (this.getForeground ());
+g.setPaintMode ();
+this.displayBoltz (g);
+}, "java.awt.Graphics");
+Clazz.defineMethod (c$, "displayBoltz", 
+function (g) {
+var i;
+org.uwi.BoltzCanvas.nPaint++;
+var r = this.getBounds ();
+g.setColor (java.awt.Color.black);
+g.drawString ("A Boltzmann Simulation (" + this.boltzmann.numOfCollisions + ")", r.x + 110, r.y + 10);
+g.drawString ("E", r.x + 5, r.y + 145);
+g.drawString ("No. of Particles", r.x + 110, r.y + 286);
+var graphRec =  new java.awt.Rectangle (r.x + 20, r.y + 20, r.width - 40, r.height - 40);
+g.clearRect (graphRec.x - 1, graphRec.y - 1, graphRec.width + 3, graphRec.height + 2);
+g.drawRect (graphRec.x - 2, graphRec.y - 2, graphRec.width + 4, graphRec.height + 3);
+var bottomRight =  new java.awt.Point (graphRec.x + graphRec.width, graphRec.y + graphRec.height);
+for (i = this.maxEnergy; i > 0; i--) {
+if (this.energyLevels[i] >= 1) break;
+this.maxEnergy--;
+}
+this.xFactor = 0;
+for (i = 1; i <= (this.maxEnergy); i++) {
+if (this.energyLevels[i] > this.xFactor) {
+this.xFactor = this.energyLevels[i];
+if (i == this.maxEnergy) this.maxEnergy = 2 * this.maxEnergy;
+}}
+var xScale = (graphRec.width) / this.xFactor;
+var yScale = (graphRec.height) / (this.maxEnergy + 1);
+g.setColor (java.awt.Color.red);
+var curY = 0;
+for (i = 0; i <= this.maxEnergy; i++) {
+curY = (bottomRight.y - 1) - (Clazz.doubleToInt (yScale * (i + 1)));
+if (this.energyLevels[i] > 0) {
+var isMax = (this.energyLevels[i] == this.xFactor);
+if (isMax) g.setColor (java.awt.Color.BLUE);
+g.drawLine (graphRec.x, curY, graphRec.x + (Clazz.doubleToInt (xScale * this.energyLevels[i])), curY);
+if (isMax) g.setColor (java.awt.Color.RED);
+}}
+}, "java.awt.Graphics");
+Clazz.defineStatics (c$,
+"nPaint", 0);
+});