diff options
author | Tatu Lund <tatu@vaadin.com> | 2020-07-03 11:39:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-03 11:39:41 +0300 |
commit | 40570e17319d96adcfebaaa8c98b1e16f58902f0 (patch) | |
tree | a46553c609af2933f2a1dea5f6f4416a6a95db97 /compatibility-server | |
parent | bafced6af34e398d52ef466b5752b34a8fd3684a (diff) | |
download | vaadin-framework-40570e17319d96adcfebaaa8c98b1e16f58902f0.tar.gz vaadin-framework-40570e17319d96adcfebaaa8c98b1e16f58902f0.zip |
Ensure type safety and serializable nature of all the listeners (#12045)
Diffstat (limited to 'compatibility-server')
11 files changed, 44 insertions, 33 deletions
diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/Property.java b/compatibility-server/src/main/java/com/vaadin/v7/data/Property.java index 8c93e72a79..f9a8da3203 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/Property.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/Property.java @@ -21,6 +21,7 @@ import java.io.Serializable; import com.vaadin.data.Binder; import com.vaadin.data.HasValue; import com.vaadin.data.ValueProvider; +import com.vaadin.event.SerializableEventListener; import com.vaadin.server.Setter; /** @@ -281,7 +282,7 @@ public interface Property<T> extends Serializable { * @since 3.0 */ @Deprecated - public interface ValueChangeListener extends Serializable { + public interface ValueChangeListener extends SerializableEventListener { /** * Notifies this listener that the Property's value has changed. @@ -373,7 +374,7 @@ public interface Property<T> extends Serializable { * @since 3.0 */ @Deprecated - public interface ReadOnlyStatusChangeListener extends Serializable { + public interface ReadOnlyStatusChangeListener extends SerializableEventListener { /** * Notifies this listener that a Property's read-only status has diff --git a/compatibility-server/src/main/java/com/vaadin/v7/event/ItemClickEvent.java b/compatibility-server/src/main/java/com/vaadin/v7/event/ItemClickEvent.java index ee7de988bb..1beb05400a 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/event/ItemClickEvent.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/event/ItemClickEvent.java @@ -19,6 +19,7 @@ import java.io.Serializable; import java.lang.reflect.Method; import com.vaadin.event.MouseEvents.ClickEvent; +import com.vaadin.event.SerializableEventListener; import com.vaadin.shared.MouseEventDetails; import com.vaadin.ui.Component; import com.vaadin.v7.data.Container; @@ -94,7 +95,7 @@ public class ItemClickEvent extends ClickEvent { } @Deprecated - public interface ItemClickListener extends Serializable { + public interface ItemClickListener extends SerializableEventListener { public void itemClick(ItemClickEvent event); } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/event/SelectionEvent.java b/compatibility-server/src/main/java/com/vaadin/v7/event/SelectionEvent.java index fb4c591744..024e5ec6c0 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/event/SelectionEvent.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/event/SelectionEvent.java @@ -22,6 +22,8 @@ import java.util.EventObject; import java.util.LinkedHashSet; import java.util.Set; +import com.vaadin.event.SerializableEventListener; + /** * An event that specifies what in a selection has changed, and where the * selection took place. @@ -100,7 +102,7 @@ public class SelectionEvent extends EventObject { * SelectionEvents}. */ @Deprecated - public interface SelectionListener extends Serializable { + public interface SelectionListener extends SerializableEventListener { /** * Notifies the listener that the selection state has changed. * diff --git a/compatibility-server/src/main/java/com/vaadin/v7/event/SortEvent.java b/compatibility-server/src/main/java/com/vaadin/v7/event/SortEvent.java index e3936dbf90..cc93c36e4a 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/event/SortEvent.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/event/SortEvent.java @@ -18,6 +18,7 @@ package com.vaadin.v7.event; import java.io.Serializable; import java.util.List; +import com.vaadin.event.SerializableEventListener; import com.vaadin.shared.Registration; import com.vaadin.ui.Component; import com.vaadin.v7.data.sort.SortOrder; @@ -78,7 +79,7 @@ public class SortEvent extends Component.Event { */ @FunctionalInterface @Deprecated - public interface SortListener extends Serializable { + public interface SortListener extends SerializableEventListener { /** * Called when the sort order has changed. * diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Calendar.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Calendar.java index f7e98a760a..66b665dfcd 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Calendar.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Calendar.java @@ -43,6 +43,7 @@ import org.jsoup.nodes.Element; import com.vaadin.event.Action; import com.vaadin.event.Action.Handler; +import com.vaadin.event.SerializableEventListener; import com.vaadin.event.dd.DropHandler; import com.vaadin.event.dd.DropTarget; import com.vaadin.event.dd.TargetDetails; @@ -182,7 +183,7 @@ public class Calendar extends AbstractLegacyComponent private String weeklyCaptionFormat = null; /** Map from event ids to event handlers */ - private final Map<String, EventListener> handlers; + private final Map<String, SerializableEventListener> handlers; /** * Drop Handler for Vaadin DD. By default null. @@ -303,7 +304,7 @@ public class Calendar extends AbstractLegacyComponent public Calendar(String caption, CalendarEventProvider eventProvider) { registerRpc(rpc); setCaption(caption); - handlers = new HashMap<String, EventListener>(); + handlers = new HashMap<String, SerializableEventListener>(); setDefaultHandlers(); currentCalendar.setTime(new Date()); setEventProvider(eventProvider); @@ -1429,7 +1430,7 @@ public class Calendar extends AbstractLegacyComponent * The method on the lister to call when the event is triggered */ protected void setHandler(String eventId, Class<?> eventType, - EventListener listener, Method listenerMethod) { + SerializableEventListener listener, Method listenerMethod) { if (handlers.get(eventId) != null) { removeListener(eventId, eventType, handlers.get(eventId)); handlers.remove(eventId); diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java index f67bbb4c3e..f13ea0198f 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java @@ -48,6 +48,7 @@ import com.vaadin.event.FieldEvents.BlurEvent; import com.vaadin.event.FieldEvents.BlurListener; import com.vaadin.event.FieldEvents.FocusEvent; import com.vaadin.event.FieldEvents.FocusListener; +import com.vaadin.event.SerializableEventListener; import com.vaadin.server.AbstractClientConnector; import com.vaadin.server.AbstractExtension; import com.vaadin.server.EncodeResult; @@ -210,7 +211,7 @@ public class Grid extends AbstractComponent * @since 7.5.0 */ @Deprecated - public interface ColumnVisibilityChangeListener extends Serializable { + public interface ColumnVisibilityChangeListener extends SerializableEventListener { /** * Called when a column has become hidden or unhidden. * @@ -831,7 +832,7 @@ public class Grid extends AbstractComponent * @since 7.5.0 */ @Deprecated - public interface ColumnReorderListener extends Serializable { + public interface ColumnReorderListener extends SerializableEventListener { /** * Called when the columns of the grid have been reordered. @@ -883,7 +884,7 @@ public class Grid extends AbstractComponent * @since 7.6 */ @Deprecated - public interface ColumnResizeListener extends Serializable { + public interface ColumnResizeListener extends SerializableEventListener { /** * Called when the columns of the grid have been resized. diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java index 0519e20f75..2cd3ad075e 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java @@ -41,6 +41,7 @@ import com.vaadin.event.Action; import com.vaadin.event.Action.Handler; import com.vaadin.event.ContextClickEvent; import com.vaadin.event.MouseEvents.ClickEvent; +import com.vaadin.event.SerializableEventListener; import com.vaadin.event.dd.DragAndDropEvent; import com.vaadin.event.dd.DragSource; import com.vaadin.event.dd.DropHandler; @@ -5430,7 +5431,7 @@ public class Table extends AbstractSelect implements Action.Container, * headerClick method is called when the user presses a header column cell. */ @Deprecated - public interface HeaderClickListener extends Serializable { + public interface HeaderClickListener extends SerializableEventListener { /** * Called when a user clicks a header column cell. @@ -5447,7 +5448,7 @@ public class Table extends AbstractSelect implements Action.Container, * footerClick method is called when the user presses a footer column cell. */ @Deprecated - public interface FooterClickListener extends Serializable { + public interface FooterClickListener extends SerializableEventListener { /** * Called when a user clicks a footer column cell. @@ -5684,7 +5685,7 @@ public class Table extends AbstractSelect implements Action.Container, * Interface for listening to column resize events. */ @Deprecated - public interface ColumnResizeListener extends Serializable { + public interface ColumnResizeListener extends SerializableEventListener { /** * This method is triggered when the column has been resized. @@ -5773,7 +5774,7 @@ public class Table extends AbstractSelect implements Action.Container, * Interface for listening to column reorder events. */ @Deprecated - public interface ColumnReorderListener extends Serializable { + public interface ColumnReorderListener extends SerializableEventListener { /** * This method is triggered when the column has been reordered. @@ -5825,7 +5826,7 @@ public class Table extends AbstractSelect implements Action.Container, * @since 7.6 */ @Deprecated - public interface ColumnCollapseListener extends Serializable { + public interface ColumnCollapseListener extends SerializableEventListener { /** * This method is triggered when the collapse state for a column has diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Tree.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Tree.java index 3a282b0233..806e16593e 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Tree.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Tree.java @@ -36,6 +36,7 @@ import org.jsoup.nodes.Element; import com.vaadin.event.Action; import com.vaadin.event.Action.Handler; import com.vaadin.event.ContextClickEvent; +import com.vaadin.event.SerializableEventListener; import com.vaadin.event.Transferable; import com.vaadin.event.dd.DragAndDropEvent; import com.vaadin.event.dd.DragSource; @@ -1054,7 +1055,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, * @since 3.0 */ @Deprecated - public interface ExpandListener extends Serializable { + public interface ExpandListener extends SerializableEventListener { public static final Method EXPAND_METHOD = ReflectTools.findMethod( ExpandListener.class, "nodeExpand", ExpandEvent.class); @@ -1159,7 +1160,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, * @since 3.0 */ @Deprecated - public interface CollapseListener extends Serializable { + public interface CollapseListener extends SerializableEventListener { public static final Method COLLAPSE_METHOD = ReflectTools.findMethod( CollapseListener.class, "nodeCollapse", CollapseEvent.class); diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Upload.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Upload.java index f7c080b4c0..189100f611 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Upload.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Upload.java @@ -23,6 +23,7 @@ import java.util.Collections; import java.util.LinkedHashSet; import java.util.Map; +import com.vaadin.event.SerializableEventListener; import com.vaadin.server.NoInputStreamException; import com.vaadin.server.NoOutputStreamException; import com.vaadin.server.PaintException; @@ -555,7 +556,7 @@ public class Upload extends AbstractLegacyComponent * @since 5.0 */ @Deprecated - public interface StartedListener extends Serializable { + public interface StartedListener extends SerializableEventListener { /** * Upload has started. @@ -573,7 +574,7 @@ public class Upload extends AbstractLegacyComponent * @since 3.0 */ @Deprecated - public interface FinishedListener extends Serializable { + public interface FinishedListener extends SerializableEventListener { /** * Upload has finished. @@ -591,7 +592,7 @@ public class Upload extends AbstractLegacyComponent * @since 3.0 */ @Deprecated - public interface FailedListener extends Serializable { + public interface FailedListener extends SerializableEventListener { /** * Upload has finished unsuccessfully. @@ -609,7 +610,7 @@ public class Upload extends AbstractLegacyComponent * @since 3.0 */ @Deprecated - public interface SucceededListener extends Serializable { + public interface SucceededListener extends SerializableEventListener { /** * Upload successful. @@ -626,7 +627,7 @@ public class Upload extends AbstractLegacyComponent * @since 7.2 */ @Deprecated - public interface ChangeListener extends Serializable { + public interface ChangeListener extends SerializableEventListener { Method FILENAME_CHANGED = ReflectTools.findMethod(ChangeListener.class, "filenameChanged", ChangeEvent.class); diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/components/calendar/CalendarComponentEvents.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/components/calendar/CalendarComponentEvents.java index cf2337274c..cc04ac15d9 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/components/calendar/CalendarComponentEvents.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/components/calendar/CalendarComponentEvents.java @@ -20,6 +20,7 @@ import java.lang.reflect.Method; import java.util.Date; import java.util.EventListener; +import com.vaadin.event.SerializableEventListener; import com.vaadin.util.ReflectTools; import com.vaadin.v7.shared.ui.calendar.CalendarEventId; import com.vaadin.v7.ui.Calendar; @@ -123,7 +124,7 @@ public interface CalendarComponentEvents extends Serializable { * */ @Deprecated - public interface EventMoveHandler extends EventListener, Serializable { + public interface EventMoveHandler extends SerializableEventListener { /** Trigger method for the MoveEvent. */ public static final Method eventMoveMethod = ReflectTools.findMethod( @@ -231,7 +232,7 @@ public interface CalendarComponentEvents extends Serializable { /** RangeSelectHandler handles RangeSelectEvent. */ @Deprecated - public interface RangeSelectHandler extends EventListener, Serializable { + public interface RangeSelectHandler extends SerializableEventListener { /** Trigger method for the RangeSelectEvent. */ public static final Method rangeSelectMethod = ReflectTools.findMethod( @@ -314,7 +315,7 @@ public interface CalendarComponentEvents extends Serializable { /** ForwardHandler handles ForwardEvent. */ @Deprecated - public interface ForwardHandler extends EventListener, Serializable { + public interface ForwardHandler extends SerializableEventListener { /** Trigger method for the ForwardEvent. */ public static final Method forwardMethod = ReflectTools.findMethod( @@ -351,7 +352,7 @@ public interface CalendarComponentEvents extends Serializable { /** BackwardHandler handles BackwardEvent. */ @Deprecated - public interface BackwardHandler extends EventListener, Serializable { + public interface BackwardHandler extends SerializableEventListener { /** Trigger method for the BackwardEvent. */ public static final Method backwardMethod = ReflectTools.findMethod( @@ -396,7 +397,7 @@ public interface CalendarComponentEvents extends Serializable { /** DateClickHandler handles DateClickEvent. */ @Deprecated - public interface DateClickHandler extends EventListener, Serializable { + public interface DateClickHandler extends SerializableEventListener { /** Trigger method for the DateClickEvent. */ public static final Method dateClickMethod = ReflectTools.findMethod( @@ -441,7 +442,7 @@ public interface CalendarComponentEvents extends Serializable { /** EventClickHandler handles EventClick. */ @Deprecated - public interface EventClickHandler extends EventListener, Serializable { + public interface EventClickHandler extends SerializableEventListener { /** Trigger method for the EventClick. */ public static final Method eventClickMethod = ReflectTools.findMethod( @@ -510,7 +511,7 @@ public interface CalendarComponentEvents extends Serializable { /** WeekClickHandler handles WeekClicks. */ @Deprecated - public interface WeekClickHandler extends EventListener, Serializable { + public interface WeekClickHandler extends SerializableEventListener { /** Trigger method for the WeekClick. */ public static final Method weekClickMethod = ReflectTools.findMethod( @@ -615,7 +616,7 @@ public interface CalendarComponentEvents extends Serializable { * Handler for EventResize event. */ @Deprecated - public interface EventResizeHandler extends EventListener, Serializable { + public interface EventResizeHandler extends SerializableEventListener { /** Trigger method for the EventResize. */ public static final Method eventResizeMethod = ReflectTools.findMethod( diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorChangeListener.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorChangeListener.java index 1077a2b7d9..2153a9e895 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorChangeListener.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorChangeListener.java @@ -15,7 +15,7 @@ */ package com.vaadin.v7.ui.components.colorpicker; -import java.io.Serializable; +import com.vaadin.event.SerializableEventListener; /** * The listener interface for receiving colorChange events. The class that is @@ -30,7 +30,7 @@ import java.io.Serializable; * @see ColorChangeEvent */ @Deprecated -public interface ColorChangeListener extends Serializable { +public interface ColorChangeListener extends SerializableEventListener { /** * Called when a new color has been selected. |