VR - The visual root node of the UI toolkit used, e.g.
javafx.scene.Node in case of JavaFX.public abstract class AbstractDomain<VR> extends java.lang.Object implements IDomain<VR>
IAdaptable.Bound<A extends IAdaptable>| Modifier and Type | Field and Description |
|---|---|
protected java.beans.PropertyChangeSupport |
pcs
A
PropertyChangeSupport that is used as a delegate to notify
listeners about changes to this object. |
ADAPTERS_PROPERTYACTIVE_PROPERTY| Constructor and Description |
|---|
AbstractDomain()
Creates a new
AbstractDomain instance, setting the
AdaptableScope for each of its IAdaptable-compliant types
(super classes implementing IAdaptable and super-interfaces
extending IAdaptable) to the newly created instance (see
AdaptableScopes#scopeTo(IAdaptable)). |
| Modifier and Type | Method and Description |
|---|---|
void |
activate() |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
closeExecutionTransaction(ITool<VR> tool)
Closes the active execution transaction, removes the given
ITool
from the transaction context, and opens a new execution transaction if
there are any tools remaining in the context. |
protected ForwardUndoCompositeOperation |
createExecutionTransaction() |
void |
deactivate() |
void |
dispose() |
void |
execute(IUndoableOperation operation)
Will execute the given
IUndoableOperation on the
IOperationHistory used by this IDomain (see
IDomain.getOperationHistory()), using the IUndoContext of this
IDomain. |
<T> T |
getAdapter(AdapterKey<? super T> key) |
<T> T |
getAdapter(java.lang.Class<? super T> classKey) |
<T> T |
getAdapter(com.google.common.reflect.TypeToken<? super T> key) |
<T> java.util.Map<AdapterKey<? extends T>,T> |
getAdapters(java.lang.Class<? super T> classKey) |
<T> java.util.Map<AdapterKey<? extends T>,T> |
getAdapters(com.google.common.reflect.TypeToken<? super T> key) |
IOperationHistory |
getOperationHistory()
Returns the
IOperationHistory that is used by this domain. |
java.util.Map<AdapterKey<? extends ITool<VR>>,ITool<VR>> |
getTools()
Returns the
ITools registered at this IDomain (via
IAdaptable.setAdapter(AdapterKey, Object)) with the AdapterKeys
used for registration. |
IUndoContext |
getUndoContext()
Returns the
UndoContext that is used by this domain. |
java.util.Map<AdapterKey<? extends IViewer<VR>>,IViewer<VR>> |
getViewers()
Returns the
IViewers registered at this IDomain (via
IAdaptable.setAdapter(AdapterKey, Object)) with the AdapterKeys
used for registration. |
boolean |
isActive() |
protected boolean |
isExecutionTransactionOpen() |
boolean |
isExecutionTransactionOpen(ITool<VR> tool)
Returns
true if the given ITool is taking part in
the currently open execution transaction. |
void |
openExecutionTransaction(ITool<VR> tool)
Opens a new transaction or adds the given
ITool to the currently
opened transaction for executing operations (via
IDomain.execute(IUndoableOperation)) on the IOperationHistory
used by this IDomain (see IDomain.getOperationHistory()), using
the IUndoContext of this IDomain. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener) |
<T> void |
setAdapter(AdapterKey<? super T> key,
T adapter) |
<T> void |
setAdapter(java.lang.Class<? super T> key,
T adapter) |
<T> void |
setAdapter(com.google.common.reflect.TypeToken<? super T> key,
T adapter) |
void |
setAdapters(java.util.Map<AdapterKey<?>,java.lang.Object> adaptersWithKeys)
Adds the set of adapters to this
IAdaptable. |
void |
setOperationHistory(IOperationHistory stack) |
void |
setUndoContext(IUndoContext undoContext) |
<T> T |
unsetAdapter(AdapterKey<? super T> key) |
protected java.beans.PropertyChangeSupport pcs
PropertyChangeSupport that is used as a delegate to notify
listeners about changes to this object. May be used by subclasses to
trigger the notification of listeners.public AbstractDomain()
AbstractDomain instance, setting the
AdaptableScope for each of its IAdaptable-compliant types
(super classes implementing IAdaptable and super-interfaces
extending IAdaptable) to the newly created instance (see
AdaptableScopes#scopeTo(IAdaptable)).public void activate()
activate in interface IActivatablepublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener in interface IPropertyChangeNotifierpublic void closeExecutionTransaction(ITool<VR> tool)
IDomainITool
from the transaction context, and opens a new execution transaction if
there are any tools remaining in the context.closeExecutionTransaction in interface IDomain<VR>tool - The ITool that should be removed from the transaction
context.IDomain.openExecutionTransaction(ITool)protected ForwardUndoCompositeOperation createExecutionTransaction()
public void deactivate()
deactivate in interface IActivatablepublic void dispose()
dispose in interface IDisposablepublic void execute(IUndoableOperation operation)
IDomainIUndoableOperation on the
IOperationHistory used by this IDomain (see
IDomain.getOperationHistory()), using the IUndoContext of this
IDomain.
In case an execution transaction is currently open (see
IDomain.openExecutionTransaction(ITool),
IDomain.closeExecutionTransaction(ITool)) the enclosing transaction will
refer to the IUndoContext used by this IDomain) (so that
no specific IUndoContext is set on the passed in
IUndoableOperation). If no transaction is currently open, the
IUndoContext of this IDomain will be set on the passed in
IUndoableOperation.execute in interface IDomain<VR>operation - The IUndoableOperation to be executed on the
IOperationHistory of this IDomain.public <T> T getAdapter(AdapterKey<? super T> key)
getAdapter in interface IAdaptablepublic <T> T getAdapter(java.lang.Class<? super T> classKey)
getAdapter in interface IAdaptablepublic <T> T getAdapter(com.google.common.reflect.TypeToken<? super T> key)
getAdapter in interface IAdaptablepublic <T> java.util.Map<AdapterKey<? extends T>,T> getAdapters(java.lang.Class<? super T> classKey)
getAdapters in interface IAdaptablepublic <T> java.util.Map<AdapterKey<? extends T>,T> getAdapters(com.google.common.reflect.TypeToken<? super T> key)
getAdapters in interface IAdaptablepublic IOperationHistory getOperationHistory()
IDomainIOperationHistory that is used by this domain.getOperationHistory in interface IDomain<VR>IOperationHistory.public java.util.Map<AdapterKey<? extends ITool<VR>>,ITool<VR>> getTools()
IDomainITools registered at this IDomain (via
IAdaptable.setAdapter(AdapterKey, Object)) with the AdapterKeys
used for registration.getTools in interface IDomain<VR>Map containing the registered ITools mapped to
their respective AdapterKeys.IAdaptable.setAdapter(AdapterKey, Object)public IUndoContext getUndoContext()
IDomainUndoContext that is used by this domain.getUndoContext in interface IDomain<VR>UndoContext.public java.util.Map<AdapterKey<? extends IViewer<VR>>,IViewer<VR>> getViewers()
IDomainIViewers registered at this IDomain (via
IAdaptable.setAdapter(AdapterKey, Object)) with the AdapterKeys
used for registration.getViewers in interface IDomain<VR>Map containing the registered IViewers mapped
to their respective AdapterKeys.IAdaptable.setAdapter(AdapterKey, Object)public boolean isActive()
isActive in interface IActivatableprotected boolean isExecutionTransactionOpen()
public boolean isExecutionTransactionOpen(ITool<VR> tool)
IDomaintrue if the given ITool is taking part in
the currently open execution transaction. Otherwise returns
false.isExecutionTransactionOpen in interface IDomain<VR>tool - The ITool that is checked.true if the given ITool is taking part in
the currently open execution transaction, otherwise
false.public void openExecutionTransaction(ITool<VR> tool)
IDomainITool to the currently
opened transaction for executing operations (via
IDomain.execute(IUndoableOperation)) on the IOperationHistory
used by this IDomain (see IDomain.getOperationHistory()), using
the IUndoContext of this IDomain.openExecutionTransaction in interface IDomain<VR>tool - The ITool starting/joining the transaction.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener in interface IPropertyChangeNotifierpublic <T> void setAdapter(AdapterKey<? super T> key, T adapter)
setAdapter in interface IAdaptablepublic <T> void setAdapter(java.lang.Class<? super T> key,
T adapter)
setAdapter in interface IAdaptablepublic <T> void setAdapter(com.google.common.reflect.TypeToken<? super T> key,
T adapter)
setAdapter in interface IAdaptable@Inject(optional=true) public void setAdapters(@AdapterMap java.util.Map<AdapterKey<?>,java.lang.Object> adaptersWithKeys)
IAdaptable. This method should
not be used by clients but is intended for injection of adapters by means
of an AdapterMapInjector.
IMPORTANT: If sub-classes override this method, they will have to transfer the inject annotation to the overwritten method to ensure that adapter map injection is still functional.
adaptersWithKeys - The adapters to add to this IAdaptable (by means of
injection)AdapterMap@Inject public void setOperationHistory(IOperationHistory stack)
@Inject public void setUndoContext(IUndoContext undoContext)
public <T> T unsetAdapter(AdapterKey<? super T> key)
unsetAdapter in interface IAdaptableCopyright (c) 2014 itemis AG and others. All rights reserved.