JFXTras to JavaFX 8 migration
Martin Sladecek
martin.sladecek at oracle.com
Mon Apr 8 02:00:27 PDT 2013
Should be.
-Martin
On 04/08/2013 10:46 AM, Tom Eugelink wrote:
>
> Thanks! That will be in b85?
>
> Tom
>
>
> On 2013-04-08 09:42, Martin Sladecek wrote:
>> Hi Tom,
>> if your ListSpinnerIntegerList doesn't implement RandomAccess
>> interface, you are not getting ObservableListWrapper, but
>> ObservableSequentialListWrapper instead. There's no reason not to
>> delegate this calls in ObservableSequentialListWrapper, esp. when it
>> will save us one extra class (iterator wrapper), so I will fix this.
>>
>> Regards,
>> -Martin
>>
>> On 04/06/2013 10:34 PM, Tom Eugelink wrote:
>>>
>>> I'm in the process of migrating my controls in JFXtras to JFX8. One
>>> of the issues I run in to is that my ListSpinner control gets stuck
>>> in a very long loop when it is used to spin over the years, where it
>>> does not on JFX2.2. The reason seems to be that the
>>> ObservableListWrapper, used to turn a regular List into a observable
>>> one (which is returned by FXCollections.observableList) is somehow
>>> by-passing the optimized indexOf that is implemented in my
>>> ListSpinnerIntegerList.
>>>
>>> ListSpinnerIntegerList extends AbstractList and overrides get() and
>>> size() to get an unmodifiable list as per JavaDoc.
>>> http://docs.oracle.com/javase/7/docs/api/java/util/AbstractList.html
>>>
>>> ListSpinnerIntegerList also overrides indexOf, because it has a very
>>> large range and instead of iterating, the index can easily be
>>> calculated from the value.
>>> https://github.com/JFXtras/jfxtras-labs/blob/8.0/src/main/java/jfxtras/labs/scene/control/ListSpinnerIntegerList.java
>>>
>>>
>>> In JFX 2.2 this works correctly, in JFX 8.0 the optimized indexOf is
>>> 'never' reached, but the JavaFX thread is busy in the iteration
>>> based implementation of indexOf in AbstractList.
>>> http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/AbstractList.java#AbstractList.indexOf%28java.lang.Object%29
>>>
>>>
>>> However, I cannot explain how it gets there and not in my optimized
>>> indexOf. The implementation of indexOf in ObservableListWrapper
>>> seems to forward it to the backing list.
>>> https://bitbucket.org/openjfxmirrors/openjfx-8-graphics-rt/src/c5937c934c188b70a51ad98cad4d24b91450105f/javafx-beans/src/com/sun/javafx/collections/ObservableListWrapper.java
>>>
>>>
>>> So I'm expecting
>>> call list.index() -> ObservableListWrapper.indexOf() ->
>>> backingList.indexOf() which is ListSpinnerIntegerList.indexOf()
>>>
>>> But that does not happen. The current workaround basically by
>>> overriding indexOf re-enforces the behavior of calling the backing
>>> list.
>>> See line 118 in
>>> https://github.com/JFXtras/jfxtras-labs/blob/8.0/src/main/java/jfxtras/labs/scene/control/ListSpinner.java
>>>
>>> I'm suspecting I'm not seeing the correct implementation of indexOf
>>> in ObservableListWrapper.
>>>
>>> How is indexOf implemented in ObservableListWrapper in 8.0?
>>>
>>> Tom
>>>
>>>
>>>
>>>
>>
>
>
More information about the openjfx-dev
mailing list