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.Parameters, which are controlled by the
DynamicAnchor.-
Property Summary
PropertiesTypePropertyDescriptionprotected javafx.beans.property.ReadOnlySetProperty<IComputationStrategy.Parameter<?>>Returns aReadOnlySetPropertythat provides thecomputation parametersof kindIComputationStrategy.Parameter.Kind.ANCHORAGE.Returns aReadOnlySetMultimapPropertythat provides thecomputation parametersof kindIComputationStrategy.Parameter.Kind.ANCHOREDperAnchorKey.Properties inherited from class org.eclipse.gef.fx.anchors.AbstractAnchor
anchorage, positionsUnmodifiable -
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAnIComputationStrategy.Parameterthat encapsulates an (anchorage) reference geometry.static classAnIComputationStrategy.Parameterthat encapsulates an (anchorage) reference point.static classAnIComputationStrategy.Parameterthat encapsulates a projection reference point.static classAnIComputationStrategy.Parameterthat encapsulates the preferred orientation to be used for orthogonal projections. -
Constructor Summary
ConstructorsConstructorDescriptionDynamicAnchor(javafx.scene.Node anchorage) Constructs a newDynamicAnchorfor the given anchorage visual that uses aChopBoxStrategyas computation strategy.DynamicAnchor(javafx.scene.Node anchorage, IComputationStrategy computationStrategy) Constructs a newDynamicAnchorfor the given anchorage visual using the givenIComputationStrategy. -
Method Summary
Modifier and TypeMethodDescriptionprotected javafx.beans.property.ReadOnlySetProperty<IComputationStrategy.Parameter<?>>Returns aReadOnlySetPropertythat provides thecomputation parametersof kindIComputationStrategy.Parameter.Kind.ANCHORAGE.Returns aReadOnlySetMultimapPropertythat provides thecomputation parametersof kindIComputationStrategy.Parameter.Kind.ANCHOREDperAnchorKey.voidprotected PointcomputePosition(AnchorKey key) Recomputes the position for the given attachedAnchorKeyby 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 theIComputationStrategyused by thisDynamicAnchor.protected Set<IComputationStrategy.Parameter<?>>getParameters(AnchorKey key) Retrieves the relevant parameters for the computation of the givenAnchorKey.voidsetComputationStrategy(IComputationStrategy computationStrategy) Sets the givenIComputationStrategyto 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 javafx.beans.property.ReadOnlySetProperty<IComputationStrategy.Parameter<?>> anchorageComputationParametersPropertyReturns aReadOnlySetPropertythat provides thecomputation parametersof kindIComputationStrategy.Parameter.Kind.ANCHORAGE. -
anchoredComputationParameters
protected ReadOnlySetMultimapProperty<AnchorKey,IComputationStrategy.Parameter<?>> anchoredComputationParametersPropertyReturns aReadOnlySetMultimapPropertythat provides thecomputation parametersof kindIComputationStrategy.Parameter.Kind.ANCHOREDperAnchorKey. The set of computation parameters for eachAnchorKeyis initialed by the responsible computation strategy.
-
-
Constructor Details
-
DynamicAnchor
public DynamicAnchor(javafx.scene.Node anchorage) Constructs a newDynamicAnchorfor the given anchorage visual that uses aChopBoxStrategyas computation strategy. The anchor will also add a default binding for theDynamicAnchor.AnchorageReferenceGeometrycomputation parameter, which is required by theChopBoxStrategy, that infers the geometry from the anchorage's shape outline.- Parameters:
anchorage- The anchorage visual.
-
DynamicAnchor
Constructs a newDynamicAnchorfor the given anchorage visual using the givenIComputationStrategy. The anchor will also add a default binding for theDynamicAnchor.AnchorageReferenceGeometrycomputation 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- TheIComputationStrategyto use.
-
-
Method Details
-
anchorageComputationParametersProperty
protected javafx.beans.property.ReadOnlySetProperty<IComputationStrategy.Parameter<?>> anchorageComputationParametersProperty()Returns aReadOnlySetPropertythat provides thecomputation parametersof kindIComputationStrategy.Parameter.Kind.ANCHORAGE. -
anchoredComputationParametersProperty
protected ReadOnlySetMultimapProperty<AnchorKey,IComputationStrategy.Parameter<?>> anchoredComputationParametersProperty()Returns aReadOnlySetMultimapPropertythat provides thecomputation parametersof kindIComputationStrategy.Parameter.Kind.ANCHOREDperAnchorKey. The set of computation parameters for eachAnchorKeyis initialed by the responsible computation strategy. -
attach
Description copied from interface:IAnchor- Specified by:
attachin interfaceIAnchor- Overrides:
attachin classAbstractAnchor- Parameters:
key- TheAnchorKeyto be attached.
-
computePosition
Recomputes the position for the given attachedAnchorKeyby delegating to the respectiveIComputationStrategy.- Specified by:
computePositionin classAbstractAnchor- Parameters:
key- TheAnchorKeyfor which to compute an anchor position.- Returns:
- The point for the given
AnchorKeyin local coordinates of the anchoredNode.
-
detach
Description copied from interface:IAnchor- Specified by:
detachin interfaceIAnchor- Overrides:
detachin classAbstractAnchor- Parameters:
key- TheAnchorKeyto 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- TheAnchorKeyfor 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 theIComputationStrategyused by thisDynamicAnchor.- Returns:
- The
IComputationStrategy.
-
getParameters
Retrieves the relevant parameters for the computation of the givenAnchorKey. -
setComputationStrategy
Sets the givenIComputationStrategyto be used by thisIAnchor.- Parameters:
computationStrategy- TheIComputationStrategythat will be used to compute positions for all attachedAnchorKeys.
-