1
/* This notice must be untouched at all times.
4
The latest version is available at
5
http://www.openjacob.org
7
Copyright (c) 2006 Andreas Herz. All rights reserved.
8
Created 5. 11. 2006 by Andreas Herz (Web: http://www.freegroup.de )
12
This library is free software; you can redistribute it and/or
13
modify it under the terms of the GNU Lesser General Public
14
License (LGPL) as published by the Free Software Foundation; either
15
version 2.1 of the License, or (at your option) any later version.
17
This library is distributed in the hope that it will be useful,
18
but WITHOUT ANY WARRANTY; without even the implied warranty of
19
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
Lesser General Public License for more details.
22
You should have received a copy of the GNU Lesser General Public
23
License along with this library; if not, write to the Free Software
24
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA,
25
or see http://www.gnu.org/copyleft/lesser.html
31
* @author Andreas Herz
32
* @param {String} title The title of the window.
35
draw2d.Dialog=function( /*:String*/ title)
38
this.buttonbar = null;
40
draw2d.Window.call(this,title);
42
draw2d.Window.call(this,"Dialog");
43
this.setDimension(400,300);
46
draw2d.Dialog.prototype = new draw2d.Window;
48
draw2d.Dialog.prototype.type="Dialog";
53
draw2d.Dialog.prototype.createHTMLElement=function()
55
var item = draw2d.Window.prototype.createHTMLElement.call(this);
59
this.buttonbar = document.createElement("div");
60
this.buttonbar.style.position="absolute";
61
this.buttonbar.style.left = "0px";
62
this.buttonbar.style.bottom = "0px";
63
this.buttonbar.style.width = this.getWidth()+"px";
64
this.buttonbar.style.height = "30px";
65
this.buttonbar.style.margin = "0px";
66
this.buttonbar.style.padding= "0px";
67
this.buttonbar.style.font="normal 10px verdana";
68
this.buttonbar.style.backgroundColor="#c0c0c0";
69
this.buttonbar.style.borderBottom="2px solid gray";
70
this.buttonbar.style.whiteSpace="nowrap";
71
this.buttonbar.style.textAlign="center";
73
this.okbutton = document.createElement("button");
74
this.okbutton.style.border="1px solid gray";
75
this.okbutton.style.font="normal 10px verdana";
76
this.okbutton.style.width="80px";
77
this.okbutton.style.margin="5px";
78
this.okbutton.innerHTML = "Ok";
79
this.okbutton.onclick=function(){oThis.onOk();};
80
this.buttonbar.appendChild(this.okbutton);
82
this.cancelbutton = document.createElement("button");
83
this.cancelbutton.innerHTML = "Cancel";
84
this.cancelbutton.style.font="normal 10px verdana";
85
this.cancelbutton.style.border="1px solid gray";
86
this.cancelbutton.style.width="80px";
87
this.cancelbutton.style.margin="5px";
88
this.cancelbutton.onclick=function(){oThis.onCancel();};
89
this.buttonbar.appendChild(this.cancelbutton);
91
item.appendChild(this.buttonbar);
97
* This method will be called if the user pressed the OK button in buttonbar of the dialog.<br>
98
* Subclasses can override this method to implement there own stuff.<br><br>
99
* Don't forget to call the super method after you have done your stuff with
100
* <code>Dialog.prototype.onOk.call(this);</code>
102
draw2d.Dialog.prototype.onOk=function()
104
this.workflow.removeFigure(this);
108
* This method will be called if the user pressed the CANCEL button in buttonbar of the dialog.<br>
109
* Subclasses can override this method to implement there own stuff.<br><br>
110
* Don't forget to call the super method after you have done your stuff with
111
* <code>Dialog.prototype.onCancel.call(this);</code>
113
draw2d.Dialog.prototype.onCancel=function()
115
this.workflow.removeFigure(this);
119
* Set the new dimension of the dialog.
120
* @param {int} w new width of the window.
121
* @param {int} h new height of the window.
123
draw2d.Dialog.prototype.setDimension=function(/*:int*/ w, /*:int*/ h)
125
draw2d.Window.prototype.setDimension.call(this,w,h);
126
if(this.buttonbar!=null)
128
this.buttonbar.style.width=this.getWidth()+"px";
133
* @param {draw2d.Workflow} workflow The new workflow of the object.
136
draw2d.Dialog.prototype.setWorkflow= function(/*:draw2d.Workflow*/ workflow)
138
draw2d.Window.prototype.setWorkflow.call(this, workflow);
143
* The framework call this method after dialog creation. You can
144
* set the focus to your HTML input element or something else.
145
* It is always recommeded to call the super method if a sub class override this
147
* Call: <code>draw2d.Dialog.prototype.setFocus.call(this);</code>
149
draw2d.Dialog.prototype.setFocus=function()
154
* Framework callback if an object has beend deleted, move, added or something else.
155
* Sub classes can override this method to implement there own stuff. e.g. update some
156
* UI elements in relation to the document dirty state.
158
draw2d.Dialog.prototype.onSetDocumentDirty=function()
b'\\ No newline at end of file'