Class WidgetValueProperty<S extends Widget,​T>

  • Type Parameters:
    S - type of the source object
    T - type of the value of the property
    All Implemented Interfaces:
    IProperty, IValueProperty<S,​T>, IWidgetValueProperty<S,​T>

    public abstract class WidgetValueProperty<S extends Widget,​T>
    extends SimpleValueProperty<S,​T>
    implements IWidgetValueProperty<S,​T>
    Abstract value property implementation for Widget properties. This class implements some basic behavior that widget properties are generally expected to have, namely: This class also provides a default widget listener implementation using SWT's untyped listener API. Subclasses may pass one or more SWT event type constants to the super constructor to indicate which events signal a property change.
    Since:
    1.3
    • Constructor Detail

      • WidgetValueProperty

        protected WidgetValueProperty()
        Constructs a WidgetValueProperty which does not listen for any SWT events.
      • WidgetValueProperty

        protected WidgetValueProperty​(int changeEvent)
        Constructs a WidgetValueProperty with the specified SWT event type
        Parameters:
        changeEvent - SWT event type constant of the event that signifies a property change.
      • WidgetValueProperty

        protected WidgetValueProperty​(int[] changeEvents)
        Constructs a WidgetValueProperty with the specified SWT event type(s).
        Parameters:
        changeEvents - array of SWT event type constants of the events that signify a property change.
      • WidgetValueProperty

        public WidgetValueProperty​(int[] changeEvents,
                                   int[] staleEvents)
        Constructs a WidgetValueProperty with the specified SWT event types.
        Parameters:
        changeEvents - array of SWT event type constants of the events that signify a property change.
        staleEvents - array of SWT event type constants of the events that signify a property became stale.
    • Method Detail

      • adaptListener

        public INativePropertyListener<S> adaptListener​(ISimplePropertyListener<S,​ValueDiff<? extends T>> listener)
        Description copied from class: SimpleValueProperty
        Returns a listener capable of adding or removing itself as a listener on a source object using the the source's "native" listener API. Events received from the source objects are parlayed to the specified listener argument.

        This method returns null if the source object has no listener APIs for this property.

        Specified by:
        adaptListener in class SimpleValueProperty<S extends Widget,​T>
        Parameters:
        listener - the property listener to receive events
        Returns:
        a native listener which parlays property change events to the specified listener, or null if the source object has no listener APIs for this property.
      • observe

        public ISWTObservableValue<T> observe​(Realm realm,
                                              S source)
        Description copied from interface: IValueProperty
        Returns an observable value observing this value property on the given property source
        Specified by:
        observe in interface IValueProperty<S extends Widget,​T>
        Overrides:
        observe in class SimpleValueProperty<S extends Widget,​T>
        Parameters:
        realm - the observable's realm
        source - the property source
        Returns:
        an observable value observing this value property on the given property source
        Since:
        1.9
      • observeDelayed

        public ISWTObservableValue<T> observeDelayed​(int delay,
                                                     S widget)
        Description copied from interface: IWidgetValueProperty
        Returns an ISWTObservableValue observing this value property on the given widget, which delays notification of value changes until at least delay milliseconds have elapsed since that last change event, or until a FocusOut event is received from the widget (whichever happens first).

        This method is equivalent to SWTObservables.observeDelayedValue(delay, observe(widget)).

        Specified by:
        observeDelayed in interface IWidgetValueProperty<S extends Widget,​T>
        Parameters:
        delay - the delay in milliseconds.
        widget - the source widget
        Returns:
        an observable value observing this value property on the given widget, and which delays change notifications for delay milliseconds.