Permalink
Browse files

Checking in bugfixes and changes in response to this thread: http://q…

  • Loading branch information...
1 parent 40b10fe commit c1edec90b5237d9d12f0d889cb6f7540cfcf4ab1 cboulanger committed Jul 9, 2010
@@ -1,20 +1,24 @@
/* ************************************************************************
+ qooxdoo dialog library
+
+ http://qooxdoo.org/contrib/project#dialog
+
Copyright:
-
+ 2007-2010 Christian Boulanger
+
License:
-
+ LGPL: http://www.gnu.org/licenses/lgpl.html
+ EPL: http://www.eclipse.org/org/documents/epl-v10.php
+ See the LICENSE file in the project's top-level directory for details.
+
Authors:
-
+ * Christian Boulanger (cboulanger)
+
************************************************************************ */
/* ************************************************************************
-
-#asset(dialog/*)
-#asset(qx/icon/Tango/48/status/dialog-information.png)
-#asset(qx/icon/Tango/22/actions/dialog-ok.png)
-#asset(qx/icon/Tango/22/actions/dialog-cancel.png)
-
+#require(dialog.Dialog)
************************************************************************ */
/**
@@ -109,7 +113,7 @@ qx.Class.define("dialog.demo.Application",
createAlert : function()
{
- dialog.alert( "Hello World!" );
+ dialog.Dialog.alert( "Hello World!" );
// same as:
// (new dialog.Alert({
// message : "Hello World!"
@@ -118,8 +122,8 @@ qx.Class.define("dialog.demo.Application",
createConfirm : function()
{
- dialog.confirm("Do you really want to erase your hard drive?", function(result){
- dialog.alert("Your answer was: " + result );
+ dialog.Dialog.confirm("Do you really want to erase your hard drive?", function(result){
+ dialog.Dialog.alert("Your answer was: " + result );
});
// (new dialog.Confirm({
// message : "Do you really want to erase your hard drive?",
@@ -134,8 +138,8 @@ qx.Class.define("dialog.demo.Application",
createPrompt : function()
{
- dialog.prompt("Please enter the root password for your server",function(result){
- dialog.alert("Your answer was: " + result );
+ dialog.Dialog.prompt("Please enter the root password for your server",function(result){
+ dialog.Dialog.alert("Your answer was: " + result );
});
// same as:
@@ -155,10 +159,10 @@ qx.Class.define("dialog.demo.Application",
*/
createDialogChain : function()
{
- dialog.alert( "This demostrates a series of 'nested' dialogs ",function(){
- dialog.confirm( "Do you believe in the Loch Ness monster?", function(result){
- dialog.confirm( "You really " + (result?"":"don't ") + "believe in the Loch Ness monster?", function(result){
- dialog.alert( result ?
+ dialog.Dialog.alert( "This demostrates a series of 'nested' dialogs ",function(){
+ dialog.Dialog.confirm( "Do you believe in the Loch Ness monster?", function(result){
+ dialog.Dialog.confirm( "You really " + (result?"":"don't ") + "believe in the Loch Ness monster?", function(result){
+ dialog.Dialog.alert( result ?
"I tell you a secret: It doesn't exist." :
"All the better." );
});
@@ -193,12 +197,12 @@ qx.Class.define("dialog.demo.Application",
*/
createSelect : function()
{
- dialog.select( "Select the type of record to create:", [
+ dialog.Dialog.select( "Select the type of record to create:", [
{ label:"Database record", value:"database" },
{ label:"World record", value:"world" },
{ label:"Pop record", value:"pop" }
], function(result){
- dialog.alert("You selected: '" + result + "'");
+ dialog.Dialog.alert("You selected: '" + result + "'");
}
);
@@ -259,9 +263,9 @@ qx.Class.define("dialog.demo.Application",
]
}
};
- dialog.form("Please fill in the form",formData, function( result )
+ dialog.Dialog.form("Please fill in the form",formData, function( result )
{
- dialog.alert("Thank you for your input:" + qx.util.Json.stringify(result).replace(/\\/g,"") );
+ dialog.Dialog.alert("Thank you for your input:" + qx.util.Json.stringify(result).replace(/\\/g,"") );
}
);
// (new dialog.Form({
@@ -373,7 +377,7 @@ qx.Class.define("dialog.demo.Application",
pageData : pageData,
allowCancel : true,
callback : qx.lang.Function.bind( function( map ){
- dialog.alert("Thank you for your input:" + qx.util.Json.stringify(map).replace(/\\/g,"") );
+ dialog.Dialog.alert("Thank you for your input:" + qx.util.Json.stringify(map).replace(/\\/g,"") );
},this)
});
wizard.start();
@@ -1,11 +1,11 @@
/* ************************************************************************
- qcl - the qooxdoo component library
+ qooxdoo dialog library
- http://qooxdoo.org/contrib/project/qcl/
+ http://qooxdoo.org/contrib/project#dialog
Copyright:
- 2007-2009 Christian Boulanger
+ 2007-2010 Christian Boulanger
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
@@ -18,10 +18,9 @@
************************************************************************ */
/* ************************************************************************
-#embed(qx.icontheme/48/status/dialog-information.png)
+#asset(qx.icontheme/48/status/dialog-information.png)
************************************************************************ */
-
/**
* A dialog that alerts the user to something.
*/
@@ -92,5 +91,5 @@ qx.Class.define("dialog.Alert",
buttonPane.add(okButton);
groupboxContainer.add(buttonPane);
}
- }
+ }
});
@@ -1,11 +1,11 @@
/* ************************************************************************
- qcl - the qooxdoo component library
+ qooxdoo dialog library
- http://qooxdoo.org/contrib/project/qcl/
+ http://qooxdoo.org/contrib/project#dialog
Copyright:
- 2007-2009 Christian Boulanger
+ 2007-2010 Christian Boulanger
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
@@ -214,5 +214,5 @@ qx.Class.define("dialog.Confirm",
this.getCallback().call(this.getContext(),false);
}
}
- }
+ }
});
@@ -1,11 +1,11 @@
/* ************************************************************************
- qcl - the qooxdoo component library
+ qooxdoo dialog library
- http://qooxdoo.org/contrib/project/qcl/
+ http://qooxdoo.org/contrib/project#dialog
Copyright:
- 2007-2009 Christian Boulanger
+ 2007-2010 Christian Boulanger
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
@@ -21,11 +21,6 @@
#asset(qx/icon/${qx.icontheme}/22/actions/dialog-cancel.png)
#asset(qx/icon/${qx.icontheme}/22/actions/dialog-ok.png)
#asset(qx/icon/${qx.icontheme}/48/status/dialog-information.png)
-
-#ignore(dialog.alert)
-#ignore(dialog.confirm)
-#ignore(dialog.prompt)
-#ignore(dialog.select)
************************************************************************ */
@@ -68,7 +63,88 @@ qx.Class.define("dialog.Dialog",
init : function()
{
qx.core.Init.getApplication().warn("Initializing the Dialog package is no longer necessary. Please remove calls to 'dialog.Dialog.init()', which is now deprecated.");
- }
+ },
+
+ /**
+ * Shortcut for alert dialog
+ * @param message {String}
+ * @param callback {Function}
+ * @param context {Object}
+ */
+ alert : function( message, callback, context )
+ {
+ (new dialog.Alert({
+ "message" : message,
+ "callback" : callback || null,
+ "context" : context || null
+ })).show();
+ },
+
+ /**
+ * Shortcut for confirm dialog
+ * @param message {String}
+ * @param callback {Function}
+ * @param context {Object}
+ */
+ confirm : function( message, callback, context )
+ {
+ (new dialog.Confirm({
+ "message" : message,
+ "callback" : callback || null,
+ "context" : context || null
+ })).show();
+ },
+
+ /**
+ * Shortcut for prompt dialog
+ * @param message {String}
+ * @param callback {Function}
+ * @param context {Object}
+ */
+ prompt : function( message, callback, context )
+ {
+ (new dialog.Prompt({
+ "message" : message,
+ "callback" : callback || null,
+ "context" : context || null
+ })).show();
+ },
+
+ /**
+ * Shortcut for select dialog
+ * @param message {String}
+ * @param options {Array}
+ * @param callback {Function}
+ * @param context {Object}
+ */
+ select : function( message, options, callback, context )
+ {
+ (new dialog.Select({
+ "message" : message,
+ "allowCancel" : true,
+ "options" : options,
+ "callback" : callback || null,
+ "context" : context || null
+ })).show();
+ },
+
+ /**
+ * Shortcut for form dialog
+ * @param message {String}
+ * @param formData {Map}
+ * @param callback {Function}
+ * @param context {Object}
+ */
+ form : function( message, formData, callback, context )
+ {
+ (new dialog.Form({
+ "message" : message,
+ "formData" : formData,
+ "allowCancel" : true,
+ "callback" : callback,
+ "context" : context || null
+ })).show();
+ }
},
/*
@@ -156,6 +232,13 @@ qx.Class.define("dialog.Dialog",
check : "Boolean",
init : true,
event : "changeAllowCancel"
+ },
+
+ // overridden
+ focusable :
+ {
+ refine : true,
+ init : true
}
},
@@ -372,6 +455,7 @@ qx.Class.define("dialog.Dialog",
root.blockContent( this.getZIndex()-1 );
}
this.setVisibility("visible");
+ this.focus();
this.fireEvent("show");
},
@@ -430,51 +514,12 @@ qx.Class.define("dialog.Dialog",
defer : function()
{
/*
- * create shortcut methods
+ * create shortcut methods for backward compatibility
*/
- dialog.alert = function( message, callback, context )
- {
- (new dialog.Alert({
- "message" : message,
- "callback" : callback || null,
- "context" : context || null
- })).show();
- }
- dialog.confirm = function( message, callback, context )
- {
- (new dialog.Confirm({
- "message" : message,
- "callback" : callback || null,
- "context" : context || null
- })).show();
- }
- dialog.prompt = function( message, callback, context )
- {
- (new dialog.Prompt({
- "message" : message,
- "callback" : callback || null,
- "context" : context || null
- })).show();
- }
- dialog.select = function( message, options, callback, context )
- {
- (new dialog.Select({
- "message" : message,
- "allowCancel" : true,
- "options" : options,
- "callback" : callback,
- "context" : context || null
- })).show();
- }
- dialog.form = function( message, formData, callback, context )
- {
- (new dialog.Form({
- "message" : message,
- "formData" : formData,
- "allowCancel" : true,
- "callback" : callback,
- "context" : context || null
- })).show();
- }
+ dialog.alert = dialog.Dialog.alert;
+ dialog.confirm = dialog.Dialog.confirm;
+ dialog.prompt = dialog.Dialog.prompt;
+ dialog.select = dialog.Dialog.select;
+ dialog.form = dialog.Dialog.form;
}
});
@@ -1,11 +1,11 @@
/* ************************************************************************
- qcl - the qooxdoo component library
+ qooxdoo dialog library
- http://qooxdoo.org/contrib/project/qcl/
+ http://qooxdoo.org/contrib/project#dialog
Copyright:
- 2007-2009 Christian Boulanger
+ 2007-2010 Christian Boulanger
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
@@ -636,5 +636,5 @@ qx.Class.define("dialog.Form",
}
this.resetCallback();
}
- }
+ }
});
Oops, something went wrong.

0 comments on commit c1edec9

Please sign in to comment.