|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.smartgwt.client.widgets.BaseWidget
com.smartgwt.client.widgets.Canvas
com.smartgwt.client.widgets.layout.Layout
com.smartgwt.client.widgets.layout.VLayout
com.smartgwt.client.widgets.Window
com.smartgwt.client.widgets.Dialog
public class Dialog
Dialogs are a specialized version of Window used for small windows that contain just
a text message or a text mesage with some standard buttons.
Many typical modal dialogs such as alerts and confirmations are built into the system with convenience APIs - see say, warn and askForValue.
Dialogs can be
modal or non-modal according to isModal.
NOTE: If you are
building a dialog that will involve more than just buttons and a message, consider starting from the Window class instead, where arbitrary components can be added to the body area via Window.addItem.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled |
| Field Summary | |
|---|---|
static Button |
APPLY
APPLY Button object to fire dialog's "applyClick()" method on click. |
static Button |
CANCEL
CANCEL Button object to fire dialog's "cancelClick()" method on click. |
static Button |
DONE
DONE Button object to fire dialog's "doneClick()" method on click. |
static Button |
NO
NO Button object to fire dialog's "noClick()" method on click. |
static Button |
OK
OK Button object to fire dialog's "okClick()" method on click. |
static Button |
YES
YES Button object to fire dialog's "yesClick()" method on click |
| Fields inherited from class com.smartgwt.client.widgets.BaseWidget |
|---|
config, configOnly, id, isElementSet, scClassName |
| Fields inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
DEBUG_ID_PREFIX |
| Constructor Summary | |
|---|---|
Dialog()
|
|
Dialog(JavaScriptObject jsObj)
|
|
| Method Summary | |
|---|---|
HandlerRegistration |
addButtonClickHandler(ButtonClickHandler handler)
Add a buttonClick handler. |
void |
applyClick()
Handle a click on the 'apply' button of this Dialog. |
void |
cancelClick()
Handle a click on the 'cancel' button of this Dialog. |
void |
closeClick()
Handles a click on the close button of this window. |
protected JavaScriptObject |
create()
|
Boolean |
getAutoFocus()
If a toolbar is showing, automatically place keyboard focus in the first button. |
int |
getDefaultWidth()
For custom components, establishes a default width for the component. |
String |
getIcon()
Icon to show in this dialog - see message. |
int |
getIconSize()
Size of the icon to show in this dialog. |
String |
getMessage()
Message to show in this dialog. |
static Dialog |
getOrCreateRef(JavaScriptObject jsObj)
|
Boolean |
getShowToolbar()
Whether to show a toolbar of buttons at the bottom of the Dialog. |
String |
getStyleName()
Style of the Dialog background |
void |
noClick()
Handle a click on the 'no' button of this Dialog. |
void |
okClick()
Handle a click on the 'ok' button of this Dialog. |
void |
saveData()
Method to save this Dialog's data. |
void |
setAutoFocus(Boolean autoFocus)
If a toolbar is showing, automatically place keyboard focus in the first button. |
void |
setButtons(Button... buttons)
Array of Buttons to show in the toolbar, if shown.
|
static void |
setDefaultProperties(Dialog dialogProperties)
Class level method to set the default properties of this class. |
void |
setDefaultWidth(int defaultWidth)
For custom components, establishes a default width for the component. |
void |
setIcon(String icon)
Icon to show in this dialog - see message. |
void |
setIconSize(int iconSize)
Size of the icon to show in this dialog. |
void |
setMessage(String message)
Message to show in this dialog. |
void |
setMessageStyle(String messageStyle)
Style to apply to the message text shown in the center of the dialog |
void |
setShowToolbar(Boolean showToolbar)
Whether to show a toolbar of buttons at the bottom of the Dialog. |
void |
setStyleName(String styleName)
Style of the Dialog background |
void |
setToolbarButtons(Canvas... toolbarButtons)
Array of Buttons to show in the showToolbar, if shown. |
void |
yesClick()
Handle a click on the 'yes' button of this Dialog. |
| Methods inherited from class com.smartgwt.client.widgets.layout.VLayout |
|---|
setDefaultProperties |
| Methods inherited from class com.google.gwt.user.client.ui.Widget |
|---|
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents |
| Methods inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
addStyleDependentName, ensureDebugId, ensureDebugId, ensureDebugId, getStyleElement, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, sinkBitlessEvent, unsinkEvents |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
|---|
fireEvent |
| Field Detail |
|---|
public static Button OK
public static Button APPLY
public static Button YES
public static Button NO
public static Button CANCEL
public static Button DONE
| Constructor Detail |
|---|
public Dialog()
public Dialog(JavaScriptObject jsObj)
| Method Detail |
|---|
public static Dialog getOrCreateRef(JavaScriptObject jsObj)
protected JavaScriptObject create()
create in class Window
public void setAutoFocus(Boolean autoFocus)
throws IllegalStateException
autoFocus - autoFocus Default value is true
IllegalStateException - this property cannot be changed after the component has been createdAppearance overview and related methodspublic Boolean getAutoFocus()
Appearance overview and related methods
public void setDefaultWidth(int defaultWidth)
throws IllegalStateException
Canvas For a component that should potentially be
sized automatically by a Layout, set this property rather than width
directly, because Layouts regard a width setting as an explicit size that shouldn't be changed.
Note : This is an advanced setting
setDefaultWidth in class CanvasdefaultWidth - defaultWidth Default value is 360
IllegalStateException - this property cannot be changed after the component has been createdAppearance overview and related methodspublic int getDefaultWidth()
Canvas For a component that should potentially be
sized automatically by a Layout, set this property rather than width
directly, because Layouts regard a width setting as an explicit size that shouldn't be changed.
getDefaultWidth in class CanvasAppearance overview and related methods
public void setIcon(String icon)
throws IllegalStateException
message.
icon - icon Default value is null
IllegalStateException - this property cannot be changed after the component has been createdpublic String getIcon()
message.
public void setIconSize(int iconSize)
throws IllegalStateException
iconSize - iconSize Default value is 32
IllegalStateException - this property cannot be changed after the component has been createdpublic int getIconSize()
public void setMessage(String message)
throws IllegalStateException
If a message is set the primary purpose of the dialog will be assumed to be to show
a message with buttons - auto-sizing to the message text will be enabled, and, if icon has also been set, the messageLabel and messageIcon AutoChildren will be created and placed together in the
messageStack AutoChild, with the toolbar underneath as usual.
If any of these behaviors are inconvenient or you want more precise control over a message and some custom widgets,
start from the superclass Window instead, and add controls via Window.addItem.
The message string may contain "${loadingImage}", if so,
the standard loading spinner will appear at that location in the text (see loadingImageSrc).
The message will be styled with the messageStyle.
message - message Default value is null
IllegalStateException - this property cannot be changed after the component has been createdpublic String getMessage()
If a message is set the primary purpose of the dialog will be assumed to be to show
a message with buttons - auto-sizing to the message text will be enabled, and, if icon has also been set, the messageLabel and messageIcon AutoChildren will be created and placed together in the
messageStack AutoChild, with the toolbar underneath as usual.
If any of these behaviors are inconvenient or you want more precise control over a message and some custom widgets,
start from the superclass Window instead, and add controls via Window.addItem.
The message string may contain "${loadingImage}", if so,
the standard loading spinner will appear at that location in the text (see loadingImageSrc).
The message will be styled with the messageStyle.
public void setShowToolbar(Boolean showToolbar)
showToolbar - showToolbar Default value is falseAppearance overview and related methodspublic Boolean getShowToolbar()
Appearance overview and related methodspublic void setStyleName(String styleName)
setStyleName in class CanvasstyleName - styleName Default value is "dialogBackground"Appearance overview and related methodspublic String getStyleName()
getStyleName in class CanvasAppearance overview and related methodspublic void applyClick()
saveData(), but
NOT close the Dialog.
public HandlerRegistration addButtonClickHandler(ButtonClickHandler handler)
Fires when any button in this Dialog's toolbar is clicked. Default implementation does nothing.
addButtonClickHandler in interface HasButtonClickHandlershandler - the buttonClick handler
HandlerRegistration used to remove this handlerpublic void cancelClick()
public void closeClick()
public void noClick()
false. Override to do
something else.
public void okClick()
saveData(), hide the
Dialog, then return true. Override to do something else.
public void saveData()
okClick(), applyClick(). No default
implementation - override to perform some action if required.
public void yesClick()
true. Override to do
something else
public static void setDefaultProperties(Dialog dialogProperties)
Note: This method is intended for setting default attributes only and will effect all instances of the underlying class (including those automatically generated in JavaScript). This method should not be used to apply standard EventHandlers or override methods for a class - use a custom subclass instead.
dialogProperties - properties that should be used as new defaults when instances of this class are createdpublic void setToolbarButtons(Canvas... toolbarButtons)
showToolbar, if shown.
The set of buttons to use is typically set by calling one of the shortcuts.
toolbarButtons - the toolbar buttons
IllegalStateException - this property cannot be changed after the component has been rendered
public void setButtons(Button... buttons)
throws IllegalStateException
toolbar, if shown.
The set of buttons to use is typically set by calling one of the shortcuts such as
isc.say or isc.confirm. A custom set of
buttons can be passed to
these shortcuts methods via the "properties" argument, or to a directly created
Dialog.
In both cases, a mixture of built-in buttons,
custom buttons,
and other components (such as a LayoutSpacer) can be
passed. Built-in buttons
can be referred to as isc.Dialog.OK, for example:
isc.Dialog.create({
buttons:[
isc.Dialog.OK,
isc.Dialog.CANCEL,
isc.LayoutSpacer.create({width:50}),
{ title:"Not now", click:"doSomething()" }
]
})
Built-in buttons will call standard methods on the Dialog itself, such as
Dialog.cancelClick, as explained in the
list of built-in buttons.
buttons - buttons Default value is null
IllegalStateException - this property cannot be changed after the component has been created
public void setMessageStyle(String messageStyle)
throws IllegalStateException
Note : This is an advanced setting
messageStyle - messageStyle Default value is "normal"
IllegalStateException - this property cannot be changed after the component has been created
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||