public class FXChopBoxAnchor extends AbstractFXAnchor
FXChopBoxAnchor
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 FXChopBoxAnchor.ComputationStrategy
. The default
computation strategy (FXChopBoxAnchor.ComputationStrategy.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 |
FXChopBoxAnchor.ComputationStrategy
The
FXChopBoxAnchor.ComputationStrategy is responsible for computing anchor
positions based on an anchorage Node , an anchored Node ,
and an anchored reference position (
FXChopBoxAnchor.ComputationStrategy.computePositionInScene(Node, Node, Point) ). |
static interface |
FXChopBoxAnchor.ReferencePointProvider
A
FXChopBoxAnchor.ReferencePointProvider 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 |
---|
FXChopBoxAnchor(javafx.scene.Node anchorage)
Constructs a new
FXChopBoxAnchor for the given anchorage visual. |
FXChopBoxAnchor(javafx.scene.Node anchorage,
FXChopBoxAnchor.ComputationStrategy computationStrategy)
Constructs a new
FXChopBoxAnchor for the given anchorage visual
using the given FXChopBoxAnchor.ComputationStrategy . |
Modifier and Type | Method and Description |
---|---|
void |
attach(AnchorKey key,
IAdaptable info)
Attaches the given
AnchorKey to this FXChopBoxAnchor . |
protected Point |
computePosition(AnchorKey key)
Recomputes the position for the given attached
AnchorKey by
retrieving a reference position via the FXChopBoxAnchor.ReferencePointProvider
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 FXChopBoxAnchor . |
anchorageProperty, getAnchorage, getKeys, getPosition, isAttached, positionProperty, registerVCLs, setAnchorage, unregisterVCLs, updatePosition
public FXChopBoxAnchor(javafx.scene.Node anchorage)
FXChopBoxAnchor
for the given anchorage visual.
Uses the default computation strategy (FXChopBoxAnchor.ComputationStrategy.Impl
).anchorage
- The anchorage visual.public FXChopBoxAnchor(javafx.scene.Node anchorage, FXChopBoxAnchor.ComputationStrategy computationStrategy)
FXChopBoxAnchor
for the given anchorage visual
using the given FXChopBoxAnchor.ComputationStrategy
.anchorage
- The anchorage visual.computationStrategy
- The FXChopBoxAnchor.ComputationStrategy
to use.public void attach(AnchorKey key, IAdaptable info)
AnchorKey
to this FXChopBoxAnchor
.
Requires that an FXChopBoxAnchor.ReferencePointProvider
can be obtained from the
passed in IAdaptable
.attach
in interface IFXAnchor
attach
in class AbstractFXAnchor
key
- The AnchorKey
to be attached.info
- An IAdaptable
, which will be used to obtain an
FXChopBoxAnchor.ReferencePointProvider
that provides reference points
for this FXChopBoxAnchor
.protected Point computePosition(AnchorKey key)
AnchorKey
by
retrieving a reference position via the FXChopBoxAnchor.ReferencePointProvider
that was obtained when attaching the AnchorKey
(
attach(AnchorKey, IAdaptable)
).computePosition
in class AbstractFXAnchor
key
- 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 FXChopBoxAnchor
.
Requires that an FXChopBoxAnchor.ReferencePointProvider
can be obtained from the
passed in IAdaptable
.detach
in interface IFXAnchor
detach
in class AbstractFXAnchor
key
- The AnchorKey
to be detached.info
- An IAdaptable
, which will be used to obtain an
FXChopBoxAnchor.ReferencePointProvider
that provides reference points
for this FXChopBoxAnchor
.Copyright (c) 2014 itemis AG and others. All rights reserved.