Package org.eclipse.gef.fx.anchors
Class DynamicAnchor
java.lang.Object
org.eclipse.gef.fx.anchors.AbstractAnchor
org.eclipse.gef.fx.anchors.DynamicAnchor
- All Implemented Interfaces:
IAnchor
The
DynamicAnchor
computes anchor positions through a
IComputationStrategy
. The strategy performs the position calculation
based on IComputationStrategy.Parameter
s, which are controlled by the
DynamicAnchor
.-
Property Summary
TypePropertyDescriptionprotected ReadOnlySetProperty<IComputationStrategy.Parameter<?>>
Returns aReadOnlySetProperty
that provides thecomputation parameters
of kindIComputationStrategy.Parameter.Kind.ANCHORAGE
.Returns aReadOnlySetMultimapProperty
that provides thecomputation parameters
of kindIComputationStrategy.Parameter.Kind.ANCHORED
perAnchorKey
.Properties inherited from class org.eclipse.gef.fx.anchors.AbstractAnchor
anchorage, positionsUnmodifiable
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
AnIComputationStrategy.Parameter
that encapsulates an (anchorage) reference geometry.static class
AnIComputationStrategy.Parameter
that encapsulates an (anchorage) reference point.static class
AnIComputationStrategy.Parameter
that encapsulates a projection reference point.static class
AnIComputationStrategy.Parameter
that encapsulates the preferred orientation to be used for orthogonal projections. -
Constructor Summary
ConstructorDescriptionDynamicAnchor
(Node anchorage) Constructs a newDynamicAnchor
for the given anchorage visual that uses aChopBoxStrategy
as computation strategy.DynamicAnchor
(Node anchorage, IComputationStrategy computationStrategy) Constructs a newDynamicAnchor
for the given anchorage visual using the givenIComputationStrategy
. -
Method Summary
Modifier and TypeMethodDescriptionprotected ReadOnlySetProperty<IComputationStrategy.Parameter<?>>
Returns aReadOnlySetProperty
that provides thecomputation parameters
of kindIComputationStrategy.Parameter.Kind.ANCHORAGE
.Returns aReadOnlySetMultimapProperty
that provides thecomputation parameters
of kindIComputationStrategy.Parameter.Kind.ANCHORED
perAnchorKey
.void
protected Point
computePosition
(AnchorKey key) Recomputes the position for the given attachedAnchorKey
by delegating to the respectiveIComputationStrategy
.void
<T extends IComputationStrategy.Parameter<?>>
TgetComputationParameter
(Class<T> parameterType) Retrieves a computation parameter of the respective type.<T extends IComputationStrategy.Parameter<?>>
TgetComputationParameter
(AnchorKey key, Class<T> parameterType) Retrieves a computation parameter of the respective type for the givenAnchorKey
.Returns theIComputationStrategy
used by thisDynamicAnchor
.protected Set<IComputationStrategy.Parameter<?>>
getParameters
(AnchorKey key) Retrieves the relevant parameters for the computation of the givenAnchorKey
.void
setComputationStrategy
(IComputationStrategy computationStrategy) Sets the givenIComputationStrategy
to be used by thisIAnchor
.Methods inherited from class org.eclipse.gef.fx.anchors.AbstractAnchor
anchorageProperty, getAnchorage, getKeys, getKeysByNode, getPosition, getPositionsUnmodifiable, isAttached, positionsUnmodifiableProperty, registerVCL, registerVCLs, setAnchorage, unregisterVCL, unregisterVCLs, updatePosition, updatePositions
-
Property Details
-
anchorageComputationParameters
protected ReadOnlySetProperty<IComputationStrategy.Parameter<?>> anchorageComputationParametersPropertyReturns aReadOnlySetProperty
that provides thecomputation parameters
of kindIComputationStrategy.Parameter.Kind.ANCHORAGE
. -
anchoredComputationParameters
protected ReadOnlySetMultimapProperty<AnchorKey,IComputationStrategy.Parameter<?>> anchoredComputationParametersPropertyReturns aReadOnlySetMultimapProperty
that provides thecomputation parameters
of kindIComputationStrategy.Parameter.Kind.ANCHORED
perAnchorKey
. The set of computation parameters for eachAnchorKey
is initialed by the responsible computation strategy.
-
-
Constructor Details
-
DynamicAnchor
Constructs a newDynamicAnchor
for the given anchorage visual that uses aChopBoxStrategy
as computation strategy. The anchor will also add a default binding for theDynamicAnchor.AnchorageReferenceGeometry
computation parameter, which is required by theChopBoxStrategy
, that infers the geometry from the anchorage's shape outline.- Parameters:
anchorage
- The anchorage visual.
-
DynamicAnchor
Constructs a newDynamicAnchor
for the given anchorage visual using the givenIComputationStrategy
. The anchor will also add a default binding for theDynamicAnchor.AnchorageReferenceGeometry
computation parameter, inferring the geometry from the anchorage's shape outline, in case this parameter is required by the givenIComputationStrategy
.- Parameters:
anchorage
- The anchorage visual.computationStrategy
- TheIComputationStrategy
to use.
-
-
Method Details
-
anchorageComputationParametersProperty
protected ReadOnlySetProperty<IComputationStrategy.Parameter<?>> anchorageComputationParametersProperty()Returns aReadOnlySetProperty
that provides thecomputation parameters
of kindIComputationStrategy.Parameter.Kind.ANCHORAGE
. -
anchoredComputationParametersProperty
protected ReadOnlySetMultimapProperty<AnchorKey,IComputationStrategy.Parameter<?>> anchoredComputationParametersProperty()Returns aReadOnlySetMultimapProperty
that provides thecomputation parameters
of kindIComputationStrategy.Parameter.Kind.ANCHORED
perAnchorKey
. The set of computation parameters for eachAnchorKey
is initialed by the responsible computation strategy. -
attach
Description copied from interface:IAnchor
- Specified by:
attach
in interfaceIAnchor
- Overrides:
attach
in classAbstractAnchor
- Parameters:
key
- TheAnchorKey
to be attached.
-
computePosition
Recomputes the position for the given attachedAnchorKey
by delegating to the respectiveIComputationStrategy
.- Specified by:
computePosition
in classAbstractAnchor
- Parameters:
key
- TheAnchorKey
for which to compute an anchor position.- Returns:
- The point for the given
AnchorKey
in local coordinates of the anchoredNode
.
-
detach
Description copied from interface:IAnchor
- Specified by:
detach
in interfaceIAnchor
- Overrides:
detach
in classAbstractAnchor
- Parameters:
key
- TheAnchorKey
to be detached.
-
getComputationParameter
public <T extends IComputationStrategy.Parameter<?>> T getComputationParameter(AnchorKey key, Class<T> parameterType) Retrieves a computation parameter of the respective type for the givenAnchorKey
.- Type Parameters:
T
- The value type of the computation parameter.- Parameters:
key
- TheAnchorKey
for which to retrieve the anchored parameter.parameterType
- The type of computation parameter.- Returns:
- The anchored computation parameter.
-
getComputationParameter
public <T extends IComputationStrategy.Parameter<?>> T getComputationParameter(Class<T> parameterType) Retrieves a computation parameter of the respective type.- Type Parameters:
T
- The value type of the computation parameter.- Parameters:
parameterType
- The type of computation parameter.- Returns:
- The anchored computation parameter.
-
getComputationStrategy
Returns theIComputationStrategy
used by thisDynamicAnchor
.- Returns:
- The
IComputationStrategy
.
-
getParameters
Retrieves the relevant parameters for the computation of the givenAnchorKey
. -
setComputationStrategy
Sets the givenIComputationStrategy
to be used by thisIAnchor
.- Parameters:
computationStrategy
- TheIComputationStrategy
that will be used to compute positions for all attachedAnchorKey
s.
-