Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345672 - Support custom labels and images for values
Summary: Support custom labels and images for values
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Sapphire (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Konstantin Komissarchik CLA
QA Contact:
URL:
Whiteboard:
Keywords: plan
Depends on:
Blocks:
 
Reported: 2011-05-12 17:00 EDT by Konstantin Komissarchik CLA
Modified: 2021-11-19 09:22 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Komissarchik CLA 2011-05-12 17:00:16 EDT
We need a way for the possible value service implementations to provide labels and images to be used when presenting the value to the user.

A reference usecase for this is the checkbox list property editor when used in conjunction with enum lists. See related Bug 345671.
Comment 1 Konstantin Komissarchik CLA 2011-05-12 17:07:19 EDT
Enhancement implemented. Content added to the what's new doc. In short, the PossibleValuesService class has two new methods (label and image) that can be overridden by implementations.
Comment 2 Ling Hao CLA 2011-06-09 19:22:51 EDT
Verified image in possible value service shows up in checkbox list property editor. I commented out @PossibleValues in IMultiSelectListGalleryItem and replaced with my own possible value service. I noticed that the slush bucket is no longer the default property editor.
Comment 3 Konstantin Komissarchik CLA 2011-06-10 19:40:17 EDT
> I commented out @PossibleValues in IMultiSelectListGalleryItem and
> replaced with my own possible value service. I noticed that the slush 
> bucket is no longer the default property editor.

This was an unrelated regression. Fixed that.

However, the original implementation only used custom labels and images in the checkbox list property editor. The slush bucket property editor didn't use. I decided to go ahead and extend the support there too right now.

In the process of broadening the scope of this feature I uncovered a bad flaw in the API. The short of it is that providing custom label and image needs to be separate from the PossibleValuesService. So I removed the new methods from PossibleValuesService and instead created ValueLabelService and ValueImageService. 

List of places where these are used:

1. checkbox list property editor
2. slush bucket property editor
3. standard list property editor
4. possible values browse dialog

I have improved the multi-select list sample in the gallery to show this feature. I have also added an enum list example under multi-select gallery.

Note that one can verify #3 and #4 above using the slush-bucket example in the multi-select gallery. That's because the RHS of a slush bucket is a standard list property editor. It's the same code. Activating cell editing on the RHS of a slush bucket will show a browse button that leads to a dialog.

Updated the documentation accordingly.
Comment 4 Ling Hao CLA 2011-06-10 20:28:49 EDT
When selecting a checkbox, a new <empty> row is added and them removed (creating a flicker)
Comment 5 Konstantin Komissarchik CLA 2011-06-10 20:36:13 EDT
> When selecting a checkbox, a new <empty> row is added and them removed
> (creating a flicker)

Please open a separate bug for that. It seems unrelated.
Comment 6 Ling Hao CLA 2011-06-10 20:38:21 EDT
Verified in gallery sample