diff --git a/webservice/static/js/jsmol/j2s/JS/ButtonGroup.js b/webservice/static/js/jsmol/j2s/JS/ButtonGroup.js new file mode 100644 index 0000000..68f2b71 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/ButtonGroup.js @@ -0,0 +1,15 @@ +Clazz.declarePackage ("JS"); +Clazz.load (null, "JS.ButtonGroup", ["JS.Component"], function () { +c$ = Clazz.decorateAsClass (function () { +this.id = null; +Clazz.instantialize (this, arguments); +}, JS, "ButtonGroup"); +Clazz.makeConstructor (c$, +function () { +this.id = JS.Component.newID ("bg"); +}); +Clazz.defineMethod (c$, "add", +function (item) { +(item).htmlName = this.id; +}, "J.api.SC"); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/Cell.js b/webservice/static/js/jsmol/j2s/JS/Cell.js new file mode 100644 index 0000000..8384105 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/Cell.js @@ -0,0 +1,21 @@ +Clazz.declarePackage ("JS"); +c$ = Clazz.decorateAsClass (function () { +this.component = null; +this.colspan = 0; +this.rowspan = 0; +this.textAlign = 0; +this.c = null; +Clazz.instantialize (this, arguments); +}, JS, "Cell"); +Clazz.makeConstructor (c$, +function (btn, c) { +this.component = btn; +this.colspan = c.gridwidth; +this.rowspan = c.gridheight; +this.c = c; +}, "JS.JComponent,JS.GridBagConstraints"); +Clazz.defineMethod (c$, "toHTML", +function (id) { +var style = this.c.getStyle (false); +return "" + this.component.toHTML () + ""; +}, "~S"); diff --git a/webservice/static/js/jsmol/j2s/JS/Color.js b/webservice/static/js/jsmol/j2s/JS/Color.js new file mode 100644 index 0000000..348efd7 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/Color.js @@ -0,0 +1,43 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["javajs.api.GenericColor"], "JS.Color", null, function () { +c$ = Clazz.decorateAsClass (function () { +this.argb = 0; +Clazz.instantialize (this, arguments); +}, JS, "Color", null, javajs.api.GenericColor); +Clazz.overrideMethod (c$, "getRGB", +function () { +return this.argb & 0x00FFFFFF; +}); +Clazz.overrideMethod (c$, "getOpacity255", +function () { +return ((this.argb >> 24) & 0xFF); +}); +Clazz.overrideMethod (c$, "setOpacity255", +function (a) { +this.argb = this.argb & 0xFFFFFF | ((a & 0xFF) << 24); +}, "~N"); +c$.get1 = Clazz.defineMethod (c$, "get1", +function (rgb) { +var c = new JS.Color (); +c.argb = rgb | 0xFF000000; +return c; +}, "~N"); +c$.get3 = Clazz.defineMethod (c$, "get3", +function (r, g, b) { +return new JS.Color ().set4 (r, g, b, 0xFF); +}, "~N,~N,~N"); +c$.get4 = Clazz.defineMethod (c$, "get4", +function (r, g, b, a) { +return new JS.Color ().set4 (r, g, b, a); +}, "~N,~N,~N,~N"); +Clazz.defineMethod (c$, "set4", + function (r, g, b, a) { +this.argb = ((a << 24) | (r << 16) | (g << 8) | b) & 0xFFFFFFFF; +return this; +}, "~N,~N,~N,~N"); +Clazz.overrideMethod (c$, "toString", +function () { +var s = ("00000000" + Integer.toHexString (this.argb)); +return "[0x" + s.substring (s.length - 8, s.length) + "]"; +}); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/Component.js b/webservice/static/js/jsmol/j2s/JS/Component.js new file mode 100644 index 0000000..949ccef --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/Component.js @@ -0,0 +1,120 @@ +Clazz.declarePackage ("JS"); +Clazz.load (null, "JS.Component", ["JU.CU"], function () { +c$ = Clazz.decorateAsClass (function () { +this._visible = false; +this.enabled = true; +this.text = null; +this.name = null; +this.width = 0; +this.height = 0; +this.id = null; +this.parent = null; +this.mouseListener = null; +this.bgcolor = null; +this.minWidth = 30; +this.minHeight = 30; +this.renderWidth = 0; +this.renderHeight = 0; +Clazz.instantialize (this, arguments); +}, JS, "Component"); +Clazz.defineMethod (c$, "setParent", +function (p) { +this.parent = p; +}, "~O"); +Clazz.makeConstructor (c$, +function (type) { +this.id = JS.Component.newID (type); +if (type == null) return; +{ +SwingController.register(this, type); +}}, "~S"); +c$.newID = Clazz.defineMethod (c$, "newID", +function (type) { +return type + ("" + Math.random ()).substring (3, 10); +}, "~S"); +Clazz.defineMethod (c$, "setBackground", +function (color) { +this.bgcolor = color; +}, "javajs.api.GenericColor"); +Clazz.defineMethod (c$, "setText", +function (text) { +this.text = text; +{ +SwingController.setText(this); +}}, "~S"); +Clazz.defineMethod (c$, "setName", +function (name) { +this.name = name; +}, "~S"); +Clazz.defineMethod (c$, "getName", +function () { +return this.name; +}); +Clazz.defineMethod (c$, "getParent", +function () { +return this.parent; +}); +Clazz.defineMethod (c$, "setPreferredSize", +function (dimension) { +this.width = dimension.width; +this.height = dimension.height; +}, "JS.Dimension"); +Clazz.defineMethod (c$, "addMouseListener", +function (listener) { +this.mouseListener = listener; +}, "~O"); +Clazz.defineMethod (c$, "getText", +function () { +return this.text; +}); +Clazz.defineMethod (c$, "isEnabled", +function () { +return this.enabled; +}); +Clazz.defineMethod (c$, "setEnabled", +function (enabled) { +this.enabled = enabled; +{ +SwingController.setEnabled(this); +}}, "~B"); +Clazz.defineMethod (c$, "isVisible", +function () { +return this._visible; +}); +Clazz.defineMethod (c$, "setVisible", +function (visible) { +this._visible = visible; +{ +SwingController.setVisible(this); +}}, "~B"); +Clazz.defineMethod (c$, "getHeight", +function () { +return this.height; +}); +Clazz.defineMethod (c$, "getWidth", +function () { +return this.width; +}); +Clazz.defineMethod (c$, "setMinimumSize", +function (d) { +this.minWidth = d.width; +this.minHeight = d.height; +}, "JS.Dimension"); +Clazz.defineMethod (c$, "getSubcomponentWidth", +function () { +return this.width; +}); +Clazz.defineMethod (c$, "getSubcomponentHeight", +function () { +return this.height; +}); +Clazz.defineMethod (c$, "getCSSstyle", +function (defaultPercentW, defaultPercentH) { +var width = (this.renderWidth > 0 ? this.renderWidth : this.getSubcomponentWidth ()); +var height = (this.renderHeight > 0 ? this.renderHeight : this.getSubcomponentHeight ()); +return (width > 0 ? "width:" + width + "px;" : defaultPercentW > 0 ? "width:" + defaultPercentW + "%;" : "") + (height > 0 ? "height:" + height + "px;" : defaultPercentH > 0 ? "height:" + defaultPercentH + "%;" : "") + (this.bgcolor == null ? "" : "background-color:" + JU.CU.toCSSString (this.bgcolor) + ";"); +}, "~N,~N"); +Clazz.defineMethod (c$, "repaint", +function () { +}); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/Container.js b/webservice/static/js/jsmol/j2s/JS/Container.js new file mode 100644 index 0000000..b6370d0 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/Container.js @@ -0,0 +1,65 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["JS.Component"], "JS.Container", ["JU.Lst"], function () { +c$ = Clazz.decorateAsClass (function () { +this.list = null; +this.cList = null; +Clazz.instantialize (this, arguments); +}, JS, "Container", JS.Component); +Clazz.defineMethod (c$, "getComponent", +function (i) { +return this.list.get (i); +}, "~N"); +Clazz.defineMethod (c$, "getComponentCount", +function () { +return (this.list == null ? 0 : this.list.size ()); +}); +Clazz.defineMethod (c$, "getComponents", +function () { +if (this.cList == null) { +if (this.list == null) return new Array (0); +this.cList = this.list.toArray (); +}return this.cList; +}); +Clazz.defineMethod (c$, "add", +function (component) { +return this.addComponent (component); +}, "JS.Component"); +Clazz.defineMethod (c$, "addComponent", +function (component) { +if (this.list == null) this.list = new JU.Lst (); +this.list.addLast (component); +this.cList = null; +component.parent = this; +return component; +}, "JS.Component"); +Clazz.defineMethod (c$, "insertComponent", +function (component, index) { +if (this.list == null) return this.addComponent (component); +this.list.add (index, component); +this.cList = null; +component.parent = this; +return component; +}, "JS.Component,~N"); +Clazz.defineMethod (c$, "remove", +function (i) { +var c = this.list.removeItemAt (i); +c.parent = null; +this.cList = null; +}, "~N"); +Clazz.defineMethod (c$, "removeAll", +function () { +if (this.list != null) { +for (var i = this.list.size (); --i >= 0; ) this.list.get (i).parent = null; + +this.list.clear (); +}this.cList = null; +}); +Clazz.defineMethod (c$, "getSubcomponentWidth", +function () { +return (this.list != null && this.list.size () == 1 ? this.list.get (0).getSubcomponentWidth () : 0); +}); +Clazz.defineMethod (c$, "getSubcomponentHeight", +function () { +return (this.list != null && this.list.size () == 1 ? this.list.get (0).getSubcomponentHeight () : 0); +}); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/Dimension.js b/webservice/static/js/jsmol/j2s/JS/Dimension.js new file mode 100644 index 0000000..919b209 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/Dimension.js @@ -0,0 +1,16 @@ +Clazz.declarePackage ("JS"); +c$ = Clazz.decorateAsClass (function () { +this.width = 0; +this.height = 0; +Clazz.instantialize (this, arguments); +}, JS, "Dimension"); +Clazz.makeConstructor (c$, +function (w, h) { +this.set (w, h); +}, "~N,~N"); +Clazz.defineMethod (c$, "set", +function (w, h) { +this.width = w; +this.height = h; +return this; +}, "~N,~N"); diff --git a/webservice/static/js/jsmol/j2s/JS/Grid.js b/webservice/static/js/jsmol/j2s/JS/Grid.js new file mode 100644 index 0000000..a84c6e3 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/Grid.js @@ -0,0 +1,46 @@ +Clazz.declarePackage ("JS"); +Clazz.load (null, "JS.Grid", ["JU.AU", "$.SB", "JS.Cell"], function () { +c$ = Clazz.decorateAsClass (function () { +this.nrows = 0; +this.ncols = 0; +this.grid = null; +this.renderer = null; +Clazz.instantialize (this, arguments); +}, JS, "Grid"); +Clazz.makeConstructor (c$, +function (rows, cols) { +this.grid = Clazz.newArray (0, 0, null); +}, "~N,~N"); +Clazz.defineMethod (c$, "add", +function (btn, c) { +if (c.gridx >= this.ncols) { +this.ncols = c.gridx + 1; +for (var i = 0; i < this.nrows; i++) { +this.grid[i] = JU.AU.ensureLength (this.grid[i], this.ncols * 2); +} +}if (c.gridy >= this.nrows) { +var g = new Array (c.gridy * 2 + 1); +for (var i = 0; i < this.nrows; i++) g[i] = this.grid[i]; + +for (var i = g.length; --i >= this.nrows; ) g[i] = new Array (this.ncols * 2 + 1); + +this.grid = g; +this.nrows = c.gridy + 1; +}this.grid[c.gridy][c.gridx] = new JS.Cell (btn, c); +}, "JS.JComponent,JS.GridBagConstraints"); +Clazz.defineMethod (c$, "toHTML", +function (id) { +var sb = new JU.SB (); +id += "_grid"; +sb.append ("\n"); +for (var i = 0; i < this.nrows; i++) { +var rowid = id + "_" + i; +sb.append ("\n"); +for (var j = 0; j < this.ncols; j++) if (this.grid[i][j] != null) sb.append (this.grid[i][j].toHTML (rowid + "_" + j)); + +sb.append (""); +} +sb.append ("\n
\n"); +return sb.toString (); +}, "~S"); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/GridBagConstraints.js b/webservice/static/js/jsmol/j2s/JS/GridBagConstraints.js new file mode 100644 index 0000000..51c7d45 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/GridBagConstraints.js @@ -0,0 +1,41 @@ +Clazz.declarePackage ("JS"); +Clazz.load (null, "JS.GridBagConstraints", ["JS.Insets"], function () { +c$ = Clazz.decorateAsClass (function () { +this.gridx = 0; +this.gridy = 0; +this.gridwidth = 0; +this.gridheight = 0; +this.weightx = 0; +this.weighty = 0; +this.anchor = 0; +this.fill = 0; +this.insets = null; +this.ipadx = 0; +this.ipady = 0; +Clazz.instantialize (this, arguments); +}, JS, "GridBagConstraints"); +Clazz.makeConstructor (c$, +function (gridx, gridy, gridwidth, gridheight, weightx, weighty, anchor, fill, insets, ipadx, ipady) { +this.gridx = gridx; +this.gridy = gridy; +this.gridwidth = gridwidth; +this.gridheight = gridheight; +this.weightx = weightx; +this.weighty = weighty; +this.anchor = anchor; +this.fill = fill; +if (insets == null) insets = new JS.Insets (0, 0, 0, 0); +this.insets = insets; +this.ipadx = ipadx; +this.ipady = ipady; +}, "~N,~N,~N,~N,~N,~N,~N,~N,JS.Insets,~N,~N"); +Clazz.defineMethod (c$, "getStyle", +function (margins) { +return "style='" + (margins ? "margin:" + this.insets.top + "px " + (this.ipady + this.insets.right) + "px " + this.insets.bottom + "px " + (this.ipadx + this.insets.left) + "px;" : "text-align:" + (this.anchor == 13 ? "right" : this.anchor == 17 ? "left" : "center")) + "'"; +}, "~B"); +Clazz.defineStatics (c$, +"NONE", 0, +"CENTER", 10, +"WEST", 17, +"EAST", 13); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/GridBagLayout.js b/webservice/static/js/jsmol/j2s/JS/GridBagLayout.js new file mode 100644 index 0000000..88b1a6c --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/GridBagLayout.js @@ -0,0 +1,4 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["JS.LayoutManager"], "JS.GridBagLayout", null, function () { +c$ = Clazz.declareType (JS, "GridBagLayout", JS.LayoutManager); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/HTMLElement.js b/webservice/static/js/jsmol/j2s/JS/HTMLElement.js new file mode 100644 index 0000000..d9765bb --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/HTMLElement.js @@ -0,0 +1,2 @@ +Clazz.declarePackage ("JS"); +Clazz.declareInterface (JS, "HTMLElement"); diff --git a/webservice/static/js/jsmol/j2s/JS/HTMLWindowEvent.js b/webservice/static/js/jsmol/j2s/JS/HTMLWindowEvent.js new file mode 100644 index 0000000..25fe5f1 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/HTMLWindowEvent.js @@ -0,0 +1,2 @@ +Clazz.declarePackage ("JS"); +Clazz.declareInterface (JS, "HTMLWindowEvent"); diff --git a/webservice/static/js/jsmol/j2s/JS/Insets.js b/webservice/static/js/jsmol/j2s/JS/Insets.js new file mode 100644 index 0000000..9a076f1 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/Insets.js @@ -0,0 +1,15 @@ +Clazz.declarePackage ("JS"); +c$ = Clazz.decorateAsClass (function () { +this.top = 0; +this.left = 0; +this.bottom = 0; +this.right = 0; +Clazz.instantialize (this, arguments); +}, JS, "Insets"); +Clazz.makeConstructor (c$, +function (top, left, bottom, right) { +this.top = top; +this.left = left; +this.bottom = bottom; +this.right = right; +}, "~N,~N,~N,~N"); diff --git a/webservice/static/js/jsmol/j2s/JS/JButton.js b/webservice/static/js/jsmol/j2s/JS/JButton.js new file mode 100644 index 0000000..5120b69 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/JButton.js @@ -0,0 +1,14 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["JS.AbstractButton"], "JS.JButton", ["JU.SB"], function () { +c$ = Clazz.declareType (JS, "JButton", JS.AbstractButton); +Clazz.makeConstructor (c$, +function () { +Clazz.superConstructor (this, JS.JButton, ["btnJB"]); +}); +Clazz.overrideMethod (c$, "toHTML", +function () { +var sb = new JU.SB (); +sb.append (""); +return sb.toString (); +}); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/JCheckBox.js b/webservice/static/js/jsmol/j2s/JS/JCheckBox.js new file mode 100644 index 0000000..c039976 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/JCheckBox.js @@ -0,0 +1,13 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["JS.AbstractButton"], "JS.JCheckBox", null, function () { +c$ = Clazz.declareType (JS, "JCheckBox", JS.AbstractButton); +Clazz.makeConstructor (c$, +function () { +Clazz.superConstructor (this, JS.JCheckBox, ["chkJCB"]); +}); +Clazz.overrideMethod (c$, "toHTML", +function () { +var s = ""; +return s; +}); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/JCheckBoxMenuItem.js b/webservice/static/js/jsmol/j2s/JS/JCheckBoxMenuItem.js new file mode 100644 index 0000000..6fb6f03 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/JCheckBoxMenuItem.js @@ -0,0 +1,8 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["JS.JMenuItem"], "JS.JCheckBoxMenuItem", null, function () { +c$ = Clazz.declareType (JS, "JCheckBoxMenuItem", JS.JMenuItem); +Clazz.makeConstructor (c$, +function () { +Clazz.superConstructor (this, JS.JCheckBoxMenuItem, ["chk", 2]); +}); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/JComboBox.js b/webservice/static/js/jsmol/j2s/JS/JComboBox.js new file mode 100644 index 0000000..d1888d1 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/JComboBox.js @@ -0,0 +1,36 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["JS.AbstractButton"], "JS.JComboBox", ["JU.SB"], function () { +c$ = Clazz.decorateAsClass (function () { +this.info = null; +this.selectedIndex = 0; +Clazz.instantialize (this, arguments); +}, JS, "JComboBox", JS.AbstractButton); +Clazz.makeConstructor (c$, +function (info) { +Clazz.superConstructor (this, JS.JComboBox, ["cmbJCB"]); +this.info = info; +}, "~A"); +Clazz.defineMethod (c$, "setSelectedIndex", +function (i) { +this.selectedIndex = i; +{ +SwingController.setSelectedIndex(this); +}}, "~N"); +Clazz.defineMethod (c$, "getSelectedIndex", +function () { +return this.selectedIndex; +}); +Clazz.defineMethod (c$, "getSelectedItem", +function () { +return (this.selectedIndex < 0 ? null : this.info[this.selectedIndex]); +}); +Clazz.overrideMethod (c$, "toHTML", +function () { +var sb = new JU.SB (); +sb.append ("\n\n"); +return sb.toString (); +}); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/JComponent.js b/webservice/static/js/jsmol/j2s/JS/JComponent.js new file mode 100644 index 0000000..815cdf2 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/JComponent.js @@ -0,0 +1,25 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["JS.Container"], "JS.JComponent", null, function () { +c$ = Clazz.decorateAsClass (function () { +this.autoScrolls = false; +this.actionCommand = null; +this.actionListener = null; +Clazz.instantialize (this, arguments); +}, JS, "JComponent", JS.Container); +Clazz.defineMethod (c$, "setAutoscrolls", +function (b) { +this.autoScrolls = b; +}, "~B"); +Clazz.defineMethod (c$, "addActionListener", +function (listener) { +this.actionListener = listener; +}, "~O"); +Clazz.defineMethod (c$, "getActionCommand", +function () { +return this.actionCommand; +}); +Clazz.defineMethod (c$, "setActionCommand", +function (actionCommand) { +this.actionCommand = actionCommand; +}, "~S"); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/JComponentImp.js b/webservice/static/js/jsmol/j2s/JS/JComponentImp.js new file mode 100644 index 0000000..c911162 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/JComponentImp.js @@ -0,0 +1,8 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["JS.JComponent"], "JS.JComponentImp", null, function () { +c$ = Clazz.declareType (JS, "JComponentImp", JS.JComponent); +Clazz.overrideMethod (c$, "toHTML", +function () { +return null; +}); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/JContentPane.js b/webservice/static/js/jsmol/j2s/JS/JContentPane.js new file mode 100644 index 0000000..4e60112 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/JContentPane.js @@ -0,0 +1,17 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["JS.JComponent"], "JS.JContentPane", ["JU.SB"], function () { +c$ = Clazz.declareType (JS, "JContentPane", JS.JComponent); +Clazz.makeConstructor (c$, +function () { +Clazz.superConstructor (this, JS.JContentPane, ["JCP"]); +}); +Clazz.defineMethod (c$, "toHTML", +function () { +var sb = new JU.SB (); +sb.append ("\n
\n"); +if (this.list != null) for (var i = 0; i < this.list.size (); i++) sb.append (this.list.get (i).toHTML ()); + +sb.append ("\n
\n"); +return sb.toString (); +}); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/JDialog.js b/webservice/static/js/jsmol/j2s/JS/JDialog.js new file mode 100644 index 0000000..1341d7f --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/JDialog.js @@ -0,0 +1,88 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["JS.Container"], "JS.JDialog", ["JU.SB", "JS.Color", "$.JContentPane"], function () { +c$ = Clazz.decorateAsClass (function () { +this.defaultWidth = 600; +this.defaultHeight = 300; +this.contentPane = null; +this.title = null; +this.html = null; +this.zIndex = 9000; +this.loc = null; +Clazz.instantialize (this, arguments); +}, JS, "JDialog", JS.Container); +Clazz.defineMethod (c$, "setZIndex", +function (zIndex) { +this.zIndex = zIndex; +}, "~N"); +Clazz.makeConstructor (c$, +function () { +Clazz.superConstructor (this, JS.JDialog, ["JD"]); +this.add (this.contentPane = new JS.JContentPane ()); +this.setBackground (JS.Color.get3 (210, 210, 240)); +this.contentPane.setBackground (JS.Color.get3 (230, 230, 230)); +}); +Clazz.defineMethod (c$, "setLocation", +function (loc) { +this.loc = loc; +}, "~A"); +Clazz.defineMethod (c$, "getContentPane", +function () { +return this.contentPane; +}); +Clazz.defineMethod (c$, "setTitle", +function (title) { +this.title = title; +}, "~S"); +Clazz.defineMethod (c$, "pack", +function () { +this.html = null; +}); +Clazz.defineMethod (c$, "validate", +function () { +this.html = null; +}); +Clazz.defineMethod (c$, "setVisible", +function (tf) { +if (tf && this.html == null) this.setDialog (); +Clazz.superCall (this, JS.JDialog, "setVisible", [tf]); +if (tf) this.toFront (); +}, "~B"); +Clazz.defineMethod (c$, "dispose", +function () { +{ +{ +SwingController.dispose(this); +}}}); +Clazz.overrideMethod (c$, "repaint", +function () { +this.setDialog (); +}); +Clazz.defineMethod (c$, "setDialog", + function () { +this.html = this.toHTML (); +{ +SwingController.setDialog(this); +}}); +Clazz.overrideMethod (c$, "toHTML", +function () { +this.renderWidth = Math.max (this.width, this.getSubcomponentWidth ()); +if (this.renderWidth == 0) this.renderWidth = this.defaultWidth; +this.renderHeight = Math.max (this.height, this.contentPane.getSubcomponentHeight ()); +if (this.renderHeight == 0) this.renderHeight = this.defaultHeight; +var h = this.renderHeight - 25; +var sb = new JU.SB (); +sb.append ("\n
\n"); +sb.append ("\n
" + "" + this.title + "" + "
\n"); +sb.append ("\n
\n"); +sb.append (this.contentPane.toHTML ()); +sb.append ("\n
\n"); +return sb.toString (); +}); +Clazz.defineMethod (c$, "toFront", +function () { +{ +SwingController.setFront(this); +}}); +Clazz.defineStatics (c$, +"headerHeight", 25); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/JEditorPane.js b/webservice/static/js/jsmol/j2s/JS/JEditorPane.js new file mode 100644 index 0000000..e1d08c5 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/JEditorPane.js @@ -0,0 +1,15 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["JS.JComponent"], "JS.JEditorPane", ["JU.SB"], function () { +c$ = Clazz.declareType (JS, "JEditorPane", JS.JComponent); +Clazz.makeConstructor (c$, +function () { +Clazz.superConstructor (this, JS.JEditorPane, ["txtJEP"]); +this.text = ""; +}); +Clazz.overrideMethod (c$, "toHTML", +function () { +var sb = new JU.SB (); +sb.append (""); +return sb.toString (); +}); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/JLabel.js b/webservice/static/js/jsmol/j2s/JS/JLabel.js new file mode 100644 index 0000000..234b3cd --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/JLabel.js @@ -0,0 +1,17 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["JS.JComponent"], "JS.JLabel", ["JU.SB"], function () { +c$ = Clazz.declareType (JS, "JLabel", JS.JComponent); +Clazz.makeConstructor (c$, +function (text) { +Clazz.superConstructor (this, JS.JLabel, ["lblJL"]); +this.text = text; +}, "~S"); +Clazz.overrideMethod (c$, "toHTML", +function () { +var sb = new JU.SB (); +sb.append (""); +sb.append (this.text); +sb.append (""); +return sb.toString (); +}); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/JMenu.js b/webservice/static/js/jsmol/j2s/JS/JMenu.js new file mode 100644 index 0000000..f06a640 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/JMenu.js @@ -0,0 +1,24 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["JS.JMenuItem"], "JS.JMenu", null, function () { +c$ = Clazz.declareType (JS, "JMenu", JS.JMenuItem); +Clazz.makeConstructor (c$, +function () { +Clazz.superConstructor (this, JS.JMenu, ["mnu", 4]); +}); +Clazz.defineMethod (c$, "getItemCount", +function () { +return this.getComponentCount (); +}); +Clazz.defineMethod (c$, "getItem", +function (i) { +return this.getComponent (i); +}, "~N"); +Clazz.overrideMethod (c$, "getPopupMenu", +function () { +return this; +}); +Clazz.overrideMethod (c$, "toHTML", +function () { +return this.getMenuHTML (); +}); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/JPanel.js b/webservice/static/js/jsmol/j2s/JS/JPanel.js new file mode 100644 index 0000000..80cc6bc --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/JPanel.js @@ -0,0 +1,39 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["JS.JComponent"], "JS.JPanel", ["JU.SB", "JS.Grid", "$.GridBagConstraints"], function () { +c$ = Clazz.decorateAsClass (function () { +this.grid = null; +this.nElements = 0; +this.last = null; +Clazz.instantialize (this, arguments); +}, JS, "JPanel", JS.JComponent); +Clazz.makeConstructor (c$, +function (manager) { +Clazz.superConstructor (this, JS.JPanel, ["JP"]); +this.grid = new JS.Grid (10, 10); +}, "JS.LayoutManager"); +Clazz.defineMethod (c$, "add", +function (btn, c) { +this.last = (++this.nElements == 1 ? btn : null); +if (Clazz.instanceOf (c, String)) { +if (c.equals ("North")) c = new JS.GridBagConstraints (0, 0, 3, 1, 0, 0, 10, 0, null, 0, 0); + else if (c.equals ("South")) c = new JS.GridBagConstraints (0, 2, 3, 1, 0, 0, 10, 0, null, 0, 0); + else if (c.equals ("East")) c = new JS.GridBagConstraints (2, 1, 1, 1, 0, 0, 13, 0, null, 0, 0); + else if (c.equals ("West")) c = new JS.GridBagConstraints (0, 1, 1, 1, 0, 0, 17, 0, null, 0, 0); + else c = new JS.GridBagConstraints (1, 1, 1, 1, 0, 0, 10, 0, null, 0, 0); +}this.grid.add (btn, c); +}, "JS.JComponent,~O"); +Clazz.overrideMethod (c$, "toHTML", +function () { +if (this.last != null) { +this.grid = new JS.Grid (1, 1); +this.grid.add (this.last, new JS.GridBagConstraints (0, 0, 1, 1, 0, 0, 10, 0, null, 0, 0)); +this.last = null; +}var sb = new JU.SB (); +sb.append ("\n
\n"); +sb.append ("\n"); +sb.append (this.grid.toHTML (this.id)); +sb.append (""); +sb.append ("\n
\n"); +return sb.toString (); +}); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/JPopupMenu.js b/webservice/static/js/jsmol/j2s/JS/JPopupMenu.js new file mode 100644 index 0000000..28ae246 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/JPopupMenu.js @@ -0,0 +1,36 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["JS.AbstractButton"], "JS.JPopupMenu", null, function () { +c$ = Clazz.decorateAsClass (function () { +this.tainted = true; +Clazz.instantialize (this, arguments); +}, JS, "JPopupMenu", JS.AbstractButton); +Clazz.makeConstructor (c$, +function (name) { +Clazz.superConstructor (this, JS.JPopupMenu, ["mnu"]); +this.name = name; +}, "~S"); +Clazz.defineMethod (c$, "setInvoker", +function (applet) { +this.applet = applet; +{ +SwingController.setMenu(this); +}}, "~O"); +Clazz.defineMethod (c$, "show", +function (applet, x, y) { +if (applet != null) this.tainted = true; +{ +SwingController.showMenu(this, x, y); +}}, "JS.Component,~N,~N"); +Clazz.defineMethod (c$, "disposeMenu", +function () { +{ +SwingController.disposeMenu(this); +}}); +Clazz.overrideMethod (c$, "toHTML", +function () { +return this.getMenuHTML (); +}); +{ +{ +SwingController.setDraggable(JS.JPopupMenu); +}}}); diff --git a/webservice/static/js/jsmol/j2s/JS/JRadioButtonMenuItem.js b/webservice/static/js/jsmol/j2s/JS/JRadioButtonMenuItem.js new file mode 100644 index 0000000..6a5ae34 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/JRadioButtonMenuItem.js @@ -0,0 +1,11 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["JS.JMenuItem"], "JS.JRadioButtonMenuItem", null, function () { +c$ = Clazz.decorateAsClass (function () { +this.isRadio = true; +Clazz.instantialize (this, arguments); +}, JS, "JRadioButtonMenuItem", JS.JMenuItem); +Clazz.makeConstructor (c$, +function () { +Clazz.superConstructor (this, JS.JRadioButtonMenuItem, ["rad", 3]); +}); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/JScrollPane.js b/webservice/static/js/jsmol/j2s/JS/JScrollPane.js new file mode 100644 index 0000000..75dbf0c --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/JScrollPane.js @@ -0,0 +1,22 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["JS.JComponent"], "JS.JScrollPane", ["JU.SB"], function () { +c$ = Clazz.declareType (JS, "JScrollPane", JS.JComponent); +Clazz.makeConstructor (c$, +function (component) { +Clazz.superConstructor (this, JS.JScrollPane, ["JScP"]); +this.add (component); +}, "JS.JComponent"); +Clazz.defineMethod (c$, "toHTML", +function () { +var sb = new JU.SB (); +sb.append ("\n
\n"); +if (this.list != null) { +var c = this.list.get (0); +sb.append (c.toHTML ()); +}sb.append ("\n
\n"); +return sb.toString (); +}); +Clazz.overrideMethod (c$, "setMinimumSize", +function (dimension) { +}, "JS.Dimension"); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/JTextField.js b/webservice/static/js/jsmol/j2s/JS/JTextField.js new file mode 100644 index 0000000..89cc910 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/JTextField.js @@ -0,0 +1,15 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["JS.JComponent"], "JS.JTextField", ["JU.SB"], function () { +c$ = Clazz.declareType (JS, "JTextField", JS.JComponent); +Clazz.makeConstructor (c$, +function (value) { +Clazz.superConstructor (this, JS.JTextField, ["txtJT"]); +this.text = value; +}, "~S"); +Clazz.overrideMethod (c$, "toHTML", +function () { +var sb = new JU.SB (); +sb.append (""); +return sb.toString (); +}); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/JTextPane.js b/webservice/static/js/jsmol/j2s/JS/JTextPane.js new file mode 100644 index 0000000..7342869 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/JTextPane.js @@ -0,0 +1,24 @@ +Clazz.declarePackage ("JS"); +Clazz.load (["JS.Document", "$.JComponent"], "JS.JTextPane", ["JU.SB"], function () { +c$ = Clazz.declareType (JS, "JTextPane", JS.JComponent, JS.Document); +Clazz.makeConstructor (c$, +function () { +Clazz.superConstructor (this, JS.JTextPane, ["txtJTP"]); +this.text = ""; +}); +Clazz.defineMethod (c$, "getDocument", +function () { +return this; +}); +Clazz.overrideMethod (c$, "insertString", +function (i, s, object) { +i = Math.min (i, this.text.length); +this.text = this.text.substring (0, i) + s + this.text.substring (i); +}, "~N,~S,~O"); +Clazz.overrideMethod (c$, "toHTML", +function () { +var sb = new JU.SB (); +sb.append (""); +return sb.toString (); +}); +}); diff --git a/webservice/static/js/jsmol/j2s/JS/LayoutManager.js b/webservice/static/js/jsmol/j2s/JS/LayoutManager.js new file mode 100644 index 0000000..bf55cc4 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/LayoutManager.js @@ -0,0 +1,2 @@ +Clazz.declarePackage ("JS"); +c$ = Clazz.declareType (JS, "LayoutManager"); diff --git a/webservice/static/js/jsmol/j2s/JS/ListSelectionModel.js b/webservice/static/js/jsmol/j2s/JS/ListSelectionModel.js new file mode 100644 index 0000000..129cde4 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/ListSelectionModel.js @@ -0,0 +1,2 @@ +Clazz.declarePackage ("JS"); +Clazz.declareInterface (JS, "ListSelectionModel"); diff --git a/webservice/static/js/jsmol/j2s/JS/SwingConstants.js b/webservice/static/js/jsmol/j2s/JS/SwingConstants.js new file mode 100644 index 0000000..b254b34 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/SwingConstants.js @@ -0,0 +1,6 @@ +Clazz.declarePackage ("JS"); +c$ = Clazz.declareType (JS, "SwingConstants"); +Clazz.defineStatics (c$, +"LEFT", 2, +"CENTER", 0, +"RIGHT", 4); diff --git a/webservice/static/js/jsmol/j2s/JS/SwingController.js b/webservice/static/js/jsmol/j2s/JS/SwingController.js new file mode 100644 index 0000000..743aab0 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/SwingController.js @@ -0,0 +1,2 @@ +Clazz.declarePackage ("JS"); +Clazz.declareInterface (JS, "SwingController"); diff --git a/webservice/static/js/jsmol/j2s/JS/TableCellRenderer.js b/webservice/static/js/jsmol/j2s/JS/TableCellRenderer.js new file mode 100644 index 0000000..128f7d5 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/TableCellRenderer.js @@ -0,0 +1,2 @@ +Clazz.declarePackage ("JS"); +Clazz.declareInterface (JS, "TableCellRenderer"); diff --git a/webservice/static/js/jsmol/j2s/JS/TableColumn.js b/webservice/static/js/jsmol/j2s/JS/TableColumn.js new file mode 100644 index 0000000..11a7859 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JS/TableColumn.js @@ -0,0 +1,2 @@ +Clazz.declarePackage ("JS"); +Clazz.declareInterface (JS, "TableColumn"); diff --git a/webservice/static/js/jsmol/j2s/JU/Font.js b/webservice/static/js/jsmol/j2s/JU/Font.js new file mode 100644 index 0000000..2e59736 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JU/Font.js @@ -0,0 +1,109 @@ +Clazz.declarePackage ("JU"); +Clazz.load (null, "JU.Font", ["JU.AU"], function () { +c$ = Clazz.decorateAsClass (function () { +this.fid = 0; +this.fontFace = null; +this.fontStyle = null; +this.fontSizeNominal = 0; +this.idFontFace = 0; +this.idFontStyle = 0; +this.fontSize = 0; +this.font = null; +this.fontMetrics = null; +this.manager = null; +this.ascent = 0; +this.descent = 0; +this.isBold = false; +this.isItalic = false; +Clazz.instantialize (this, arguments); +}, JU, "Font"); +Clazz.makeConstructor (c$, + function (manager, fid, idFontFace, idFontStyle, fontSize, fontSizeNominal, graphics) { +this.manager = manager; +this.fid = fid; +this.fontFace = JU.Font.fontFaces[idFontFace]; +this.fontStyle = JU.Font.fontStyles[idFontStyle]; +this.idFontFace = idFontFace; +this.idFontStyle = idFontStyle; +this.fontSize = fontSize; +this.isBold = (idFontStyle & 1) == 1; +this.isItalic = (idFontStyle & 2) == 2; +this.fontSizeNominal = fontSizeNominal; +this.font = manager.newFont (JU.Font.fontFaces[idFontFace], this.isBold, this.isItalic, fontSize); +this.fontMetrics = manager.getFontMetrics (this, graphics); +this.descent = manager.getFontDescent (this.fontMetrics); +this.ascent = manager.getFontAscent (this.fontMetrics); +}, "J.api.FontManager,~N,~N,~N,~N,~N,~O"); +c$.getFont3D = Clazz.defineMethod (c$, "getFont3D", +function (fontID) { +return JU.Font.font3ds[fontID & 0xFF]; +}, "~N"); +c$.createFont3D = Clazz.defineMethod (c$, "createFont3D", +function (fontface, fontstyle, fontsize, fontsizeNominal, manager, graphicsForMetrics) { +if (fontsize > 0xFF) fontsize = 0xFF; +var fontsizeX16 = (Clazz.floatToInt (fontsize)) << 4; +var fontkey = ((fontface & 3) | ((fontstyle & 3) << 2) | (fontsizeX16 << 4)); +for (var i = JU.Font.fontkeyCount; --i > 0; ) if (fontkey == JU.Font.fontkeys[i] && JU.Font.font3ds[i].fontSizeNominal == fontsizeNominal) return JU.Font.font3ds[i]; + +var fontIndexNext = JU.Font.fontkeyCount++; +if (fontIndexNext == JU.Font.fontkeys.length) JU.Font.fontkeys = JU.AU.arrayCopyI (JU.Font.fontkeys, fontIndexNext + 8); +JU.Font.font3ds = JU.AU.arrayCopyObject (JU.Font.font3ds, fontIndexNext + 8); +var font3d = new JU.Font (manager, fontIndexNext, fontface, fontstyle, fontsize, fontsizeNominal, graphicsForMetrics); +JU.Font.font3ds[fontIndexNext] = font3d; +JU.Font.fontkeys[fontIndexNext] = fontkey; +return font3d; +}, "~N,~N,~N,~N,J.api.FontManager,~O"); +c$.getFontFaceID = Clazz.defineMethod (c$, "getFontFaceID", +function (fontface) { +return ("Monospaced".equalsIgnoreCase (fontface) ? 2 : "Serif".equalsIgnoreCase (fontface) ? 1 : 0); +}, "~S"); +c$.getFontStyleID = Clazz.defineMethod (c$, "getFontStyleID", +function (fontstyle) { +for (var i = 4; --i >= 0; ) if (JU.Font.fontStyles[i].equalsIgnoreCase (fontstyle)) return i; + +return -1; +}, "~S"); +Clazz.defineMethod (c$, "getAscent", +function () { +return this.ascent; +}); +Clazz.defineMethod (c$, "getDescent", +function () { +return this.descent; +}); +Clazz.defineMethod (c$, "getHeight", +function () { +return this.getAscent () + this.getDescent (); +}); +Clazz.defineMethod (c$, "getFontMetrics", +function () { +return this.fontMetrics; +}); +Clazz.defineMethod (c$, "stringWidth", +function (text) { +return this.manager.fontStringWidth (this, text); +}, "~S"); +Clazz.defineMethod (c$, "getInfo", +function () { +return this.fontSizeNominal + " " + this.fontFace + " " + this.fontStyle; +}); +Clazz.overrideMethod (c$, "toString", +function () { +return "[" + this.getInfo () + "]"; +}); +Clazz.defineStatics (c$, +"FONT_ALLOCATION_UNIT", 8, +"fontkeyCount", 1, +"fontkeys", Clazz.newIntArray (8, 0)); +c$.font3ds = c$.prototype.font3ds = new Array (8); +Clazz.defineStatics (c$, +"FONT_FACE_SANS", 0, +"FONT_FACE_SERIF", 1, +"FONT_FACE_MONO", 2, +"fontFaces", Clazz.newArray (-1, ["SansSerif", "Serif", "Monospaced", ""]), +"FONT_STYLE_PLAIN", 0, +"FONT_STYLE_BOLD", 1, +"FONT_STYLE_ITALIC", 2, +"FONT_STYLE_BOLDITALIC", 3, +"fontStyles", Clazz.newArray (-1, ["Plain", "Bold", "Italic", "BoldItalic"])); +}); diff --git a/webservice/static/js/jsmol/j2s/JU/MolWriter.js b/webservice/static/js/jsmol/j2s/JU/MolWriter.js new file mode 100644 index 0000000..92a31cc --- /dev/null +++ b/webservice/static/js/jsmol/j2s/JU/MolWriter.js @@ -0,0 +1,230 @@ +Clazz.declarePackage ("JU"); +Clazz.load (null, "JU.MolWriter", ["java.lang.Float", "java.util.Arrays", "$.Hashtable", "JU.Lst", "$.Measure", "$.P3", "$.PT", "$.SB", "$.V3", "JS.SV", "$.T", "JU.Elements", "$.Escape", "JV.PropertyManager", "$.Viewer"], function () { +c$ = Clazz.decorateAsClass (function () { +this.vwr = null; +this.ptTemp = null; +this.vNorm = null; +this.vTemp = null; +this.connections = null; +Clazz.instantialize (this, arguments); +}, JU, "MolWriter"); +Clazz.makeConstructor (c$, +function () { +}); +Clazz.defineMethod (c$, "setViewer", +function (vwr) { +this.vwr = vwr; +return this; +}, "JV.Viewer"); +Clazz.defineMethod (c$, "addMolFile", +function (iModel, mol, bsAtoms, bsBonds, asV3000, asJSON, noAromatic, q) { +var nAtoms = bsAtoms.cardinality (); +var nBonds = bsBonds.cardinality (); +if (!asV3000 && !asJSON && (nAtoms > 999 || nBonds > 999)) return false; +var asSDF = (iModel >= 0); +var molData = (asSDF ? this.vwr.ms.getInfo (iModel, "molData") : null); +var _keyList = (asSDF ? this.vwr.ms.getInfo (iModel, "molDataKeys") : null); +var ms = this.vwr.ms; +var atomMap = Clazz.newIntArray (ms.ac, 0); +var pTemp = new JU.P3 (); +if (asV3000) { +mol.append (" 0 0 0 0 0 0 999 V3000"); +} else if (asJSON) { +mol.append ("{\"mol\":{\"createdBy\":\"Jmol " + JV.Viewer.getJmolVersion () + "\",\"a\":["); +} else { +JU.PT.rightJustify (mol, " ", "" + nAtoms); +JU.PT.rightJustify (mol, " ", "" + nBonds); +mol.append (" 0 0 0 0 999 V2000"); +}if (!asJSON) mol.append ("\n"); +if (asV3000) { +mol.append ("M V30 BEGIN CTAB\nM V30 COUNTS ").appendI (nAtoms).append (" ").appendI (nBonds).append (" 0 0 0\n").append ("M V30 BEGIN ATOM\n"); +}var o = (molData == null ? null : molData.get ("atom_value_name")); +if (Clazz.instanceOf (o, JS.SV)) o = (o).asString (); +var valueType = (o == null ? 0 : JS.T.getTokFromName ("" + o)); +var atomValues = (valueType == 0 && !asSDF ? null : new JU.SB ()); +for (var i = bsAtoms.nextSetBit (0), n = 0; i >= 0; i = bsAtoms.nextSetBit (i + 1)) { +this.getAtomRecordMOL (iModel, ms, mol, atomMap[i] = ++n, ms.at[i], q, pTemp, asV3000, asJSON, atomValues, valueType, asSDF); +} +if (asV3000) { +mol.append ("M V30 END ATOM\nM V30 BEGIN BOND\n"); +} else if (asJSON) { +mol.append ("],\"b\":["); +}for (var i = bsBonds.nextSetBit (0), n = 0; i >= 0; i = bsBonds.nextSetBit (i + 1)) this.getBondRecordMOL (mol, ++n, ms.bo[i], atomMap, asV3000, asJSON, noAromatic); + +if (asV3000) { +mol.append ("M V30 END BOND\nM V30 END CTAB\n"); +}if (asJSON) mol.append ("]}}"); + else { +if (atomValues != null && atomValues.length () > 0) mol.append (atomValues.toString ()); +mol.append ("M END\n"); +}if (asSDF) { +try { +var pc = ms.getPartialCharges (); +if (molData == null) molData = new java.util.Hashtable (); +var sb = new JU.SB (); +if (pc != null) { +sb.appendI (nAtoms).appendC ('\n'); +for (var i = bsAtoms.nextSetBit (0), n = 0; i >= 0; i = bsAtoms.nextSetBit (i + 1)) sb.appendI (++n).append (" ").appendF (pc[i]).appendC ('\n'); + +molData.put ("jmol_partial_charges", sb.toString ()); +}sb.setLength (0); +sb.appendI (nAtoms).appendC ('\n'); +for (var i = bsAtoms.nextSetBit (0), n = 0; i >= 0; i = bsAtoms.nextSetBit (i + 1)) { +var name = ms.at[i].getAtomName ().trim (); +if (name.length == 0) name = "."; +sb.appendI (++n).append (" ").append (name.$replace (' ', '_')).appendC ('\n'); +} +molData.put ("jmol_atom_names", sb.toString ()); +if (_keyList == null) _keyList = new JU.Lst (); +for (var key, $key = molData.keySet ().iterator (); $key.hasNext () && ((key = $key.next ()) || true);) if (!_keyList.contains (key)) _keyList.addLast (key); + +for (var i = 0, n = _keyList.size (); i < n; i++) { +var key = _keyList.get (i); +if (key.startsWith (">")) continue; +o = molData.get (key); +if (Clazz.instanceOf (o, JS.SV)) o = (o).asString (); +mol.append ("> <" + key.toUpperCase () + ">\n"); +this.output80CharWrap (mol, o.toString (), 80); +mol.append ("\n\n"); +} +} catch (e) { +} +mol.append ("$$$$\n"); +}return true; +}, "~N,JU.SB,JU.BS,JU.BS,~B,~B,~B,JU.Quat"); +Clazz.defineMethod (c$, "getAtomRecordMOL", + function (iModel, ms, mol, n, a, q, pTemp, asV3000, asJSON, atomValues, tokValue, asSDF) { +JV.PropertyManager.getPointTransf (iModel, ms, a, q, pTemp); +var elemNo = a.getElementNumber (); +var sym = (a.isDeleted () ? "Xx" : JU.Elements.elementSymbolFromNumber (elemNo)); +var isotope = a.getIsotopeNumber (); +var charge = a.getFormalCharge (); +var o = Clazz.newArray (-1, [pTemp]); +if (asV3000) { +mol.append ("M V30 ").appendI (n).append (" ").append (sym).append (JU.PT.sprintf (" %12.5p %12.5p %12.5p 0", "p", o)); +if (charge != 0) mol.append (" CHG=").appendI (charge); +if (isotope != 0) mol.append (" MASS=").appendI (isotope); +mol.append ("\n"); +} else if (asJSON) { +if (n != 1) mol.append (","); +mol.append ("{"); +if (a.getElementNumber () != 6) mol.append ("\"l\":\"").append (a.getElementSymbol ()).append ("\","); +if (charge != 0) mol.append ("\"c\":").appendI (charge).append (","); +if (isotope != 0) mol.append ("\"m\":").appendI (isotope).append (","); +mol.append ("\"x\":").appendF (a.x).append (",\"y\":").appendF (a.y).append (",\"z\":").appendF (a.z).append ("}"); +} else { +mol.append (JU.PT.sprintf ("%10.4p%10.4p%10.4p", "p", o)); +mol.append (" ").append (sym); +if (sym.length == 1) mol.append (" "); +JU.PT.rightJustify (mol, " ", "" + (isotope > 0 ? isotope - JU.Elements.getNaturalIsotope (a.getElementNumber ()) : 0)); +if (asSDF && isotope > 0) { +atomValues.append ("M ISO 1"); +JU.PT.rightJustify (atomValues, " ", "" + n); +JU.PT.rightJustify (atomValues, " ", "" + isotope); +atomValues.append ("\n"); +}JU.PT.rightJustify (mol, " ", "" + (charge == 0 ? 0 : 4 - charge)); +mol.append (" ").append (this.getAtomParity (a)); +mol.append (" 0 0 0\n"); +var label = (tokValue == 0 || asV3000 ? null : this.getAtomPropertyAsString (a, tokValue)); +if (label != null && (label = label.trim ()).length > 0) { +var sn = " " + n + " "; +atomValues.append ("V ").append (sn.substring (sn.length - 4)); +this.output80CharWrap (atomValues, label, 73); +}}}, "~N,JM.ModelSet,JU.SB,~N,JM.Atom,JU.Quat,JU.P3,~B,~B,JU.SB,~N,~B"); +Clazz.defineMethod (c$, "getAtomParity", + function (a) { +if (a.getCovalentBondCount () == 4) { +if (this.connections == null) { +this.connections = Clazz.newIntArray (4, 0); +this.vTemp = new JU.V3 (); +this.vNorm = new JU.V3 (); +}var bonds = a.bonds; +var nH = 0; +for (var pt = 0, i = bonds.length; --i >= 0; ) { +if (bonds[i].isCovalent ()) { +var b = bonds[i].getOtherAtom (a); +if (b.getAtomicAndIsotopeNumber () == 1) nH++; +this.connections[pt++] = b.i; +}} +if (nH < 3) { +java.util.Arrays.sort (this.connections); +var atoms = this.vwr.ms.at; +JU.Measure.getNormalThroughPoints (atoms[this.connections[0]], atoms[this.connections[1]], atoms[this.connections[2]], this.vNorm, this.vTemp); +this.vTemp.sub2 (atoms[this.connections[3]], atoms[this.connections[0]]); +return (this.vTemp.dot (this.vNorm) > 0 ? "1" : "2"); +}}return "0"; +}, "JM.Atom"); +Clazz.defineMethod (c$, "getAtomPropertyAsString", + function (a, tok) { +switch (tok & 1136656384) { +case 1094713344: +var i = a.atomPropertyInt (tok); +return (tok == 1765808134 ? JU.PT.trim (JU.Escape.escapeColor (i), "[x]").toUpperCase () : "" + i); +case 1086324736: +return a.atomPropertyString (this.vwr, tok); +case 1111490560: +var f = a.atomPropertyFloat (this.vwr, tok, null); +return (Float.isNaN (f) ? null : "" + f); +default: +if (this.ptTemp == null) this.ptTemp = new JU.P3 (); +a.atomPropertyTuple (this.vwr, tok, this.ptTemp); +return (this.ptTemp == null ? null : this.ptTemp.toString ()); +} +}, "JM.Atom,~N"); +Clazz.defineMethod (c$, "getBondRecordMOL", + function (mol, n, b, atomMap, asV3000, asJSON, noAromatic) { +var a1 = atomMap[b.atom1.i]; +var a2 = atomMap[b.atom2.i]; +var order = b.getValence (); +if (order > 3) order = 1; +switch (b.order & -131073) { +case 515: +order = (asJSON ? -3 : 4); +break; +case 66: +order = (asJSON ? -3 : 5); +break; +case 513: +order = (asJSON || noAromatic ? 1 : 6); +break; +case 514: +order = (asJSON || noAromatic ? 2 : 7); +break; +case 33: +order = (asJSON ? -1 : 8); +break; +} +if (asV3000) { +mol.append ("M V30 ").appendI (n).append (" ").appendI (order).append (" ").appendI (a1).append (" ").appendI (a2).appendC ('\n'); +} else if (asJSON) { +if (n != 1) mol.append (","); +mol.append ("{\"b\":").appendI (a1 - 1).append (",\"e\":").appendI (a2 - 1); +if (order != 1) { +mol.append (",\"o\":"); +if (order < 0) { +mol.appendF (-order / 2); +} else { +mol.appendI (order); +}}mol.append ("}"); +} else { +JU.PT.rightJustify (mol, " ", "" + a1); +JU.PT.rightJustify (mol, " ", "" + a2); +mol.append (" ").appendI (order).append (" 0 0 0\n"); +}}, "JU.SB,~N,JM.Bond,~A,~B,~B,~B"); +Clazz.defineMethod (c$, "output80CharWrap", + function (mol, data, maxN) { +if (maxN < 80) data = JU.PT.rep (data, "\n", "|"); +var lines = JU.PT.split (JU.PT.trim (JU.PT.rep (data, "\n\n", "\n"), "\n"), "\n"); +for (var i = 0; i < lines.length; i++) this.outputLines (mol, lines[i], maxN); + +}, "JU.SB,~S,~N"); +Clazz.defineMethod (c$, "outputLines", + function (mol, data, maxN) { +var done = false; +for (var i = 0, n = data.length; i < n && !done; i += 80) { +mol.append (data.substring (i, Math.min (i + maxN, n))); +if (!(done = (maxN != 80)) && i + 80 < n) mol.append ("+"); +mol.append ("\n"); +} +}, "JU.SB,~S,~N"); +}); diff --git a/webservice/static/js/jsmol/j2s/javajs/api/js/JSAppletObject.js b/webservice/static/js/jsmol/j2s/javajs/api/js/JSAppletObject.js new file mode 100644 index 0000000..7015139 --- /dev/null +++ b/webservice/static/js/jsmol/j2s/javajs/api/js/JSAppletObject.js @@ -0,0 +1,2 @@ +Clazz.declarePackage ("javajs.api.js"); +Clazz.declareInterface (javajs.api.js, "JSAppletObject");