Introduction
ConfirmBox is a programatic only component in XUL. Meaning you cannot add it to the XUL doc. It's included for the sake of maintaining UI neutral code.
Properties
Property |
Fires Events |
Possible Values |
Notes |
---|---|---|---|
message (String) |
No |
|
|
title (String) |
No |
|
|
acceptLabel (String) |
No |
|
|
cancelLabel (String) |
No |
|
|
height (int) |
No |
|
|
width (int) |
No |
|
|
icon (String) |
No |
|
|
message (String) |
No |
|
|
title (String) |
No |
|
|
scrollable (bool) |
No |
|
|
Methods
open() - Blocks in the case of Swing and SWT, but not in GWT. Hence the addition of the XulDialogCallback.
addDialogCallback(XulDialogCallback)
removeDialogCallback(XulDialogCallback)
setModalParent(Object parent) - used to properly parent the dialog.
Sample Usage
XulConfirmBox confirm = (XulConfirmBox) document.createElementById("confirmbox"); confirm.setTitle("User Input Requred"); confirm.setMessage("Would you like to continue doing that thing?"); confirm.addDialogCallback(new XulDialogCallback(){ enum Status{ ACCEPT, CANCEL, ONEXTRA1, ONEXTRA2 } public void onClose(XulComponent sender, Status returnCode, Object retVal){ switch(returnCode){ case ACCEPT: continueDoingThatThing(true); break; case CANCEL: continueDoingThatThing(false); break; } } public void onError(XulComponent sender, Throwable t){ } }); confirm.open();