Revision: 10188
Author: jlaba...@google.com
Date: Mon May 16 08:38:11 2011
Log: SelectionChangeEvent currently is tightly coupled with
SelectionModel. There is no way to fire a SelectionChangeEvent outside of
something that implements SelectionModel. This patch fixes that and resuses
the HasFooHandlers pattern that is seen in most other gwt events.
Review at http://gwt-code-reviews.appspot.com/1426801/
Author: larse...@gmail.com (Jeff Larsen)
Review by: jlabanca
http://code.google.com/p/google-web-toolkit/source/detail?r=10188
Modified:
/trunk/user/src/com/google/gwt/view/client/SelectionChangeEvent.java
/trunk/user/src/com/google/gwt/view/client/SelectionModel.java
=======================================
--- /trunk/user/src/com/google/gwt/view/client/SelectionChangeEvent.java
Wed Oct 6 11:53:24 2010
+++ /trunk/user/src/com/google/gwt/view/client/SelectionChangeEvent.java
Mon May 16 08:38:11 2011
@@ -17,6 +17,8 @@
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
/**
* Represents a selection change event.
@@ -36,6 +38,20 @@
*/
void onSelectionChange(SelectionChangeEvent event);
}
+
+ /**
+ * Interface specifying that a class can add
+ * {@code SelectionChangeEvent.Handler}s.
+ */
+ public interface HasSelectionChangedHandlers extends HasHandlers {
+ /**
+ * Adds a {@link SelectionChangeEvent} handler.
+ *
+ * @param handler the handler
+ * @return {@link HandlerRegistration} used to remove this handler
+ */
+ HandlerRegistration addSelectionChangeHandler(Handler handler);
+ }
/**
* Handler type.
@@ -48,7 +64,7 @@
*
* @param source the source of the handlers
*/
- public static void fire(SelectionModel<?> source) {
+ public static void fire(HasSelectionChangedHandlers source) {
if (TYPE != null) {
SelectionChangeEvent event = new SelectionChangeEvent();
source.fireEvent(event);
=======================================
--- /trunk/user/src/com/google/gwt/view/client/SelectionModel.java Tue Nov
16 08:49:35 2010
+++ /trunk/user/src/com/google/gwt/view/client/SelectionModel.java Mon May
16 08:38:11 2011
@@ -20,14 +20,14 @@
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.event.shared.HasHandlers;
+import
com.google.gwt.view.client.SelectionChangeEvent.HasSelectionChangedHandlers;
/**
* A model for selection within a list.
*
* @param <T> the data type of records in the list
*/
-public interface SelectionModel<T> extends HasHandlers, ProvidesKey<T> {
+public interface SelectionModel<T> extends HasSelectionChangedHandlers,
ProvidesKey<T> {
/**
* A default implementation of {@link SelectionModel} that provides
listener
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors