JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / jalview / appletgui / EditNameDialog.js
1 Clazz.declarePackage ("jalview.appletgui");\r
2 Clazz.load (["jalview.appletgui.JVDialog"], "jalview.appletgui.EditNameDialog", ["awt2swing.Label", "$.Panel", "$.TextField", "java.awt.BorderLayout", "$.Font"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.id = null;\r
5 this.description = null;\r
6 Clazz.instantialize (this, arguments);\r
7 }, jalview.appletgui, "EditNameDialog", jalview.appletgui.JVDialog);\r
8 Clazz.overrideMethod (c$, "getName", \r
9 function () {\r
10 return this.id.getText ();\r
11 });\r
12 Clazz.defineMethod (c$, "getDescription", \r
13 function () {\r
14 if (this.description.getText ().length < 1) {\r
15 return null;\r
16 } else {\r
17 return this.description.getText ();\r
18 }});\r
19 Clazz.makeConstructor (c$, \r
20 function (name, desc, label1, label2, owner, title, width, height, display) {\r
21 Clazz.superConstructor (this, jalview.appletgui.EditNameDialog, [owner, title, true, width, height]);\r
22 var mono =  new java.awt.Font ("Monospaced", 0, 12);\r
23 var panel =  new awt2swing.Panel ( new java.awt.BorderLayout ());\r
24 var panel2 =  new awt2swing.Panel ( new java.awt.BorderLayout ());\r
25 this.id =  new awt2swing.TextField (name, 40);\r
26 this.id.setFont (mono);\r
27 var label =  new awt2swing.Label (label1);\r
28 label.setFont (mono);\r
29 panel2.add (label, "West");\r
30 panel2.add (this.id, "Center");\r
31 panel.add (panel2, "North");\r
32 if (label2 != null) {\r
33 panel2 =  new awt2swing.Panel ( new java.awt.BorderLayout ());\r
34 this.description =  new awt2swing.TextField (desc, 40);\r
35 this.description.setFont (mono);\r
36 label =  new awt2swing.Label (label2);\r
37 label.setFont (mono);\r
38 panel2.add (label, "West");\r
39 panel2.add (this.description, "Center");\r
40 panel.add (panel2, "Center");\r
41 }this.setMainPanel (panel);\r
42 this.setVisible (display);\r
43 }, "~S,~S,~S,~S,awt2swing.Frame,~S,~N,~N,~B");\r
44 });\r