[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    Defaulting a comboBox's buttonCell to the cellFactory
From:       jonathan.giles () oracle ! com (Jonathan Giles)
Date:       2012-06-25 2:37:18
Message-ID: 4FE7CEDE.6080707 () oracle ! com
[Download RAW message or body]

Due to a lot of high-priority work that came in recently, I've just 
returned to this topic now. The issue that I see with taking option A is 
that the logic in the code would go something like this:

buttonCell = comboBox.getButtonCell() != null ? comboBox.getButtonCell() :
                 comboBox.getCellFactory() != null ? 
comboBox.getCellFactory().call(listView) :
                 getDefaultCellFactory().call(listView);

With option A, when the user wants to have the button area use the cell 
factory, the buttonCell will be null, and the cell factory will be 
non-null. This is fine - the display will be populated with a node from 
the cell factory. However, if the user wants the button area to be the 
default look, and they have a cell factory, they presently have no way 
of specifying that they do not want to use the cell factory.

Conversely, with the current approach, if a user wants a custom 
buttonCell - they set it in ComboBox.buttonCell. If they want a custom 
cell factory for the popup ListView, they set ComboBox.cellFactory. If 
they want both, they set both (and create a cell from the cell factory 
to set in the buttonCell, if they want the same look in both places).

Given how close we are cutting it to high resistance development 
(tomorrow for my team), I am not about to make any major changes to 
restructure this. I am at peace with the current design, and plan to 
leave things as-is. Urs, I'm sorry I could not meet your desired approach.

-- Jonathan

On 2/06/2012 9:32 a.m., Jonathan Giles wrote:
> So, in summary, Urs and I would appreciate votes on option A or option B:
>
> Option A: the ComboBox buttonCell by default uses a cell from the 
> provided cell factory.
>
> Option B: The ComboBox buttonCell DOES NOT use a cell from the 
> provided cell factory, and instead requires the user to manually 
> create a cell and set it in the buttonCell property.
>
> Option A is consistent with the approach used in JavaFX 2.1, whereas 
> Option B is the current approach used in JavaFX 2.2.
>
> The answer to this question largely comes down to the more common use 
> case when using the cell factory: do we expect users to want to use 
> the same cell in the button and the list, or do we expect them to want 
> to have different cells (and perhaps the default cell in the button 
> area).
>
> I'm totally not against changing this, so I welcome your votes on this 
> matter.
>
> -- Jonathan
>
>
> On 1/06/2012 5:39 p.m., Urs Reupke wrote:
>> Hi all,
>> back in April, Jonathan proposed a change to comboBoxes that allowed
>> to separate the button's rendering from the list's rendering.[1]
>>
>> In the JIRA issue accompanying that discussion [2], he also mentioned
>> ways to render the button when the new buttonCell property is not set:
>> "If this is not set, there are two options:
>> 1) Use a cell from the ComboBox.cellFactory
>> 2) Not style the button at all, and use a default cell from the skin"
>>
>> Now, in FX2.2b10, the buttonCell is rendered as toString if the
>> property is not set.
>> I believe that his option 1) would be a great improvement to the
>> behaviour, and Jonathan asked me to make that proposal public.
>> My reasoning is that those who need the buttonCell to be rendered
>> differently can do it, whereas those whose buttons and listcells look
>> alike don't need to think about it. From my experience, the latter
>> should be the majority.
>>
>> I appreciate your feedback on the matter.
>>
>> Thank you
>> -Urs
>>
>> [1] 
>> http://mail.openjdk.java.net/pipermail/openjfx-dev/2012-April/001209.html
>> [2] http://javafx-jira.kenai.com/browse/RT-21023



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic