VR
- The visual root node of the UI toolkit used, e.g.
javafx.scene.Node in case of JavaFX.public class ContentPolicy<VR> extends AbstractTransactionPolicy<VR>
ITransactionalOperation
s that delegate
to respective operations of the host IContentPart
upon execution.
In detail, the following delegations are performed to operations of the host
IContentPart
:
addContentChild(Object, int)
will delegate through a
AddContentChildOperation
to
IContentPart.addContentChild(Object, int)
removeContentChild(Object)
will delegate through a
RemoveContentChildOperation
to
IContentPart.removeContentChild(Object)
attachToContentAnchorage(Object, String)
will delegate through a
AttachToContentAnchorageOperation
to
IContentPart.attachToContentAnchorage(Object, String)
detachFromContentAnchorage(Object, String)
will delegate through
a DetachFromContentAnchorageOperation
to
IContentPart#detachFromContentAnchorage(Object, String)}
This policy should be registered on each IContentPart
.
adaptable
IAdaptable.Bound.Impl<T extends IAdaptable>
Constructor and Description |
---|
ContentPolicy() |
Modifier and Type | Method and Description |
---|---|
void |
addContentChild(java.lang.Object contentChild,
int index)
Creates and records operations to add the given contentChild to
the
host of this ContentPolicy at the
specified index. |
void |
attachToContentAnchorage(java.lang.Object contentAnchorage,
java.lang.String role)
Creates and records operations to attach the
host of
this ContentPolicy to the specified contentAnchorage under
the specified role. |
protected ITransactionalOperation |
createOperation()
Creates an
ITransactionalOperation that is used to encapsulate
the changes that are applied by this AbstractTransactionPolicy
through its "work" methods. |
void |
detachFromContentAnchorage(java.lang.Object contentAnchorage,
java.lang.String role)
Creates and records operations to detach the
host of
this ContentPolicy from the specified contentAnchorage
under the specified role. |
protected AbstractCompositeOperation |
getCompositeOperation()
Extracts a
AbstractCompositeOperation from the operation created
by createOperation() . |
IContentPart<VR,? extends VR> |
getHost()
|
void |
removeContentChild(java.lang.Object contentChild)
Creates and records operations to remove the given contentChild
from the content children of the
host of this
ContentPolicy . |
void |
setAdaptable(IVisualPart<VR,? extends VR> adaptable)
Sets the value of the property adaptable.
|
checkInitialized, commit, getOperation, init, isInitialized, locallyExecuteOperation, rollback
adaptableProperty, getAdaptable
public void addContentChild(java.lang.Object contentChild, int index)
host
of this ContentPolicy
at the
specified index.contentChild
- The content Object
that is to be added to the
host
of this ContentPolicy
.index
- The index of the new content child.public void attachToContentAnchorage(java.lang.Object contentAnchorage, java.lang.String role)
host
of
this ContentPolicy
to the specified contentAnchorage under
the specified role.contentAnchorage
- The content Object
to which the host
of this ContentPolicy
is to be attached.role
- The role for the attachment.protected ITransactionalOperation createOperation()
AbstractTransactionPolicy
ITransactionalOperation
that is used to encapsulate
the changes that are applied by this AbstractTransactionPolicy
through its "work" methods. The created operation should allow for
local execution
at each time.createOperation
in class AbstractTransactionPolicy<VR>
ITransactionalOperation
to encapsulate all applied
changes.public void detachFromContentAnchorage(java.lang.Object contentAnchorage, java.lang.String role)
host
of
this ContentPolicy
from the specified contentAnchorage
under the specified role.contentAnchorage
- The content Object
from which the getHost()
of this ContentPolicy
is detached.role
- The role under which the anchorage is detached.protected AbstractCompositeOperation getCompositeOperation()
AbstractCompositeOperation
from the operation created
by createOperation()
. The composite operation is used to combine
individual content change operations.AbstractCompositeOperation
that is used to combine
the individual content change operations.public IContentPart<VR,? extends VR> getHost()
IPolicy
public void removeContentChild(java.lang.Object contentChild)
host
of this
ContentPolicy
.contentChild
- The content Object
that is removed from content
children of the host
of this
ContentPolicy
.public void setAdaptable(IVisualPart<VR,? extends VR> adaptable)
AbstractPolicy
setAdaptable
in interface IAdaptable.Bound<IVisualPart<VR,? extends VR>>
setAdaptable
in class AbstractPolicy<VR>
Copyright (c) 2014 itemis AG and others. All rights reserved.