Class ListProperty<S,E>
- java.lang.Object
-
- org.eclipse.core.databinding.property.list.ListProperty<S,E>
-
- Type Parameters:
S
- type of the source objectE
- type of the elements in the list
- All Implemented Interfaces:
IProperty
,IListProperty<S,E>
- Direct Known Subclasses:
DelegatingListProperty
,MultiListProperty
,SimpleListProperty
public abstract class ListProperty<S,E> extends Object implements IListProperty<S,E>
Abstract implementation of IListProperty.- Since:
- 1.2
- Implementation Note:
- If methods are added to the interface which this class implements then implementations of those methods must be added to this class.
-
-
Constructor Summary
Constructors Constructor Description ListProperty()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<E>
doGetList(S source)
Returns a List with the current contents of the source's list propertyprotected void
doSetList(S source, List<E> list)
Updates the property on the source with the specified change.protected void
doUpdateList(S source, ListDiff<E> diff)
Updates the property on the source with the specified changeList<E>
getList(S source)
By default, this method returnsCollections.EMPTY_LIST
in case the source object isnull
.IObservableFactory<S,IObservableList<E>>
listFactory()
Returns a factory for creating observable lists tracking this property of a particular property source.IObservableFactory<S,IObservableList<E>>
listFactory(Realm realm)
Returns a factory for creating observable lists in the given realm, tracking this property of a particular property source.IObservableList<E>
observe(S source)
Returns an observable list observing this list property on the given property source<U extends S>
IObservableList<E>observeDetail(IObservableValue<U> master)
Returns an observable list on the master observable's realm which tracks this property of the current value ofmaster
.void
setList(S source, List<E> list)
Updates the property on the source with the specified changevoid
updateList(S source, ListDiff<E> diff)
Updates the property on the source with the specified change<T> IListProperty<S,T>
values(IValueProperty<? super E,T> detailValue)
Returns the nested combination of this property and the specified detail value property.-
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.list.IListProperty
getElementType, observe
-
-
-
-
Method Detail
-
getList
public List<E> getList(S source)
By default, this method returnsCollections.EMPTY_LIST
in case the source object isnull
. Otherwise, this method delegates todoGetList(Object)
.Clients may override this method if they e.g. want to return a specific default list in case the source object is
null
.- Specified by:
getList
in interfaceIListProperty<S,E>
- Parameters:
source
- the property source (may be null)- Returns:
- an unmodifiable List with the current contents of the source's list property
- Since:
- 1.3
- See Also:
doGetList(Object)
-
doGetList
protected List<E> doGetList(S source)
Returns a List with the current contents of the source's list property- Parameters:
source
- the property source- Returns:
- a List with the current contents of the source's list property
- Since:
- 1.6
- Restriction:
- This method is not intended to be referenced by clients.
-
setList
public final void setList(S source, List<E> list)
Description copied from interface:IListProperty
Updates the property on the source with the specified changeNote: This method is made available to facilitate basic property access. However if the property source lacks property change notification, then observables on the source object may not be notified of the change. In most cases it is preferable to modify the source through an
IObservableList
than through the property directly.- Specified by:
setList
in interfaceIListProperty<S,E>
- Parameters:
source
- the property source (may be null)list
- the new list- Since:
- 1.3
-
doSetList
protected void doSetList(S source, List<E> list)
Updates the property on the source with the specified change.- Parameters:
source
- the property sourcelist
- the new list- Since:
- 1.6
- Restriction:
- This method is not intended to be referenced by clients.
-
updateList
public final void updateList(S source, ListDiff<E> diff)
Description copied from interface:IListProperty
Updates the property on the source with the specified changeNote: This method is made available to facilitate basic property access. However if the property source lacks property change notification, then observables on the source object may not be notified of the change. In most cases it is preferable to modify the source through an
IObservableList
than through the property directly.- Specified by:
updateList
in interfaceIListProperty<S,E>
- Parameters:
source
- the property source (may be null)diff
- a diff describing the change- Since:
- 1.3
-
doUpdateList
protected void doUpdateList(S source, ListDiff<E> diff)
Updates the property on the source with the specified change- Parameters:
source
- the property sourcediff
- a diff describing the change- Since:
- 1.3
-
observe
public IObservableList<E> observe(S source)
Description copied from interface:IListProperty
Returns an observable list observing this list property on the given property source- Specified by:
observe
in interfaceIListProperty<S,E>
- Parameters:
source
- the property source- Returns:
- an observable list observing this list property on the given property source
-
listFactory
public IObservableFactory<S,IObservableList<E>> listFactory()
Description copied from interface:IListProperty
Returns a factory for creating observable lists tracking this property of a particular property source.- Specified by:
listFactory
in interfaceIListProperty<S,E>
- Returns:
- a factory for creating observable lists tracking this property of a particular property source.
-
listFactory
public IObservableFactory<S,IObservableList<E>> listFactory(Realm realm)
Description copied from interface:IListProperty
Returns a factory for creating observable lists in the given realm, tracking this property of a particular property source.- Specified by:
listFactory
in interfaceIListProperty<S,E>
- Parameters:
realm
- the realm- Returns:
- a factory for creating observable lists in the given realm, tracking this property of a particular property source.
-
observeDetail
public <U extends S> IObservableList<E> observeDetail(IObservableValue<U> master)
Description copied from interface:IListProperty
Returns an observable list on the master observable's realm which tracks this property of the current value ofmaster
.- Specified by:
observeDetail
in interfaceIListProperty<S,E>
- Parameters:
master
- the master observable- Returns:
- an observable list on the given realm which tracks this property
of the current value of
master
.
-
values
public final <T> IListProperty<S,T> values(IValueProperty<? super E,T> detailValue)
Description copied from interface:IListProperty
Returns the nested combination of this property and the specified detail value property. Note that because this property is a projection of value properties over a list, the only modification supported is through theIObservableList.set(int, Object)
method. Modifications made through the returned property are delegated to the detail property, using the corresponding list element from the master property as the source.- Specified by:
values
in interfaceIListProperty<S,E>
- Parameters:
detailValue
- the detail property- Returns:
- the nested combination of the master list and detail value properties
-
-