public class MessageBox extends Dialog implements HasIcon
Custom Dialog
for displaying information to the user.
Note that the MessageBox
is asynchronous. Unlike a regular
JavaScript alert
(which will halt browser execution), showing a
MessageBox will not cause the code to stop.
Modifier and Type | Class and Description |
---|---|
static interface |
MessageBox.MessageBoxAppearance |
static interface |
MessageBox.MessageBoxIcons |
Dialog.DefaultDialogMessages, Dialog.DialogMessages, Dialog.PredefinedButton
Window.DefaultWindowMessages, Window.WindowAppearance, Window.WindowMessages
ContentPanel.ContentPanelAppearance, ContentPanel.ContentPanelMessages, ContentPanel.DefaultContentPanelMessages, ContentPanel.PanelHeaderAppearance
Modifier and Type | Field and Description |
---|---|
protected ImageResource |
icon |
static MessageBox.MessageBoxIcons |
ICONS
The basic icons used to decorate the message box.
|
ariaMoveResizeDistance, closeBtn, dragger, manager, removeFromParentOnHide, restoreBtn
buttonBar, header, secondPassRequired
resize, widget
forceLayoutCommand, forceLayoutOnResize, hadLayoutRunning, layoutCommand, layoutRequiredThisEventLoop, layoutRunning
adjustSize, allowTextSelection, cacheSizes, disableContextMenu, disabled, disabledStyle, ensureVisibilityOnSizing, height, hidden, lastSize, layer, left, mask, maskMessage, monitorWindowResize, pageX, pageY, shim, tabIndex, toolTip, toolTipConfig, top, width, windowResizeDelay, windowResizeTask
Constructor and Description |
---|
MessageBox(SafeHtml headingHtml)
Creates a message box with the specified heading text.
|
MessageBox(SafeHtml headingHtml,
SafeHtml messageHtml)
Creates a message box with the default message box appearance and the
specified heading and message HTML.
|
MessageBox(SafeHtml headingHtml,
SafeHtml messageHtml,
Window.WindowAppearance windowAppearance,
MessageBox.MessageBoxAppearance messageBoxAppearance)
Creates a message box with the specified heading HTML, message HTML and
windowAppearance.
|
MessageBox(String headingText)
Creates a message box with the specified heading text.
|
MessageBox(String headingText,
String messageText)
Creates a message box with the specified heading and message text.
|
Modifier and Type | Method and Description |
---|---|
ImageResource |
getIcon()
Returns the icon.
|
MessageBox.MessageBoxAppearance |
getMessageBoxAppearance()
Returns the message box appearance.
|
protected void |
onResize(int width,
int height)
Called after the widget is resized, this method is empty by default but can be implemented by any subclass that
needs to perform custom logic after a resize occurs.
|
protected void |
resizeContents()
Resize contents on
show() and onResize(int, int) |
void |
setIcon(ImageResource icon)
Sets the icon.
|
void |
setMessage(SafeHtml message)
Sets the message.
|
void |
setMessage(String message)
Sets the message.
|
void |
show()
Shows the window, rendering it first if necessary, or activates it and brings it to front if hidden.
|
addDialogHideHandler, createButtons, getButton, getDialogMessages, getPredefinedButton, getPredefinedButtons, getText, hide, isHideOnButtonClick, onButtonPressed, setDialogMessages, setHideOnButtonClick, setPredefinedButtons
addActivateHandler, addDeactivateHandler, addMaximizeHandler, addMinimizeHandler, addRestoreHandler, afterShow, alignTo, center, createGhost, doFocus, doLayout, fitContainer, focus, getAppearance, getConstrain, getContainer, getDraggable, getFocusWidget, getMinHeight, getMinWidth, getModalPanel, getResizable, getWindowMessages, ghost, initTools, isAutoHide, isBlinkModal, isClosable, isDraggable, isMaximizable, isMaximized, isMinimizable, isModal, isOnEsc, isResizable, maximize, minimize, onAfterFirstAttach, onBrowserEvent, onDetach, onDragCancel, onDragEnd, onDragMove, onDragStart, onEndResize, onKeyPress, onStartResize, onWindowResize, restore, setActive, setAutoHide, setBlinkModal, setClosable, setConstrain, setContainer, setDraggable, setFocusWidget, setMaximizable, setMinHeight, setMinimizable, setMinWidth, setModal, setOnEsc, setPagePosition, setPosition, setResizable, setWindowMessages, setZIndex, showWindow, toBack, toFront, unghost
addBeforeCollapseHandler, addBeforeExpandHandler, addButton, addCollapseHandler, addExpandHandler, addTool, adjustBodySize, afterCollapse, afterExpand, collapse, doAttachChildren, doDetachChildren, doLayoutButtonBar, expand, forceLayout, getAnimationDuration, getBody, getButtonAlign, getButtonBar, getContainerTarget, getFrameSize, getHeader, getHeading, getMessages, getMinButtonWidth, isAnimCollapse, isCollapsed, isCollapsible, isExpanded, isHideCollapseTool, isTitleCollapse, layoutBars, onClick, onCollapse, onDisable, onEnable, onExpand, setAnimationDuration, setAnimCollapse, setBodyBorder, setBodyStyle, setBodyStyleName, setButtonAlign, setCollapsible, setExpanded, setHeaderVisible, setHeading, setHideCollapseTool, setMessages, setMinButtonWidth, setTitleCollapse
add, add, getWidget, isResize, onRemove, setElement, setResize, setWidget, setWidget
applyLayout, applyLayout, forceLayoutOnChildren, forceLayoutOnChildren, getLeftRightMargins, getParentLayoutWidget, getSideMargins, getTopBottomMargins, isLayoutRunning, isOrWasLayoutRunning, isWidgetVisible, onBeforeDoLayout, onLoad, onResize
addAddHandler, addBeforeAddHandler, addBeforeRemoveHandler, addContainerHandler, addRemoveHandler, adjustIndex, adopt, checkIndexBoundsForInsertion, clear, disable, doPhysicalAttach, doPhysicalDetach, enable, ensureGroupingHandlerRegistration, findWidget, getChildren, getItemByItemId, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, iterator, onInsert, onWidgetHide, onWidgetShow, orphan, remove, remove, remove
addBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addGestureRecognizer, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleDependentName, addStyleOnOver, adjustPosition, adjustSize, applyState, assertAfterRender, assertPreRender, blur, clearSizeCache, disableContextMenu, disableEvents, enableEvents, fireCancellableEvent, fireEvent, getData, getElement, getFocusEl, getFocusSupport, getGestureRecognizer, getGestureRecognizerCount, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getPositionEl, getShadow, getShadowPosition, getStateId, getTabIndex, getToolTip, hideShadow, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isMonitorWindowResize, isRendered, isStateful, isVisible, isVisible, mask, mask, notifyHide, notifyShow, onAttach, onBlur, onFocus, onHide, onHideContextMenu, onPosition, onRightClick, onShow, onShowContextMenu, onTouch, onUnload, removeStyleDependentName, removeStyleOnOver, removeToolTip, setAllowTextSelection, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHeight, setHideMode, setId, setItemId, setMonitorWindowResize, setPixelSize, setShadow, setShadowPosition, setSize, setStateful, setStateId, setStyleDependentName, setTabIndex, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, sync, syncSize, unmask
public static MessageBox.MessageBoxIcons ICONS
protected ImageResource icon
public MessageBox(String headingText)
headingText
- the text to display for the message box heading.public MessageBox(SafeHtml headingHtml)
headingHtml
- the html to display for the message box headingpublic MessageBox(String headingText, String messageText)
headingText
- the text to display for the message box headingmessageText
- the text to display in the message boxpublic MessageBox(SafeHtml headingHtml, SafeHtml messageHtml)
headingHtml
- the HTML to display for the message box headingmessageHtml
- the HTML to display in the message boxpublic MessageBox(SafeHtml headingHtml, SafeHtml messageHtml, Window.WindowAppearance windowAppearance, MessageBox.MessageBoxAppearance messageBoxAppearance)
headingHtml
- the HTML to display for the message box headingmessageHtml
- the HTML to display in the message boxwindowAppearance
- the message box window windowAppearancemessageBoxAppearance
- the message box content windowAppearancepublic ImageResource getIcon()
HasIcon
public MessageBox.MessageBoxAppearance getMessageBoxAppearance()
public void setIcon(ImageResource icon)
HasIcon
public void setMessage(String message)
setMessage(SafeHtml)
to display HTML.message
- the messagepublic void setMessage(SafeHtml message)
message
- the messageprotected void onResize(int width, int height)
Component
onResize
in class ContentPanel
width
- the widthheight
- the heightpublic void show()
Window
protected void resizeContents()
show()
and onResize(int, int)
Copyright © 2018. All rights reserved.