Alexandre (Shura) Iline
alexandre.iline at oracle.com
Mon Dec 26 03:54:58 PST 2011
What I am missing from the spec is how "other values, such as text or
images" are iterated through.
Will there be a comparator interface of some sort or will the data need
to be wrapped into some kind of container or what?
This is where the question is coming from:
If an automated test needs to scroll ("spin" ?) to a particular value,
how does it figure out which way to scroll and what value to expect next
after scrolling one time?
On 12/23/2011 03:46 AM, Jonathan Giles wrote:
> We've just made available the UX specs for Date Picker and Spinner here:
> -- Jonathan
> On 17/12/2011 6:16 p.m., Tom Eugelink wrote:
>> I would like to propose the addition of a spinner control to OpenJFX.
>> A spinner control for all means and purposes is a listview where only
>> one cell is visible (rendered) at a time. Moving to the next and
>> previous cell is done via clicking with the mouse on arrows or using
>> keyboard presses. The control's API could look like:
>> Class: *Spinner<T> extends Control*
>> T denotes the type it is holding; String, Integer, any bean.
>> *- ObjectProperty<T> valueProperty()
>> * The value property holds the currently displayed (selected) value
>> - ObjectProperty<Boolean> cyclicProperty()
>> * Cyclic means that the spinners cycles back to the beginning when the
>> end of the list of values is reached, e.g. december -> next ->
>> januari, or vice versa (januari -> previous -> december).
>> *- public void decrease()
>> * programatically select the previous value
>> - public void increase()
>> * programatically select the next value
>> *- ObjectProperty<EventHandler<CycleEvent>> onCycleProperty()
>> * OnCycle method gets called when the spinners cycles (see cyclic
>> A value change event is not needed, since registering to the value
>> property will take care of that. Detecting a cycle based on value
>> changes is cumbersome, so hence the OnCycle event.
>> Implementation considerations:
>> Since this actually is a list-with-just-one-cell, adopting a cell
>> factory may be a good idea.
>> Even though a spinner is a list-with-just-one-cell, using a list as
>> its data source is restrictive, because lists always have a lower and
>> upper bound. For example, take a spinner that selects a year: the
>> value "year" has no natural lower and upper bound. It could have in
>> certain situations, but as a concept it has not. Therefor I would like
>> to propose the usage of a data provider, in this case a
>> single-value-linear-data-provider. Such a data provider uses a
>> BigInteger to represent the current value and can increment or decrement.
>> Data provide API:
>> - *public BigInteger getPreviousIdx(BigInteger idx);*
>> Calculate the previous index given the provided one, returning null if
>> there is no previous. (Spinner may cycle.)
>> - *public BigInteger getNextIdx(BigInteger idx);*
>> Calculate the next index given the provided one, returning null if
>> there is no next. (Spinner may cycle.)
>> - *public T getValue(BigInteger idx);*
>> Return the value for the specified index, could return null as a valid
>> - *public BigInteger getIdx(T value);*
>> Return the idx for the specified value, returning null means the value
>> does not exist
>> The DataProvider can be based on an actual list, or on an
>> implementation allowing the endless selection of a year.
>> A initial (but fully working) implementation can be found at
>> (screenshot attached to the email).
More information about the openjfx-dev