|
|||||||||
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.Composite
com.google.gwt.user.client.ui.StackLayoutPanel
public class StackLayoutPanel
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 standards mode, which requires that the HTML page in which it is run have an explicit <!DOCTYPE> declaration.
public class StackLayoutPanelExample implements EntryPoint { public void onModuleLoad() { // Create a three-item stack, with headers sized in EMs. StackLayoutPanel p = new StackLayoutPanel(Unit.EM); p.add(new HTML("this"), new HTML("[this]"), 4); p.add(new HTML("that"), new HTML("[that]"), 4); p.add(new HTML("the other"), new HTML("[the other]"), 4); // Attach the LayoutPanel to the RootLayoutPanel. The latter will listen for // resize events on the window to ensure that its children are informed of // possible size changes. RootLayoutPanel rp = RootLayoutPanel.get(); rp.add(p); } }
A StackLayoutPanel element in a
UiBinder
template may have a
unit
attribute with a
Style.Unit
value (it defaults to
PX).
The children of a StackLayoutPanel element are laid out in <g:stack>
elements. Each stack can have one widget child and one of two types of header
elements. A <g:header> element can hold html, or a <g:customHeader>
element can hold a widget. (Note that the tags of the header elements are not
capitalized. This is meant to signal that the head is not a runtime object,
and so cannot have a ui:field
attribute.)
For example:
<g:StackLayoutPanel unit='PX'> <g:stack> <g:header size='3'><b>HTML</b> header</g:header> <g:Label>able</g:Label> </g:stack> <g:stack> <g:customHeader size='3'> <g:Label>Custom header</g:Label> </g:customHeader> <g:Label>baker</g:Label> </g:stack> </g: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 | |
---|---|
StackLayoutPanel(Style.Unit unit)
Creates an empty stack panel. |
Method Summary | |
---|---|
void |
add(Widget w)
Adds a child widget. |
void |
add(Widget widget,
Widget header,
double headerSize)
Adds a child widget to this stack, along with a widget representing the stack header. |
void |
clear()
Removes all child widgets. |
java.util.Iterator<Widget> |
iterator()
Gets an iterator for the contained widgets. |
protected void |
onLoad()
This method is called immediately after a widget becomes attached to the browser's document. |
void |
onResize()
This method must be called whenever the implementor's size has been modified. |
boolean |
remove(Widget child)
Removes a child widget. |
void |
showWidget(Widget widget)
Shows the specified widget. |
Methods inherited from class com.google.gwt.user.client.ui.Composite |
---|
getWidget, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, setWidget |
Methods inherited from class com.google.gwt.user.client.ui.Widget |
---|
addDomHandler, addHandler, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onUnload, 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, onEnsureDebugId, 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 |
Constructor Detail |
---|
public StackLayoutPanel(Style.Unit unit)
unit
- the unit to be used for layoutMethod Detail |
---|
public void add(Widget w)
HasWidgets
add
in interface HasWidgets
w
- the widget to be addedpublic void add(Widget widget, Widget header, double headerSize)
widget
- the child widget to be addedheader
- the header widgetheaderSize
- the size of the header widgetpublic void clear()
HasWidgets
clear
in interface HasWidgets
public java.util.Iterator<Widget> iterator()
HasWidgets
Iterator.remove()
.
iterator
in interface HasWidgets
iterator
in interface java.lang.Iterable<Widget>
public void onResize()
RequiresResize
onResize
in interface RequiresResize
public boolean remove(Widget child)
HasWidgets
remove
in interface HasWidgets
child
- the widget to be removed
true
if the widget was presentpublic void showWidget(Widget widget)
widget
- the child widget to be shown.protected void onLoad()
Widget
onLoad
in class Widget
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |