public class DynamicAnchor extends AbstractAnchor
DynamicAnchor
computes anchor positions through a
IComputationStrategy
. The strategy performs the position calculation
based on IComputationStrategy.Parameter
s, which are controlled by the
DynamicAnchor
.Type | Property and Description |
---|---|
protected javafx.beans.property.ReadOnlySetProperty<IComputationStrategy.Parameter<?>> |
anchorageComputationParameters
Returns a
ReadOnlySetProperty that provides the
computation parameters of kind
IComputationStrategy.Parameter.Kind.ANCHORAGE . |
protected ReadOnlySetMultimapProperty<AnchorKey,IComputationStrategy.Parameter<?>> |
anchoredComputationParameters
Returns a
ReadOnlySetMultimapProperty that provides the
computation parameters of kind
IComputationStrategy.Parameter.Kind.ANCHORED per AnchorKey . |
anchorage, positionsUnmodifiable
Modifier and Type | Class and Description |
---|---|
static class |
DynamicAnchor.AnchorageReferenceGeometry
An
IComputationStrategy.Parameter that encapsulates an
(anchorage) reference geometry. |
static class |
DynamicAnchor.AnchorageReferencePosition
An
IComputationStrategy.Parameter that encapsulates an
(anchorage) reference point. |
static class |
DynamicAnchor.AnchoredReferencePoint
An
IComputationStrategy.Parameter that encapsulates a projection
reference point. |
static class |
DynamicAnchor.PreferredOrientation
An
IComputationStrategy.Parameter that encapsulates the preferred
orientation to be used for orthogonal projections. |
Constructor and Description |
---|
DynamicAnchor(javafx.scene.Node anchorage)
Constructs a new
DynamicAnchor for the given anchorage visual
that uses a ChopBoxStrategy as computation strategy. |
DynamicAnchor(javafx.scene.Node anchorage,
IComputationStrategy computationStrategy)
Constructs a new
DynamicAnchor for the given anchorage visual
using the given IComputationStrategy . |
Modifier and Type | Method and Description |
---|---|
protected javafx.beans.property.ReadOnlySetProperty<IComputationStrategy.Parameter<?>> |
anchorageComputationParametersProperty()
Returns a
ReadOnlySetProperty that provides the
computation parameters of kind
IComputationStrategy.Parameter.Kind.ANCHORAGE . |
protected ReadOnlySetMultimapProperty<AnchorKey,IComputationStrategy.Parameter<?>> |
anchoredComputationParametersProperty()
Returns a
ReadOnlySetMultimapProperty that provides the
computation parameters of kind
IComputationStrategy.Parameter.Kind.ANCHORED per AnchorKey . |
void |
attach(AnchorKey key)
|
protected Point |
computePosition(AnchorKey key)
Recomputes the position for the given attached
AnchorKey by
delegating to the respective IComputationStrategy . |
void |
detach(AnchorKey key)
|
<T extends IComputationStrategy.Parameter<?>> |
getComputationParameter(AnchorKey key,
java.lang.Class<T> parameterType)
Retrieves a computation parameter of the respective type for the given
AnchorKey . |
<T extends IComputationStrategy.Parameter<?>> |
getComputationParameter(java.lang.Class<T> parameterType)
Retrieves a computation parameter of the respective type.
|
IComputationStrategy |
getComputationStrategy()
Returns the
IComputationStrategy used by this
DynamicAnchor . |
protected java.util.Set<IComputationStrategy.Parameter<?>> |
getParameters(AnchorKey key)
Retrieves the relevant parameters for the computation of the given
AnchorKey . |
void |
setComputationStrategy(IComputationStrategy computationStrategy)
Sets the given
IComputationStrategy to be used by this
IAnchor . |
anchorageProperty, getAnchorage, getKeys, getKeysByNode, getPosition, getPositionsUnmodifiable, isAttached, positionsUnmodifiableProperty, registerVCL, registerVCLs, setAnchorage, unregisterVCL, unregisterVCLs, updatePosition, updatePositions
protected javafx.beans.property.ReadOnlySetProperty<IComputationStrategy.Parameter<?>> anchorageComputationParametersProperty
ReadOnlySetProperty
that provides the
computation parameters
of kind
IComputationStrategy.Parameter.Kind.ANCHORAGE
.protected ReadOnlySetMultimapProperty<AnchorKey,IComputationStrategy.Parameter<?>> anchoredComputationParametersProperty
ReadOnlySetMultimapProperty
that provides the
computation parameters
of kind
IComputationStrategy.Parameter.Kind.ANCHORED
per AnchorKey
. The set of computation
parameters for each AnchorKey
is initialed by the responsible
computation strategy.public DynamicAnchor(javafx.scene.Node anchorage)
DynamicAnchor
for the given anchorage visual
that uses a ChopBoxStrategy
as computation strategy. The anchor
will also add a default binding for the
DynamicAnchor.AnchorageReferenceGeometry
computation parameter, which is
required by the ChopBoxStrategy
, that infers the geometry from
the anchorage's shape outline.anchorage
- The anchorage visual.public DynamicAnchor(javafx.scene.Node anchorage, IComputationStrategy computationStrategy)
DynamicAnchor
for the given anchorage visual
using the given IComputationStrategy
. The anchor will also add a
default binding for the DynamicAnchor.AnchorageReferenceGeometry
computation
parameter, inferring the geometry from the anchorage's shape outline, in
case this parameter is required by the given
IComputationStrategy
.anchorage
- The anchorage visual.computationStrategy
- The IComputationStrategy
to use.protected javafx.beans.property.ReadOnlySetProperty<IComputationStrategy.Parameter<?>> anchorageComputationParametersProperty()
ReadOnlySetProperty
that provides the
computation parameters
of kind
IComputationStrategy.Parameter.Kind.ANCHORAGE
.protected ReadOnlySetMultimapProperty<AnchorKey,IComputationStrategy.Parameter<?>> anchoredComputationParametersProperty()
ReadOnlySetMultimapProperty
that provides the
computation parameters
of kind
IComputationStrategy.Parameter.Kind.ANCHORED
per AnchorKey
. The set of computation
parameters for each AnchorKey
is initialed by the responsible
computation strategy.public void attach(AnchorKey key)
IAnchor
attach
in interface IAnchor
attach
in class AbstractAnchor
key
- The AnchorKey
to be attached.protected Point computePosition(AnchorKey key)
AnchorKey
by
delegating to the respective IComputationStrategy
.computePosition
in class AbstractAnchor
key
- The AnchorKey
for which to compute an anchor position.AnchorKey
in local coordinates of
the anchored Node
.public void detach(AnchorKey key)
IAnchor
detach
in interface IAnchor
detach
in class AbstractAnchor
key
- The AnchorKey
to be detached.public <T extends IComputationStrategy.Parameter<?>> T getComputationParameter(AnchorKey key, java.lang.Class<T> parameterType)
AnchorKey
.T
- The value type of the computation parameter.key
- The AnchorKey
for which to retrieve the anchored
parameter.parameterType
- The type of computation parameter.public <T extends IComputationStrategy.Parameter<?>> T getComputationParameter(java.lang.Class<T> parameterType)
T
- The value type of the computation parameter.parameterType
- The type of computation parameter.public IComputationStrategy getComputationStrategy()
IComputationStrategy
used by this
DynamicAnchor
.IComputationStrategy
.protected java.util.Set<IComputationStrategy.Parameter<?>> getParameters(AnchorKey key)
AnchorKey
.public void setComputationStrategy(IComputationStrategy computationStrategy)
IComputationStrategy
to be used by this
IAnchor
.computationStrategy
- The IComputationStrategy
that will be used to compute
positions for all attached AnchorKey
s.Copyright (c) 2014 itemis AG and others. All rights reserved.