Class WStackedWidget
public class WStackedWidget extends WContainerWidget
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
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
Field Summary
Fields inherited from class eu.webtoolkit.jwt.WInteractWidget
dragTouchEndSlot_, dragTouchSlot_
-
Constructor Summary
Constructors Constructor Description WStackedWidget()
Creates a new stack.WStackedWidget(WContainerWidget parent)
Creates a new stack. -
Method Summary
Modifier and Type Method Description void
addWidget(WWidget widget)
Adds a child widget to this container.protected DomElement
createDomElement(WApplication app)
Create DOM element for widget.int
getCurrentIndex()
Returns the index of the widget that is currently shown.WWidget
getCurrentWidget()
Returns the widget that is currently shown.protected void
getDomChanges(java.util.List<DomElement> result, WApplication app)
Get DOM changes for this widget.void
insertWidget(int index, WWidget widget)
Insert a widget at a given index.protected void
render(java.util.EnumSet<RenderFlag> flags)
Renders the widget.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, getScrollLeft, getScrollTop, getWidget, insertBefore, isGlobalUnfocussed, isList, isOrderedList, isUnorderedList, parentResized, remove, removeWidget, scrolled, setContentAlignment, setContentAlignment, setFormData, setGlobalUnfocused, 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, getMouseOverDelay, isEnabled, keyPressed, keyWentDown, keyWentUp, load, mouseDragged, mouseMoved, mouseWentDown, mouseWentOut, mouseWentOver, mouseWentUp, mouseWheel, propagateSetEnabled, setDraggable, setDraggable, setDraggable, setDraggable, setMouseOverDelay, setPopup, touchEnded, touchMoved, touchStarted, unsetDraggable
Methods inherited from class eu.webtoolkit.jwt.WWebWidget
addStyleClass, blurred, callJavaScriptMember, childrenChanged, doJavaScript, enableAjax, escapeText, escapeText, escapeText, escapeText, find, findById, focussed, getAttributeValue, getBaseZIndex, getChildren, getClearSides, getDecorationStyle, getFloatSide, getHeight, getHtmlTagName, getId, getJavaScriptMember, getLineHeight, getMargin, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getOffset, getPositionScheme, getScrollVisibilityMargin, getStyleClass, getTabIndex, getToolTip, getVerticalAlignment, getVerticalAlignmentLength, getWidth, hasFocus, hasStyleClass, isCanReceiveFocus, isDisabled, isHidden, isHiddenKeepsGeometry, isInline, isLoaded, isPopup, isRendered, isScrollVisibilityEnabled, isScrollVisible, isSetFirstFocus, isThemeStyleEnabled, isVisible, jsStringLiteral, jsStringLiteral, parentResized, propagateSetVisible, refresh, removeScript, removeStyleClass, resize, scrollVisibilityChanged, setAttributeValue, setBaseZIndex, setCanReceiveFocus, setClearSides, setDecorationStyle, setDeferredToolTip, setDisabled, setFloatSide, setFocus, setHidden, setHiddenKeepsGeometry, setHtmlTagName, setId, setInline, setJavaScriptMember, setLineHeight, setLoadLaterWhenInvisible, setMargin, setMaximumSize, setMinimumSize, setOffsets, setPositionScheme, setScrollVisibilityEnabled, setScrollVisibilityMargin, setSelectable, setStyleClass, setTabIndex, setThemeStyleEnabled, setToolTip, setVerticalAlignment, updateSignalConnection, voidEventSignal
Methods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addJSignal, addStyleClass, animateHide, animateShow, boxBorder, boxPadding, createJavaScript, disable, dropEvent, enable, getDropTouch, getJsRef, getParent, hide, htmlText, isExposed, isLayoutSizeAware, layoutSizeChanged, needsRerender, positionAt, positionAt, removeChild, removeStyleClass, render, resize, scheduleRender, scheduleRender, scheduleRender, setClearSides, setDeferredToolTip, setFocus, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setObjectName, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, tr
Methods inherited from class eu.webtoolkit.jwt.WObject
addChild, getObjectName
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
WStackedWidget
Creates a new stack. -
WStackedWidget
public WStackedWidget()Creates a new stack.
-
-
Method Details
-
addWidget
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 classWContainerWidget
-
getCurrentIndex
public int getCurrentIndex()Returns the index of the widget that is currently shown.- See Also:
setCurrentIndex(int index)
,getCurrentWidget()
-
getCurrentWidget
Returns the widget that is currently shown. -
insertWidget
Insert a widget at a given index.- Overrides:
insertWidget
in classWContainerWidget
- 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
-
setCurrentIndex
Changes the current widget using a custom animation. -
setCurrentIndex
Changes the current widget using a custom animation. -
setCurrentWidget
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
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 totrue
, then the reverse animation is chosen when the new index precedes the current index. This only applies toAnimationEffect#SlideInFromLeft
,AnimationEffect#SlideInFromRight
, WAnimation::SlideInFromUp or WAnimation::SlideInFromDown transition effects.Note: If you intend to use a transition animation with a
WStackedWidget
you should set it before it is first rendered. Otherwise, transition animations caused bysetCurrentIndex()
may not be correctly performed. If you do want to force this change you can useWApplication.processEvents()
before callingsetCurrentIndex()
.Note: It is also not supported to use a
AnimationEffect#Pop
animation on aWStackedWidget
.- See Also:
setCurrentIndex(int index)
-
setTransitionAnimation
Specifies an animation used during transitions. -
createDomElement
Description copied from class:WWebWidget
Create DOM element for widget.This is an internal function, and should not be called directly, or be overridden!
- Overrides:
createDomElement
in classWContainerWidget
-
getDomChanges
Description copied from class:WWebWidget
Get DOM changes for this widget.This is an internal function, and should not be called directly, or be overridden!
- Overrides:
getDomChanges
in classWContainerWidget
-
render
Description copied from class:WWidget
Renders the widget.This function renders the widget (or an update for the widget), after this has been scheduled using
scheduleRender()
.The default implementation will render the widget by serializing changes to JavaScript and HTML. You may want to reimplement this widget if you have been postponing some of the layout / rendering implementation until the latest moment possible. In that case you should make sure you call the base implementation however.
- Overrides:
render
in classWWebWidget
-