zaheeer / opal

Automatically exported from code.google.com/p/opal
0 stars 0 forks source link

DualList: Notifcation on SelectionChange #28

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a table
2. Try to get notified when the user adds or removes items to / from the 
selected list

What is the expected output? What do you see instead?
An api to register listeners that are notified when a (de-)selection is done.
The listeners that can be registered so far are widget event listeners and not 
notified when a user modifies the item lists. see selectItems.
Subclassing DualList is not possible as the itemsTable is private and wouldn't 
even allow to get notified if all items are moved at once.

What version of the product are you using? On what operating system?
0.9.9c

Please provide any additional information below.

I would recommend to extende the DualList with 
1) A separate interface for listeners to be notified when the current selection 
is changed by the user
2) Methods to add or remove such listeners
3) Enhancing selectItems() and deselectItems() to notify those listeners
4) Improve JavaDoc to better differentiate between 
select()/selectAll()/deselect()/deselectAll() and the 
selectItems()/deselectItems() methods.+

For 1 to 3 you can find the according code recommmendation attached to this 
issue. Please note, that the attached code contains the bug fix decribed for 
issue 26 as well.

Original issue reported on code.google.com by benjamin...@gmail.com on 10 Apr 2014 at 8:35

Attachments:

GoogleCodeExporter commented 8 years ago
This issue was closed by revision ba75c186be08.

Original comment by laurent....@gmail.com on 13 Apr 2014 at 8:20

GoogleCodeExporter commented 8 years ago
Hi Laurent,

I checked your modification and noticed it now fires separate events per 
selected item.
That means, if you have a listener triggering an expensive process on a user 
interaction, this happens many times instead of the single user interaction.

Based on you implementation, I could also not decide when all events have been 
fired.

Last but not least, based on your generic EventType and listener interface, I 
need to perform additional checks to find out if the items my listener was 
notified about have been selected or deselected.

So far, the "fix" is not what we needed and proposed. :(
Do you see any room for adaptation?

Original comment by benjamin...@gmail.com on 17 Apr 2014 at 3:28

GoogleCodeExporter commented 8 years ago
Hi Benjamin,

I'm sorry that this new release disapointed you, I did not understand your 
request :(
I've fixed the behaviour, which is close to a "classical" SWT widget.

If I understand well, you need to know :
a) If a item is selected or deselected (for exemple, a property in the event 
contains this information)
b) This event is fired when the selection changed, so it can contains a list of 
items
c) This event contains an information saying that this selection/deselection is 
done by code or by the user.

I need to implement a new Listener (for example SelectionChangeListener), and 
the method selectionChange will have
a parameter SelectionChangedEvents in which you'll find the widget (DualList), 
a flag saying "this change has been
done by code or user), a list of beans containing 2 objects : 
    - the item
    - a state : selected of deselected

Does it sound good for you ?

Laurent

Original comment by laurent....@gmail.com on 17 Apr 2014 at 7:23

GoogleCodeExporter commented 8 years ago
This issue was closed by revision d12e0114a62f.

Original comment by laurent....@gmail.com on 17 Apr 2014 at 9:39

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 0b0af41345ac.

Original comment by laurent....@gmail.com on 17 Apr 2014 at 9:39

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 3a440c1db791.

Original comment by laurent....@gmail.com on 17 Apr 2014 at 9:39