Class SimpleValueProperty<S,T>
- java.lang.Object
-
- org.eclipse.core.databinding.property.value.ValueProperty<S,T>
-
- org.eclipse.core.databinding.property.value.SimpleValueProperty<S,T>
-
- Type Parameters:
S
- type of the source objectT
- type of the value of the property
- All Implemented Interfaces:
IProperty
,IValueProperty<S,T>
- Direct Known Subclasses:
ViewerValueProperty
,WidgetValueProperty
public abstract class SimpleValueProperty<S,T> extends ValueProperty<S,T>
Simplified abstract implementation of IValueProperty. This class takes care of most of the functional requirements for an IValueProperty implementation, leaving only the property-specific details to subclasses.Subclasses must implement these methods:
IValueProperty.getValueType()
doGetValue(Object)
doSetValue(Object, Object)
adaptListener(ISimplePropertyListener)
In addition, we recommended overriding
Object.toString()
to return a description suitable for debugging purposes.- Since:
- 1.2
-
-
Constructor Summary
Constructors Constructor Description SimpleValueProperty()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract INativePropertyListener<S>
adaptListener(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.protected abstract T
doGetValue(S source)
Returns the value of the property on the specified source objectprotected abstract void
doSetValue(S source, T value)
Sets the source's value property to the specified vlaueIObservableValue<T>
observe(Realm realm, S source)
Returns an observable value observing this value property on the given property source<U extends S>
IObservableList<T>observeDetail(IObservableList<U> master)
Returns an observable list on the master observable's realm which tracks this property on each element ofmaster
.<K,V extends S>
IObservableMap<K,T>observeDetail(IObservableMap<K,V> master)
Returns an observable map on the master observable's realm where the map's key set is the same as the master observable map, and where each value is the property value of the corresponding value in the master observable map.<U extends S>
IObservableMap<U,T>observeDetail(IObservableSet<U> master)
Returns an observable map on the master observable's realm where the map's key set is the specified master set, and where each key maps to the current property value for each element.-
Methods inherited from class org.eclipse.core.databinding.property.value.ValueProperty
getValue, list, map, observe, observeDetail, set, setValue, value, valueFactory, valueFactory
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.core.databinding.property.value.IValueProperty
getValueType
-
-
-
-
Method Detail
-
doGetValue
protected abstract T doGetValue(S source)
Description copied from class:ValueProperty
Returns the value of the property on the specified source object- Overrides:
doGetValue
in classValueProperty<S,T>
- Parameters:
source
- the property source- Returns:
- the current value of the source's value property
-
doSetValue
protected abstract void doSetValue(S source, T value)
Description copied from class:ValueProperty
Sets the source's value property to the specified vlaue- Overrides:
doSetValue
in classValueProperty<S,T>
- Parameters:
source
- the property sourcevalue
- the new value
-
adaptListener
public abstract INativePropertyListener<S> adaptListener(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. 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.
- 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.
- Restriction:
- This method is not intended to be referenced by clients.
-
observe
public IObservableValue<T> observe(Realm realm, S source)
Description copied from interface:IValueProperty
Returns an observable value observing this value property on the given property source- Parameters:
realm
- the observable's realmsource
- the property source- Returns:
- an observable value observing this value property on the given property source
-
observeDetail
public <U extends S> IObservableList<T> observeDetail(IObservableList<U> master)
Description copied from interface:IValueProperty
Returns an observable list on the master observable's realm which tracks this property on each element ofmaster
.- Specified by:
observeDetail
in interfaceIValueProperty<S,T>
- Overrides:
observeDetail
in classValueProperty<S,T>
- Parameters:
master
- the master observable- Returns:
- an observable list which tracks this property on each element of the master observable.
-
observeDetail
public <U extends S> IObservableMap<U,T> observeDetail(IObservableSet<U> master)
Description copied from interface:IValueProperty
Returns an observable map on the master observable's realm where the map's key set is the specified master set, and where each key maps to the current property value for each element.- Specified by:
observeDetail
in interfaceIValueProperty<S,T>
- Overrides:
observeDetail
in classValueProperty<S,T>
- Parameters:
master
- the master observable- Returns:
- an observable map that tracks the current value of this property for the elements in the given set.
-
observeDetail
public <K,V extends S> IObservableMap<K,T> observeDetail(IObservableMap<K,V> master)
Description copied from interface:IValueProperty
Returns an observable map on the master observable's realm where the map's key set is the same as the master observable map, and where each value is the property value of the corresponding value in the master observable map.- Specified by:
observeDetail
in interfaceIValueProperty<S,T>
- Overrides:
observeDetail
in classValueProperty<S,T>
- Parameters:
master
- the master observable- Returns:
- an observable map on the master observable's realm which tracks the current value of this property for the elements in the given map's values collection
-
-