Interface ICarousel
- All Superinterfaces:
IAnyGroup<ICarousel>,IChildable<ICarousel,,ICarouselitem<IAnyGroup>> IComponent<ICarousel>,IHtmlBasedComponent<ICarousel>,IXulElement<ICarousel>
Carousel component.
A carousel (slideshow) container. Children must be ICarouselitem.
Support @Action
| Name | Action Type |
|---|---|
| onSelect | ActionData: RequestData
Denotes the user moved to another slide; the zero-based index of the new slide can be received from RequestData.getData() with the key
"index". |
| onChanging | ActionData: RequestData
Denotes a slide change is starting; RequestData.getData()
carries the keys "fromIndex" and "toIndex". Not
cancelable. |
- Since:
- 11.0.0
- Author:
- peaker
- See Also:
-
Carousel
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classBuilds instances of typeICarousel.static classBuilds an updater of typeICarouselforUiAgent.smartUpdate(Locator, SmartUpdater). -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault intReturns the index of the currently active slide.default StringReturns the transition effect used when moving between slides, or null when it was reset to the default.default intReturns the autoplay interval in milliseconds.default StringReturns the orientation along which the slides advance, or null when it was reset to the default.default StringReturns the client widget class.default booleanReturns whether the carousel advances through its slides automatically.default booleanReturns whether the carousel reacts to left/right arrow keys when focused.default booleanisLoop()Returns whether the carousel wraps around from the last slide back to the first (and vice versa).default booleanisPause()Returns whether autoplay pauses while the cursor hovers over the carousel.default booleanReturns whether the previous/next navigation arrows are shown.default booleanReturns whether the slide indicators (the position dots) are shown.static ICarouselof(Iterable<? extends ICarouselitem<IAnyGroup>> children) Returns the instance with the givenICarouselitemchildren.static ICarouselof(ICarouselitem<IAnyGroup>... children) Returns the instance with the givenICarouselitemchildren.static ICarouselReturns the instance with the given id.withActiveIndex(int activeIndex) Returns a copy ofthisimmutable component with the specifiedactiveIndex.withAutoplay(boolean autoplay) Returns a copy ofthisimmutable component with the specifiedautoplay.withEffect(String effect) Returns a copy ofthisimmutable component with the specifiedeffect.withInterval(int interval) Returns a copy ofthisimmutable component with the specifiedinterval.withKeyboard(boolean keyboard) Returns a copy ofthisimmutable component with the specifiedkeyboard.withLoop(boolean loop) Returns a copy ofthisimmutable component with the specifiedloop.withOrient(String orient) Returns a copy ofthisimmutable component with the specifiedorient.withPause(boolean pause) Returns a copy ofthisimmutable component with the specifiedpause.withShowArrows(boolean showArrows) Returns a copy ofthisimmutable component with the specifiedshowArrows.withShowIndicators(boolean showIndicators) Returns a copy ofthisimmutable component with the specifiedshowIndicators.Methods inherited from interface org.zkoss.stateless.sul.IChildable
getChildren, withChildren, withChildrenMethods inherited from interface org.zkoss.stateless.sul.IComponent
getAction, getActions, getClientAttributes, getId, getMold, getWidgetListeners, getWidgetOverrides, isVisible, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withActions, withActions, withClientAttribute, withClientAttributes, withId, withMold, withVisible, withWidgetClass, withWidgetListener, withWidgetListeners, withWidgetOverride, withWidgetOverridesMethods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent
getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getSkeleton, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withHflex, withLeft, withRenderdefer, withSclass, withSkeleton, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withWidth, withZclass, withZIndexMethods inherited from interface org.zkoss.stateless.sul.IXulElement
getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip
-
Field Details
-
DEFAULT
Constant for default attributes of this immutable component.
-
-
Method Details
-
getWidgetClass
Returns the client widget class.Default:
"zul.wgt.Carousel"- Specified by:
getWidgetClassin interfaceIComponent<ICarousel>
-
getActiveIndex
default int getActiveIndex()Returns the index of the currently active slide.Unlike
Carousel.getActiveIndex(), the stored value is returned as given; the clamp toslideCount - 1happens at render time only.Default:
0. -
withActiveIndex
Returns a copy ofthisimmutable component with the specifiedactiveIndex.Sets the index of the currently active slide.
Note:
UiAgent.smartUpdate(Locator, SmartUpdater)is not supported for this property —ICarousel.Updaterships the raw attribute while the initial render ships the value clamped toslideCount - 1. Push a whole component withUiAgent.replaceWith(Locator, IComponent)instead.- Parameters:
activeIndex- the zero-based index of the slide to activate. An index past the last slide is clamped toslideCount - 1when rendered.Default:
0.- Returns:
- A modified copy of the
thisobject - Throws:
org.zkoss.zk.ui.WrongValueException- ifactiveIndexis negative.
-
isAutoplay
default boolean isAutoplay()Returns whether the carousel advances through its slides automatically.Default:
false. -
withAutoplay
Returns a copy ofthisimmutable component with the specifiedautoplay.Sets whether the carousel advances through its slides automatically.
- Parameters:
autoplay- true to start advancing slides automatically (using theinterval), false to leave navigation manual.Default:
false.- Returns:
- A modified copy of the
thisobject
-
getInterval
default int getInterval()Returns the autoplay interval in milliseconds.Default:
5000. -
withInterval
Returns a copy ofthisimmutable component with the specifiedinterval.Sets the autoplay interval in milliseconds.
- Parameters:
interval- the autoplay interval in milliseconds; must be at least 500.Default:
5000.- Returns:
- A modified copy of the
thisobject - Throws:
org.zkoss.zk.ui.WrongValueException- ifintervalis less than 500ms.
-
isShowArrows
default boolean isShowArrows()Returns whether the previous/next navigation arrows are shown.Default:
true. -
withShowArrows
Returns a copy ofthisimmutable component with the specifiedshowArrows.Sets whether the previous/next navigation arrows are shown.
- Parameters:
showArrows- true to display the navigation arrows, false to hide them.Default:
true.- Returns:
- A modified copy of the
thisobject
-
isShowIndicators
default boolean isShowIndicators()Returns whether the slide indicators (the position dots) are shown.Default:
true. -
withShowIndicators
Returns a copy ofthisimmutable component with the specifiedshowIndicators.Sets whether the slide indicators (the position dots) are shown.
- Parameters:
showIndicators- true to display the indicators, false to hide them.Default:
true.- Returns:
- A modified copy of the
thisobject
-
isLoop
default boolean isLoop()Returns whether the carousel wraps around from the last slide back to the first (and vice versa).Default:
true. -
withLoop
Returns a copy ofthisimmutable component with the specifiedloop.Sets whether the carousel wraps around from the last slide back to the first (and vice versa).
- Parameters:
loop- true to wrap around continuously, false to stop at the ends.Default:
true.- Returns:
- A modified copy of the
thisobject
-
isPause
default boolean isPause()Returns whether autoplay pauses while the cursor hovers over the carousel.Default:
true. -
withPause
Returns a copy ofthisimmutable component with the specifiedpause.Sets whether autoplay pauses while the cursor hovers over the carousel.
- Parameters:
pause- true to pause autoplay on hover, false to keep advancing.Default:
true.- Returns:
- A modified copy of the
thisobject
-
isKeyboard
default boolean isKeyboard()Returns whether the carousel reacts to left/right arrow keys when focused.Default:
true. -
withKeyboard
Returns a copy ofthisimmutable component with the specifiedkeyboard.Sets whether the carousel reacts to left/right arrow keys when focused.
- Parameters:
keyboard- true to enable arrow-key navigation, false to disable it.Default:
true.- Returns:
- A modified copy of the
thisobject
-
getOrient
Returns the orientation along which the slides advance, or null when it was reset to the default.Default:
"horizontal". -
withOrient
Returns a copy ofthisimmutable component with the specifiedorient.Sets the orientation along which the slides advance.
- Parameters:
orient- either"horizontal"or"vertical".Default:
"horizontal".- Returns:
- A modified copy of the
thisobject - Throws:
org.zkoss.zk.ui.WrongValueException- iforientis neither"horizontal"nor"vertical".
-
getEffect
Returns the transition effect used when moving between slides, or null when it was reset to the default.Default:
"slide". -
withEffect
Returns a copy ofthisimmutable component with the specifiedeffect.Sets the transition effect used when moving between slides.
- Parameters:
effect- one of"slide","fade"or"none".Default:
"slide".- Returns:
- A modified copy of the
thisobject - Throws:
org.zkoss.zk.ui.WrongValueException- ifeffectis none of"slide","fade"or"none".
-
of
Returns the instance with the givenICarouselitemchildren.- Parameters:
children- The children ofICarouselitem
-
of
Returns the instance with the givenICarouselitemchildren.- Parameters:
children- The children ofICarouselitem
-
ofId
Returns the instance with the given id.- Parameters:
id- The id to identify this component
-