Class WidgetValueProperty<S extends Widget,T>
- Type Parameters:
S- type of the source objectT- type of the value of the property
- All Implemented Interfaces:
IProperty,IValueProperty<S,,T> IWidgetValueProperty<S,T>
Widget properties. This
class implements some basic behavior that widget properties are generally
expected to have, namely:
- Calling
observe(org.eclipse.core.databinding.observable.Realm, S)should create the observable on the display realm of the widget, rather than the current default realm - All
observe()methods should return anISWTObservableValue
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 Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs a WidgetValueProperty which does not listen for any SWT events.protectedWidgetValueProperty(int changeEvent) Constructs a WidgetValueProperty with the specified SWT event typeprotectedWidgetValueProperty(int[] changeEvents) Constructs a WidgetValueProperty with the specified SWT event type(s).WidgetValueProperty(int[] changeEvents, int[] staleEvents) Constructs a WidgetValueProperty with the specified SWT event types. -
Method Summary
Modifier and TypeMethodDescriptionadaptListener(ISimplePropertyListener<S, ValueDiff<? extends T>> listener) Returns a listener capable of adding or removing itself as a listener on a source object using the the source's "native" listener API.Returns an observable value observing this value property on the given property sourceReturns an observable value observing this value property on the given property source.observeDelayed(int delay, S widget) Returns anISWTObservableValueobserving this value property on the given widget, which delays notification of value changes until at leastdelaymilliseconds have elapsed since that last change event, or until a FocusOut event is received from the widget (whichever happens first).protected ISWTObservableValue<T>wrapObservable(IObservableValue<T> observable, Widget widget) Methods inherited from class org.eclipse.core.databinding.property.value.SimpleValueProperty
doGetValue, doSetValue, observeDetail, observeDetail, observeDetailMethods inherited from class org.eclipse.core.databinding.property.value.ValueProperty
getValue, list, map, observeDetail, set, setValue, value, valueFactory, valueFactoryMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.core.databinding.property.value.IValueProperty
getValue, getValueType, list, map, observeDetail, observeDetail, observeDetail, observeDetail, set, setValue, value, valueFactory, valueFactory
-
Constructor Details
-
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 Details
-
adaptListener
public INativePropertyListener<S> adaptListener(ISimplePropertyListener<S, ValueDiff<? extends T>> listener) Description copied from class:SimpleValuePropertyReturns 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:
adaptListenerin classSimpleValueProperty<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
Description copied from interface:IValuePropertyReturns an observable value observing this value property on the given property source- Specified by:
observein interfaceIValueProperty<S extends Widget,T> - Overrides:
observein classSimpleValueProperty<S extends Widget,T> - Parameters:
realm- the observable's realmsource- the property source- Returns:
- an observable value observing this value property on the given property source
- Since:
- 1.9
-
wrapObservable
-
observe
Description copied from interface:IValuePropertyReturns an observable value observing this value property on the given property source.- Specified by:
observein interfaceIValueProperty<S extends Widget,T> - Specified by:
observein interfaceIWidgetValueProperty<S extends Widget,T> - Overrides:
observein classValueProperty<S extends Widget,T> - Parameters:
widget- the property source- Returns:
- an observable value observing this value property on the given property source
-
observeDelayed
Description copied from interface:IWidgetValuePropertyReturns anISWTObservableValueobserving this value property on the given widget, which delays notification of value changes until at leastdelaymilliseconds have elapsed since that last change event, or until a FocusOut event is received from the widget (whichever happens first).This observable helps to boost performance in situations where an observable has computationally expensive listeners (e.g. changing filters in a viewer) or many dependencies (master fields with multiple detail fields). A common use of this observable is to delay validation of user input until the user stops typing in a UI field.
To notify about pending changes, the returned observable fires a stale event when the wrapped observable value fires a change event, and remains stale until the delay has elapsed and the value change is fired. A call to
IObservableValue.getValue()while a value change is pending will fire the value change immediately, short-circuiting the delay.Only updates resulting from the observed widget are delayed. Calls directly to
IObservableValue.setValue(T)are not, and they cancel pending delayed values.Note that this observable will not forward
ValueChangingEventevents from a wrappedIVetoableValue.This method is equivalent to
SWTObservables.observeDelayedValue(delay, observe(widget)).- Specified by:
observeDelayedin interfaceIWidgetValueProperty<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
delaymilliseconds.
-