|
|||||||||
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
public class PopupPanel
A panel that can "pop up" over other widgets. It overlays the browser's client area (and any previously-created popups).
public class PopupPanelExample implements EntryPoint, ClickListener { private static class MyPopup extends PopupPanel { public MyPopup() { // PopupPanel's constructor takes 'auto-hide' as its boolean parameter. // If this is set, the panel closes itself automatically when the user // clicks outside of it. super(true); // PopupPanel is a SimplePanel, so you have to set it's widget property to // whatever you want its contents to be. setWidget(new Label("Click outside of this popup to close it")); } } public void onModuleLoad() { Button b = new Button("Click me"); b.addClickListener(this); RootPanel.get().add(b); } public void onClick(Widget sender) { // Instantiate the popup and show it. new MyPopup().show(); } }
Constructor Summary | |
---|---|
PopupPanel()
Creates an empty popup panel. |
|
PopupPanel(boolean autoHide)
Creates an empty popup panel, specifying its "auto-hide" property. |
Method Summary | |
---|---|
void |
addPopupListener(PopupListener listener)
Adds a listener interface to receive popup events. |
int |
getPopupLeft()
Gets the popup's left position relative to the browser's client area. |
int |
getPopupTop()
Gets the popup's top position relative to the browser's client area. |
void |
hide()
Hides the popup. |
boolean |
onEventPreview(Event event)
Called when a browser event occurs and this event preview is on top of the preview stack. |
boolean |
onKeyDownPreview(char key,
int modifiers)
Popups get an opportunity to preview keyboard events before they are passed to any other widget. |
boolean |
onKeyPressPreview(char key,
int modifiers)
Popups get an opportunity to preview keyboard events before they are passed to any other widget. |
boolean |
onKeyUpPreview(char key,
int modifiers)
Popups get an opportunity to preview keyboard events before they are passed to any other widget. |
boolean |
remove(Widget w)
Removes a child widget. |
void |
removePopupListener(PopupListener listener)
Removes a previously added popup listener. |
void |
setPopupPosition(int left,
int top)
Sets the popup's position relative to the browser's client area. |
void |
show()
Shows the popup. |
Methods inherited from class com.google.gwt.user.client.ui.SimplePanel |
---|
add, getContainerElement, getWidget, iterator, setWidget |
Methods inherited from class com.google.gwt.user.client.ui.Panel |
---|
adopt, clear, disown, onAttach, onDetach |
Methods inherited from class com.google.gwt.user.client.ui.Widget |
---|
getParent, isAttached, onBrowserEvent, onLoad, removeFromParent |
Methods inherited from class com.google.gwt.user.client.ui.UIObject |
---|
addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, getTitle, isVisible, isVisible, removeStyleName, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PopupPanel()
public PopupPanel(boolean autoHide)
autoHide
- true
if the popup should be automatically
hidden when the user clicks outside of itMethod Detail |
---|
public void addPopupListener(PopupListener listener)
SourcesPopupEvents
addPopupListener
in interface SourcesPopupEvents
listener
- the listener interface to add.public int getPopupLeft()
public int getPopupTop()
public void hide()
public boolean onEventPreview(Event event)
EventPreview
onEventPreview
in interface EventPreview
event
- the browser event
false
to cancel the eventDOM.addEventPreview(EventPreview)
public boolean onKeyDownPreview(char key, int modifiers)
key
- the key code of the depressed keymodifiers
- keyboard modifiers, as specified in
KeyboardListener
.
false
to suppress the eventpublic boolean onKeyPressPreview(char key, int modifiers)
key
- the unicode character pressedmodifiers
- keyboard modifiers, as specified in
KeyboardListener
.
false
to suppress the eventpublic boolean onKeyUpPreview(char key, int modifiers)
key
- the key code of the released keymodifiers
- keyboard modifiers, as specified in
KeyboardListener
.
false
to suppress the eventpublic boolean remove(Widget w)
HasWidgets
remove
in interface HasWidgets
remove
in class SimplePanel
w
- the widget to be removed
true
if the widget was presentpublic void removePopupListener(PopupListener listener)
SourcesPopupEvents
removePopupListener
in interface SourcesPopupEvents
listener
- the listener interface to remove.public void setPopupPosition(int left, int top)
show()
.
left
- the left position, in pixelstop
- the top position, in pixelspublic void show()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |