Eclipse Platform
Release 3.3

org.eclipse.core.databinding
Class AggregateValidationStatus

java.lang.Object
  extended byorg.eclipse.core.databinding.AggregateValidationStatus
All Implemented Interfaces:
IObservable, IObservableValue

public final class AggregateValidationStatus
extends Object
implements IObservableValue

This class can be used to aggregate status values from a data binding context into a single status value. Instances of this class can be used as an observable value with a value type of IStatus, or the static methods can be called directly if an aggregated status result is only needed once.

Since:
1.0

Field Summary
static int MAX_SEVERITY
          Constant denoting an aggregation strategy that always returns the most severe status from the given bindings.
static int MERGED
          Constant denoting an aggregation strategy that merges multiple non-OK status objects in a MultiStatus.
 
Constructor Summary
AggregateValidationStatus(IObservableCollection bindings, int strategy)
           
 
Method Summary
 void addChangeListener(IChangeListener listener)
          Adds the given change listener to the list of change listeners.
 void addStaleListener(IStaleListener listener)
          Adds the given stale listener to the list of stale listeners.
 void addValueChangeListener(IValueChangeListener listener)
           
 void dispose()
          Disposes of this observable object, removing all listeners registered with this object, and all listeners this object might have registered on other objects.
 Realm getRealm()
          Returns the realm for this observable.
static IStatus getStatusMaxSeverity(Collection bindings)
          Returns a status that always returns the most severe status from the given bindings.
static IStatus getStatusMerged(Collection bindings)
          Returns a status object that merges multiple non-OK status objects in a MultiStatus.
 Object getValue()
          Returns the value.
 Object getValueType()
          The value type of this observable value, or null if this observable value is untyped.
 boolean isStale()
          Returns whether the state of this observable is stale and is expected to change soon.
 void removeChangeListener(IChangeListener listener)
          Removes the given change listener from the list of change listeners.
 void removeStaleListener(IStaleListener listener)
          Removes the given stale listener from the list of stale listeners.
 void removeValueChangeListener(IValueChangeListener listener)
           
 void setValue(Object value)
          Sets the value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MERGED

public static final int MERGED
Constant denoting an aggregation strategy that merges multiple non-OK status objects in a MultiStatus. Returns an OK status result if all statuses from the given bindings are the an OK status. Returns a single status if there is only one non-OK status.

See Also:
getStatusMerged(Collection), Constant Field Values

MAX_SEVERITY

public static final int MAX_SEVERITY
Constant denoting an aggregation strategy that always returns the most severe status from the given bindings. If there is more than one status at the same severity level, it picks the first one it encounters.

See Also:
getStatusMaxSeverity(Collection), Constant Field Values
Constructor Detail

AggregateValidationStatus

public AggregateValidationStatus(IObservableCollection bindings,
                                 int strategy)
Parameters:
bindings - an observable collection containing elements of type IStatus
strategy - a strategy constant, one of MERGED or MAX_SEVERITY.
Method Detail

addChangeListener

public void addChangeListener(IChangeListener listener)
Description copied from interface: IObservable
Adds the given change listener to the list of change listeners. Change listeners are notified about changes of the state of this observable in a generic way, without specifying the change that happened. To get the changed state, a change listener needs to query for the current state of this observable.

Specified by:
addChangeListener in interface IObservable
Parameters:
listener -
See Also:
IObservable.addChangeListener(org.eclipse.core.databinding.observable.IChangeListener)

addStaleListener

public void addStaleListener(IStaleListener listener)
Description copied from interface: IObservable
Adds the given stale listener to the list of stale listeners. Stale listeners are notified when an observable object becomes stale, not when is becomes non-stale.

Specified by:
addStaleListener in interface IObservable
Parameters:
listener -
See Also:
IObservable.addStaleListener(org.eclipse.core.databinding.observable.IStaleListener)

addValueChangeListener

public void addValueChangeListener(IValueChangeListener listener)
Specified by:
addValueChangeListener in interface IObservableValue
Parameters:
listener -
See Also:
IObservableValue.addValueChangeListener(org.eclipse.core.databinding.observable.value.IValueChangeListener)

dispose

public void dispose()
Description copied from interface: IObservable
Disposes of this observable object, removing all listeners registered with this object, and all listeners this object might have registered on other objects.

Specified by:
dispose in interface IObservable

getRealm

public Realm getRealm()
Description copied from interface: IObservable
Returns the realm for this observable. Unless otherwise specified, getters and setters must be accessed from within this realm. Listeners will be within this realm when they receive events from this observable.

Because observables can only be accessed from within one realm, and they always fire events on that realm, their state can be observed in an incremental way. It is always safe to call getters of an observable from within a change listener attached to that observable.

Specified by:
getRealm in interface IObservable
Returns:
the realm

getValue

public Object getValue()
Description copied from interface: IObservableValue
Returns the value. Must be invoked in the Realm of the observable.

Specified by:
getValue in interface IObservableValue
Returns:
the current value

getValueType

public Object getValueType()
Description copied from interface: IObservableValue
The value type of this observable value, or null if this observable value is untyped.

Specified by:
getValueType in interface IObservableValue
Returns:
the value type, or null

isStale

public boolean isStale()
Description copied from interface: IObservable
Returns whether the state of this observable is stale and is expected to change soon. A non-stale observable that becomes stale will notify its stale listeners. A stale object that becomes non-stale does so by changing its state and notifying its change listeners, it does not notify its stale listeners about becoming non-stale. Clients that do not expect asynchronous changes may ignore staleness of observable objects.

Specified by:
isStale in interface IObservable
Returns:
true if this observable's state is stale and will change soon.

removeChangeListener

public void removeChangeListener(IChangeListener listener)
Description copied from interface: IObservable
Removes the given change listener from the list of change listeners. Has no effect if the given listener is not registered as a change listener.

Specified by:
removeChangeListener in interface IObservable
Parameters:
listener -

removeStaleListener

public void removeStaleListener(IStaleListener listener)
Description copied from interface: IObservable
Removes the given stale listener from the list of stale listeners. Has no effect if the given listener is not registered as a stale listener.

Specified by:
removeStaleListener in interface IObservable
Parameters:
listener -

removeValueChangeListener

public void removeValueChangeListener(IValueChangeListener listener)
Specified by:
removeValueChangeListener in interface IObservableValue
Parameters:
listener -

setValue

public void setValue(Object value)
Description copied from interface: IObservableValue
Sets the value. Must be invoked in the Realm of the observable.

Specified by:
setValue in interface IObservableValue
Parameters:
value - the value to set

getStatusMerged

public static IStatus getStatusMerged(Collection bindings)
Returns a status object that merges multiple non-OK status objects in a MultiStatus. Returns an OK status result if all statuses from the given bindings are the an OK status. Returns a single status if there is only one non-OK status.

Parameters:
bindings - a collection of bindings
Returns:
a merged status

getStatusMaxSeverity

public static IStatus getStatusMaxSeverity(Collection bindings)
Returns a status that always returns the most severe status from the given bindings. If there is more than one status at the same severity level, it picks the first one it encounters.

Parameters:
bindings - a collection of bindings
Returns:
a single status reflecting the most severe status from the given bindings

Eclipse Platform
Release 3.3

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.