-package javajs.api;\r
-\r
-import javajs.awt.Component;\r
-import javajs.awt.Dimension;\r
-\r
-/**\r
- * SwingController is an interface that javajs.swing classes will need.\r
- * It must be implemented as a JavaScript object PRIOR to \r
- * any calls to create any components.\r
- * \r
- * In JSmol it is Jmol.Swing (see JsmolCore.js)\r
- * \r
- * There should be one and only one SwingController on a page. \r
- * It is called by its class name "SwingController" directly. \r
- * \r
- * @author hansonr\r
- * \r
- */\r
-public interface SwingController {\r
- \r
- /**\r
- * Fired from clicking an element such as a button or \r
- * check box or table entry, or from entering text in a text box.\r
- * \r
- * SwingController should make the changes in the underlying \r
- * "Java" object directly, then send notification of the event to the manager.\r
- * For instance:\r
- * \r
- * var component = Jmol.Swing.htDialogs[element.id];\r
- * var info = component.toString();\r
- * \r
- * if (info.indexOf("JCheck") >= 0)\r
- * component.selected = element.checked;\r
- * var id = $("div.JDialog:has(#" + element.id + ")")[0].id\r
- * var dialog = Jmol.Swing.htDialogs[id];\r
- * dialog.manager.actionPerformed(component ? component.name : dialog.registryKey + "/" + element.id);\r
- * \r
- * @param element\r
- * @param event \r
- */\r
- void click(HTMLElement element, HTMLWindowEvent event);\r
- \r
-\r
- /**\r
- * Remove this component's HTML5 equivalent and clear references to it.\r
- * \r
- * @param dialog\r
- */\r
- void dispose(Component dialog);\r
- \r
- /**\r
- * Return the width and height of the window in d.\r
- * For example:\r
- * \r
- * d.width = $(window).width();\r
- * d.height = $(window).height();\r
- *\r
- * @param d\r
- */\r
- void getScreenDimensions(Dimension d);\r
- \r
- /**\r
- * Set c's id to a unique identifier\r
- * and add it to an associative array that will\r
- * associate that id with c.\r
- * \r
- * @param c\r
- * @param type\r
- */\r
- void register(Component c, String type);\r
- \r
- /**\r
- * The HTML for this dialog has been generated.\r
- * Now create the HTML on the page for this dialog\r
- * based on dialog.html and wrap it appropriately.\r
- * \r
- * @param dialog\r
- */\r
- void setDialog(Component dialog);\r
- \r
- /**\r
- * Convey to the HTML object that this check box's selection\r
- * has been changed.\r
- * \r
- * $("#" + chk.id).prop('checked', !!chk.selected);\r
- * \r
- * @param chk\r
- */\r
- void setSelected(Component chk);\r
- \r
- /**\r
- * Convey to the HTML object that this combo box's selected item\r
- * has been changed.\r
- * \r
- * $("#" + cmb.id).prop('selectedIndex', cmb.selectedIndex);\r
- * \r
- * @param cmb\r
- */\r
- void setSelectedIndex(Component cmb);\r
- \r
- /**\r
- * Convey to the HTML object that this component's text\r
- * has been changed.\r
- * \r
- * $("#" + btn.id).prop('value', btn.text);\r
- * \r
- * @param text\r
- */\r
- void setText(String text);\r
- \r
- /**\r
- * Convey to the HTML object that this component's text\r
- * has been changed.\r
- * \r
- * if (c.visible)\r
- * $("#" + c.id).show();\r
- * else\r
- * $("#" + c.id).hide(); \r
- *\r
- * @param c\r
- */ \r
- void setVisible(Component c);\r
- \r
- /**\r
- * Called by clicking the [x] in the corner of the dialog;\r
- * send a notification back to the manager via processWindowClosing(key)\r
- * \r
- * var id = $("div.JDialog:has(#" + element.id + ")")[0].id\r
- * var dialog = Jmol.Swing.htDialogs[id];\r
- * dialog.manager.processWindowClosing(dialog.registryKey);\r
- * \r
- * @param element\r
- */\r
- void windowClosing(HTMLElement element);\r
- \r
-}\r
+package javajs.api;
+
+import javajs.awt.Component;
+import javajs.awt.Dimension;
+
+/**
+ * SwingController is an interface that javajs.swing classes will need.
+ * It must be implemented as a JavaScript object PRIOR to
+ * any calls to create any components.
+ *
+ * In JSmol it is Jmol.Swing (see JsmolCore.js)
+ *
+ * There should be one and only one SwingController on a page.
+ * It is called by its class name "SwingController" directly.
+ *
+ * @author hansonr
+ *
+ */
+public interface SwingController {
+
+ /**
+ * Fired from clicking an element such as a button or
+ * check box or table entry, or from entering text in a text box.
+ *
+ * SwingController should make the changes in the underlying
+ * "Java" object directly, then send notification of the event to the manager.
+ * For instance:
+ *
+ * var component = Jmol.Swing.htDialogs[element.id];
+ * var info = component.toString();
+ *
+ * if (info.indexOf("JCheck") >= 0)
+ * component.selected = element.checked;
+ * var id = $("div.JDialog:has(#" + element.id + ")")[0].id
+ * var dialog = Jmol.Swing.htDialogs[id];
+ * dialog.manager.actionPerformed(component ? component.name : dialog.registryKey + "/" + element.id);
+ *
+ * @param element
+ * @param event
+ */
+ void click(HTMLElement element, HTMLWindowEvent event);
+
+
+ /**
+ * Remove this component's HTML5 equivalent and clear references to it.
+ *
+ * @param dialog
+ */
+ void dispose(Component dialog);
+
+ /**
+ * Return the width and height of the window in d.
+ * For example:
+ *
+ * d.width = $(window).width();
+ * d.height = $(window).height();
+ *
+ * @param d
+ */
+ void getScreenDimensions(Dimension d);
+
+ /**
+ * Set c's id to a unique identifier
+ * and add it to an associative array that will
+ * associate that id with c.
+ *
+ * @param c
+ * @param type
+ */
+ void register(Component c, String type);
+
+ /**
+ * The HTML for this dialog has been generated.
+ * Now create the HTML on the page for this dialog
+ * based on dialog.html and wrap it appropriately.
+ *
+ * @param dialog
+ */
+ void setDialog(Component dialog);
+
+ /**
+ * Convey to the HTML object that this check box's selection
+ * has been changed.
+ *
+ * $("#" + chk.id).prop('checked', !!chk.selected);
+ *
+ * @param chk
+ */
+ void setSelected(Component chk);
+
+ /**
+ * Convey to the HTML object that this combo box's selected item
+ * has been changed.
+ *
+ * $("#" + cmb.id).prop('selectedIndex', cmb.selectedIndex);
+ *
+ * @param cmb
+ */
+ void setSelectedIndex(Component cmb);
+
+ /**
+ * Convey to the HTML object that this component's text
+ * has been changed.
+ *
+ * $("#" + btn.id).prop('value', btn.text);
+ *
+ * @param text
+ */
+ void setText(String text);
+
+ /**
+ * Convey to the HTML object that this component's text
+ * has been changed.
+ *
+ * if (c.visible)
+ * $("#" + c.id).show();
+ * else
+ * $("#" + c.id).hide();
+ *
+ * @param c
+ */
+ void setVisible(Component c);
+
+ /**
+ * Called by clicking the [x] in the corner of the dialog;
+ * send a notification back to the manager via processWindowClosing(key)
+ *
+ * var id = $("div.JDialog:has(#" + element.id + ")")[0].id
+ * var dialog = Jmol.Swing.htDialogs[id];
+ * dialog.manager.processWindowClosing(dialog.registryKey);
+ *
+ * @param element
+ */
+ void windowClosing(HTMLElement element);
+
+}