Top Description Inners Fields Constructors Methods
com.dlsc.gemsfx

public Class StripView<T>

extends Control
Class Inheritance
Type Parameters
<T>
the type of the items shown by the view
Imports
com.dlsc.gemsfx.skins.StripViewSkin, javafx.beans.InvalidationListener, .WeakInvalidationListener, javafx.beans.property.BooleanProperty, .BooleanPropertyBase, .DoubleProperty, .ListProperty, .ObjectProperty, .SimpleBooleanProperty, .SimpleListProperty, .SimpleObjectProperty, javafx.collections.FXCollections, .ObservableList, javafx.css.CssMetaData, .PseudoClass, .Styleable, .StyleableDoubleProperty, .StyleableProperty, javafx.css.converter.SizeConverter, javafx.scene.AccessibleAttribute, javafx.scene.control.Control, .Label, .Skin, javafx.util.Callback, .Duration, java.util.ArrayList, .Collections, .List, .Objects

A view which can be used to lay out a fixed number of items horizontally. If the available width is not sufficient then scrolling buttons will appear on either side of the view so that the user can make hidden items visible. The nice thing about this control is that it uses a MaskedView to fade out the elements on the side. This ensures that the scroll buttons will be fully visible.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
StripView.StripCell<
the type of the model object shown by the cell
T
>

A strip cell is being used by cell factories of the StripView control.

private static class

Field Summary

Modifier and TypeField and Description
private final BooleanProperty
private final BooleanProperty
private final ObjectProperty<Duration>
private final BooleanProperty
private final ObjectProperty<Callback<StripView<T>, StripView.StripCell<T>>>
private static final int
private DoubleProperty
private final ListProperty<T>
private final BooleanProperty
public final ObjectProperty<T>

Constructor Summary

AccessConstructor and Description
public
StripView()

Constructs a new strip view.

Method Summary

Modifier and TypeMethod and Description
public final BooleanProperty

Returns:

true if the selected item will be centered
alwaysCenterProperty
()

A flag used to signal whether the currently selected item should always end up in the center location of the view (if possible).

public final BooleanProperty

Returns:

true if the scroll operation will be animated
animateScrollingProperty
()

Enables or disables whether animation is being used when scrolling to the left or right.

public final ObjectProperty<Duration>

Returns:

the scroll animation duration
animationDurationProperty
()

Determines the duration of the scroll animation.

public final BooleanProperty

Returns:

true if the control uses automatic scrolling when an item becomes selected
autoScrollingProperty
()

Determines whether the view will automatically scroll to a newly selected item.

public final ObjectProperty<Callback<StripView<T>, StripView.StripCell<T>>>

Returns:

the cell factory
cellFactoryProperty
()

A factory used for creating cells that will display the items added to the strip view.

protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control.

public final DoubleProperty

Returns:

the size of the fading areas / the clips used for fading
fadingSizeProperty
()

Specifies the size of the fade in / out areas on the left- and right-hand side.

public final Duration
public final Callback<StripView<T>, StripView.StripCell<T>>
public static List<CssMetaData<? extends Styleable, ?>>
getClassCssMetaData()

Hides javafx.scene.control.Control.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

protected List<CssMetaData<? extends Styleable, ?>>
getControlCssMetaData()

Overrides javafx.scene.control.Control.getControlCssMetaData.

Gets the unmodifiable list of the control's CSS-styleable properties.

public final double
public final ObservableList<T>
public final T
public String
getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method.

public final boolean
public final boolean
public final boolean
public final boolean
public final ListProperty<T>

Returns:

the list of items shown in the view
itemsProperty
()

The model used by the strip view control.

public final BooleanProperty
loopSelectionProperty()

Property to determine whether the selection should loop from the end to the start and vice versa.

public void
scrollTo(T item)

public final ObjectProperty<T>

Returns:

the selected item
selectedItemProperty
()

Stores the currently selected item.

public final void
setAlwaysCenter(boolean alwaysCenter)

public final void
setAnimateScrolling(boolean animateScrolling)

public final void
setAnimationDuration(Duration animationDuration)

public final void
setAutoScrolling(boolean autoScrolling)

public final void
public final void
setFadingSize(double fadingSize)

public final void
public final void
setLoopSelection(boolean value)

public final void
setSelectedItem(T selectedItem)

Inherited from javafx.scene.control.Control:
computeMaxHeightcomputeMaxWidthcomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthcontextMenuPropertyexecuteAccessibleActiongetBaselineOffsetgetContextMenugetCssMetaDatagetInitialFocusTraversablegetSkingetTooltipisResizablelayoutChildrenqueryAccessibleAttributesetContextMenusetSkinsetTooltipskinPropertytooltipProperty

Field Detail

alwaysCenterback to summary
private final BooleanProperty alwaysCenter
animateScrollingback to summary
private final BooleanProperty animateScrolling
animationDurationback to summary
private final ObjectProperty<Duration> animationDuration
autoScrollingback to summary
private final BooleanProperty autoScrolling
cellFactoryback to summary
private final ObjectProperty<Callback<StripView<T>, StripView.StripCell<T>>> cellFactory
DEFAULT_FADING_SIZEback to summary
private static final int DEFAULT_FADING_SIZE
fadingSizeback to summary
private DoubleProperty fadingSize
itemsback to summary
private final ListProperty<T> items
loopSelectionback to summary
private final BooleanProperty loopSelection
selectedItemback to summary
public final ObjectProperty<T> selectedItem

Constructor Detail

StripViewback to summary
public StripView()

Constructs a new strip view.

Method Detail

alwaysCenterPropertyback to summary
public final BooleanProperty alwaysCenterProperty()

A flag used to signal whether the currently selected item should always end up in the center location of the view (if possible).

Returns:BooleanProperty

true if the selected item will be centered

animateScrollingPropertyback to summary
public final BooleanProperty animateScrollingProperty()

Enables or disables whether animation is being used when scrolling to the left or right.

Returns:BooleanProperty

true if the scroll operation will be animated

animationDurationPropertyback to summary
public final ObjectProperty<Duration> animationDurationProperty()

Determines the duration of the scroll animation.

Returns:ObjectProperty<Duration>

the scroll animation duration

autoScrollingPropertyback to summary
public final BooleanProperty autoScrollingProperty()

Determines whether the view will automatically scroll to a newly selected item.

Returns:BooleanProperty

true if the control uses automatic scrolling when an item becomes selected

cellFactoryPropertyback to summary
public final ObjectProperty<Callback<StripView<T>, StripView.StripCell<T>>> cellFactoryProperty()

A factory used for creating cells that will display the items added to the strip view.

Returns:ObjectProperty<Callback<StripView<T>, StripView.StripCell<T>>>

the cell factory

createDefaultSkinback to summary
protected Skin<?> createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Doc from javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).

Annotations
@Override
fadingSizePropertyback to summary
public final DoubleProperty fadingSizeProperty()

Specifies the size of the fade in / out areas on the left- and right-hand side.

Returns:DoubleProperty

the size of the fading areas / the clips used for fading

getAnimationDurationback to summary
public final Duration getAnimationDuration()
getCellFactoryback to summary
public final Callback<StripView<T>, StripView.StripCell<T>> getCellFactory()
getClassCssMetaDataback to summary
public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData()

Hides javafx.scene.control.Control.getClassCssMetaData.

Doc from javafx.scene.control.Control.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

getControlCssMetaDataback to summary
protected List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData()

Overrides javafx.scene.control.Control.getControlCssMetaData.

Doc from javafx.scene.control.Control.getControlCssMetaData.

Gets the unmodifiable list of the control's CSS-styleable properties.

Annotations
@Override
getFadingSizeback to summary
public final double getFadingSize()
getItemsback to summary
public final ObservableList<T> getItems()
getSelectedItemback to summary
public final T getSelectedItem()
getUserAgentStylesheetback to summary
public String getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

Doc from javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. These styles are used in addition to whatever user-agent stylesheets are in use. This provides a mechanism for third parties to introduce styles for custom controls.

The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath.

Subclasses overriding this method should not assume any particular implementation approach as to the number and frequency with which it is called. For this reason, attempting any kind of dynamic implementation (i.e. returning different user agent stylesheet values) based on some state change is highly discouraged, as there is no guarantee when, or even if, this method will be called. Some JavaFX CSS implementations may choose to cache this response for an indefinite period of time, and therefore there should be no expectation around when this method is called.



package com.example.javafx.app;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class MyApp extends Application {

    @Override public void start(Stage stage) {
        Scene scene = new Scene(new Group());
        scene.getStylesheets().add("/com/example/javafx/app/mystyles.css");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
For additional information about using CSS with the scene graph, see the CSS Reference Guide.
Annotations
@Override
isAlwaysCenterback to summary
public final boolean isAlwaysCenter()
isAnimateScrollingback to summary
public final boolean isAnimateScrolling()
isAutoScrollingback to summary
public final boolean isAutoScrolling()
isLoopSelectionback to summary
public final boolean isLoopSelection()
itemsPropertyback to summary
public final ListProperty<T> itemsProperty()

The model used by the strip view control.

Returns:ListProperty<T>

the list of items shown in the view

loopSelectionPropertyback to summary
public final BooleanProperty loopSelectionProperty()

Property to determine whether the selection should loop from the end to the start and vice versa. true means that the selection will loop.

scrollToback to summary
public void scrollTo(T item)
selectedItemPropertyback to summary
public final ObjectProperty<T> selectedItemProperty()

Stores the currently selected item.

Returns:ObjectProperty<T>

the selected item

setAlwaysCenterback to summary
public final void setAlwaysCenter(boolean alwaysCenter)
setAnimateScrollingback to summary
public final void setAnimateScrolling(boolean animateScrolling)
setAnimationDurationback to summary
public final void setAnimationDuration(Duration animationDuration)
setAutoScrollingback to summary
public final void setAutoScrolling(boolean autoScrolling)
setCellFactoryback to summary
public final void setCellFactory(Callback<StripView<T>, StripView.StripCell<T>> cellFactory)
setFadingSizeback to summary
public final void setFadingSize(double fadingSize)
setItemsback to summary
public final void setItems(ObservableList<T> items)
setLoopSelectionback to summary
public final void setLoopSelection(boolean value)
setSelectedItemback to summary
public final void setSelectedItem(T selectedItem)
com.dlsc.gemsfx back to summary

public Class StripView.StripCell<T>

extends Label
Class Inheritance
Type Parameters
<T>
the type of the model object shown by the cell

A strip cell is being used by cell factories of the StripView control.

Field Summary

Modifier and TypeField and Description
private final ObjectProperty<T>
private static final PseudoClass
private BooleanProperty
private final InvalidationListener
private final ObjectProperty<StripView<T>>
private final WeakInvalidationListener

Constructor Summary

AccessConstructor and Description
public
StripCell()

Constructs a new cell.

Method Summary

Modifier and TypeMethod and Description
public final T
public final StripView<T>
public final boolean
public final ObjectProperty<T>

Returns:

the model item
itemProperty
()

The model item shown in the cell.

public final BooleanProperty

Returns:

true if the cell is selected
selectedProperty
()

Defines whether a cell is currently selected or not.

public final void
setItem(T item)

public final void
setSelected(boolean value)

public final void
setStripView(StripView<T> stripView)

public final ObjectProperty<StripView<T>>

Returns:

the parent control
stripViewProperty
()

Stores a reference back to the strip view where the cell is being used.

private void
Inherited from javafx.scene.control.Label:
createDefaultSkingetInitialFocusTraversablegetLabelForlabelForPropertysetLabelFor

Field Detail

itemback to summary
private final ObjectProperty<T> item
PSEUDO_CLASS_SELECTEDback to summary
private static final PseudoClass PSEUDO_CLASS_SELECTED
selectedback to summary
private BooleanProperty selected
selectionListenerback to summary
private final InvalidationListener selectionListener
stripViewback to summary
private final ObjectProperty<StripView<T>> stripView
weakSelectionListenerback to summary
private final WeakInvalidationListener weakSelectionListener

Constructor Detail

StripCellback to summary
public StripCell()

Constructs a new cell.

Method Detail

getItemback to summary
public final T getItem()
getStripViewback to summary
public final StripView<T> getStripView()
isSelectedback to summary
public final boolean isSelected()
itemPropertyback to summary
public final ObjectProperty<T> itemProperty()

The model item shown in the cell.

Returns:ObjectProperty<T>

the model item

selectedPropertyback to summary
public final BooleanProperty selectedProperty()

Defines whether a cell is currently selected or not.

Returns:BooleanProperty

true if the cell is selected

setItemback to summary
public final void setItem(T item)
setSelectedback to summary
public final void setSelected(boolean value)
setStripViewback to summary
public final void setStripView(StripView<T> stripView)
stripViewPropertyback to summary
public final ObjectProperty<StripView<T>> stripViewProperty()

Stores a reference back to the strip view where the cell is being used.

Returns:ObjectProperty<StripView<T>>

the parent control

updateSelectionback to summary
private void updateSelection()
com.dlsc.gemsfx back to summary

private Class StripView.StyleableProperties

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final CssMetaData<StripView<T>, Number>
private static final List<CssMetaData<? extends Styleable, ?>>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

FADING_SIZEback to summary
private static final CssMetaData<StripView<T>, Number> FADING_SIZE
STYLEABLESback to summary
private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES

Constructor Detail

StyleablePropertiesback to summary
private StyleableProperties()