This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 91338 - GTK L&F: Provide workaround for combo boxes with custom renderer
Summary: GTK L&F: Provide workaround for combo boxes with custom renderer
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords: API, API_REVIEW_FAST, GTK, UI
Depends on:
Blocks: 72440 212297
  Show dependency tree
 
Reported: 2006-12-20 13:53 UTC by David Simonek
Modified: 2012-05-11 16:53 UTC (History)
8 users (show)

See Also:
Issue Type: TASK
Exception Reporter:


Attachments
diff of API (4.98 KB, patch)
2006-12-20 14:02 UTC, David Simonek
Details | Diff
example API usage in projects UI (two cases) (8.13 KB, patch)
2006-12-20 14:03 UTC, David Simonek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Simonek 2006-12-20 13:53:23 UTC
In order to enable GTL LF by default for JDK 1.6.0 update 1, we need to
workaround JDK bug causing combo boxes with custom renderer to have no border
and incorrect smaller size in GTK look and feel. Details at
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6505565
Comment 1 David Simonek 2006-12-20 13:58:50 UTC
I propose to create new API class called JDKBug_6505565_WorkaroundRenderer.
Clients with custom renderers in combo boxes will subclass in order to get the
right look on GTK. Change has no visual effects on other known LFs.
Comment 2 David Simonek 2006-12-20 14:02:49 UTC
Created attachment 36841 [details]
diff of API
Comment 3 David Simonek 2006-12-20 14:03:39 UTC
Created attachment 36842 [details]
example API usage in projects UI (two cases)
Comment 4 David Simonek 2006-12-20 14:09:02 UTC
Hello api reviews, I'm asking for fast track review of this issue. All materials
are attached as diffs, both API + javadoc and its example usages.
Comment 5 Jesse Glick 2007-01-05 02:44:40 UTC
I don't think we should make a permanent API addition to work around a bug in
one JDK release! There must be some other solution that does not involve a
public API.


BTW please do not use the IDE's diff tool for generating patches for review. It
cannot produce -u diffs.
Comment 6 David Simonek 2007-01-30 17:16:54 UTC
Jesse, of course there is a way without API - copy & paste workaround code
(10-15 lines of code) into 50+ places in NetBeans where we are using custom
renderers for combo boxes. Is that right solution? I'm not sure...

Maybe I should rename API renderer class to NbDefaultListCellRenderer. That way,
only minimal change is needed on these 50+ places. And moreover, current code in
cvs won't work even after the fix from JDK team. Today, most custom renderers
extends from DefaultListCellRenderer, but it won't be enough. You will have to
extend from DefaultListCellRenderer.UIResource to say GTK LF: "paint the borders
and dimensions and style for me as it is in default case".
NbDefaultListCellRenderer will work the same way as
DefaultListCellRenderer.UIResource in future JDK versions (1.6.0 update 2 and
higher). Kirill Kirichenko from JDK team can provide details.

Note that we would like to show nice Netbeans running on GTK LF on JavaOne 2007,
and only 1.6 update 1 will be released at that time - that't why this is important.

What do you think? 

Comment 7 Jesse Glick 2007-01-30 18:09:56 UTC
I think with the name NbDefaultListCellRenderer it is OK *if* this is intended
as a permanent change (even after a fix of the JDK bug). I would first like some
clearer confirmation from the Swing team that there is no safe, portable, simple
way to write a list cell renderer, i.e. that a custom NB support API would
really be needed in perpetuity. DLCR.UIResource's Javadoc says

"DefaultListCellRenderer doesn't implement UIResource directly so that
applications can safely override the cellRenderer property with
DefaultListCellRenderer subclasses."

but I really can't figure out what that is supposed to mean.

If after the bugfix code should simply be subclassing DLCR.UIR (or something),
then I think introducing a new API as a workaround for a transient bug is a
mistake. We could create custom builds with the GTK support patch, or modify
source files and then revert the modifications after 6.0u2 is released, or
(perhaps) add the API as initially @Deprecated and then delete it later.
Comment 8 kirill_k 2007-01-31 11:08:14 UTC
JDKBug_6505565_WorkaroundRenderer will definitely work with further update
releases. I'll take care of it.
Swing tutorial show the correct way of creating custom renderers: implement
ListCellRenderer and extend JLabel. Of course it's possible to use
DefaultListCellRenderer here but it the Default and it sets up specific borders
and isOpaque policy which makes it look different than your implementation of
ListCellRenderer and extending JLabel.
Yesterday I had a talk with Scott Violet about using DefaultListCellRendrerer in
ComboBoxes (unfortunately he's leaving Sun soon) and we ended up with a way how
to fix it but it is not a preferable way.
And yes you should always implement UIResource in your custom renderers if want
them look like GTK native - it's Synth policy which we inherit in GTK L&F.
Otherwise you'll have to implement all painting bu yourself.
Comment 9 Jesse Glick 2011-11-28 18:09:13 UTC
Forgotten?
Comment 10 Stanislav Aubrecht 2011-12-12 10:56:23 UTC
bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6505565 is already fixed.
i also tried the latest build and it looks ok to me running either with 1.6 or 1.7

closing