|
GWT 2.0.3 | ||||||||
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.ComplexPanel
com.google.gwt.user.client.ui.StackPanel
public class StackPanel
A panel that stacks its children vertically, displaying only one at a time, with a header for each child which the user can click to display.
This widget will only work in quirks mode. If your application is in
Standards Mode, use StackLayoutPanel
instead.
public class StackPanelExample implements EntryPoint { public void onModuleLoad() { // Create a stack panel containing three labels. StackPanel panel = new StackPanel(); panel.add(new Label("Foo"), "foo"); panel.add(new Label("Bar"), "bar"); panel.add(new Label("Baz"), "baz"); // Add it to the root panel. RootPanel.get().add(panel); } }
StackLayoutPanel
Nested Class Summary |
---|
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 | |
---|---|
StackPanel()
Creates an empty stack panel. |
Method Summary | |
---|---|
void |
add(Widget w)
Adds a child widget. |
void |
add(Widget w,
java.lang.String stackText)
Adds a new child with the given widget and header. |
void |
add(Widget w,
java.lang.String stackText,
boolean asHTML)
Adds a new child with the given widget and header, optionally interpreting the header as HTML. |
int |
getSelectedIndex()
Gets the currently selected child index. |
void |
insert(Widget w,
int beforeIndex)
Inserts a child widget before the specified index. |
void |
onBrowserEvent(Event event)
Fired whenever a browser event is received. |
protected void |
onEnsureDebugId(java.lang.String baseID)
Affected Elements: -text# = The element around the header at the specified index. -text-wrapper# = The element around the header at the specified index. -content# = The element around the body at the specified index. |
boolean |
remove(int index)
Removes the widget at the specified index. |
boolean |
remove(Widget child)
Removes a child widget. |
void |
setStackText(int index,
java.lang.String text)
Sets the text associated with a child by its index. |
void |
setStackText(int index,
java.lang.String text,
boolean asHTML)
Sets the text associated with a child by its index. |
void |
showStack(int index)
Shows the widget at the specified child index. |
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel |
---|
add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, insert, insert, 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 |
---|
addDomHandler, addHandler, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onDetach, removeFromParent, setLayoutData, sinkEvents |
Methods inherited from class com.google.gwt.user.client.ui.UIObject |
---|
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.google.gwt.user.client.ui.IndexedPanel |
---|
getWidget, getWidgetCount, getWidgetIndex |
Constructor Detail |
---|
public StackPanel()
Method Detail |
---|
public void add(Widget w)
Panel
How to Override this Method
There are several important things that must take place in the correct order to properly add or insert a Widget to a Panel. Not all of these steps will be relevant to every Panel, but all of the steps must be considered.
ComplexPanel.adjustIndex(Widget, int)
.Widget.removeFromParent()
on the
Widget.WidgetCollection
at the appropriate index.Panel.adopt(Widget)
to finalize the add as the
very last step.
add
in interface HasWidgets
add
in interface InsertPanel
add
in class Panel
w
- the widget to be addedHasWidgets.add(Widget)
public void add(Widget w, java.lang.String stackText)
w
- the widget to be addedstackText
- the header text associated with this widgetpublic void add(Widget w, java.lang.String stackText, boolean asHTML)
w
- the widget to be addedstackText
- the header text associated with this widgetasHTML
- true
to treat the specified text as HTMLpublic int getSelectedIndex()
public void insert(Widget w, int beforeIndex)
InsertPanel
insert
in interface InsertPanel
w
- the child widget to be insertedbeforeIndex
- the index before which it will be insertedpublic void onBrowserEvent(Event event)
EventListener
onBrowserEvent
in interface EventListener
onBrowserEvent
in class Widget
event
- the event receivedpublic boolean remove(int index)
IndexedPanel
remove
in interface IndexedPanel
remove
in class ComplexPanel
index
- the index of the widget to be removed
false
if the widget is not presentpublic boolean remove(Widget child)
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 ComplexPanel
child
- the widget to be removed
true
if the child was presentpublic void setStackText(int index, java.lang.String text)
index
- the index of the child whose text is to be settext
- the text to be associated with itpublic void setStackText(int index, java.lang.String text, boolean asHTML)
index
- the index of the child whose text is to be settext
- the text to be associated with itasHTML
- true
to treat the specified text as HTMLpublic void showStack(int index)
index
- the index of the child to be shownprotected void onEnsureDebugId(java.lang.String baseID)
onEnsureDebugId
in class UIObject
baseID
- the base ID used by the main elementUIObject.onEnsureDebugId(String)
|
GWT 2.0.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |