|
|||||||||
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.google.gwt.user.client.ui.Panel
com.google.gwt.user.client.ui.SimplePanel
com.google.gwt.user.client.ui.PopupPanel
com.google.gwt.user.client.ui.DecoratedPopupPanel
com.google.gwt.user.client.ui.DialogBox
public class DialogBox
A form of popup that has a caption area at the top and can be dragged by the
user. Unlike a PopupPanel, calls to PopupPanel.setWidth(String)
and
PopupPanel.setHeight(String)
will set the width and height of the dialog box
itself, even if a widget has not been added as yet.
public class DialogBoxExample implements EntryPoint, ClickListener { private static class MyDialog extends DialogBox { public MyDialog() { // Set the dialog box's caption. setText("My First Dialog"); // DialogBox is a SimplePanel, so you have to set its widget property to // whatever you want its contents to be. Button ok = new Button("OK"); ok.addClickListener(new ClickListener() { public void onClick(Widget sender) { MyDialog.this.hide(); } }); setWidget(ok); } } public void onModuleLoad() { Button b = new Button("Click me"); b.addClickListener(this); RootPanel.get().add(b); } public void onClick(Widget sender) { // Instantiate the dialog box and show it. new MyDialog().show(); } }
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.PopupPanel |
---|
PopupPanel.PositionCallback |
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
---|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled |
Field Summary |
---|
Fields inherited from class com.google.gwt.user.client.ui.UIObject |
---|
DEBUG_ID_PREFIX |
Constructor Summary | |
---|---|
DialogBox()
Creates an empty dialog box. |
|
DialogBox(boolean autoHide)
Creates an empty dialog box specifying its "auto-hide" property. |
|
DialogBox(boolean autoHide,
boolean modal)
Creates an empty dialog box specifying its "auto-hide" property. |
Method Summary | |
---|---|
protected void |
doAttachChildren()
If a widget implements HasWidgets, it must override this method and call onAttach() for each of its child widgets. |
protected void |
doDetachChildren()
If a widget implements HasWidgets, it must override this method and call onDetach() for each of its child widgets. |
java.lang.String |
getHTML()
Gets this object's contents as HTML. |
java.lang.String |
getText()
Gets this object's text. |
protected void |
onEnsureDebugId(java.lang.String baseID)
Affected Elements: -caption = text at the top of the DialogBox .
-content = the container around the content.
|
boolean |
onEventPreview(Event event)
Called when a browser event occurs and this event preview is on top of the preview stack. |
void |
onMouseDown(Widget sender,
int x,
int y)
Fired when the user depresses the mouse button over a widget. |
void |
onMouseEnter(Widget sender)
Fired when the mouse enters a widget's area. |
void |
onMouseLeave(Widget sender)
Fired when the mouse leaves a widget's area. |
void |
onMouseMove(Widget sender,
int x,
int y)
Fired when the user moves the mouse over a widget. |
void |
onMouseUp(Widget sender,
int x,
int y)
Fired when the user releases the mouse button over a widget. |
void |
setHTML(java.lang.String html)
Sets the html string inside the caption. |
void |
setText(java.lang.String text)
Sets the text inside the caption. |
Methods inherited from class com.google.gwt.user.client.ui.DecoratedPopupPanel |
---|
clear, getCellElement, getWidget, iterator, remove, setWidget |
Methods inherited from class com.google.gwt.user.client.ui.PopupPanel |
---|
addPopupListener, center, getContainerElement, getOffsetHeight, getOffsetWidth, getPopupLeft, getPopupTop, getTitle, hide, hide, isAnimationEnabled, onDetach, onKeyDownPreview, onKeyPressPreview, onKeyUpPreview, removePopupListener, setAnimationEnabled, setHeight, setPopupPosition, setPopupPositionAndShow, setTitle, setVisible, setWidth, show |
Methods inherited from class com.google.gwt.user.client.ui.SimplePanel |
---|
add |
Methods inherited from class com.google.gwt.user.client.ui.Panel |
---|
adopt, adopt, disown, onLoad, onUnload, orphan |
Methods inherited from class com.google.gwt.user.client.ui.Widget |
---|
getParent, isAttached, onAttach, onBrowserEvent, removeFromParent |
Methods inherited from class com.google.gwt.user.client.ui.UIObject |
---|
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, isVisible, removeStyleDependentName, removeStyleName, setElement, setElement, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, sinkEvents, toString, unsinkEvents |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DialogBox()
SimplePanel.add(Widget)
.
public DialogBox(boolean autoHide)
SimplePanel.add(Widget)
.
autoHide
- true
if the dialog should be automatically
hidden when the user clicks outside of itpublic DialogBox(boolean autoHide, boolean modal)
SimplePanel.add(Widget)
.
autoHide
- true
if the dialog should be automatically
hidden when the user clicks outside of itmodal
- true
if keyboard and mouse events for widgets
not contained by the dialog should be ignoredMethod Detail |
---|
public java.lang.String getHTML()
HasHTML
getHTML
in interface HasHTML
public java.lang.String getText()
HasText
getText
in interface HasText
public boolean onEventPreview(Event event)
EventPreview
onEventPreview
in interface EventPreview
onEventPreview
in class PopupPanel
event
- the browser event
false
to cancel the eventDOM.addEventPreview(EventPreview)
public void onMouseDown(Widget sender, int x, int y)
MouseListener
onMouseDown
in interface MouseListener
sender
- the widget sending the eventx
- the x coordinate of the mousey
- the y coordinate of the mousepublic void onMouseEnter(Widget sender)
MouseListener
onMouseEnter
in interface MouseListener
sender
- the widget sending the eventpublic void onMouseLeave(Widget sender)
MouseListener
onMouseLeave
in interface MouseListener
sender
- the widget sending the eventpublic void onMouseMove(Widget sender, int x, int y)
MouseListener
onMouseMove
in interface MouseListener
sender
- the widget sending the eventx
- the x coordinate of the mousey
- the y coordinate of the mousepublic void onMouseUp(Widget sender, int x, int y)
MouseListener
onMouseUp
in interface MouseListener
sender
- the widget sending the eventx
- the x coordinate of the mousey
- the y coordinate of the mousepublic void setHTML(java.lang.String html)
DecoratedPopupPanel.setWidget(Widget)
to set the contents inside the
DialogBox
.
setHTML
in interface HasHTML
html
- the object's new HTMLpublic void setText(java.lang.String text)
DecoratedPopupPanel.setWidget(Widget)
to set the contents inside the
DialogBox
.
setText
in interface HasText
text
- the object's new textprotected void doAttachChildren()
Widget
doAttachChildren
in class DecoratedPopupPanel
Widget.onAttach()
protected void doDetachChildren()
Widget
doDetachChildren
in class DecoratedPopupPanel
Widget.onDetach()
protected void onEnsureDebugId(java.lang.String baseID)
DialogBox
.
onEnsureDebugId
in class UIObject
baseID
- the base ID used by the main elementUIObject.onEnsureDebugId(String)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |