Class ValueChangeEvent<T>

    • 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 handlers
        value - 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 handlers
        oldValue - the oldValue, may be null
        newValue - the newValue, may be null
      • 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 source
        oldValue - the old value
        newValue - the new value
        Returns:
        whether the event should be fired
      • 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 class Event<ValueChangeHandler<T>>
        Returns:
        a string representing the event's specifics.