Top Description Fields Constructors Methods
impl.org.controlsfx.skin

public Class ToggleSwitchSkin

extends SkinBase<ToggleSwitch>
Class Inheritance
Imports
javafx.animation.Animation, .TranslateTransition, javafx.beans.property.DoubleProperty, javafx.beans.value.WritableValue, javafx.css.CssMetaData, .Styleable, .StyleableDoubleProperty, .StyleableProperty, javafx.css.converter.SizeConverter, javafx.geometry.Pos, javafx.scene.control.Label, .SkinBase, javafx.scene.input.KeyCode, .KeyEvent, javafx.scene.layout.StackPane, javafx.util.Duration, org.controlsfx.control.ToggleSwitch, java.util.ArrayList, .Collections, .List

Basic Skin implementation for the ToggleSwitch

Field Summary

Modifier and TypeField and Description
private final Label
private final StackPane
private static final List<CssMetaData<? extends Styleable, ?>>
private final StackPane
private static final CssMetaData<ToggleSwitch, Number>
private final StackPane
private DoubleProperty
thumbMoveAnimationTime

How many milliseconds it should take for the thumb to go from one edge to the other

private final TranslateTransition

Constructor Summary

AccessConstructor and Description
public
ToggleSwitchSkin(ToggleSwitch
The ToggleSwitch for which this Skin should attach to.
control
)

Constructor for all ToggleSwitchSkin instances.

Method Summary

Modifier and TypeMethod and Description
protected double
computeMaxHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computeMaxHeight.

Computes the maximum allowable height of the Skin, based on the provided width.

protected double
computeMaxWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computeMaxWidth.

Computes the maximum allowable width of the Skin, based on the provided height.

protected double
computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computeMinHeight.

Computes the minimum allowable height of the Skin, based on the provided width.

protected double
computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computeMinWidth.

Computes the minimum allowable width of the Skin, based on the provided height.

protected double
computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computePrefHeight.

Calculates the preferred height of this SkinBase.

protected double
computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computePrefWidth.

Calculates the preferred width of this SkinBase.

public static List<CssMetaData<? extends Styleable, ?>>

Returns:

The CssMetaData associated with this class, which may include the CssMetaData of its super classes.
getClassCssMetaData
()

Hides javafx.scene.control.SkinBase.getClassCssMetaData.

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

public List<CssMetaData<? extends Styleable, ?>>
getCssMetaData()

Overrides javafx.scene.control.SkinBase.getCssMetaData.

This method should delegate to Node#getClassCssMetaData() so that a Node's CssMetaData can be accessed without the need for reflection.

private double
protected void
layoutChildren(double contentX, double contentY, double contentWidth, double contentHeight)

Overrides javafx.scene.control.SkinBase.layoutChildren.

Called during the layout pass of the scenegraph.

private void
private DoubleProperty
private void
toggle(ToggleSwitch toggleSwitch)

Inherited from javafx.scene.control.SkinBase:
computeBaselineOffsetconsumeMouseEventsdisposeexecuteAccessibleActiongetChildrengetNodegetSkinnablelayoutInArealayoutInArealayoutInAreapositionInAreapositionInAreapseudoClassStateChangedqueryAccessibleAttributeregisterChangeListenerregisterInvalidationListenerregisterListChangeListenersnappedBottomInsetsnappedLeftInsetsnappedRightInsetsnappedTopInsetsnapPositionsnapPositionXsnapPositionYsnapSizesnapSizeXsnapSizeYsnapSpacesnapSpaceXsnapSpaceYunregisterChangeListenersunregisterInvalidationListenersunregisterListChangeListeners

Field Detail

labelback to summary
private final Label label
labelContainerback to summary
private final StackPane labelContainer
STYLEABLESback to summary
private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES
thumbback to summary
private final StackPane thumb
THUMB_MOVE_ANIMATION_TIMEback to summary
private static final CssMetaData<ToggleSwitch, Number> THUMB_MOVE_ANIMATION_TIME
thumbAreaback to summary
private final StackPane thumbArea
thumbMoveAnimationTimeback to summary
private DoubleProperty thumbMoveAnimationTime

How many milliseconds it should take for the thumb to go from one edge to the other

transitionback to summary
private final TranslateTransition transition

Constructor Detail

ToggleSwitchSkinback to summary
public ToggleSwitchSkin(ToggleSwitch control)

Constructor for all ToggleSwitchSkin instances.

Parameters
control:ToggleSwitch

The ToggleSwitch for which this Skin should attach to.

Method Detail

computeMaxHeightback to summary
protected double computeMaxHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computeMaxHeight.

Doc from javafx.scene.control.SkinBase.computeMaxHeight.

Computes the maximum allowable height of the Skin, based on the provided width.

Annotations
@Override
computeMaxWidthback to summary
protected double computeMaxWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computeMaxWidth.

Doc from javafx.scene.control.SkinBase.computeMaxWidth.

Computes the maximum allowable width of the Skin, based on the provided height.

Annotations
@Override
computeMinHeightback to summary
protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computeMinHeight.

Doc from javafx.scene.control.SkinBase.computeMinHeight.

Computes the minimum allowable height of the Skin, based on the provided width.

Annotations
@Override
computeMinWidthback to summary
protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computeMinWidth.

Doc from javafx.scene.control.SkinBase.computeMinWidth.

Computes the minimum allowable width of the Skin, based on the provided height.

Annotations
@Override
computePrefHeightback to summary
protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computePrefHeight.

Doc from javafx.scene.control.SkinBase.computePrefHeight.

Calculates the preferred height of this SkinBase. The default implementation calculates this height as the height of the area occupied by its managed children when they are positioned at their current positions at their preferred heights.

Annotations
@Override
computePrefWidthback to summary
protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computePrefWidth.

Doc from javafx.scene.control.SkinBase.computePrefWidth.

Calculates the preferred width of this SkinBase. The default implementation calculates this width as the width of the area occupied by its managed children when they are positioned at their current positions at their preferred widths.

Annotations
@Override
getClassCssMetaDataback to summary
public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData()

Hides javafx.scene.control.SkinBase.getClassCssMetaData.

Doc from javafx.scene.control.SkinBase.getClassCssMetaData.

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

Returns:List<CssMetaData<? extends Styleable, ?>>

The CssMetaData associated with this class, which may include the CssMetaData of its super classes.

getCssMetaDataback to summary
public List<CssMetaData<? extends Styleable, ?>> getCssMetaData()

Overrides javafx.scene.control.SkinBase.getCssMetaData.

Doc from javafx.scene.control.SkinBase.getCssMetaData.

This method should delegate to Node#getClassCssMetaData() so that a Node's CssMetaData can be accessed without the need for reflection.

Annotations
@Override
getThumbMoveAnimationTimeback to summary
private double getThumbMoveAnimationTime()
layoutChildrenback to summary
protected void layoutChildren(double contentX, double contentY, double contentWidth, double contentHeight)

Overrides javafx.scene.control.SkinBase.layoutChildren.

Doc from javafx.scene.control.SkinBase.layoutChildren.

Called during the layout pass of the scenegraph.

Annotations
@Override
selectedStateChangedback to summary
private void selectedStateChanged()
thumbMoveAnimationTimePropertyback to summary
private DoubleProperty thumbMoveAnimationTimeProperty()
toggleback to summary
private void toggle(ToggleSwitch toggleSwitch)