|
|||||||||
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.DialogBox
public class DialogBox
A form of popup that has a caption area at the top and can be dragged by the user.
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 |
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 | |
---|---|
java.lang.String |
getHTML()
Gets this object's contents as HTML. |
java.lang.String |
getText()
Gets this object's text. |
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. |
boolean |
remove(Widget w)
Removes a child widget. |
void |
setHTML(java.lang.String html)
Sets this object's contents via HTML. |
void |
setText(java.lang.String text)
Sets this object's text. |
void |
setWidget(Widget w)
Sets this panel's widget. |
void |
setWidth(java.lang.String width)
Override, so that interior panel reflows to match parent's new width. |
Methods inherited from class com.google.gwt.user.client.ui.PopupPanel |
---|
addPopupListener, center, getContainerElement, getOffsetHeight, getOffsetWidth, getPopupLeft, getPopupTop, getStyleElement, getTitle, hide, onDetach, onKeyDownPreview, onKeyPressPreview, onKeyUpPreview, removePopupListener, setHeight, setPopupPosition, setPopupPositionAndShow, setTitle, setVisible, show |
Methods inherited from class com.google.gwt.user.client.ui.SimplePanel |
---|
add, getWidget, iterator |
Methods inherited from class com.google.gwt.user.client.ui.Panel |
---|
adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, onLoad, onUnload, orphan |
Methods inherited from class com.google.gwt.user.client.ui.Widget |
---|
getParent, isAttached, onAttach, onBrowserEvent, removeFromParent, setElement |
Methods inherited from class com.google.gwt.user.client.ui.UIObject |
---|
addStyleDependentName, addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, isVisible, removeStyleDependentName, removeStyleName, 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 boolean remove(Widget w)
Panel
How to Override this Method
There are several important things that must take place in the correct order to properly remove a Widget from a Panel. Not all of these steps will be relevant to every Panel, but all of the steps must be considered.
false
if it is not.Panel.orphan(Widget)
first while the child
Widget is still attached.WidgetCollection
.
remove
in interface HasWidgets
remove
in class SimplePanel
w
- the widget to be removed
true
if the child was presentpublic void setHTML(java.lang.String html)
HasHTML
HasText.setText(String)
whenever possible.
setHTML
in interface HasHTML
html
- the object's new HTMLpublic void setText(java.lang.String text)
HasText
setText
in interface HasText
text
- the object's new textpublic void setWidget(Widget w)
SimplePanel
setWidget
in class PopupPanel
w
- the panel's new widget, or null
to clear the panelpublic void setWidth(java.lang.String width)
setWidth
in class PopupPanel
width
- the object's new width, in CSS units (e.g. "10px", "1em")
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |