static class SpinnerValueFactory.LocalTimeSpinnerValueFactory extends SpinnerValueFactory<java.time.LocalTime>
SpinnerValueFactory
implementation designed to iterate through
LocalTime
values.
Note that the default converter
is implemented
simply as shown below, which may be adequate in many cases, but it is important
for users to ensure that this suits their needs (and adjust when necessary):
setConverter(new StringConverter<LocalTime>() { @Override public String toString(LocalTime object) { if (object == null) { return ""; } return object.toString(); } @Override public LocalTime fromString(String string) { return LocalTime.parse(string); } });
SpinnerValueFactory.DoubleSpinnerValueFactory, SpinnerValueFactory.IntegerSpinnerValueFactory, SpinnerValueFactory.ListSpinnerValueFactory<T>, SpinnerValueFactory.LocalDateSpinnerValueFactory, SpinnerValueFactory.LocalTimeSpinnerValueFactory
Modifier and Type | Field and Description |
---|---|
private LongProperty |
amountToStepBy |
private ObjectProperty<java.time.LocalTime> |
max |
private ObjectProperty<java.time.LocalTime> |
min
*
Properties *
*
|
private ObjectProperty<java.time.temporal.TemporalUnit> |
temporalUnit |
Constructor and Description |
---|
LocalTimeSpinnerValueFactory()
Creates a new instance of the LocalTimepinnerValueFactory, using the
value returned by calling
LocalTime#now() as the initial value,
and using a stepping amount of one day. |
LocalTimeSpinnerValueFactory(java.time.LocalTime initialValue)
Creates a new instance of the LocalTimeSpinnerValueFactory, using the
provided initial value, and a stepping amount of one hour.
|
LocalTimeSpinnerValueFactory(java.time.LocalTime min,
java.time.LocalTime max,
java.time.LocalTime initialValue)
Creates a new instance of the LocalTimeSpinnerValueFactory, using the
provided initial value, and a stepping amount of one hour.
|
LocalTimeSpinnerValueFactory(java.time.LocalTime min,
java.time.LocalTime max,
java.time.LocalTime initialValue,
long amountToStepBy,
java.time.temporal.TemporalUnit temporalUnit)
Creates a new instance of the LocalTimeSpinnerValueFactory, using the
provided min, max, and initial values, as well as the amount to step
by and
TemporalUnit . |
Modifier and Type | Method and Description |
---|---|
LongProperty |
amountToStepByProperty()
Sets the amount to increment or decrement by, per step.
|
void |
decrement(int steps)
Attempts to decrement the
value by the given
number of steps. |
long |
getAmountToStepBy() |
java.time.LocalTime |
getMax() |
java.time.LocalTime |
getMin() |
java.time.temporal.TemporalUnit |
getTemporalUnit() |
void |
increment(int steps)
Attempts to omcrement the
value by the given
number of steps. |
ObjectProperty<java.time.LocalTime> |
maxProperty()
Sets the maximum allowable value for this value factory
|
ObjectProperty<java.time.LocalTime> |
minProperty()
Sets the minimum allowable value for this value factory
|
void |
setAmountToStepBy(long value) |
void |
setMax(java.time.LocalTime value) |
void |
setMin(java.time.LocalTime value) |
void |
setTemporalUnit(java.time.temporal.TemporalUnit value) |
ObjectProperty<java.time.temporal.TemporalUnit> |
temporalUnitProperty()
The size of each step (e.g.
|
converterProperty, getConverter, getValue, isWrapAround, setConverter, setValue, setWrapAround, valueProperty, wrapAroundProperty
private ObjectProperty<java.time.LocalTime> min
private ObjectProperty<java.time.LocalTime> max
private ObjectProperty<java.time.temporal.TemporalUnit> temporalUnit
private LongProperty amountToStepBy
public LocalTimeSpinnerValueFactory()
LocalTime#now()
as the initial value,
and using a stepping amount of one day.public LocalTimeSpinnerValueFactory(java.time.LocalTime initialValue)
initialValue
- The value of the Spinner when first instantiated.public LocalTimeSpinnerValueFactory(java.time.LocalTime min, java.time.LocalTime max, java.time.LocalTime initialValue)
min
- The minimum allowed double value for the Spinner.max
- The maximum allowed double value for the Spinner.initialValue
- The value of the Spinner when first instantiated.public LocalTimeSpinnerValueFactory(java.time.LocalTime min, java.time.LocalTime max, java.time.LocalTime initialValue, long amountToStepBy, java.time.temporal.TemporalUnit temporalUnit)
TemporalUnit
.
To better understand, here are a few examples:
new LocalTimeSpinnerValueFactory(LocalTime.MIN, LocalTime.MAX, LocalTime.now(), 1, ChronoUnit.HOURS)
new LocalTimeSpinnerValueFactory(LocalTime.MIN, LocalTime.MAX, LocalTime.now(), 1, ChronoUnit.MINUTES)
min
- The minimum allowed double value for the Spinner.max
- The maximum allowed double value for the Spinner.initialValue
- The value of the Spinner when first instantiated.amountToStepBy
- The amount to increment or decrement by, per step.temporalUnit
- The size of each step (e.g. day, week, month, year, etc)public final void setMin(java.time.LocalTime value)
public final java.time.LocalTime getMin()
public final ObjectProperty<java.time.LocalTime> minProperty()
public final void setMax(java.time.LocalTime value)
public final java.time.LocalTime getMax()
public final ObjectProperty<java.time.LocalTime> maxProperty()
public final void setTemporalUnit(java.time.temporal.TemporalUnit value)
public final java.time.temporal.TemporalUnit getTemporalUnit()
public final ObjectProperty<java.time.temporal.TemporalUnit> temporalUnitProperty()
public final void setAmountToStepBy(long value)
public final long getAmountToStepBy()
public final LongProperty amountToStepByProperty()
public void decrement(int steps)
value
by the given
number of steps.decrement
in class SpinnerValueFactory<java.time.LocalTime>
steps
- The number of decrements that should be performed on the value.public void increment(int steps)
value
by the given
number of steps.increment
in class SpinnerValueFactory<java.time.LocalTime>
steps
- The number of increments that should be performed on the value.