JAL-1807 includes ?j2sdebug flag and DebugJS._(msg)
[jalviewjs.git] / bin / jalview / appletgui / JVDialog.js
1 Clazz.declarePackage ("jalview.appletgui");
2 Clazz.load (["java.awt.Dialog", "java.awt.event.ActionListener", "awt2swing.Button"], "jalview.appletgui.JVDialog", ["awt2swing.Panel", "java.awt.FlowLayout"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.ap = null;
5 this.buttonPanel = null;
6 this.ok = null;
7 this.cancel = null;
8 this.accept = false;
9 this.owner = null;
10 Clazz.instantialize (this, arguments);
11 }, jalview.appletgui, "JVDialog", java.awt.Dialog, java.awt.event.ActionListener);
12 Clazz.prepareFields (c$, function () {
13 this.ok =  new awt2swing.Button ("Accept");
14 this.cancel =  new awt2swing.Button ("Cancel");
15 });
16 Clazz.makeConstructor (c$, 
17 function (owner, title, modal, width, height) {
18 Clazz.superConstructor (this, jalview.appletgui.JVDialog, [owner, title, modal]);
19 this.owner = owner;
20 height += owner.getInsets ().top + this.getInsets ().bottom;
21 this.setBounds (owner.getBounds ().x + Clazz.doubleToInt ((owner.getSize ().width - width) / 2), owner.getBounds ().y + Clazz.doubleToInt ((owner.getSize ().height - height) / 2), width, height);
22 }, "awt2swing.Frame,~S,~B,~N,~N");
23 Clazz.defineMethod (c$, "setMainPanel", 
24 function (panel) {
25 this.add (panel, "North");
26 this.buttonPanel =  new awt2swing.Panel ( new java.awt.FlowLayout ());
27 this.buttonPanel.add (this.ok);
28 this.buttonPanel.add (this.cancel);
29 this.ok.addActionListener (this);
30 this.cancel.addActionListener (this);
31 this.add (this.buttonPanel, "South");
32 this.pack ();
33 }, "awt2swing.Panel");
34 Clazz.overrideMethod (c$, "actionPerformed", 
35 function (evt) {
36 if (evt.getSource () === this.ok) {
37 this.accept = true;
38 }this.setVisible (false);
39 }, "java.awt.event.ActionEvent");
40 });