Class WStackedWidget
- java.lang.Object
-
- eu.webtoolkit.jwt.WObject
-
- eu.webtoolkit.jwt.WWidget
-
- eu.webtoolkit.jwt.WWebWidget
-
- eu.webtoolkit.jwt.WInteractWidget
-
- eu.webtoolkit.jwt.WContainerWidget
-
- 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()andsetCurrentIndex()you can retrieve or set the visible widget.When calling the above
, this will fire thesetCurrentIndex()currentWidgetChanged()signal. This allows developers to know when the current visible widget has changed and what the new visible widget is.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.WObject
WObject.FormData
-
-
Field Summary
-
Fields inherited from class eu.webtoolkit.jwt.WInteractWidget
dragTouchEndSlot_, dragTouchSlot_, noDefault
-
Fields inherited from class eu.webtoolkit.jwt.WWidget
WT_GETEXTRAMS_JS
-
-
Constructor Summary
Constructors Constructor Description WStackedWidget()Creates a new stack.WStackedWidget(WContainerWidget parentContainer)Creates a new stack.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddWidget(WWidget widget)Adds a child widget to this container.protected DomElementcreateDomElement(WApplication app)Create DOM element for widget.Signal1<WWidget>currentWidgetChanged()Signal which indicates that the current widget was changed.intgetCurrentIndex()Returns the index of the widget that is currently shown.WWidgetgetCurrentWidget()Returns the widget that is currently shown.protected voidgetDomChanges(java.util.List<DomElement> result, WApplication app)Get DOM changes for this widget.voidinsertWidget(int index, WWidget widget)Insert a widget at a given index.WWidgetremoveWidget(WWidget widget)Removes a child widget from this container.protected voidrender(java.util.EnumSet<RenderFlag> flags)Renders the widget.voidsetCurrentIndex(int index)Changes the current widget.voidsetCurrentIndex(int index, WAnimation animation)Changes the current widget using a custom animation.voidsetCurrentIndex(int index, WAnimation animation, boolean autoReverse)Changes the current widget using a custom animation.voidsetCurrentWidget(WWidget widget)Changes the current widget.voidsetTransitionAnimation(WAnimation animation)Specifies an animation used during transitions.voidsetTransitionAnimation(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, hideToolTip, 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, showToolTip, showToolTipOnHover, unescapeText, updateSignalConnection, voidEventSignal, widgetAdded, widgetRemoved
-
Methods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addJSignal, addStyleClass, animateHide, animateShow, applyThemeStyles, boxBorder, boxPadding, createJavaScript, disable, dropEvent, enable, getDropTouch, getJsRef, getParent, hide, htmlText, isExposed, isGlobalWidget, isLayoutSizeAware, layoutSizeChanged, needsRerender, positionAt, positionAt, positionAt, positionAt, removeFromParent, removeStyleClass, render, resize, scheduleRender, scheduleRender, scheduleRender, scheduleThemeStyleApply, 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 Detail
-
WStackedWidget
public WStackedWidget(WContainerWidget parentContainer)
Creates a new stack.
-
WStackedWidget
public WStackedWidget()
Creates a new stack.
-
-
Method Detail
-
addWidget
public void addWidget(WWidget widget)
Description copied from class:WContainerWidgetAdds 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:
addWidgetin classWContainerWidget
-
removeWidget
public WWidget removeWidget(WWidget widget)
Description copied from class:WContainerWidgetRemoves a child widget from this container.If the
WContainerWidgetowns 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:
removeWidgetin classWContainerWidget
-
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.
-
insertWidget
public void insertWidget(int index, WWidget widget)Insert a widget at a given index.- Overrides:
insertWidgetin classWContainerWidget
-
setCurrentIndex
public void setCurrentIndex(int index)
Changes the current widget.The widget with index
indexis 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 if there are child widgets, if no child widgets were added this returns -1.
-
setCurrentIndex
public void setCurrentIndex(int index, WAnimation animation, boolean autoReverse)Changes the current widget using a custom animation.
-
setCurrentIndex
public final void setCurrentIndex(int index, WAnimation animation)Changes the current widget using a custom animation.
-
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
animationis WAnimation(), specifying no animation.When
autoReverseis set totrue, then the reverse animation is chosen when the new index precedes the current index. This only applies toAnimationEffect.SlideInFromLeft,AnimationEffect.SlideInFromRight,AnimationEffect.SlideInFromToporAnimationEffect.SlideInFromBottomtransition effects.Note: If you intend to use a transition animation with a
WStackedWidgetyou 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.Popanimation on aWStackedWidget.- See Also:
setCurrentIndex(int index)
-
setTransitionAnimation
public final void setTransitionAnimation(WAnimation animation)
Specifies an animation used during transitions.
-
currentWidgetChanged
public Signal1<WWidget> currentWidgetChanged()
Signal which indicates that the current widget was changed.This signal is emitted when the current widget was changed. It holds a pointer to the new current widget. It is emitted every time the
setCurrentIndex()orsetCurrentWidget()is called.
-
createDomElement
protected DomElement createDomElement(WApplication app)
Description copied from class:WWebWidgetCreate DOM element for widget.This is an internal function, and should not be called directly, or be overridden!
- Overrides:
createDomElementin classWContainerWidget
-
getDomChanges
protected void getDomChanges(java.util.List<DomElement> result, WApplication app)
Description copied from class:WWebWidgetGet DOM changes for this widget.This is an internal function, and should not be called directly, or be overridden!
- Overrides:
getDomChangesin classWContainerWidget
-
render
protected void render(java.util.EnumSet<RenderFlag> flags)
Description copied from class:WWidgetRenders 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:
renderin classWInteractWidget
-
-