View Full Version : Improved ChangeListener management

22 Apr 2008, 2:51 AM
I think it would be useful to have the following methods on model objects:

setSilent(boolean) (or deactivateListeners)

There are situations where many properties on model objects are updated, but you don't want the views to be notified on each property update.

Since the BaseModel.notify() method now is public, the following sceneario would be useful:

- Controller does RPC call and fetches lots of data
- Controller silences the model object
- Controller updates many props on the model object
- Controller reactivates ChangeListeners on model object
- Controller calls notify() with generic model update event to allow viewers to refresh themselves.

22 Apr 2008, 7:36 AM
You bring up some good use cases. Here is what I am doing:

1. addChangeListener / removeChangeListener now use varargs. So you can add multiple listeners using the same method for adding a single listener. I prefer this over adding additional methods to the ChangeEventSource interface.

2. I added a new removeChangeListeners method.

2. I have added a setSilent method that enables / disables the firing of events.

How does that sound? Changes will go out in the next rev.

22 Apr 2008, 1:06 PM
Sounds good Darrel, thanks!

Now I only need to convince purchasing department in our enterprise to speed up purchasing Ext-GWT support, so I can get access to SVN trunk again....