Top Inners Fields Constructors Methods
com.dlsc.pickerfx.skins

public Class SegmentSkin<T, S>

extends SkinBase<Segment<T, S>>
Class Inheritance
Imports
com.dlsc.pickerfx.Segment, .SegmentCell, javafx.animation.Interpolator, .KeyFrame, .KeyValue, .Timeline, javafx.beans.InvalidationListener, javafx.beans.property.DoubleProperty, .SimpleDoubleProperty, javafx.collections.ObservableList, javafx.concurrent.Service, .Task, javafx.geometry.Orientation, javafx.scene.control.SkinBase, javafx.scene.input.MouseEvent, .ScrollEvent, javafx.scene.shape.Rectangle, javafx.util.Callback, .Duration

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private boolean
private final SegmentSkin.FixerService
private boolean
private final DoubleProperty
private double
private double
private final double
private Timeline
private boolean

Constructor Summary

AccessConstructor and Description
public
SegmentSkin(Segment<T, S> control)

Method Summary

Modifier and TypeMethod and Description
private int
private double
private int
private boolean
private void
layoutCell(double contentX, double contentY, double contentWidth, double contentHeight, double x, double y, double offset, Segment<T, S> segment, Callback<Segment<T, S>, SegmentCell<S>> cellFactory, ObservableList<S> items, int index, int position)

protected void
layoutChildren(double
the x position
contentX
,
double
the y position
contentY
,
double
the width
contentWidth
,
double
the height
contentHeight
)

Overrides javafx.scene.control.SkinBase.layoutChildren.

Called during the layout pass of the scenegraph.

private void
layoutChildrenHorizontally(double contentX, double contentY, double contentWidth, double contentHeight, Segment<T, S> tumbler, Callback<Segment<T, S>, SegmentCell<S>> cellFactory, ObservableList<S> items, double cellSize)

private void
layoutChildrenVertically(double contentX, double contentY, double contentWidth, double contentHeight, Segment<T, S> tumbler, Callback<Segment<T, S>, SegmentCell<S>> cellFactory, ObservableList<S> items, double cellSize)

private void
scrollTo(double loc)

private void
scrollToAnimated(double loc)

private void
private void
Inherited from javafx.scene.control.SkinBase:
computeBaselineOffsetcomputeMaxHeightcomputeMaxWidthcomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthconsumeMouseEventsdisposeexecuteAccessibleActiongetChildrengetClassCssMetaDatagetCssMetaDatagetNodegetSkinnablelayoutInArealayoutInArealayoutInAreapositionInAreapositionInAreapseudoClassStateChangedqueryAccessibleAttributeregisterChangeListenerregisterInvalidationListenerregisterListChangeListenersnappedBottomInsetsnappedLeftInsetsnappedRightInsetsnappedTopInsetsnapPositionsnapPositionXsnapPositionYsnapSizesnapSizeXsnapSizeYsnapSpacesnapSpaceXsnapSpaceYunregisterChangeListenersunregisterInvalidationListenersunregisterListChangeListeners

Field Detail

draggingback to summary
private boolean dragging
fixerServiceback to summary
private final SegmentSkin.FixerService fixerService
inertiaback to summary
private boolean inertia
locationback to summary
private final DoubleProperty location
mouseStartXback to summary
private double mouseStartX
mouseStartYback to summary
private double mouseStartY
STEPSback to summary
private final double STEPS
timelineback to summary
private Timeline timeline
updatingValueback to summary
private boolean updatingValue

Constructor Detail

SegmentSkinback to summary
public SegmentSkin(Segment<T, S> control)

Method Detail

getIndexForLocationback to summary
private int getIndexForLocation()
getOffsetback to summary
private double getOffset()
getValueIndexForLocationback to summary
private int getValueIndexForLocation()
isInertiaback to summary
private boolean isInertia()
layoutCellback to summary
private void layoutCell(double contentX, double contentY, double contentWidth, double contentHeight, double x, double y, double offset, Segment<T, S> segment, Callback<Segment<T, S>, SegmentCell<S>> cellFactory, ObservableList<S> items, int index, int position)
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.

Parameters
contentX:double

the x position

contentY:double

the y position

contentWidth:double

the width

contentHeight:double

the height

Annotations
@Override
layoutChildrenHorizontallyback to summary
private void layoutChildrenHorizontally(double contentX, double contentY, double contentWidth, double contentHeight, Segment<T, S> tumbler, Callback<Segment<T, S>, SegmentCell<S>> cellFactory, ObservableList<S> items, double cellSize)
layoutChildrenVerticallyback to summary
private void layoutChildrenVertically(double contentX, double contentY, double contentWidth, double contentHeight, Segment<T, S> tumbler, Callback<Segment<T, S>, SegmentCell<S>> cellFactory, ObservableList<S> items, double cellSize)
scrollToback to summary
private void scrollTo(double loc)
scrollToAnimatedback to summary
private void scrollToAnimated(double loc)
scrollToCurrentValueback to summary
private void scrollToCurrentValue()
snapLocationback to summary
private void snapLocation()
com.dlsc.pickerfx.skins back to summary

pack-priv Class SegmentSkin.FixerService

extends Service<Void>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final SegmentSkin<?, ?>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected Task<Void>
createTask()

Implements abstract javafx.concurrent.Service.createTask.

Invoked after the Service is started on the JavaFX Application Thread.

Inherited from javafx.concurrent.Service:
addEventFilteraddEventHandlerbuildEventDispatchChaincancelcancelledexceptionPropertyexecuteTaskexecutorPropertyfailedfireEventgetExceptiongetExecutorgetMessagegetOnCancelledgetOnFailedgetOnReadygetOnRunninggetOnScheduledgetOnSucceededgetProgressgetStategetTitlegetTotalWorkgetValuegetWorkDoneisRunningmessagePropertyonCancelledPropertyonFailedPropertyonReadyPropertyonRunningPropertyonScheduledPropertyonSucceededPropertyprogressPropertyreadyremoveEventFilterremoveEventHandlerresetrestartrunningrunningPropertyscheduledsetEventHandlersetExecutorsetOnCancelledsetOnFailedsetOnReadysetOnRunningsetOnScheduledsetOnSucceededstartstatePropertysucceededtitlePropertytotalWorkPropertyvaluePropertyworkDoneProperty

Field Detail

segmentSkinback to summary
private final SegmentSkin<?, ?> segmentSkin

Constructor Detail

FixerServiceback to summary
pack-priv FixerService(SegmentSkin<?, ?> skin)

Method Detail

createTaskback to summary
protected Task<Void> createTask()

Implements abstract javafx.concurrent.Service.createTask.

Doc from javafx.concurrent.Service.createTask.

Invoked after the Service is started on the JavaFX Application Thread. Implementations should save off any state into final variables prior to creating the Task, since accessing properties defined on the Service within the background thread code of the Task will result in exceptions. For example:


    protected Task createTask() {
        final String url = myService.getUrl();
        return new Task<String>() {
            protected String call() {
                URL u = new URL("http://www.oracle.com");
                BufferedReader in = new BufferedReader(
                        new InputStreamReader(u.openStream()));
                String result = in.readLine();
                in.close();
                return result;
            }
        }
    }

If the Task is a pre-defined class (as opposed to being an anonymous class), and if it followed the recommended best-practice, then there is no need to save off state prior to constructing the Task since its state is completely provided in its constructor.

protected Task createTask() {
        // This is safe because getUrl is called on the FX Application
        // Thread and the FirstLineReaderTasks stores it as an
        // immutable property
        return new FirstLineReaderTask(myService.getUrl());
    }
Returns:Task<Void>

the Task to execute

Annotations
@Override
com.dlsc.pickerfx.skins back to summary

pack-priv Class SegmentSkin.FixerTask

extends Task<Void>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final SegmentSkin<?, ?>

Constructor Summary

AccessConstructor and Description
pack-priv
FixerTask(SegmentSkin<?, ?> skin)

Method Summary

Modifier and TypeMethod and Description
protected Void
call()

Implements abstract javafx.concurrent.Task.call.

Invoked when the Task is executed, the call method must be overridden and implemented by subclasses.

Inherited from javafx.concurrent.Task:
addEventFilteraddEventHandlerbuildEventDispatchChaincancelcancelcancelledexceptionPropertyfailedfireEventgetExceptiongetMessagegetOnCancelledgetOnFailedgetOnRunninggetOnScheduledgetOnSucceededgetProgressgetStategetTitlegetTotalWorkgetValuegetWorkDoneisRunningmessagePropertyonCancelledPropertyonFailedPropertyonRunningPropertyonScheduledPropertyonSucceededPropertyprogressPropertyremoveEventFilterremoveEventHandlerrunningrunningPropertyscheduledsetEventHandlersetOnCancelledsetOnFailedsetOnRunningsetOnScheduledsetOnSucceededstatePropertysucceededtitlePropertytotalWorkPropertyupdateMessageupdateProgressupdateProgressupdateTitleupdateValuevaluePropertyworkDoneProperty

Field Detail

segmentSkinback to summary
private final SegmentSkin<?, ?> segmentSkin

Constructor Detail

FixerTaskback to summary
pack-priv FixerTask(SegmentSkin<?, ?> skin)

Method Detail

callback to summary
protected Void call() throws Exception

Implements abstract javafx.concurrent.Task.call.

Doc from javafx.concurrent.Task.call.

Invoked when the Task is executed, the call method must be overridden and implemented by subclasses. The call method actually performs the background thread logic. Only the updateProgress, updateMessage, updateValue and updateTitle methods of Task may be called from code within this method. Any other interaction with the Task from the background thread will result in runtime exceptions.

Returns:Void

The result of the background work, if any.

Annotations
@Override
Exceptions
Exception:
an unhandled exception which occurred during the background operation