RFR: 8087555: [ChoiceBox] uncontained value not shown
Ambarish Rapte
arapte at openjdk.java.net
Fri Apr 24 14:07:44 UTC 2020
On Tue, 21 Apr 2020 12:16:57 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> The issue is that ChoiceBoxSkin
>> a) doesn't update the text of the label if the value is not contained in the items
>> b) doesn't respect converter for label text
>>
>> Fixed by
>> - listening to value changes to update the label
>> - removing ad-hoc updates (not needed), added update on converter change
>> - passing all label updates through converter
>>
>> Added test for text updates that failed before the fix and pass after (note: there were no tests for the display text,
>> so for coveragy, contains also tests that passed before as well as after)
>
> @aghaisas @arapte can you review?
I have not reviewed the code but have only tested it.
The value of index is not defined when an uncontained item is selected.
With the current implementation (with and without this PR change) there is a difference of behavior when an uncontained
item is selected Vs when an existing item is selected, in scenarios as below,
=> clearSelection()
a) scenario 1
1. Select/set an uncontained item. `selectedIndex` would be -1.
2. call `clearSelection()`, Does NOT clear the selected item to null
b) scenario 2
1. Select an item at index 2, `selectedIndex` would be 2.
2. Select/set an uncontained item. `selectedIndex` would remain 2.
3. call `clearSelection()`, => clears the selected item to null and selected index to -1
and similarly the difference of behavior can be observed with `selectNext()`, `selectPrevious()`
This is not formally documented(nor decided), so we might need to decide on a value of index for an uncontained value.
-------------
PR: https://git.openjdk.java.net/jfx/pull/191
More information about the openjfx-dev
mailing list