eu.webtoolkit.jwt
Class WStackedWidget

java.lang.Object
  extended by eu.webtoolkit.jwt.WObject
      extended by eu.webtoolkit.jwt.WWidget
          extended by eu.webtoolkit.jwt.WWebWidget
              extended by eu.webtoolkit.jwt.WInteractWidget
                  extended by eu.webtoolkit.jwt.WContainerWidget
                      extended by eu.webtoolkit.jwt.WStackedWidget

public class WStackedWidget
extends WContainerWidget

A container widget that stacks its widgets on top of each other.

This is a container widget which at all times has only one item visible. The widget accomplishes this using setHidden(bool) on the children.

Using getCurrentIndex() and setCurrentIndex() you can retrieve or set the visible widget.

WStackedWidget, like WContainerWidget, is by default not inline.

CSS

The widget is rendered using an HTML <div> tag and does not provide styling. It can be styled using inline or external CSS as appropriate.

See Also:
WMenu

Nested Class Summary
 
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WContainerWidget
WContainerWidget.Overflow
 
Constructor Summary
WStackedWidget()
          Creates a new stack.
WStackedWidget(WContainerWidget parent)
          Creates a new stack.
 
Method Summary
 void addWidget(WWidget widget)
          Adds a child widget to this container.
 int getCurrentIndex()
          Returns the index of the widget that is currently shown.
 WWidget getCurrentWidget()
          Returns the widget that is currently shown.
 void insertWidget(int index, WWidget widget)
          Insert a widget at a given index.
 void setCurrentIndex(int index)
          Changes the current widget.
 void setCurrentIndex(int index, WAnimation animation)
          Changes the current widget using a custom animation.
 void setCurrentIndex(int index, WAnimation animation, boolean autoReverse)
          Changes the current widget using a custom animation.
 void setCurrentWidget(WWidget widget)
          Changes the current widget.
 void setTransitionAnimation(WAnimation animation)
          Specifies an animation used during transitions.
 void setTransitionAnimation(WAnimation animation, boolean autoReverse)
          Specifies an animation used during transitions.
 
Methods inherited from class eu.webtoolkit.jwt.WContainerWidget
clear, getContentAlignment, getCount, getIndexOf, getLayout, getPadding, getWidget, insertBefore, isList, isOrderedList, isUnorderedList, remove, removeWidget, scrolled, setContentAlignment, setContentAlignment, setLayout, setLayout, setLayout, setList, setList, setOverflow, setOverflow, setOverflow, setPadding, setPadding, setPadding
 
Methods inherited from class eu.webtoolkit.jwt.WInteractWidget
clicked, doubleClicked, enterPressed, escapePressed, gestureChanged, gestureEnded, gestureStarted, isEnabled, keyPressed, keyWentDown, keyWentUp, load, mouseDragged, mouseMoved, mouseWentDown, mouseWentOut, mouseWentOver, mouseWentUp, mouseWheel, propagateSetEnabled, setDraggable, setDraggable, setDraggable, setDraggable, touchEnded, touchMoved, touchStarted
 
Methods inherited from class eu.webtoolkit.jwt.WWebWidget
addStyleClass, callJavaScriptMember, childrenChanged, doJavaScript, domCanBeSaved, enableAjax, escapeText, escapeText, escapeText, escapeText, find, getAttributeValue, getChildren, getClearSides, getDecorationStyle, getFloatSide, getHeight, getId, getJavaScriptMember, getLineHeight, getMargin, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getOffset, getPositionScheme, getStyleClass, getTabIndex, getToolTip, getVerticalAlignment, getVerticalAlignmentLength, getWidth, isDisabled, isHidden, isHiddenKeepsGeometry, isInline, isLoaded, isPopup, isRendered, isVisible, jsStringLiteral, jsStringLiteral, refresh, removeScript, removeStyleClass, resize, setAttributeValue, setClearSides, setDecorationStyle, setDisabled, setFloatSide, setHidden, setHiddenKeepsGeometry, setId, setInline, setJavaScriptMember, setLineHeight, setLoadLaterWhenInvisible, setMargin, setMaximumSize, setMinimumSize, setOffsets, setPopup, setPositionScheme, setSelectable, setStyleClass, setTabIndex, setToolTip, setVerticalAlignment, updateSignalConnection
 
Methods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addStyleClass, animateHide, animateShow, boxBorder, boxPadding, containsExposed, disable, dropEvent, enable, getDrop, getJsRef, getParent, hide, htmlText, isLayoutSizeAware, layoutSizeChanged, positionAt, positionAt, removeStyleClass, resize, setClearSides, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, tr
 
Methods inherited from class eu.webtoolkit.jwt.WObject
getObjectName, setObjectName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WStackedWidget

public WStackedWidget(WContainerWidget parent)
Creates a new stack.


WStackedWidget

public WStackedWidget()
Creates a new stack.

Calls this((WContainerWidget)null)

Method Detail

addWidget

public void addWidget(WWidget widget)
Description copied from class: WContainerWidget
Adds a child widget to this container.

This is equivalent to passing this container as the parent when constructing the child. The widget is appended to the list of children, and thus also layed-out at the end.

Overrides:
addWidget in class WContainerWidget

getCurrentIndex

public int getCurrentIndex()
Returns the index of the widget that is currently shown.

See Also:
setCurrentIndex(int index), getCurrentWidget()

getCurrentWidget

public WWidget getCurrentWidget()
Returns the widget that is currently shown.

See Also:
setCurrentWidget(WWidget widget), getCurrentIndex()

insertWidget

public void insertWidget(int index,
                         WWidget widget)
Insert a widget at a given index.

Overrides:
insertWidget in class WContainerWidget
See Also:
WContainerWidget.insertBefore(WWidget widget, WWidget before)

setCurrentIndex

public void setCurrentIndex(int index)
Changes the current widget.

The widget with index index is made visible, while all other widgets are hidden.

The change of current widget is done using the animation settings specified by setTransitionAnimation().

The default value for current index is 0 (provided thath

See Also:
getCurrentIndex(), setCurrentWidget(WWidget widget)

setCurrentIndex

public void setCurrentIndex(int index,
                            WAnimation animation,
                            boolean autoReverse)
Changes the current widget using a custom animation.

See Also:
getCurrentIndex(), setCurrentWidget(WWidget widget)

setCurrentIndex

public final void setCurrentIndex(int index,
                                  WAnimation animation)
Changes the current widget using a custom animation.

Calls setCurrentIndex(index, animation, true)


setCurrentWidget

public void setCurrentWidget(WWidget widget)
Changes the current widget.

The widget widget, which must have been added before, is made visible, while all other widgets are hidden.

See Also:
getCurrentWidget(), setCurrentIndex(int index)

setTransitionAnimation

public void setTransitionAnimation(WAnimation animation,
                                   boolean autoReverse)
Specifies an animation used during transitions.

The animation is used to hide the previously current widget and show the next current widget using setCurrentIndex().

The initial value for animation is WAnimation(), specifying no animation.

When autoReverse is set to true, then the reverse animation is chosen when the new index precedes the current index. This only applies to WAnimation::SlideLeft, WAnimation::SlideRight, WAnimation::SlideUp or WAnimation::SlideDown transition effects.

See Also:
setCurrentIndex(int index)

setTransitionAnimation

public final void setTransitionAnimation(WAnimation animation)
Specifies an animation used during transitions.

Calls setTransitionAnimation(animation, false)