| Summary: | GalleryTreeViewer | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Peter Centgraf <peter> | ||||||||||
| Component: | Nebula | Assignee: | Peter Centgraf <peter> | ||||||||||
| Status: | CLOSED INVALID | QA Contact: | |||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P1 | CC: | nicolas.richeton, tom.schindl | ||||||||||
| Version: | unspecified | Keywords: | plan | ||||||||||
| Target Milestone: | --- | ||||||||||||
| Hardware: | All | ||||||||||||
| OS: | All | ||||||||||||
| Whiteboard: | |||||||||||||
| Bug Depends on: | 212073, 212074, 212077 | ||||||||||||
| Bug Blocks: | 224692 | ||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Peter Centgraf
Created attachment 84678 [details]
Initial Implementation
This patch includes an initial implementation of GalleryTreeViewer, along with the supporting classes GalleryViewerRow and FlatTreeContentProvider. FlatTreeContentProvider adapts an IStructuredContentProvider to ITreeContentProvider so that it can be used with GalleryTreeViewer. I've also included a simple GalleryViewerTester class that demonstrates use of the content provider, label provider, comparator, and filter APIs with Gallery.
The attached implementation has some limitations: Since visual properties cannot be set for individual GalleryItems, the methods of ILabelProvider that relate to these properties have no effect. This can be fixed easily once bug 212073 is fixed. Gallery does not support the TreeListener APIs (bug 212077), so neither does GalleryTreeViewer. GalleryItems cannot be created out of order (bug 212074), so AbstractTreeViewer.insert() will always place the new item at the end of the list for the given parent. There is currently no way to configure the description property of a GalleryItem. The ColumnLabelProvider.update(ViewerCell) method seems like the most logical way to support this, but I haven't quite figured out how to map the ColumnViewer semantics onto Gallery. The same goes for tooltips, etc. In general, any APIs related to columns should be treated as forbidden territory. I'm not sure how to deal with this yet. All of this code is minimally tested, so use with caution. For example, I have no idea how it will react if you give it an ITreeContentProvider that wants to go deeper than two levels. For that matter, I don't know how Gallery would react if you did this with its raw APIs. Help in testing would definitely be appreciated. Really cool. I've fixed the blocking bugs. I'll try it ASAP. The gallery is designed to support more than 2 levels, but the current renderers only support 1 or 2 so this is clearly untested. Created attachment 84766 [details]
Updated patch with item rendering and insertion support
New version of GalleryTreeViewer with support for the new APIs introduced by the bugs listed above. GalleryViewerTester now makes some arbitrary changes to the item rendering for demonstration.
I also removed the Java 5 language features so that this will compile cleanly in 1.4. Please let me know if I left any 1.5 APIs, since I don't have a 1.4 JVM installed right now. I've included project-specific compiler settings to enforce this in the future.
If you need some support from JFace don't bother to ask. (In reply to comment #5) > If you need some support from JFace don't bother to ask. > It didn't meant what the words above translate into. I wanted to say if you need support from JFace e.g. to get API, ... . You can bother me/us everytime, I appreciate that people are using the new JFace-Infrastructure and want to support them in all ways possible. Tom I've committed your GallerryViewer on CVS and made some changes in color and background management. Created attachment 87569 [details]
Better handling of image and text setters in GalleryViewerRow
Created attachment 87570 [details]
Stopgap solution for disposed items in the Gallery selection
This patch is a workaround for the fact that Gallery.getSelection() sometimes returns disposed GalleryItems. It should only be used until the behavior of Gallery has been fixed.
About your patch (87569) : GalleryItem.setText(null) is valid, I don't think it should be replaced by an empty string. I'll review and commit your patchs this week, sorry for the delay. TreeItem and TableItem don't allow this so if you want to stay compilant with them you should not allow it. If you take a look at TableViewerRow and TreeViewerRow you'll see that there the viewer code takes care of this just like Peters patch does. Ok, I changed the renderers to check for an empty string. I also made some progress on the Virtual support. The Gallery widget didn't support adding items with new GalleryItem() in virtual mode. I'll commit the code this week but because of the changes I made, I need to ensure I didn't break anything. Currently Junit tests are green, Nebula examples and Sharemedia work as expected I've committed my latest changes and Peter's patches. I've ensured that Gallery and Tree have the same behavior in virtual mode, when creating and disposing items manually. (There is a new unit test for that purpose) Anything left to do on this bug ? It seems that all provided patches have been checked in. Peter, can I close this bug ? Yes, you can close this bug. The only remaining task would be to update the code to copy-paste from the latest version of TreeViewer instead of from the 3.3 version I originally used. Or better yet, to convince Tom to push the virtual support up the class hierarchy. :-) Is there a bug for pushing this up? The original reason to leave it in TreeViewer was that we hand no customer - this has changed when I read the comment appropriately. So please file a bug and we are going to investigate moving the support up into AbstractTreeViewer - now that we have a customer we have a justification to invest the time. Opened bug 273188 This bug does not have a target milestone assigned and is automatically closed as part of the 2.3.0 release cleanup. It could be that this bug is accidentally closed for which we apologize. If this bug is still relevant, please re-open and set a target milestone. |