Class ValueChangeEvent<T>
- java.lang.Object
-
- com.google.web.bindery.event.shared.Event<H>
-
- com.google.gwt.event.shared.GwtEvent<ValueChangeHandler<T>>
-
- com.google.gwt.event.logical.shared.ValueChangeEvent<T>
-
- Type Parameters:
T
- the value about to be changed
- Direct Known Subclasses:
DateChangeEvent
public class ValueChangeEvent<T> extends GwtEvent<ValueChangeHandler<T>>
Represents a value change event.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.gwt.event.shared.GwtEvent
GwtEvent.Type<H>
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ValueChangeEvent(T value)
Creates a value change event.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
dispatch(ValueChangeHandler<T> handler)
Should only be called byHandlerManager
.static <T> void
fire(HasValueChangeHandlers<T> source, T value)
Fires a value change event on all registered handlers in the handler manager.static <T> void
fireIfNotEqual(HasValueChangeHandlers<T> source, T oldValue, T newValue)
Fires value change event if the old value is not equal to the new value.GwtEvent.Type<ValueChangeHandler<T>>
getAssociatedType()
Returns theEvent.Type
used to register this event, allowing anEventBus
to find handlers of the appropriate class.static GwtEvent.Type<ValueChangeHandler<?>>
getType()
Gets the type associated with this event.T
getValue()
Gets the value.protected static <T> boolean
shouldFire(HasValueChangeHandlers<T> source, T oldValue, T newValue)
Convenience method to allow subtypes to know when they should fire a value change event in a null-safe manner.java.lang.String
toDebugString()
This is a method used primarily for debugging.
-
-
-
Constructor Detail
-
ValueChangeEvent
protected ValueChangeEvent(T value)
Creates a value change event.- Parameters:
value
- the value
-
-
Method Detail
-
fire
public static <T> void fire(HasValueChangeHandlers<T> source, T value)
Fires a value change event on all registered handlers in the handler manager. If no such handlers exist, this method will do nothing.- Type Parameters:
T
- the old value type- Parameters:
source
- the source of the handlersvalue
- the value
-
fireIfNotEqual
public static <T> void fireIfNotEqual(HasValueChangeHandlers<T> source, T oldValue, T newValue)
Fires value change event if the old value is not equal to the new value. Use this call rather than making the decision to short circuit yourself for safe handling of null.- Type Parameters:
T
- the old value type- Parameters:
source
- the source of the handlersoldValue
- the oldValue, may be nullnewValue
- the newValue, may be null
-
getType
public static GwtEvent.Type<ValueChangeHandler<?>> getType()
Gets the type associated with this event.- Returns:
- returns the handler type
-
shouldFire
protected static <T> boolean shouldFire(HasValueChangeHandlers<T> source, T oldValue, T newValue)
Convenience method to allow subtypes to know when they should fire a value change event in a null-safe manner.- Type Parameters:
T
- value type- Parameters:
source
- the sourceoldValue
- the old valuenewValue
- the new value- Returns:
- whether the event should be fired
-
getAssociatedType
public final GwtEvent.Type<ValueChangeHandler<T>> getAssociatedType()
Description copied from class:Event
Returns theEvent.Type
used to register this event, allowing anEventBus
to find handlers of the appropriate class.- Specified by:
getAssociatedType
in classGwtEvent<ValueChangeHandler<T>>
- Returns:
- the type
-
getValue
public T getValue()
Gets the value.- Returns:
- the value
-
toDebugString
public java.lang.String toDebugString()
Description copied from class:Event
This is a method used primarily for debugging. It gives a string representation of the event details. This does not override the toString method because the compiler cannot always optimize toString out correctly. Event types should override as desired.- Overrides:
toDebugString
in classEvent<ValueChangeHandler<T>>
- Returns:
- a string representing the event's specifics.
-
dispatch
protected void dispatch(ValueChangeHandler<T> handler)
Description copied from class:GwtEvent
Should only be called byHandlerManager
. In other words, do not use or call.- Specified by:
dispatch
in classGwtEvent<ValueChangeHandler<T>>
- Parameters:
handler
- handler- See Also:
EventBus.dispatchEvent(Event, Object)
-
-