(function(Clazz ,Clazz_getClassName ,Clazz_newLongArray ,Clazz_doubleToByte ,Clazz_doubleToInt ,Clazz_doubleToLong ,Clazz_declarePackage ,Clazz_instanceOf ,Clazz_load ,Clazz_instantialize ,Clazz_decorateAsClass ,Clazz_floatToInt ,Clazz_floatToLong ,Clazz_makeConstructor ,Clazz_defineEnumConstant ,Clazz_exceptionOf ,Clazz_newIntArray ,Clazz_defineStatics ,Clazz_newFloatArray ,Clazz_declareType ,Clazz_prepareFields ,Clazz_superConstructor ,Clazz_newByteArray ,Clazz_declareInterface ,Clazz_p0p ,Clazz_pu$h ,Clazz_newShortArray ,Clazz_innerTypeInstance ,Clazz_isClassDefined ,Clazz_prepareCallback ,Clazz_newArray ,Clazz_castNullAs ,Clazz_floatToShort ,Clazz_superCall ,Clazz_decorateAsType ,Clazz_newBooleanArray ,Clazz_newCharArray ,Clazz_implementOf ,Clazz_newDoubleArray ,Clazz_overrideConstructor ,Clazz_clone ,Clazz_doubleToShort ,Clazz_getInheritedLevel ,Clazz_getParamsType ,Clazz_isAF ,Clazz_isAB ,Clazz_isAI ,Clazz_isAS ,Clazz_isASS ,Clazz_isAP ,Clazz_isAFloat ,Clazz_isAII ,Clazz_isAFF ,Clazz_isAFFF ,Clazz_tryToSearchAndExecute ,Clazz_getStackTrace ,Clazz_inheritArgs ,Clazz_alert ,Clazz_defineMethod ,Clazz_overrideMethod ,Clazz_declareAnonymous //,Clazz_checkPrivateMethod ,Clazz_cloneFinals ){ var $t$; //var c$; Clazz_declarePackage ("javajs.awt"); Clazz_load (["javajs.awt.LayoutManager"], "javajs.awt.BorderLayout", null, function () { c$ = Clazz_declareType (javajs.awt, "BorderLayout", javajs.awt.LayoutManager); Clazz_defineStatics (c$, "CENTER", "Center", "NORTH", "North", "SOUTH", "South", "EAST", "East", "WEST", "West"); }); Clazz_declarePackage ("javajs.awt"); Clazz_load (null, "javajs.awt.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); }, javajs.awt, "Component"); Clazz_defineMethod (c$, "setParent", function (p) { this.parent = p; }, "~O"); Clazz_makeConstructor (c$, function (type) { this.id = javajs.awt.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; }, "javajs.awt.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; }, "javajs.awt.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 () { }); }); Clazz_declarePackage ("javajs.awt"); Clazz_load (["javajs.awt.Component"], "javajs.awt.Container", ["JU.Lst"], function () { c$ = Clazz_decorateAsClass (function () { this.list = null; this.cList = null; Clazz_instantialize (this, arguments); }, javajs.awt, "Container", javajs.awt.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); }, "javajs.awt.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; }, "javajs.awt.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; }, "javajs.awt.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); }); }); Clazz_declarePackage ("javajs.awt"); c$ = Clazz_declareType (javajs.awt, "LayoutManager"); Clazz_declarePackage ("javajs.awt.event"); Clazz_load (["javajs.awt.event.Event"], "javajs.awt.event.ActionEvent", null, function () { c$ = Clazz_decorateAsClass (function () { this.actionCommand = null; Clazz_instantialize (this, arguments); }, javajs.awt.event, "ActionEvent", javajs.awt.event.Event); Clazz_defineMethod (c$, "getActionCommand", function () { return this.actionCommand; }); }); Clazz_declarePackage ("javajs.awt.event"); Clazz_load (["javajs.awt.event.Event"], "javajs.awt.event.ItemEvent", null, function () { c$ = Clazz_declareType (javajs.awt.event, "ItemEvent", javajs.awt.event.Event); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["javajs.awt.SC", "J.awtjs.swing.JComponent"], "J.awtjs.swing.AbstractButton", null, function () { c$ = Clazz_decorateAsClass (function () { this.itemListener = null; this.applet = null; this.htmlName = null; this.selected = false; this.popupMenu = null; this.icon = null; Clazz_instantialize (this, arguments); }, J.awtjs.swing, "AbstractButton", J.awtjs.swing.JComponent, javajs.awt.SC); Clazz_makeConstructor (c$, function (type) { Clazz_superConstructor (this, J.awtjs.swing.AbstractButton, [type]); this.enabled = true; }, "~S"); Clazz_overrideMethod (c$, "setSelected", function (selected) { this.selected = selected; { SwingController.setSelected(this); }}, "~B"); Clazz_overrideMethod (c$, "isSelected", function () { return this.selected; }); Clazz_overrideMethod (c$, "addItemListener", function (listener) { this.itemListener = listener; }, "~O"); Clazz_overrideMethod (c$, "getIcon", function () { return this.icon; }); Clazz_overrideMethod (c$, "setIcon", function (icon) { this.icon = icon; }, "~O"); Clazz_overrideMethod (c$, "init", function (text, icon, actionCommand, popupMenu) { this.text = text; this.icon = icon; this.actionCommand = actionCommand; this.popupMenu = popupMenu; { SwingController.initMenuItem(this); }}, "~S,~O,~S,javajs.awt.SC"); Clazz_defineMethod (c$, "getTopPopupMenu", function () { return this.popupMenu; }); Clazz_defineMethod (c$, "add", function (item) { this.addComponent (item); }, "javajs.awt.SC"); Clazz_overrideMethod (c$, "insert", function (subMenu, index) { this.insertComponent (subMenu, index); }, "javajs.awt.SC,~N"); Clazz_overrideMethod (c$, "getPopupMenu", function () { return null; }); Clazz_defineMethod (c$, "getMenuHTML", function () { var label = (this.icon != null ? this.icon : this.text != null ? this.text : null); var s = (label == null ? "" : "
  • " + label + "" + this.htmlMenuOpener ("ul")); var n = this.getComponentCount (); if (n > 0) for (var i = 0; i < n; i++) s += this.getComponent (i).toHTML (); if (label != null) s += "
  • "; return s; }); Clazz_defineMethod (c$, "htmlMenuOpener", function (type) { return "<" + type + " id=\"" + this.id + "\"" + (this.enabled ? "" : this.getHtmlDisabled ()) + ">"; }, "~S"); Clazz_defineMethod (c$, "getHtmlDisabled", function () { return " disabled=\"disabled\""; }); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["J.awtjs.swing.TableColumn"], "J.awtjs.swing.AbstractTableModel", null, function () { Clazz_declareInterface (J.awtjs.swing, "AbstractTableModel", J.awtjs.swing.TableColumn); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (null, "J.awtjs.swing.ButtonGroup", ["javajs.awt.Component"], function () { c$ = Clazz_decorateAsClass (function () { this.id = null; Clazz_instantialize (this, arguments); }, J.awtjs.swing, "ButtonGroup"); Clazz_makeConstructor (c$, function () { this.id = javajs.awt.Component.newID ("bg"); }); Clazz_defineMethod (c$, "add", function (item) { (item).htmlName = this.id; }, "javajs.awt.SC"); }); Clazz_declarePackage ("J.awtjs.swing"); c$ = Clazz_decorateAsClass (function () { this.component = null; this.colspan = 0; this.rowspan = 0; this.textAlign = 0; this.c = null; Clazz_instantialize (this, arguments); }, J.awtjs.swing, "Cell"); Clazz_makeConstructor (c$, function (btn, c) { this.component = btn; this.colspan = c.gridwidth; this.rowspan = c.gridheight; this.c = c; }, "J.awtjs.swing.JComponent,J.awtjs.swing.GridBagConstraints"); Clazz_defineMethod (c$, "toHTML", function (id) { var style = this.c.getStyle (false); return "" + this.component.toHTML () + ""; }, "~S"); Clazz_declarePackage ("J.awtjs.swing"); Clazz_declareInterface (J.awtjs.swing, "ColumnSelectionModel"); Clazz_declarePackage ("J.awtjs.swing"); Clazz_declareInterface (J.awtjs.swing, "Document"); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["javajs.awt.LayoutManager"], "J.awtjs.swing.FlowLayout", null, function () { c$ = Clazz_declareType (J.awtjs.swing, "FlowLayout", javajs.awt.LayoutManager); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (null, "J.awtjs.swing.Grid", ["JU.AU", "$.SB", "J.awtjs.swing.Cell"], function () { c$ = Clazz_decorateAsClass (function () { this.nrows = 0; this.ncols = 0; this.grid = null; this.renderer = null; Clazz_instantialize (this, arguments); }, J.awtjs.swing, "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 J.awtjs.swing.Cell (btn, c); }, "J.awtjs.swing.JComponent,J.awtjs.swing.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"); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (null, "J.awtjs.swing.GridBagConstraints", ["J.awtjs.swing.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); }, J.awtjs.swing, "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 J.awtjs.swing.Insets (0, 0, 0, 0); this.insets = insets; this.ipadx = ipadx; this.ipady = ipady; }, "~N,~N,~N,~N,~N,~N,~N,~N,J.awtjs.swing.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); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["javajs.awt.LayoutManager"], "J.awtjs.swing.GridBagLayout", null, function () { c$ = Clazz_declareType (J.awtjs.swing, "GridBagLayout", javajs.awt.LayoutManager); }); Clazz_declarePackage ("J.awtjs.swing"); c$ = Clazz_decorateAsClass (function () { this.top = 0; this.left = 0; this.bottom = 0; this.right = 0; Clazz_instantialize (this, arguments); }, J.awtjs.swing, "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"); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["J.awtjs.swing.AbstractButton"], "J.awtjs.swing.JButton", ["JU.SB"], function () { c$ = Clazz_declareType (J.awtjs.swing, "JButton", J.awtjs.swing.AbstractButton); Clazz_makeConstructor (c$, function () { Clazz_superConstructor (this, J.awtjs.swing.JButton, ["btnJB"]); }); Clazz_overrideMethod (c$, "toHTML", function () { var sb = new JU.SB (); sb.append (""); return sb.toString (); }); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["J.awtjs.swing.AbstractButton"], "J.awtjs.swing.JCheckBox", null, function () { c$ = Clazz_declareType (J.awtjs.swing, "JCheckBox", J.awtjs.swing.AbstractButton); Clazz_makeConstructor (c$, function () { Clazz_superConstructor (this, J.awtjs.swing.JCheckBox, ["chkJCB"]); }); Clazz_overrideMethod (c$, "toHTML", function () { var s = ""; return s; }); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["J.awtjs.swing.JMenuItem"], "J.awtjs.swing.JCheckBoxMenuItem", null, function () { c$ = Clazz_declareType (J.awtjs.swing, "JCheckBoxMenuItem", J.awtjs.swing.JMenuItem); Clazz_makeConstructor (c$, function () { Clazz_superConstructor (this, J.awtjs.swing.JCheckBoxMenuItem, ["chk", 2]); }); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["J.awtjs.swing.AbstractButton"], "J.awtjs.swing.JComboBox", ["JU.SB"], function () { c$ = Clazz_decorateAsClass (function () { this.info = null; this.selectedIndex = 0; Clazz_instantialize (this, arguments); }, J.awtjs.swing, "JComboBox", J.awtjs.swing.AbstractButton); Clazz_makeConstructor (c$, function (info) { Clazz_superConstructor (this, J.awtjs.swing.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 (); }); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["javajs.awt.Container"], "J.awtjs.swing.JComponent", null, function () { c$ = Clazz_decorateAsClass (function () { this.autoScrolls = false; this.actionCommand = null; this.actionListener = null; Clazz_instantialize (this, arguments); }, J.awtjs.swing, "JComponent", javajs.awt.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"); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["J.awtjs.swing.JComponent"], "J.awtjs.swing.JComponentImp", null, function () { c$ = Clazz_declareType (J.awtjs.swing, "JComponentImp", J.awtjs.swing.JComponent); Clazz_overrideMethod (c$, "toHTML", function () { return null; }); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["J.awtjs.swing.JComponent"], "J.awtjs.swing.JContentPane", ["JU.SB"], function () { c$ = Clazz_declareType (J.awtjs.swing, "JContentPane", J.awtjs.swing.JComponent); Clazz_makeConstructor (c$, function () { Clazz_superConstructor (this, J.awtjs.swing.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 (); }); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["javajs.awt.Container"], "J.awtjs.swing.JDialog", ["javajs.awt.Color", "JU.SB", "J.awtjs.swing.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); }, J.awtjs.swing, "JDialog", javajs.awt.Container); Clazz_defineMethod (c$, "setZIndex", function (zIndex) { this.zIndex = zIndex; }, "~N"); Clazz_makeConstructor (c$, function () { Clazz_superConstructor (this, J.awtjs.swing.JDialog, ["JD"]); this.add (this.contentPane = new J.awtjs.swing.JContentPane ()); this.setBackground (javajs.awt.Color.get3 (210, 210, 240)); this.contentPane.setBackground (javajs.awt.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, J.awtjs.swing.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); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["J.awtjs.swing.JComponent"], "J.awtjs.swing.JEditorPane", ["JU.SB"], function () { c$ = Clazz_declareType (J.awtjs.swing, "JEditorPane", J.awtjs.swing.JComponent); Clazz_makeConstructor (c$, function () { Clazz_superConstructor (this, J.awtjs.swing.JEditorPane, ["txtJEP"]); this.text = ""; }); Clazz_overrideMethod (c$, "toHTML", function () { var sb = new JU.SB (); sb.append (""); return sb.toString (); }); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["J.awtjs.swing.JComponent"], "J.awtjs.swing.JLabel", ["JU.SB"], function () { c$ = Clazz_declareType (J.awtjs.swing, "JLabel", J.awtjs.swing.JComponent); Clazz_makeConstructor (c$, function (text) { Clazz_superConstructor (this, J.awtjs.swing.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 (); }); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["J.awtjs.swing.JMenuItem"], "J.awtjs.swing.JMenu", null, function () { c$ = Clazz_declareType (J.awtjs.swing, "JMenu", J.awtjs.swing.JMenuItem); Clazz_makeConstructor (c$, function () { Clazz_superConstructor (this, J.awtjs.swing.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 (); }); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["J.awtjs.swing.AbstractButton"], "J.awtjs.swing.JMenuItem", null, function () { c$ = Clazz_decorateAsClass (function () { this.btnType = 0; Clazz_instantialize (this, arguments); }, J.awtjs.swing, "JMenuItem", J.awtjs.swing.AbstractButton); Clazz_makeConstructor (c$, function (text) { Clazz_superConstructor (this, J.awtjs.swing.JMenuItem, ["btn"]); this.setText (text); this.btnType = (text == null ? 0 : 1); }, "~S"); Clazz_makeConstructor (c$, function (type, i) { Clazz_superConstructor (this, J.awtjs.swing.JMenuItem, [type]); this.btnType = i; }, "~S,~N"); Clazz_overrideMethod (c$, "toHTML", function () { return this.htmlMenuOpener ("li") + (this.text == null ? "" : "" + this.htmlLabel () + "") + ""; }); Clazz_overrideMethod (c$, "getHtmlDisabled", function () { return " class=\"ui-state-disabled\""; }); Clazz_defineMethod (c$, "htmlLabel", function () { return (this.btnType == 1 ? this.text : ""); }); Clazz_defineStatics (c$, "TYPE_SEPARATOR", 0, "TYPE_BUTTON", 1, "TYPE_CHECKBOX", 2, "TYPE_RADIO", 3, "TYPE_MENU", 4); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["J.awtjs.swing.JComponent"], "J.awtjs.swing.JPanel", ["JU.SB", "J.awtjs.swing.Grid", "$.GridBagConstraints"], function () { c$ = Clazz_decorateAsClass (function () { this.grid = null; this.nElements = 0; this.last = null; Clazz_instantialize (this, arguments); }, J.awtjs.swing, "JPanel", J.awtjs.swing.JComponent); Clazz_makeConstructor (c$, function (manager) { Clazz_superConstructor (this, J.awtjs.swing.JPanel, ["JP"]); this.grid = new J.awtjs.swing.Grid (10, 10); }, "javajs.awt.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 J.awtjs.swing.GridBagConstraints (0, 0, 3, 1, 0, 0, 10, 0, null, 0, 0); else if (c.equals ("South")) c = new J.awtjs.swing.GridBagConstraints (0, 2, 3, 1, 0, 0, 10, 0, null, 0, 0); else if (c.equals ("East")) c = new J.awtjs.swing.GridBagConstraints (2, 1, 1, 1, 0, 0, 13, 0, null, 0, 0); else if (c.equals ("West")) c = new J.awtjs.swing.GridBagConstraints (0, 1, 1, 1, 0, 0, 17, 0, null, 0, 0); else c = new J.awtjs.swing.GridBagConstraints (1, 1, 1, 1, 0, 0, 10, 0, null, 0, 0); }this.grid.add (btn, c); }, "J.awtjs.swing.JComponent,~O"); Clazz_overrideMethod (c$, "toHTML", function () { if (this.last != null) { this.grid = new J.awtjs.swing.Grid (1, 1); this.grid.add (this.last, new J.awtjs.swing.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 (); }); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["J.awtjs.swing.AbstractButton"], "J.awtjs.swing.JPopupMenu", null, function () { c$ = Clazz_decorateAsClass (function () { this.tainted = true; Clazz_instantialize (this, arguments); }, J.awtjs.swing, "JPopupMenu", J.awtjs.swing.AbstractButton); Clazz_makeConstructor (c$, function (name) { Clazz_superConstructor (this, J.awtjs.swing.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); }}, "javajs.awt.Component,~N,~N"); Clazz_defineMethod (c$, "disposeMenu", function () { { SwingController.disposeMenu(this); }}); Clazz_overrideMethod (c$, "toHTML", function () { return this.getMenuHTML (); }); { { SwingController.setDraggable(J.awtjs.swing.JPopupMenu); }}}); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["J.awtjs.swing.JMenuItem"], "J.awtjs.swing.JRadioButtonMenuItem", null, function () { c$ = Clazz_decorateAsClass (function () { this.isRadio = true; Clazz_instantialize (this, arguments); }, J.awtjs.swing, "JRadioButtonMenuItem", J.awtjs.swing.JMenuItem); Clazz_makeConstructor (c$, function () { Clazz_superConstructor (this, J.awtjs.swing.JRadioButtonMenuItem, ["rad", 3]); }); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["J.awtjs.swing.JComponent"], "J.awtjs.swing.JScrollPane", ["JU.SB"], function () { c$ = Clazz_declareType (J.awtjs.swing, "JScrollPane", J.awtjs.swing.JComponent); Clazz_makeConstructor (c$, function (component) { Clazz_superConstructor (this, J.awtjs.swing.JScrollPane, ["JScP"]); this.add (component); }, "J.awtjs.swing.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) { }, "javajs.awt.Dimension"); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["J.awtjs.swing.JComponent"], "J.awtjs.swing.JSplitPane", ["JU.SB", "J.awtjs.swing.JComponentImp"], function () { c$ = Clazz_decorateAsClass (function () { this.isH = true; this.split = 1; this.right = null; this.left = null; Clazz_instantialize (this, arguments); }, J.awtjs.swing, "JSplitPane", J.awtjs.swing.JComponent); Clazz_makeConstructor (c$, function (split) { Clazz_superConstructor (this, J.awtjs.swing.JSplitPane, ["JSpP"]); this.split = split; this.isH = (split == 1); }, "~N"); Clazz_defineMethod (c$, "setRightComponent", function (r) { this.right = new J.awtjs.swing.JComponentImp (null); this.right.add (r); }, "J.awtjs.swing.JComponent"); Clazz_defineMethod (c$, "setLeftComponent", function (l) { this.left = new J.awtjs.swing.JComponentImp (null); this.left.add (l); }, "J.awtjs.swing.JComponent"); Clazz_defineMethod (c$, "getSubcomponentWidth", function () { var w = this.width; if (w == 0) { var wleft = this.left.getSubcomponentWidth (); var wright = this.right.getSubcomponentWidth (); if (wleft > 0 && wright > 0) { if (this.isH) w = wleft + wright; else w = Math.max (wleft, wright); }}return w; }); Clazz_defineMethod (c$, "getSubcomponentHeight", function () { var h = this.height; if (h == 0) { var hleft = this.left.getSubcomponentHeight (); var hright = this.right.getSubcomponentHeight (); if (hleft > 0 && hright > 0) { if (this.isH) h = Math.max (hleft, hright); else h = hleft + hright; }}return h; }); Clazz_defineMethod (c$, "toHTML", function () { if (this.left == null || this.right == null) return ""; var isH = (this.split == 1); if (this.width == 0) this.width = this.getSubcomponentWidth (); if (this.height == 0) this.height = this.getSubcomponentHeight (); var sb = new JU.SB (); sb.append ("
    "); if (isH) sb.append ("
    "); else sb.append ("
    "); sb.append (this.left.getComponents ()[0].toHTML ()); if (isH) sb.append ("
    "); else sb.append ("
    "); sb.append (this.right.getComponents ()[0].toHTML ()); sb.append ("
    \n"); return sb.toString (); }); Clazz_defineStatics (c$, "HORIZONTAL_SPLIT", 1); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["J.awtjs.swing.ColumnSelectionModel", "$.JComponent", "$.ListSelectionModel"], "J.awtjs.swing.JTable", ["JU.BS", "$.SB"], function () { c$ = Clazz_decorateAsClass (function () { this.tableModel = null; this.bsSelectedCells = null; this.bsSelectedRows = null; this.rowSelectionAllowed = false; this.cellSelectionEnabled = false; this.selectionListener = null; Clazz_instantialize (this, arguments); }, J.awtjs.swing, "JTable", J.awtjs.swing.JComponent, [J.awtjs.swing.ListSelectionModel, J.awtjs.swing.ColumnSelectionModel]); Clazz_makeConstructor (c$, function (tableModel) { Clazz_superConstructor (this, J.awtjs.swing.JTable, ["JT"]); this.tableModel = tableModel; this.bsSelectedCells = new JU.BS (); this.bsSelectedRows = new JU.BS (); }, "J.awtjs.swing.AbstractTableModel"); Clazz_overrideMethod (c$, "getSelectionModel", function () { return this; }); Clazz_defineMethod (c$, "getColumnModel", function () { return this; }); Clazz_defineMethod (c$, "setPreferredScrollableViewportSize", function (dimension) { this.width = dimension.width; this.height = dimension.height; }, "javajs.awt.Dimension"); Clazz_defineMethod (c$, "clearSelection", function () { this.bsSelectedCells.clearAll (); this.bsSelectedRows.clearAll (); }); Clazz_defineMethod (c$, "setRowSelectionAllowed", function (b) { this.rowSelectionAllowed = b; }, "~B"); Clazz_defineMethod (c$, "setRowSelectionInterval", function (i, j) { this.bsSelectedRows.clearAll (); this.bsSelectedRows.setBits (i, j); this.bsSelectedCells.clearAll (); }, "~N,~N"); Clazz_defineMethod (c$, "setCellSelectionEnabled", function (enabled) { this.cellSelectionEnabled = enabled; }, "~B"); Clazz_overrideMethod (c$, "addListSelectionListener", function (listener) { this.selectionListener = listener; }, "~O"); Clazz_overrideMethod (c$, "getColumn", function (i) { return this.tableModel.getColumn (i); }, "~N"); Clazz_overrideMethod (c$, "toHTML", function () { var sb = new JU.SB (); sb.append ("\n"); this.tableModel.toHTML (sb, this.id, this.bsSelectedRows); sb.append ("\n
    \n"); return sb.toString (); }); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["J.awtjs.swing.JComponent"], "J.awtjs.swing.JTextField", ["JU.SB"], function () { c$ = Clazz_declareType (J.awtjs.swing, "JTextField", J.awtjs.swing.JComponent); Clazz_makeConstructor (c$, function (value) { Clazz_superConstructor (this, J.awtjs.swing.JTextField, ["txtJT"]); this.text = value; }, "~S"); Clazz_overrideMethod (c$, "toHTML", function () { var sb = new JU.SB (); sb.append (""); return sb.toString (); }); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_load (["J.awtjs.swing.Document", "$.JComponent"], "J.awtjs.swing.JTextPane", ["JU.SB"], function () { c$ = Clazz_declareType (J.awtjs.swing, "JTextPane", J.awtjs.swing.JComponent, J.awtjs.swing.Document); Clazz_makeConstructor (c$, function () { Clazz_superConstructor (this, J.awtjs.swing.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 (); }); }); Clazz_declarePackage ("J.awtjs.swing"); Clazz_declareInterface (J.awtjs.swing, "ListSelectionModel"); Clazz_declarePackage ("J.awtjs.swing"); c$ = Clazz_declareType (J.awtjs.swing, "SwingConstants"); Clazz_defineStatics (c$, "LEFT", 2, "CENTER", 0, "RIGHT", 4); Clazz_declarePackage ("J.awtjs.swing"); Clazz_declareInterface (J.awtjs.swing, "TableCellRenderer"); Clazz_declarePackage ("J.awtjs.swing"); Clazz_declareInterface (J.awtjs.swing, "TableColumn"); Clazz_declarePackage ("J.popup"); Clazz_load (["javajs.awt.GenericMenuInterface", "java.util.Hashtable", "JU.Lst"], "J.popup.GenericSwingPopup", ["java.util.StringTokenizer", "JU.PT", "$.SB", "JU.Logger"], function () { c$ = Clazz_decorateAsClass (function () { this.helper = null; this.strMenuStructure = null; this.allowSignedFeatures = false; this.isJS = false; this.isApplet = false; this.isSigned = false; this.isWebGL = false; this.thisx = 0; this.thisy = 0; this.isTainted = true; this.menuName = null; this.popupMenu = null; this.thisPopup = null; this.htCheckbox = null; this.buttonGroup = null; this.currentMenuItemId = null; this.htMenus = null; this.SignedOnly = null; Clazz_instantialize (this, arguments); }, J.popup, "GenericSwingPopup", null, javajs.awt.GenericMenuInterface); Clazz_prepareFields (c$, function () { this.htCheckbox = new java.util.Hashtable (); this.htMenus = new java.util.Hashtable (); this.SignedOnly = new JU.Lst (); }); Clazz_defineMethod (c$, "initSwing", function (title, bundle, applet, isJS, isSigned, isWebGL) { this.isJS = isJS; this.isApplet = (applet != null); this.isSigned = isSigned; this.isWebGL = isWebGL; this.allowSignedFeatures = (!this.isApplet || isSigned); this.menuName = title; this.popupMenu = this.helper.menuCreatePopup (title, applet); this.thisPopup = this.popupMenu; this.htMenus.put (title, this.popupMenu); this.addMenuItems ("", title, this.popupMenu, bundle); try { this.jpiUpdateComputedMenus (); } catch (e) { if (Clazz_exceptionOf (e, NullPointerException)) { } else { throw e; } } }, "~S,J.popup.PopupResource,~O,~B,~B,~B"); Clazz_defineMethod (c$, "addMenuItems", function (parentId, key, menu, popupResourceBundle) { var id = parentId + "." + key; var value = popupResourceBundle.getStructure (key); if (JU.Logger.debugging) JU.Logger.debug (id + " --- " + value); if (value == null) { this.menuCreateItem (menu, "#" + key, "", ""); return; }var st = new java.util.StringTokenizer (value); var item; while (value.indexOf ("@") >= 0) { var s = ""; while (st.hasMoreTokens ()) s += " " + ((item = st.nextToken ()).startsWith ("@") ? popupResourceBundle.getStructure (item) : item); value = s.substring (1); st = new java.util.StringTokenizer (value); } while (st.hasMoreTokens ()) { item = st.nextToken (); if (!this.checkKey (item)) continue; if ("-".equals (item)) { this.menuAddSeparator (menu); continue; }var label = popupResourceBundle.getWord (item); var newItem = null; var script = ""; var isCB = false; label = this.appFixLabel (label == null ? item : label); if (label.equals ("null")) { continue; }if (item.indexOf ("Menu") >= 0) { if (item.indexOf ("more") < 0) this.helper.menuAddButtonGroup (null); var subMenu = this.menuNewSubMenu (label, id + "." + item); this.menuAddSubMenu (menu, subMenu); if (item.indexOf ("Computed") < 0) this.addMenuItems (id, item, subMenu, popupResourceBundle); this.appCheckSpecialMenu (item, subMenu, label); newItem = subMenu; } else if (item.endsWith ("Checkbox") || (isCB = (item.endsWith ("CB") || item.endsWith ("RD")))) { script = popupResourceBundle.getStructure (item); var basename = item.substring (0, item.length - (!isCB ? 8 : 2)); var isRadio = (isCB && item.endsWith ("RD")); if (script == null || script.length == 0 && !isRadio) script = "set " + basename + " T/F"; newItem = this.menuCreateCheckboxItem (menu, label, basename + ":" + script, id + "." + item, false, isRadio); this.rememberCheckbox (basename, newItem); if (isRadio) this.helper.menuAddButtonGroup (newItem); } else { script = popupResourceBundle.getStructure (item); if (script == null) script = item; newItem = this.menuCreateItem (menu, label, script, id + "." + item); }this.htMenus.put (item, newItem); if (item.startsWith ("SIGNED")) { this.SignedOnly.addLast (newItem); if (!this.allowSignedFeatures) this.menuEnable (newItem, false); }this.appCheckItem (item, newItem); } }, "~S,~S,javajs.awt.SC,J.popup.PopupResource"); Clazz_defineMethod (c$, "updateSignedAppletItems", function () { for (var i = this.SignedOnly.size (); --i >= 0; ) this.menuEnable (this.SignedOnly.get (i), this.allowSignedFeatures); }); Clazz_defineMethod (c$, "checkKey", function (key) { return (key.indexOf (this.isApplet ? "JAVA" : "APPLET") < 0 && (!this.isWebGL || key.indexOf ("NOGL") < 0)); }, "~S"); Clazz_defineMethod (c$, "rememberCheckbox", function (key, checkboxMenuItem) { this.htCheckbox.put (key + "::" + this.htCheckbox.size (), checkboxMenuItem); }, "~S,javajs.awt.SC"); Clazz_defineMethod (c$, "updateButton", function (b, entry, script) { var ret = Clazz_newArray (-1, [entry]); var icon = this.getEntryIcon (ret); entry = ret[0]; b.init (entry, icon, script, this.thisPopup); this.isTainted = true; }, "javajs.awt.SC,~S,~S"); Clazz_defineMethod (c$, "getEntryIcon", function (ret) { var entry = ret[0]; if (!entry.startsWith ("<")) return null; var pt = entry.indexOf (">"); ret[0] = entry.substring (pt + 1); var fileName = entry.substring (1, pt); return this.getImageIcon (fileName); }, "~A"); Clazz_defineMethod (c$, "addMenuItem", function (menuItem, entry) { return this.menuCreateItem (menuItem, entry, "", null); }, "javajs.awt.SC,~S"); Clazz_defineMethod (c$, "menuSetLabel", function (m, entry) { m.setText (entry); this.isTainted = true; }, "javajs.awt.SC,~S"); Clazz_defineMethod (c$, "menuSetCheckBoxValue", function (source) { var isSelected = source.isSelected (); var what = source.getActionCommand (); this.checkForCheckBoxScript (source, what, isSelected); this.appUpdateSpecialCheckBoxValue (source, what, isSelected); this.isTainted = true; }, "javajs.awt.SC"); Clazz_overrideMethod (c$, "menuClickCallback", function (source, script) { this.processClickCallback (source, script); }, "javajs.awt.SC,~S"); Clazz_defineMethod (c$, "processClickCallback", function (source, script) { this.appRestorePopupMenu (); if (script == null || script.length == 0) return; if (script.equals ("MAIN")) { this.show (this.thisx, this.thisy, true); return; }var id = this.menuGetId (source); if (id != null) { script = this.appFixScript (id, script); this.currentMenuItemId = id; }this.appRunScript (script); }, "javajs.awt.SC,~S"); Clazz_overrideMethod (c$, "menuCheckBoxCallback", function (source) { this.appRestorePopupMenu (); this.menuSetCheckBoxValue (source); var id = this.menuGetId (source); if (id != null) { this.currentMenuItemId = id; }}, "javajs.awt.SC"); Clazz_defineMethod (c$, "checkForCheckBoxScript", function (item, what, TF) { if (!item.isEnabled ()) return; if (what.indexOf ("##") < 0) { var pt = what.indexOf (":"); if (pt < 0) { JU.Logger.error ("check box " + item + " IS " + what); return; }var basename = what.substring (0, pt); if (this.appIsSpecialCheckBox (item, basename, what, TF)) return; what = what.substring (pt + 1); if ((pt = what.indexOf ("|")) >= 0) what = (TF ? what.substring (0, pt) : what.substring (pt + 1)).trim (); what = JU.PT.rep (what, "T/F", (TF ? " TRUE" : " FALSE")); }this.appRunScript (what); }, "javajs.awt.SC,~S,~B"); Clazz_defineMethod (c$, "menuCreateItem", function (menu, entry, script, id) { var item = this.helper.getMenuItem (entry); item.addActionListener (this.helper); return this.newMenuItem (item, menu, entry, script, id); }, "javajs.awt.SC,~S,~S,~S"); Clazz_defineMethod (c$, "menuCreateCheckboxItem", function (menu, entry, basename, id, state, isRadio) { var jmi = (isRadio ? this.helper.getRadio (entry) : this.helper.getCheckBox (entry)); jmi.setSelected (state); jmi.addItemListener (this.helper); return this.newMenuItem (jmi, menu, entry, basename, id); }, "javajs.awt.SC,~S,~S,~S,~B,~B"); Clazz_defineMethod (c$, "menuAddSeparator", function (menu) { menu.add (this.helper.getMenuItem (null)); this.isTainted = true; }, "javajs.awt.SC"); Clazz_defineMethod (c$, "menuNewSubMenu", function (entry, id) { var jm = this.helper.getMenu (entry); this.updateButton (jm, entry, null); jm.setName (id); jm.setAutoscrolls (true); return jm; }, "~S,~S"); Clazz_defineMethod (c$, "menuRemoveAll", function (menu, indexFrom) { if (indexFrom <= 0) menu.removeAll (); else for (var i = menu.getComponentCount (); --i >= indexFrom; ) menu.remove (i); this.isTainted = true; }, "javajs.awt.SC,~N"); Clazz_defineMethod (c$, "newMenuItem", function (item, menu, text, script, id) { this.updateButton (item, text, script); if (id != null && id.startsWith ("Focus")) { item.addMouseListener (this.helper); id = menu.getName () + "." + id; }item.setName (id == null ? menu.getName () + "." : id); this.menuAddItem (menu, item); return item; }, "javajs.awt.SC,javajs.awt.SC,~S,~S,~S"); Clazz_defineMethod (c$, "setText", function (item, text) { var m = this.htMenus.get (item); if (m != null) m.setText (text); return m; }, "~S,~S"); Clazz_defineMethod (c$, "menuAddItem", function (menu, item) { menu.add (item); this.isTainted = true; }, "javajs.awt.SC,javajs.awt.SC"); Clazz_defineMethod (c$, "menuAddSubMenu", function (menu, subMenu) { this.menuAddItem (menu, subMenu); }, "javajs.awt.SC,javajs.awt.SC"); Clazz_defineMethod (c$, "menuEnable", function (component, enable) { if (component == null || component.isEnabled () == enable) return; component.setEnabled (enable); }, "javajs.awt.SC,~B"); Clazz_defineMethod (c$, "menuGetId", function (menu) { return menu.getName (); }, "javajs.awt.SC"); Clazz_defineMethod (c$, "menuSetAutoscrolls", function (menu) { menu.setAutoscrolls (true); this.isTainted = true; }, "javajs.awt.SC"); Clazz_defineMethod (c$, "menuGetListPosition", function (item) { var p = item.getParent (); var i; for (i = p.getComponentCount (); --i >= 0; ) if (this.helper.getSwingComponent (p.getComponent (i)) === item) break; return i; }, "javajs.awt.SC"); Clazz_defineMethod (c$, "show", function (x, y, doPopup) { this.thisx = x; this.thisy = y; this.appUpdateForShow (); this.updateCheckBoxesForShow (); if (doPopup) this.menuShowPopup (this.popupMenu, this.thisx, this.thisy); }, "~N,~N,~B"); Clazz_defineMethod (c$, "updateCheckBoxesForShow", function () { for (var entry, $entry = this.htCheckbox.entrySet ().iterator (); $entry.hasNext () && ((entry = $entry.next ()) || true);) { var key = entry.getKey (); var item = entry.getValue (); var basename = key.substring (0, key.indexOf (":")); var b = this.appGetBooleanProperty (basename); if (item.isSelected () != b) { item.setSelected (b); this.isTainted = true; }} }); Clazz_overrideMethod (c$, "jpiGetMenuAsString", function (title) { this.appUpdateForShow (); var pt = title.indexOf ("|"); if (pt >= 0) { var type = title.substring (pt); title = title.substring (0, pt); if (type.indexOf ("current") >= 0) { var sb = new JU.SB (); var menu = this.htMenus.get (this.menuName); this.menuGetAsText (sb, 0, menu, "PopupMenu"); return sb.toString (); }}return this.appGetMenuAsString (title); }, "~S"); Clazz_defineMethod (c$, "menuGetAsText", function (sb, level, menu, menuName) { var name = menuName; var subMenus = menu.getComponents (); var flags = null; var script = null; var text = null; var key = 'S'; for (var i = 0; i < subMenus.length; i++) { var m = this.helper.getSwingComponent (subMenus[i]); var type = this.helper.getItemType (m); switch (type) { case 4: key = 'M'; name = m.getName (); flags = "enabled:" + m.isEnabled (); text = m.getText (); script = null; break; case 0: key = 'S'; flags = script = text = null; break; default: key = 'I'; flags = "enabled:" + m.isEnabled (); if (type == 2 || type == 3) flags += ";checked:" + m.isSelected (); script = this.appFixScript (m.getName (), m.getActionCommand ()); name = m.getName (); text = m.getText (); break; } J.popup.GenericSwingPopup.addItemText (sb, key, level, name, text, script, flags); if (type == 2) this.menuGetAsText (sb, level + 1, this.helper.getSwingComponent (m.getPopupMenu ()), name); } }, "JU.SB,~N,javajs.awt.SC,~S"); c$.addItemText = Clazz_defineMethod (c$, "addItemText", function (sb, type, level, name, label, script, flags) { sb.appendC (type).appendI (level).appendC ('\t').append (name); if (label == null) { sb.append (".\n"); return; }sb.append ("\t").append (label).append ("\t").append (script == null || script.length == 0 ? "-" : script).append ("\t").append (flags).append ("\n"); }, "JU.SB,~S,~N,~S,~S,~S,~S"); c$.convertToMegabytes = Clazz_defineMethod (c$, "convertToMegabytes", function (num) { if (num <= 9223372036854251519) num += 524288; return (Clazz_doubleToInt (num / (1048576))); }, "~N"); }); Clazz_declarePackage ("J.popup"); Clazz_load (null, "J.popup.PopupResource", ["java.io.BufferedReader", "$.StringReader", "java.util.Properties", "JU.SB"], function () { c$ = Clazz_decorateAsClass (function () { this.structure = null; this.words = null; Clazz_instantialize (this, arguments); }, J.popup, "PopupResource"); Clazz_makeConstructor (c$, function (menuStructure, menuText) { this.structure = new java.util.Properties (); this.words = new java.util.Properties (); this.buildStructure (menuStructure); this.localize (menuStructure != null, menuText); }, "~S,java.util.Properties"); Clazz_defineMethod (c$, "getStructure", function (key) { return this.structure.getProperty (key); }, "~S"); Clazz_defineMethod (c$, "getWord", function (key) { var str = this.words.getProperty (key); return (str == null ? key : str); }, "~S"); Clazz_defineMethod (c$, "setStructure", function (slist, gt) { var br = new java.io.BufferedReader ( new java.io.StringReader (slist)); var line; var pt; try { while ((line = br.readLine ()) != null) { if (line.length == 0 || line.charAt (0) == '#') continue; pt = line.indexOf ("="); if (pt < 0) { pt = line.length; line += "="; }var name = line.substring (0, pt).trim (); var value = line.substring (pt + 1).trim (); var label = null; if ((pt = name.indexOf ("|")) >= 0) { label = name.substring (pt + 1).trim (); name = name.substring (0, pt).trim (); }if (name.length == 0) continue; if (value.length > 0) this.structure.setProperty (name, value); if (label != null && label.length > 0) this.words.setProperty (name, (gt == null ? label : gt.translate (label))); } } catch (e) { if (Clazz_exceptionOf (e, Exception)) { } else { throw e; } } try { br.close (); } catch (e) { if (Clazz_exceptionOf (e, Exception)) { } else { throw e; } } }, "~S,J.api.Translator"); Clazz_defineMethod (c$, "addItems", function (itemPairs) { var previous = ""; for (var i = 0; i < itemPairs.length; i++) { var pair = itemPairs[i]; var str = pair[1]; if (str == null) str = previous; previous = str; this.structure.setProperty (pair[0], str); } }, "~A"); Clazz_defineMethod (c$, "localize", function (haveUserMenu, menuText) { var wordContents = this.getWordContents (); for (var i = 0; i < wordContents.length; i++) { var item = wordContents[i++]; var word = this.words.getProperty (item); if (word == null) word = wordContents[i]; this.words.setProperty (item, word); if (menuText != null && item.indexOf ("Text") >= 0) menuText.setProperty (item, word); } }, "~B,java.util.Properties"); Clazz_defineMethod (c$, "getStuctureAsText", function (title, menuContents, structureContents) { return "# " + this.getMenuName () + ".mnu " + title + "\n\n" + "# Part I -- Menu Structure\n" + "# ------------------------\n\n" + this.dumpStructure (menuContents) + "\n\n" + "# Part II -- Key Definitions\n" + "# --------------------------\n\n" + this.dumpStructure (structureContents) + "\n\n" + "# Part III -- Word Translations\n" + "# -----------------------------\n\n" + this.dumpWords (); }, "~S,~A,~A"); Clazz_defineMethod (c$, "dumpWords", function () { var wordContents = this.getWordContents (); var s = new JU.SB (); for (var i = 0; i < wordContents.length; i++) { var key = wordContents[i++]; if (this.structure.getProperty (key) == null) s.append (key).append (" | ").append (wordContents[i]).appendC ('\n'); } return s.toString (); }); Clazz_defineMethod (c$, "dumpStructure", function (items) { var previous = ""; var s = new JU.SB (); for (var i = 0; i < items.length; i++) { var key = items[i][0]; var label = this.words.getProperty (key); if (label != null) key += " | " + label; s.append (key).append (" = ").append (items[i][1] == null ? previous : (previous = items[i][1])).appendC ('\n'); } return s.toString (); }, "~A"); }); Clazz_declarePackage ("J.popup"); Clazz_load (["J.popup.PopupHelper"], "J.popup.JSSwingPopupHelper", ["J.awtjs.swing.ButtonGroup", "$.JCheckBoxMenuItem", "$.JMenu", "$.JMenuItem", "$.JPopupMenu", "$.JRadioButtonMenuItem"], function () { c$ = Clazz_decorateAsClass (function () { this.popup = null; this.buttonGroup = null; Clazz_instantialize (this, arguments); }, J.popup, "JSSwingPopupHelper", null, J.popup.PopupHelper); Clazz_makeConstructor (c$, function (popup) { this.popup = popup; }, "javajs.awt.GenericMenuInterface"); Clazz_overrideMethod (c$, "menuCreatePopup", function (name, applet) { var j = new J.awtjs.swing.JPopupMenu (name); j.setInvoker (applet); return j; }, "~S,~O"); Clazz_overrideMethod (c$, "getMenu", function (name) { return new J.awtjs.swing.JMenu (); }, "~S"); Clazz_overrideMethod (c$, "getMenuItem", function (name) { return new J.awtjs.swing.JMenuItem (name); }, "~S"); Clazz_overrideMethod (c$, "getRadio", function (name) { return new J.awtjs.swing.JRadioButtonMenuItem (); }, "~S"); Clazz_overrideMethod (c$, "getCheckBox", function (name) { return new J.awtjs.swing.JCheckBoxMenuItem (); }, "~S"); Clazz_overrideMethod (c$, "menuAddButtonGroup", function (item) { if (item == null) { this.buttonGroup = null; return; }if (this.buttonGroup == null) this.buttonGroup = new J.awtjs.swing.ButtonGroup (); this.buttonGroup.add (item); }, "javajs.awt.SC"); Clazz_overrideMethod (c$, "getItemType", function (m) { return (m).btnType; }, "javajs.awt.SC"); Clazz_overrideMethod (c$, "menuInsertSubMenu", function (menu, subMenu, index) { (subMenu).setParent (menu); }, "javajs.awt.SC,javajs.awt.SC,~N"); Clazz_overrideMethod (c$, "getSwingComponent", function (component) { return component; }, "~O"); Clazz_overrideMethod (c$, "menuClearListeners", function (menu) { if (menu != null) (menu).disposeMenu (); }, "javajs.awt.SC"); Clazz_defineMethod (c$, "itemStateChanged", function (e) { this.popup.menuCheckBoxCallback (e.getSource ()); }, "javajs.awt.event.ItemEvent"); Clazz_defineMethod (c$, "actionPerformed", function (e) { this.popup.menuClickCallback (e.getSource (), e.getActionCommand ()); }, "javajs.awt.event.ActionEvent"); Clazz_overrideMethod (c$, "getButtonGroup", function () { return this.buttonGroup; }); }); Clazz_declarePackage ("J.popup"); Clazz_declareInterface (J.popup, "PopupHelper"); })(Clazz ,Clazz.getClassName ,Clazz.newLongArray ,Clazz.doubleToByte ,Clazz.doubleToInt ,Clazz.doubleToLong ,Clazz.declarePackage ,Clazz.instanceOf ,Clazz.load ,Clazz.instantialize ,Clazz.decorateAsClass ,Clazz.floatToInt ,Clazz.floatToLong ,Clazz.makeConstructor ,Clazz.defineEnumConstant ,Clazz.exceptionOf ,Clazz.newIntArray ,Clazz.defineStatics ,Clazz.newFloatArray ,Clazz.declareType ,Clazz.prepareFields ,Clazz.superConstructor ,Clazz.newByteArray ,Clazz.declareInterface ,Clazz.p0p ,Clazz.pu$h ,Clazz.newShortArray ,Clazz.innerTypeInstance ,Clazz.isClassDefined ,Clazz.prepareCallback ,Clazz.newArray ,Clazz.castNullAs ,Clazz.floatToShort ,Clazz.superCall ,Clazz.decorateAsType ,Clazz.newBooleanArray ,Clazz.newCharArray ,Clazz.implementOf ,Clazz.newDoubleArray ,Clazz.overrideConstructor ,Clazz.clone ,Clazz.doubleToShort ,Clazz.getInheritedLevel ,Clazz.getParamsType ,Clazz.isAF ,Clazz.isAB ,Clazz.isAI ,Clazz.isAS ,Clazz.isASS ,Clazz.isAP ,Clazz.isAFloat ,Clazz.isAII ,Clazz.isAFF ,Clazz.isAFFF ,Clazz.tryToSearchAndExecute ,Clazz.getStackTrace ,Clazz.inheritArgs ,Clazz.alert ,Clazz.defineMethod ,Clazz.overrideMethod ,Clazz.declareAnonymous //,Clazz.checkPrivateMethod ,Clazz.cloneFinals );