Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make FlatComboPopup accessible and do not ignore prototype display value #80

Closed
etsinko opened this issue Mar 31, 2020 · 7 comments
Closed
Milestone

Comments

@etsinko
Copy link

etsinko commented Mar 31, 2020

There are cases when FlatComboBoxUI and FlatComboPopup need to be customized (i.e. to fix this problem: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4618607)

Currently FlatComboPopup is private and cannot be overriden by any class that inherits from FlatComobBoxUI. This leads to unnecessary copy/paste.

@DevCharly
Copy link
Collaborator

Good idea. Changed in master branch.

But FlatLaf uses wider popup for comboboxes by default:

image

Does this not work for you?

@etsinko
Copy link
Author

etsinko commented Mar 31, 2020

Hmm.. This is exactly what we need! But, for some reason, I thought FlatLaf didn't implement it.

@etsinko
Copy link
Author

etsinko commented Mar 31, 2020

Also, this is not related to the issue here, but in FlatComboPopup there are these lines:

Object prototype = comboBox.getPrototypeDisplayValue();
if( prototype != null )
comboBox.setPrototypeDisplayValue( null );
Dimension displaySize = getDisplaySize();
if( prototype != null )
comboBox.setPrototypeDisplayValue( prototype );

The problem for us is that we use prototype to speed up these calculations. Unfortunately, here it is set to null and then getDisplaySize() is called which iterates over all items in combo box if there is no prototype.

Is there any specific reason why prototype display value is set to null here?

@DevCharly
Copy link
Collaborator

I think the idea was to use the prototype to calculate the width of the combobox itself and then ignore it when computing popup width to get wider popup.

But this contrary to what the prototype is mainly there: increase performance.

I think I should change this...

@etsinko
Copy link
Author

etsinko commented Mar 31, 2020

I agree,
the most important function of prototype is to improve the performance of scroll pane width/height calculation. If the resulting width ends up incorrect, then it is up to the client code to either fix the prototype or remove it.

DevCharly added a commit that referenced this issue Mar 31, 2020
@DevCharly
Copy link
Collaborator

Now changed in master branch.
Thanks for pointing out the issue 👍

@DevCharly DevCharly changed the title Make FlatComboPopup accessible Make FlatComboPopup accessible and do not ignore prototype display value Mar 31, 2020
@DevCharly DevCharly added this to the 0.29 milestone Mar 31, 2020
@DevCharly
Copy link
Collaborator

fixed in 0.29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants