]>
git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/SpecEditor.js
2 * Generic modal popup window.
3 * It is layed out with a dock layout. When adding components to it, they are added as "center".
4 * @author Charles du Jeu
6 qx
.Class
.define("org.argeo.slc.ria.execution.SpecEditor",
8 extend
: qx
.ui
.window
.Window
,
12 * Triggered when the user clicks the "ok" button.
14 "ok" : "qx.event.type.Event"
18 * @param caption {String} Title of the window
19 * @param icon {String} Icon of the window
20 * @param text {String} Default content of the window.
22 construct : function(executionFlow
){
23 this.base(arguments
, "Spec Editor");
27 width
: parseInt(qx
.bom
.Viewport
.getWidth()*80/100),
28 height
: parseInt(qx
.bom
.Viewport
.getHeight()*80/100)
30 this.setLayout(new qx
.ui
.layout
.Dock());
34 this.addContent(new qx
.ui
.basic
.Label("Editing specs for flow : "+executionFlow
.getName()));
36 this.addCloseButton();
42 * Display a component (panel) in the center of the popup
43 * @param panel {qx.ui.core.Widget} A gui component (will be set at width 100%).
45 addContent: function(panel
){
46 this.add(panel
, {edge
:'center', width
:'100%'});
47 this.addCloseButton();
50 * Automatically attach to the application root, then show.
52 attachAndShow:function(){
53 org
.argeo
.ria
.components
.ViewsManager
.getInstance().getApplicationRoot().add(this);
57 * Adds a close button bottom-center aligned to the popup
59 addCloseButton : function(){
60 this.closeButton
= new qx
.ui
.form
.Button("Close");
61 this.closeButton
.addListener("execute", this._closeAndDestroy
, this);
62 this.add(this.closeButton
, {edge
:'south'});
65 * Adds two buttons bottom-center aligned (Ok and Cancel).
66 * Ok button has no listener by default, Cancel will close and destroy the popup.
68 addOkCancel : function(){
69 var buttonPane
= new qx
.ui
.container
.Composite(new qx
.ui
.layout
.HBox(5, 'right'));
70 buttonPane
.setAlignX("center");
71 this.add(buttonPane
, {edge
:"south"});
72 this.okButton
= new qx
.ui
.form
.Button("Ok");
73 this.okButton
.addListener("execute", function(e
){
75 this._closeAndDestroy();
77 this.cancelButton
= new qx
.ui
.form
.Button("Cancel");
78 this.cancelButton
.addListener("execute", this._closeAndDestroy
, this);
79 buttonPane
.add(this.okButton
);
80 buttonPane
.add(this.cancelButton
);
83 * Close this modal window and destroy it.
85 _closeAndDestroy : function(){