|
GWT 2.7.0 | |||||||
| 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.ResizeComposite
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 |
| Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets |
|---|
HasWidgets.ForIsWidget |
| Field Summary |
|---|
| Fields inherited from class com.google.gwt.user.client.ui.Widget |
|---|
eventsToSink |
| Fields inherited from class com.google.gwt.user.client.ui.UIObject |
|---|
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR |
| Constructor Summary | |
|---|---|
StackLayoutPanel(Style.Unit unit)
Creates an empty stack panel. |
|
| Method Summary | |
|---|---|
void |
add(IsWidget widget,
IsWidget header,
double headerSize)
Overloaded version for IsWidget. |
void |
add(IsWidget widget,
java.lang.String header,
boolean asHtml,
double headerSize)
Overloaded version for IsWidget. |
void |
add(Widget w)
Adds a child widget. |
void |
add(Widget widget,
SafeHtml header,
double headerSize)
Adds a child widget to this stack, along with a widget representing the stack header. |
void |
add(Widget widget,
java.lang.String header,
boolean asHtml,
double headerSize)
Adds a child widget to this stack, along with a widget representing the stack header. |
void |
add(Widget widget,
java.lang.String header,
double headerSize)
Adds a child widget to this stack, along with a widget representing the stack header. |
void |
add(Widget widget,
Widget header,
double headerSize)
Adds a child widget to this stack, along with a widget representing the stack header. |
HandlerRegistration |
addBeforeSelectionHandler(BeforeSelectionHandler<java.lang.Integer> handler)
Adds a BeforeSelectionEvent handler. |
HandlerRegistration |
addSelectionHandler(SelectionHandler<java.lang.Integer> handler)
Adds a SelectionEvent handler. |
void |
animate(int duration)
Layout children, animating over the specified period of time. |
void |
animate(int duration,
Layout.AnimationCallback callback)
Layout children, animating over the specified period of time. |
void |
clear()
Removes all child widgets. |
void |
forceLayout()
Layout children immediately. |
int |
getAnimationDuration()
Get the duration of the animated transition between children. |
Widget |
getHeaderWidget(int index)
Gets the widget in the stack header at the given index. |
Widget |
getHeaderWidget(Widget child)
Gets the widget in the stack header associated with the given child widget. |
int |
getVisibleIndex()
Gets the currently-selected index. |
Widget |
getVisibleWidget()
Gets the currently-selected widget. |
Widget |
getWidget(int index)
Gets the child widget at the specified index. |
int |
getWidgetCount()
Gets the number of child widgets in this panel. |
int |
getWidgetIndex(IsWidget child)
|
int |
getWidgetIndex(Widget child)
Gets the index of the specified child widget. |
void |
insert(Widget child,
SafeHtml html,
double headerSize,
int beforeIndex)
Inserts a widget into the panel. |
void |
insert(Widget child,
java.lang.String text,
boolean asHtml,
double headerSize,
int beforeIndex)
Inserts a widget into the panel. |
void |
insert(Widget child,
java.lang.String text,
double headerSize,
int beforeIndex)
Inserts a widget into the panel. |
void |
insert(Widget child,
Widget header,
double headerSize,
int beforeIndex)
Inserts a widget into the panel. |
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(int index)
Removes the widget at the specified index. |
boolean |
remove(Widget child)
Removes a child widget. |
void |
setAnimationDuration(int duration)
Set the duration of the animated transition between children. |
void |
setHeaderHTML(int index,
SafeHtml html)
Sets a stack header's HTML contents. |
void |
setHeaderHTML(int index,
java.lang.String html)
Sets a stack header's HTML contents. |
void |
setHeaderText(int index,
java.lang.String text)
Sets a stack header's text contents. |
void |
showWidget(int index)
Shows the widget at the specified index and fires events. |
void |
showWidget(int index,
boolean fireEvents)
Shows the widget at the specified index. |
void |
showWidget(Widget child)
Shows the specified widget and fires events. |
void |
showWidget(Widget child,
boolean fireEvents)
Shows the specified widget. |
| Methods inherited from class com.google.gwt.user.client.ui.ResizeComposite |
|---|
initWidget |
| Methods inherited from class com.google.gwt.user.client.ui.Composite |
|---|
claimElement, getWidget, initializeClaimedElement, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget |
| Methods inherited from class com.google.gwt.user.client.ui.Widget |
|---|
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isOrWasAttached, onUnload, removeFromParent, replaceElement, setLayoutData, setParent, sinkEvents, unsinkEvents |
| 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, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
|---|
fireEvent |
| Constructor Detail |
|---|
public StackLayoutPanel(Style.Unit unit)
unit - the unit to be used for layout| Method Detail |
|---|
public void add(Widget w)
HasWidgets
add in interface HasWidgetsw - the widget to be added
public void add(Widget widget,
SafeHtml header,
double headerSize)
widget - the child widget to be addedheader - the html to be shown on its headerheaderSize - the size of the header widget
public void add(Widget widget,
java.lang.String header,
boolean asHtml,
double headerSize)
widget - the child widget to be addedheader - the text to be shown on its headerasHtml - true to treat the specified text as HTMLheaderSize - the size of the header widget
public void add(IsWidget widget,
java.lang.String header,
boolean asHtml,
double headerSize)
add(Widget,String,boolean,double)
public void add(Widget widget,
java.lang.String header,
double headerSize)
widget - the child widget to be addedheader - the text to be shown on its headerheaderSize - the size of the header widget
public void add(Widget widget,
Widget header,
double headerSize)
widget - the child widget to be addedheader - the header widgetheaderSize - the size of the header widget
public void add(IsWidget widget,
IsWidget header,
double headerSize)
add(Widget,Widget,double)public HandlerRegistration addBeforeSelectionHandler(BeforeSelectionHandler<java.lang.Integer> handler)
HasBeforeSelectionHandlersBeforeSelectionEvent handler.
addBeforeSelectionHandler in interface HasBeforeSelectionHandlers<java.lang.Integer>handler - the handler
public HandlerRegistration addSelectionHandler(SelectionHandler<java.lang.Integer> handler)
HasSelectionHandlersSelectionEvent handler.
addSelectionHandler in interface HasSelectionHandlers<java.lang.Integer>handler - the handler
public void animate(int duration)
AnimatedLayout
animate in interface AnimatedLayoutduration - the animation duration, in milliseconds
public void animate(int duration,
Layout.AnimationCallback callback)
AnimatedLayoutThis method provides a callback that will be informed of animation updates. This can be used to create more complex animation effects.
animate in interface AnimatedLayoutduration - the animation duration, in millisecondscallback - the animation callbackpublic void clear()
HasWidgets
clear in interface HasWidgetspublic void forceLayout()
AnimatedLayout
This is not normally necessary, unless you want to update child widgets'
positions explicitly to create a starting point for a subsequent call to
AnimatedLayout.animate(int).
forceLayout in interface AnimatedLayoutAnimatedLayout.animate(int),
AnimatedLayout.animate(int, Layout.AnimationCallback)public int getAnimationDuration()
public Widget getHeaderWidget(int index)
index - the index of the stack header to be retrieved
public Widget getHeaderWidget(Widget child)
child - the child whose stack header is to be retrieved
public int getVisibleIndex()
-1 if none is selectedpublic Widget getVisibleWidget()
null if none existpublic Widget getWidget(int index)
IndexedPanel
getWidget in interface IndexedPanelindex - the child widget's index
public int getWidgetCount()
IndexedPanel
getWidgetCount in interface IndexedPanelpublic int getWidgetIndex(IsWidget child)
getWidgetIndex in interface IndexedPanel.ForIsWidgetpublic int getWidgetIndex(Widget child)
IndexedPanel
getWidgetIndex in interface IndexedPanelchild - the widget to be found
-1 if it is not a child of this
panel
public void insert(Widget child,
SafeHtml html,
double headerSize,
int beforeIndex)
child - the widget to be addedhtml - the safe html to be shown on its headerheaderSize - the size of the header widgetbeforeIndex - the index before which it will be inserted
public void insert(Widget child,
java.lang.String text,
boolean asHtml,
double headerSize,
int beforeIndex)
child - the widget to be addedtext - the text to be shown on its headerasHtml - true to treat the specified text as HTMLheaderSize - the size of the header widgetbeforeIndex - the index before which it will be inserted
public void insert(Widget child,
java.lang.String text,
double headerSize,
int beforeIndex)
child - the widget to be addedtext - the text to be shown on its headerheaderSize - the size of the header widgetbeforeIndex - the index before which it will be inserted
public void insert(Widget child,
Widget header,
double headerSize,
int beforeIndex)
child - the widget to be addedheader - the widget to be placed in the associated headerheaderSize - the size of the header widgetbeforeIndex - the index before which it will be insertedpublic java.util.Iterator<Widget> iterator()
HasWidgetsIterator.remove().
iterator in interface HasWidgetsiterator in interface java.lang.Iterable<Widget>public void onResize()
RequiresResize
onResize in interface RequiresResizeonResize in class ResizeCompositepublic boolean remove(int index)
IndexedPanel
remove in interface IndexedPanelindex - the index of the widget to be removed
false if the widget is not presentpublic boolean remove(Widget child)
HasWidgets
remove in interface HasWidgetschild - the widget to be removed
true if the widget was presentpublic void setAnimationDuration(int duration)
duration - the duration in milliseconds.
public void setHeaderHTML(int index,
java.lang.String html)
setHeaderHTML(int, SafeHtml) or
setHeaderText(int, String) whenever possible.
index - the index of the header whose HTML is to be sethtml - the header's new HTML contents
public void setHeaderHTML(int index,
SafeHtml html)
index - the index of the header whose HTML is to be sethtml - the header's new HTML contents
public void setHeaderText(int index,
java.lang.String text)
index - the index of the header whose text is to be settext - the object's new textpublic void showWidget(int index)
index - the index of the child widget to be shown.
public void showWidget(int index,
boolean fireEvents)
index - the index of the child widget to be shown.fireEvents - true to fire events, false not topublic void showWidget(Widget child)
child - the child widget to be shown.
public void showWidget(Widget child,
boolean fireEvents)
child - the child widget to be shown.fireEvents - true to fire events, false not toprotected void onLoad()
Widget
onLoad in class Widget
|
GWT 2.7.0 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||