|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.extjs.gxt.ui.client.widget.MessageBox
public class MessageBox
Utility class for generating different styles of message boxes.
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.
Nested Class Summary | |
---|---|
static class |
MessageBox.MessageBoxType
MessageBox type enumeration. |
Field Summary | |
---|---|
static java.lang.String |
CANCEL
Button constant that displays a single CANCEL button. |
static java.lang.String |
ERROR
The CSS style name that provides the ERROR icon image. |
static java.lang.String |
INFO
The CSS style name that provides the INFO icon image. |
static java.lang.String |
OK
Button constant that displays a single OK button. |
static java.lang.String |
OKCANCEL
Button constant that displays a OK and CANCEL button. |
static java.lang.String |
QUESTION
The CSS style name that provides the QUESTION icon image. |
static java.lang.String |
WARNING
The CSS style name that provides the WARNING icon image. |
static java.lang.String |
YESNO
Button constant that displays a YES and NO button. |
static java.lang.String |
YESNOCANCEL
Button constant that displays a YES, NO, and CANCEL button. |
Constructor Summary | |
---|---|
MessageBox()
|
Method Summary | |
---|---|
void |
addCallback(Listener<MessageBoxEvent> listener)
Adds a listener that will be called when the message box is closed. |
void |
addListener(EventType event,
Listener<MessageBoxEvent> listener)
Convenience method to add a listener to the underlying dialog instance. |
static MessageBox |
alert(java.lang.String title,
java.lang.String msg,
Listener<MessageBoxEvent> callback)
Displays a standard read-only message box with an OK button (comparable to the basic JavaScript alert prompt). |
void |
close()
Closes the message box. |
static MessageBox |
confirm(java.lang.String title,
java.lang.String msg,
Listener<MessageBoxEvent> callback)
Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm). |
java.lang.String |
getButtons()
Returns the buttons. |
int |
getDefaultTextHeight()
Returns the default text height. |
Dialog |
getDialog()
Returns the underlying window. |
int |
getMaxWidth()
Returns the max width. |
java.lang.String |
getMessage()
Returns the message. |
int |
getMinProgressWidth()
Returns the min progress width. |
int |
getMinWidth()
Returns the min width. |
ProgressBar |
getProgressBar()
Returns the box's progress applies. |
java.lang.String |
getProgressText()
Returns the progress text. |
TextArea |
getTextArea()
Returns the box's text area. |
TextField<java.lang.String> |
getTextBox()
Returns the box's text box. |
java.lang.String |
getTitle()
Returns the title text. |
MessageBox.MessageBoxType |
getType()
Returns the message box type. |
void |
hide()
Deprecated. use close() |
static MessageBox |
info(java.lang.String title,
java.lang.String msg,
Listener<MessageBoxEvent> callback)
Displays a standard read-only message box with an OK button (comparable to the basic JavaScript alert prompt). |
boolean |
isClosable()
Returns true if the hide button is displayed. |
boolean |
isModal()
Returns true if modal is enabled. |
boolean |
isVisible()
Returns true if the message box is currently displayed. |
static MessageBox |
progress(java.lang.String title,
java.lang.String msg,
java.lang.String progressText)
Displays a message box with a progress bar. |
static MessageBox |
prompt(java.lang.String title,
java.lang.String msg)
Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). |
static MessageBox |
prompt(java.lang.String title,
java.lang.String msg,
boolean multiline)
Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). |
static MessageBox |
prompt(java.lang.String title,
java.lang.String msg,
boolean multiline,
Listener<MessageBoxEvent> callback)
Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). |
static MessageBox |
prompt(java.lang.String title,
java.lang.String msg,
Listener<MessageBoxEvent> callback)
Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). |
void |
setButtons(java.lang.String buttons)
The buttons to display (defaults to OK, pre-render). |
void |
setClosable(boolean closable)
False to hide the top-right close button (defaults to true, pre-render). |
void |
setDefaultTextHeight(int defaultTextHeight)
The default height in pixels of the message box's multiline textarea if displayed (defaults to 75, pre-render). |
void |
setIcon(java.lang.String iconStyle)
Adds the specified icon to the dialog. |
void |
setMaxWidth(int maxWidth)
The maximum width in pixels of the message box (defaults to 600, pre-render). |
void |
setMessage(java.lang.String message)
A string that will replace the existing message box body text (defaults to the XHTML-compliant non-breaking space character ' '). |
void |
setMinProgressWidth(int minProgressWidth)
The minimum width in pixels of the message box if it is a progress-style dialog. |
void |
setMinWidth(int minWidth)
The minimum width in pixels of the message box (defaults to 100, pre-render). |
void |
setModal(boolean modal)
False to allow user interaction with the page while the message box is displayed (defaults to true, pre-render). |
void |
setProgressText(java.lang.String progressText)
The text to display inside the progress bar if progress = true (defaults to "", pre-render). |
void |
setTitle(java.lang.String title)
Sets the title text (pre-render). |
void |
setType(MessageBox.MessageBoxType type)
Sets the message box type (pre-render). |
void |
show()
Displays the message box. |
MessageBox |
updateProgress(double value,
java.lang.String text)
Updates a progress-style message box's text and progress bar. |
MessageBox |
updateText(java.lang.String text)
Updates the message box body text. |
static MessageBox |
wait(java.lang.String title,
java.lang.String msg,
java.lang.String progressText)
Displays a message box with an infinitely auto-updating progress bar. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String OK
public static final java.lang.String CANCEL
public static final java.lang.String OKCANCEL
public static final java.lang.String YESNO
public static final java.lang.String YESNOCANCEL
public static java.lang.String INFO
public static java.lang.String WARNING
public static java.lang.String QUESTION
public static java.lang.String ERROR
Constructor Detail |
---|
public MessageBox()
Method Detail |
---|
public static MessageBox alert(java.lang.String title, java.lang.String msg, Listener<MessageBoxEvent> callback)
title
- the title bar textmsg
- the message box body textcallback
- listener to be called when the box is closed
public static MessageBox confirm(java.lang.String title, java.lang.String msg, Listener<MessageBoxEvent> callback)
title
- the title bar textmsg
- the message box body textcallback
- the listener invoked after the message box is closed
public static MessageBox info(java.lang.String title, java.lang.String msg, Listener<MessageBoxEvent> callback)
title
- the title bar textmsg
- the message box body textcallback
- listener to be called when the box is closed
public static MessageBox progress(java.lang.String title, java.lang.String msg, java.lang.String progressText)
updateProgress(double, java.lang.String)
title
- the title bar textmsg
- the message box body textprogressText
- the text to display inside the progress bar
public static MessageBox prompt(java.lang.String title, java.lang.String msg)
title
- the title bar textmsg
- the message box body text
public static MessageBox prompt(java.lang.String title, java.lang.String msg, boolean multiline)
title
- the title bar textmsg
- the message box body textmultiline
- true for a multi-line text aread
public static MessageBox prompt(java.lang.String title, java.lang.String msg, boolean multiline, Listener<MessageBoxEvent> callback)
title
- the title bar textmsg
- the message box body textmultiline
- true for a multi-line text aread
public static MessageBox prompt(java.lang.String title, java.lang.String msg, Listener<MessageBoxEvent> callback)
title
- the title bar textmsg
- the message box body textcallback
- the callback
public static MessageBox wait(java.lang.String title, java.lang.String msg, java.lang.String progressText)
title
- the title bar textmsg
- the message box body textprogressText
- the text to display inside the progress bar
public void addCallback(Listener<MessageBoxEvent> listener)
listener
- the callback listenerpublic void addListener(EventType event, Listener<MessageBoxEvent> listener)
event
- the event typelistener
- the listenerpublic void close()
public java.lang.String getButtons()
public int getDefaultTextHeight()
public Dialog getDialog()
public int getMaxWidth()
public java.lang.String getMessage()
public int getMinProgressWidth()
public int getMinWidth()
public ProgressBar getProgressBar()
public java.lang.String getProgressText()
public TextArea getTextArea()
public TextField<java.lang.String> getTextBox()
public java.lang.String getTitle()
public MessageBox.MessageBoxType getType()
public void hide()
close()
public boolean isClosable()
public boolean isModal()
public boolean isVisible()
public void setButtons(java.lang.String buttons)
buttons
- the buttonspublic void setClosable(boolean closable)
closable
- false to hide the top-right close buttonpublic void setDefaultTextHeight(int defaultTextHeight)
defaultTextHeight
- the default text heightpublic void setIcon(java.lang.String iconStyle)
MessageBox.INFO MessageBox.WARNING MessageBox.QUESTION MessageBox.ERROR
iconStyle
- the icon stylepublic void setMaxWidth(int maxWidth)
maxWidth
- the max widthpublic void setMessage(java.lang.String message)
message
- the messagepublic void setMinProgressWidth(int minProgressWidth)
minProgressWidth
- the min progress widthpublic void setMinWidth(int minWidth)
minWidth
- the min widthpublic void setModal(boolean modal)
modal
- true for modalpublic void setProgressText(java.lang.String progressText)
progressText
- the progress textpublic void setTitle(java.lang.String title)
title
- the title textpublic void setType(MessageBox.MessageBoxType type)
type
- the typepublic void show()
public MessageBox updateProgress(double value, java.lang.String text)
progress(java.lang.String, java.lang.String, java.lang.String)
.
value
- any number between 0 and 1 (e.g., .5)text
- the progress text to display inside the progress bar or null
public MessageBox updateText(java.lang.String text)
text
- the new text or null to clear
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |