Carousel

open class Carousel<T, M : ListModel<T>>(model: M, itemVisualizer: ItemVisualizer<T, CarouselItem>) : View(source)

A visual component that renders and cycles through a list of items of type T using a CarouselBehavior. Items are obtained via the model and presented such that a single item is "selected" at any time. Large ("infinite") lists of items are supported efficiently, since Carousel recycles the Views generated to render its items.

Carousel relies heavily on the Presenter provided by its behavior for the positioning and visual treatment of its underlying data. Different StageManagers can radically change the way a Carousel looks and functions.

Parameters

model

that holds the data for this Carousel

itemVisualizer

that maps T to View for each item in the List

Inheritors

Constructors

Link copied to clipboard
constructor(model: M, itemVisualizer: ItemVisualizer<T, CarouselItem>)

Types

Link copied to clipboard

Data structure defining where the previous and next items are located relative to their Carousel's origin. This data is provided to Transitioners at the end of a Carousel's manual movement, so they can decide which item to stop at.

Link copied to clipboard

An item bound to some data (and a View) within a Carousel that will be displayed. Presenters create these during Presenter.present to decide what is shown within a Carousel.

Properties

Link copied to clipboard

CarouselBehavior that governs the way this Carousel behaves.

Link copied to clipboard

The index the Carousel is closest to displaying in the "selected" slot at this moment. This value changes as the Carousel animates to a new targetItem.

Link copied to clipboard

Notifies of changes to the Carousel's nearestItem.

Link copied to clipboard

Number of items in the Carousel

Link copied to clipboard

The previous item selected by the Carousel.

Link copied to clipboard

Notifies of changes to the Carousel's progress to its target. Listeners can then check nearestItem, progressToTargetItem and progressToNextItem to figure out exactly how the Carousel is positioned.

Link copied to clipboard

Where the Carousel is between nearestItem and the next index as it travels to targetItem. This value is always within [0-1].

Link copied to clipboard

Where the Carousel is between previousSelectedItem and targetItem as it travels to the latter. This value is always within [0-1].

Link copied to clipboard

The item being selected by the Carousel, even if that selection is in progress.

Link copied to clipboard

Determines whether the Carousel will wrap its values at the start and end.

Inherited properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
override var bounds: Rectangle
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
protected open val children: ObservableList<View>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open var focusable: Boolean
Link copied to clipboard
Link copied to clipboard
protected val focusCycleRoot: View?
Link copied to clipboard
Link copied to clipboard
var font: Font?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
override var height: Double
Link copied to clipboard
override var idealSize: Size?
Link copied to clipboard
protected open var insets: Insets
Link copied to clipboard
protected open var isFocusCycleRoot: Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
protected open var layout: Layout?
Link copied to clipboard
override var minimumSize: Size
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var parent: View?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
override var position: Point
Link copied to clipboard
Link copied to clipboard
override var size: Size
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
override var visible: Boolean
Link copied to clipboard
override var width: Double
Link copied to clipboard
override var x: Double
Link copied to clipboard
override var y: Double
Link copied to clipboard
var zOrder: Int

Functions

Link copied to clipboard

Finishes an ongoing manual move and indicates that the Carousel should return to a state where it has selected an item.

Link copied to clipboard
operator fun get(index: Int): Result<T>

Gets the value at the given index.

Link copied to clipboard

Manually moves the Carousel's contents to some to. This will stop any current transition and update the selected item as the values change.

Link copied to clipboard
fun next()

Moves to the next item if one exists.

Link copied to clipboard
fun previous()

Moves to the previous item if one exists.

Link copied to clipboard
open override fun render(canvas: Canvas)
Link copied to clipboard
fun skip(amount: Int)

Skips forward/backward by amount to select the item there.

Link copied to clipboard

Initiates manual movement of the Carousel. This will interrupt any other movement and get the Carousel ready for subsequent calls to moveManually.

Inherited functions

Link copied to clipboard
protected open fun addedToDisplay()
Link copied to clipboard
protected open infix fun ancestorOf(view: View): Boolean
Link copied to clipboard
protected open fun child(at: Point): View?
Link copied to clipboard
protected operator fun contains(child: View): Boolean
open operator override fun contains(point: Point): Boolean
Link copied to clipboard
protected fun contentDirectionChanged()
Link copied to clipboard
protected fun cursorChanged(old: Cursor?, new: Cursor?)
Link copied to clipboard
protected open fun doLayout()
Link copied to clipboard
protected fun enabledChanged(old: Boolean, new: Boolean, filter: (View) -> Boolean)
Link copied to clipboard
protected open fun filterKeyEvent(event: KeyEvent)
Link copied to clipboard
protected open fun filterPointerEvent(event: PointerEvent)
Link copied to clipboard
protected open fun filterPointerMotionEvent(event: PointerEvent)
Link copied to clipboard
fun fromAbsolute(point: Point): Point
Link copied to clipboard
operator fun get(traversalType: FocusTraversalPolicy.TraversalType): Set<KeyState>?
Link copied to clipboard
protected open fun handleDisplayRectEvent(old: Rectangle, new: Rectangle)
Link copied to clipboard
protected open fun handleKeyEvent(event: KeyEvent)
Link copied to clipboard
protected open fun handlePointerEvent(event: PointerEvent)
Link copied to clipboard
protected open fun handlePointerMotionEvent(event: PointerEvent)
Link copied to clipboard
open infix fun intersects(point: Point): Boolean
Link copied to clipboard
protected open fun relayout()
Link copied to clipboard
protected open fun removedFromDisplay()
Link copied to clipboard
fun rerender()
Link copied to clipboard
Link copied to clipboard
protected fun revalidate()
Link copied to clipboard
operator fun set(traversalType: FocusTraversalPolicy.TraversalType, keyStates: Set<KeyState>?)
Link copied to clipboard
protected open fun shouldHandlePointerEvent(event: PointerEvent): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
protected fun styleChanged(filter: (View) -> Boolean)
Link copied to clipboard
fun toAbsolute(point: Point): Point
Link copied to clipboard
fun toLocal(point: Point, from: View?): Point
Link copied to clipboard
Link copied to clipboard
fun toParent(point: Point): Point