Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 212073 - Item-specific colors and font
Summary: Item-specific colors and font
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Nebula (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nicolas Richeton CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 212071
  Show dependency tree
 
Reported: 2007-12-05 16:32 EST by Peter Centgraf CLA
Modified: 2021-07-05 11:40 EDT (History)
0 users

See Also:


Attachments
Fix for item-specific rendering properties (29.15 KB, patch)
2007-12-07 13:42 EST, Peter Centgraf CLA
nicolas.richeton: iplog+
Details | Diff
Updated rendering patch (29.47 KB, patch)
2007-12-10 17:48 EST, Peter Centgraf CLA
nicolas.richeton: iplog+
Details | Diff
Refresh GalleryItem when setters are called. (1.50 KB, patch)
2008-01-22 17:03 EST, Peter Centgraf CLA
nicolas.richeton: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Centgraf CLA 2007-12-05 16:32:40 EST
The JFace Viewer APIs assume that individual Item subclasses can have distinct Foreground, Background, and Font settings.  For full parity with the Table, Tree, and Grid APIs, Gallery should also support item-level configuration of these properties.
Comment 1 Nicolas Richeton CLA 2007-12-07 04:28:32 EST
Fixed on CVS.
Note that it' up to the renderer to make use of these properties. The current renderers do not use them ATM.
Thanks for reporting this
Comment 2 Peter Centgraf CLA 2007-12-07 13:39:54 EST
The new properties do not check arguments or trigger a redraw.
Comment 3 Peter Centgraf CLA 2007-12-07 13:42:42 EST
Created attachment 84765 [details]
Fix for item-specific rendering properties

GalleryItem now triggers a redraw when a rendering property is changed, following the model of TableItem.  DefaultGalleryItemRenderer now uses these properties or defaults to the Gallery values if they are null.  I also included some fixes for rendering in Gallery itself.  A test snippet will be forthcoming in the latest version of the GalleryTreeViewer patch.
Comment 4 Peter Centgraf CLA 2007-12-10 17:45:29 EST
I've just noticed that none of the other properties of GalleryItem causes a redraw, as they should.  Although the base Item class does not explicitly redraw, TableItem and TreeItem both do.  I'm not sure if this fits here or should be another bug.  Since this is tied in with the fix for this bug, I'll update my patch here.
Comment 5 Peter Centgraf CLA 2007-12-10 17:48:09 EST
Created attachment 84905 [details]
Updated rendering patch

The GalleryItem text, image, and description setters call redraw(GalleryItem), and the expanded setter calls updateStructuralValues(false) and then a full redraw().
Comment 6 Nicolas Richeton CLA 2007-12-11 13:52:39 EST
There are some issues with your new background color management :
- Redraw problems on mac (Some black lines appear when you scroll the gallery viewer on mac)
- The gallery no longer draw the background on mac. 

Additionally, you let the item renderer fill the background, and this will prevent group renderers to draw a custom background (gradient or image). 

If TableItem or TreeItem redraw their parent on property change, GalleryItem should do it.  But I'd rather redraw only the item and not the full table. 

Since my subnet is no longer blacklisted by dev.eclipse, I can start working on this too :-)
Comment 7 Peter Centgraf CLA 2007-12-11 15:20:38 EST
I agree with all of your comments.  Unfortunately, I only tested with Windows XP so far, so platform-specific bugs are likely.  I have access to Mac OS X 10.4 and 10.5 and Fedora 7, but not Vista.  It will take time for me to try them all, though.

In my patch, only setExpanded() will cause a full redraw.  I think it is necessary in that case, since the layout needs to be fully recomputed.  Other properties call the redraw(GalleryItem) method, which should only affect the one item that has changed.  I implemented that method myself, so it is not well tested yet.

I see your point about the GalleryItem background color.  I suppose that it should only fill the background when a color has been set, and otherwise allow the background to remain unmodified.  I was also making an incorrect assumption that the Gallery would be completely filled by GalleryItems, but I see now that there may be gaps between them.  You can simply restore the old code that filled the entire background before drawing the items.
Comment 8 Nicolas Richeton CLA 2008-01-10 04:49:32 EST
Fixed in CVS. Thanks for the patch.
Comment 9 Peter Centgraf CLA 2008-01-22 17:03:07 EST
Created attachment 87572 [details]
Refresh GalleryItem when setters are called.

These changes were included in the last patch, but they got lost in the shuffle.  This patch is against the current HEAD 1.10 version of GalleryItem.
Comment 10 Peter Centgraf CLA 2008-01-22 17:03:50 EST
Please apply the latest patch before closing this again.
Comment 11 Nicolas Richeton CLA 2008-01-23 03:24:16 EST
Fixed in CVS
Comment 12 Nicolas Richeton CLA 2009-02-26 02:40:48 EST
Closing