Bug 21708 - [Viewers] Combo should support a Viewer
Summary: [Viewers] Combo should support a Viewer
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P2 enhancement with 1 vote (vote)
Target Milestone: 3.0 M9   Edit
Assignee: Stefan Xenos CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
: 33396 (view as bug list)
Depends on: 4510
Blocks:
  Show dependency tree
 
Reported: 2002-07-18 15:50 EDT by Eric CLA
Modified: 2004-04-08 21:11 EDT (History)
3 users (show)

See Also:


Attachments
Fix from bug 33396 (12.23 KB, patch)
2004-02-10 21:49 EST, Stefan Xenos CLA
no flags Details | Diff
A JUnit test for ComboControl (3.24 KB, patch)
2004-02-10 22:26 EST, Stefan Xenos CLA
no flags Details | Diff
Alternate ComboViewer implementation that shares its implementation with ListViewer (27.59 KB, patch)
2004-02-10 22:30 EST, Stefan Xenos CLA
no flags Details | Diff
Copies of the refactoried classes (in case the previous patch doesn't apply) (11.49 KB, application/octet-stream)
2004-02-10 22:32 EST, Stefan Xenos CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric CLA 2002-07-18 15:50:59 EDT
The Combo widget should support a viewer so that a content provider and label 
provider can be used. The content provider would allow something other than 
Strings to serve as a model and ideally the label provider would allow images 
to be displayed along side of text.
Comment 1 Steve Northover CLA 2002-07-22 11:39:06 EDT
Reassigning to UI.
Comment 2 Nick Edgar CLA 2002-07-23 10:21:35 EDT
Combo does not support images.  There is an existing PR for this: bug 4510, 
but it has not been touched in a while so if you really need this you should 
annotate that PR.

How are you using the Combo?  Is it in a preference page?  JFace has a 
FieldEditor abstraction for preference pages, and other components have 
written a ComboFieldEditor.  We should consider pushing this down, and 
supporting objects with a label provider in addition to strings.

Combos can also allow arbitrary editing in addition to picking from a 
predefined list.  There would be no underlying model object in this case.  It 
would have to give the value in the selection callback as a String in this 
case.


Comment 3 Eric CLA 2002-07-24 16:21:39 EDT
I would like to add a Combo to a composite outside of preferences which 
contains strings and images that refer to a custom object. For example, cars 
with a relevant image next to each car name.

Are you sure this bug is a duplicate of bug 4510? 4510 only refers to 
ComboBoxCellEditor's whereas this one strictly covers the Combo widget.

Regarding arbitrary editing, you could still have a separate model and provide 
something similar to an ICellModifier to handle when the value is changed. An 
example of a Combo that has a model is the JComboBox in Swing. 
Comment 4 Nick Edgar CLA 2003-02-09 23:25:29 EST
There are no plans for the UI team to work on this defect until higher priority 
items are addressed.   If you would like to work on this defect, please let us 
know on the platform-ui-dev mailing list.
Comment 5 Joseph Khalil CLA 2003-03-27 09:14:33 EST
This is really an important viewer that we are missing here
i don't know how this is not a high priority issue
Comment 6 Sebastian Davids CLA 2004-02-01 13:54:34 EST
possible fix in 33396
Comment 7 Stefan Xenos CLA 2004-02-10 20:42:10 EST
*** Bug 33396 has been marked as a duplicate of this bug. ***
Comment 8 Stefan Xenos CLA 2004-02-10 21:49:46 EST
Created attachment 7762 [details]
Fix from bug 33396

Simple fix for this defect (from duplicate bug 33396). I've been using this
class for some time, and it seems to work well.
Comment 9 Stefan Xenos CLA 2004-02-10 22:26:35 EST
Created attachment 7764 [details]
A JUnit test for ComboControl

This is a patch for org.eclipse.jface.tests.viewers in head. It contains new
tests for ComboViewer. The new tests are almost identical to the ListViewer
tests.

Note: currently, ComboViewer fails the insertChild test.
Comment 10 Stefan Xenos CLA 2004-02-10 22:30:54 EST
Created attachment 7765 [details]
Alternate ComboViewer implementation that shares its implementation with ListViewer

Here's an alternative ComboViewer implementation. This moves the common code
for ListViewer and ComboViewer into a common base class.

This is much cleaner, but it is not well tested. This is API-compatibile with
the other patch. The refactored version of ListViewer passes the test suites.
Comment 11 Stefan Xenos CLA 2004-02-10 22:32:44 EST
Created attachment 7766 [details]
Copies of the refactoried classes (in case the previous patch doesn't apply)
Comment 12 David Graham CLA 2004-03-12 19:21:57 EST
Do you realize how embarrassing it is to explain to Swing programmers that we
have to track model object indexing outside of the Combo?  Using the Combo
widget has been a royal pain so I hope this makes it into M8 :-).
Comment 13 Nick Edgar CLA 2004-03-15 00:37:51 EST
The patch needs work:

Overall:
- API classes should not extend non-API classes

AbstractListViewer:
- should be public
- missing Javadoc for class and its methods
- AbstractListViewer's abstract methods should be protected, not package-visible

ComboViewer
- missing @since 3.0 tag
- remove @author tag
- can have org.eclipse.swt.widgets.Combo in imports (this wasn't done for List 
in order to disambiguate it from java.util.List)
Comment 14 Stefan Xenos CLA 2004-04-08 21:11:41 EDT
Fixed in HEAD.