public class ChopBoxAnchor extends AbstractAnchor
ChopBoxAnchor computes anchor positions based on a reference
position per anchored and one reference position for the anchorage. The
anchoreds' reference positions are provided when
attaching an AnchorKey. The
computation is carried out by a ChopBoxAnchor.IComputationStrategy. The default
computation strategy (ChopBoxAnchor.IComputationStrategy.Impl) will connect anchored and anchorage
reference position and compute the intersection with the outline of the
anchorage.anchorageProperty, positionProperty| Modifier and Type | Class and Description |
|---|---|
static interface |
ChopBoxAnchor.IComputationStrategy
The
ChopBoxAnchor.IComputationStrategy is responsible for computing anchor
positions based on an anchorage Node, an anchored Node,
and an anchored reference position (
ChopBoxAnchor.IComputationStrategy.computePositionInScene(Node, Node, Point)). |
static interface |
ChopBoxAnchor.IReferencePointProvider
A
ChopBoxAnchor.IReferencePointProvider needs to be provided as default adapter
(see AdapterKey.get(Class)) on the IAdaptable info that
gets passed into attach(AnchorKey, IAdaptable) and
detach(AnchorKey, IAdaptable). |
| Constructor and Description |
|---|
ChopBoxAnchor(javafx.scene.Node anchorage)
Constructs a new
ChopBoxAnchor for the given anchorage visual. |
ChopBoxAnchor(javafx.scene.Node anchorage,
ChopBoxAnchor.IComputationStrategy computationStrategy)
Constructs a new
ChopBoxAnchor for the given anchorage visual
using the given ChopBoxAnchor.IComputationStrategy. |
| Modifier and Type | Method and Description |
|---|---|
void |
attach(AnchorKey key,
IAdaptable info)
Attaches the given
AnchorKey to this ChopBoxAnchor. |
protected Point |
computePosition(AnchorKey key)
Recomputes the position for the given attached
AnchorKey by
retrieving a reference position via the ChopBoxAnchor.IReferencePointProvider
that was obtained when attaching the AnchorKey (
attach(AnchorKey, IAdaptable)). |
protected Point |
computePosition(javafx.scene.Node anchored,
Point anchoredReferencePointInLocal)
Computes the point of intersection between the outline of the anchorage
reference shape and the line through the reference points of anchorage
and anchored.
|
void |
detach(AnchorKey key,
IAdaptable info)
Detaches the given
AnchorKey from this ChopBoxAnchor. |
anchorageProperty, getAnchorage, getKeys, getPosition, isAttached, positionProperty, registerVCL, registerVCLs, setAnchorage, unregisterVCL, unregisterVCLs, updatePositionpublic ChopBoxAnchor(javafx.scene.Node anchorage)
ChopBoxAnchor for the given anchorage visual.
Uses the default computation strategy (ChopBoxAnchor.IComputationStrategy.Impl).anchorage - The anchorage visual.public ChopBoxAnchor(javafx.scene.Node anchorage,
ChopBoxAnchor.IComputationStrategy computationStrategy)
ChopBoxAnchor for the given anchorage visual
using the given ChopBoxAnchor.IComputationStrategy.anchorage - The anchorage visual.computationStrategy - The ChopBoxAnchor.IComputationStrategy to use.public void attach(AnchorKey key, IAdaptable info)
AnchorKey to this ChopBoxAnchor.
Requires that an ChopBoxAnchor.IReferencePointProvider can be obtained from the
passed in IAdaptable.attach in interface IAnchorattach in class AbstractAnchorkey - The AnchorKey to be attached.info - An IAdaptable, which will be used to obtain an
ChopBoxAnchor.IReferencePointProvider that provides reference points
for this ChopBoxAnchor.protected Point computePosition(AnchorKey key)
AnchorKey by
retrieving a reference position via the ChopBoxAnchor.IReferencePointProvider
that was obtained when attaching the AnchorKey (
attach(AnchorKey, IAdaptable)).computePosition in class AbstractAnchorkey - The AnchorKey for which to compute an anchor position.AnchorKey.protected Point computePosition(javafx.scene.Node anchored, Point anchoredReferencePointInLocal)
anchored - The to be anchored Node for which the anchor position
is to be determined.anchoredReferencePointInLocal - A reference Point used for calculation of the anchor
position, provided within the local coordinate system of the
to be anchored Node.Node.public void detach(AnchorKey key, IAdaptable info)
AnchorKey from this ChopBoxAnchor.
Requires that an ChopBoxAnchor.IReferencePointProvider can be obtained from the
passed in IAdaptable.detach in interface IAnchordetach in class AbstractAnchorkey - The AnchorKey to be detached.info - An IAdaptable, which will be used to obtain an
ChopBoxAnchor.IReferencePointProvider that provides reference points
for this ChopBoxAnchor.Copyright (c) 2014 itemis AG and others. All rights reserved.