Class WStackedWidget
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:
-
Nested Class Summary
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
ConstructorsConstructorDescriptionCreates a new stack.WStackedWidget
(WContainerWidget parentContainer) Creates a new stack. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a child widget to this container.protected DomElement
Create DOM element for widget.int
Returns the index of the widget that is currently shown.Returns the widget that is currently shown.protected void
getDomChanges
(List<DomElement> result, WApplication app) Get DOM changes for this widget.void
insertWidget
(int index, WWidget widget) Insert a widget at a given index.removeWidget
(WWidget widget) Removes a child widget from this container.protected void
render
(EnumSet<RenderFlag> flags) Renders the widget.void
setCurrentIndex
(int index) Changes the current widget.final 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.final 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, iterateChildren, parentResized, remove, scrolled, setContentAlignment, setContentAlignment, setFormData, setGlobalUnfocused, 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, beingDeleted, 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, manageWidget, parentResized, propagateSetVisible, refresh, removeScript, removeStyleClass, resize, scrollVisibilityChanged, setAttributeValue, setBaseZIndex, setCanReceiveFocus, setClearSides, setDecorationStyle, setDeferredToolTip, setDisabled, setFlexBox, setFloatSide, setFocus, setHidden, setHiddenKeepsGeometry, setHtmlTagName, setId, setInline, setJavaScriptMember, setLineHeight, setLoadLaterWhenInvisible, setMargin, setMaximumSize, setMinimumSize, setObjectName, setOffsets, setParentWidget, setPositionScheme, setScrollVisibilityEnabled, setScrollVisibilityMargin, setSelectable, setStyleClass, setTabIndex, setThemeStyleEnabled, setToolTip, setVerticalAlignment, unescapeText, updateSignalConnection, voidEventSignal, widgetAdded, widgetRemoved
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, isGlobalWidget, isLayoutSizeAware, layoutSizeChanged, needsRerender, positionAt, positionAt, removeFromParent, removeStyleClass, render, resize, scheduleRender, scheduleRender, scheduleRender, setClearSides, setDeferredToolTip, setFocus, 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
-
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.The widget is appended to the list of children, and thus also layed-out at the end.
If, for some reason, you want to be in control of the lifetime of the widget, you can retrieve a unique_ptr with WObject::removeChild()
- Overrides:
addWidget
in classWContainerWidget
-
removeWidget
Description copied from class:WContainerWidget
Removes a child widget from this container.If the
WContainerWidget
owns the given widget (i.e. if it was added withaddWidget()
orinsertWidget()
and not removed with WObject::removeChild()), a unique_ptr to this widget is returned. Otherwise, this returns nullptr.- Overrides:
removeWidget
in classWContainerWidget
-
getCurrentIndex
public int getCurrentIndex()Returns the index of the widget that is currently shown.- See Also:
-
getCurrentWidget
Returns the widget that is currently shown. -
insertWidget
Insert a widget at a given index.- Overrides:
insertWidget
in classWContainerWidget
-
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:
-
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
,AnimationEffect.SlideInFromTop
orAnimationEffect.SlideInFromBottom
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:
-
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
-