public class ActivatableSupport
extends java.lang.Object
IActivatable.
It offers all methods defined by IActivatable, while not formally
implementing the interface, and can thus be used by a source
IActivatable as a delegate.
In addition to the source IActivatable a
PropertyChangeSupport is expected during construction. It will be
used to fire PropertyChangeEvents when the active state changes, i.e.
whenever a call to activate() or deactivate() results in a
state change. IActivatable.ACTIVE_PROPERTY will be used as the
property name within all those events.
If the given IActivatable is also IAdaptable, all calls to
activate() and deactivate() will be forwarded to all
adapters registered at the IActivatable at that moment. However, the
ActivatableSupport will not register a property change listener on
the IAdaptable to get notified about newly set or unset adapters, so
they will not be automatically activated/deactivated. The source
IActivatable may use an AdaptableSupport as a second delegate
for this purpose.
| Constructor and Description |
|---|
ActivatableSupport(IActivatable source,
java.beans.PropertyChangeSupport pcs)
Creates a new
ActivatableSupport for the given source
IActivatable and a related PropertyChangeSupport. |
| Modifier and Type | Method and Description |
|---|---|
void |
activate()
Activates this
ActivatableSupport if it is not yet active. |
void |
deactivate()
Deactivates this
ActivatableSupport if it is not yet inactive. |
boolean |
isActive()
Reports whether this
ActivatableSupport is active or inactive. |
public ActivatableSupport(IActivatable source, java.beans.PropertyChangeSupport pcs)
ActivatableSupport for the given source
IActivatable and a related PropertyChangeSupport.source - The IActivatable that encloses the to be created
ActivatableSupport, delegating calls to it. May not be
nullpcs - An PropertyChangeSupport, which will be used to fire
PropertyChangeEvent's during state changes. May not be
nullpublic boolean isActive()
ActivatableSupport is active or inactive.true in case the ActivatableSupport is active,
false otherwise.IActivatable.isActive()public void activate()
ActivatableSupport if it is not yet active.
Will first adjust the (internal) active state, then fire a
PropertyChangeEvent, and will finally activate any
IActivatable adapters, being registered at the source
IActivatable.IActivatable.activate()public void deactivate()
ActivatableSupport if it is not yet inactive.
Will first deactivate any IActivatable adapters, being registered
at the source IActivatable, then adjust the (internal) active
state, and finally fire a PropertyChangeEvent.IActivatable.deactivate()Copyright (c) 2014 itemis AG and others. All rights reserved.