- All Implemented Interfaces:
ConnectableFigure,ConnectingFigure,Figure,FillableFigure,LabelConnectionFigure,PaddableFigure,PathIterableFigure,ShapeableFigure,StrokableFigure,TextFillableFigure,TextFontableFigure,TextLayoutableFigure,TransformableFigure,TransformCachingFigure,PropertyBean,StyleableBean,StyleablePropertyBean,TreeNode<Figure>
- Direct Known Subclasses:
SimpleLabelConnectionFigure
LabelConnectionFigure.LABEL_CONNECTOR and
LabelConnectionFigure.LABEL_TARGET.
When the label is attached it computes the LABELED_LOCATION using the
LabelConnectionFigure.LABEL_CONNECTOR on the target figure. Then it computes the AbstractLabelFigure.ORIGIN
and rotation of the label using the properties LABEL_OFFSET
and LABEL_AUTOROTATE.
LABELED_LOCATION: x,y (has a derivative that can be rotated)
|
| + LABEL_OFFSET (perpendicular to
| LABELED_LOCATION)
↓
+--------------------+
ORIGIN: | x,y |
LABEL_AUTOROTATE: | ↺ |
| |
| layout bounds |
+--------------------+
- Author:
- Werner Randelshofer
-
Property Summary
PropertiesTypePropertyDescriptionjavafx.beans.property.ReadOnlyBooleanPropertyThis property is true when the figure is connected.Properties inherited from class org.jhotdraw8.draw.figure.AbstractFigure
parentProperties inherited from interface org.jhotdraw8.fxbase.styleable.StyleableBean
id -
Nested Class Summary
Nested classes/interfaces inherited from interface org.jhotdraw8.fxbase.tree.TreeNode
TreeNode.AncestorIterator<T extends TreeNode<T>> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NonNullEnumStyleableKey<LabelAutorotate> Whether the label should be rotated with the target.static final CssPoint2DStyleableMapAccessorstatic final CssSizeStyleableKeyThe tangential offset of the label.static final CssSizeStyleableKeyThe perpendicular offset of the label.static final CssPoint2DStyleableMapAccessorThe position relative to the parent (respectively the offset).static final CssSizeStyleableKeystatic final CssSizeStyleableKeystatic final CssPoint2DStyleableMapAccessorstatic final CssSizeStyleableKeystatic final CssSizeStyleableKeyFields inherited from class org.jhotdraw8.draw.figure.AbstractLabelFigure
ICON_FILL, ICON_POSITION, ICON_ROTATE, ICON_SHAPE, ICON_SIZE, ICON_TEXT_GAP, ICON_TRANSLATE, ICON_TRANSLATE_X, ICON_TRANSLATE_Y, ORIGIN, ORIGIN_X, ORIGIN_Y, TEXT_HPOSFields inherited from class org.jhotdraw8.fxbase.styleable.AbstractStyleablePropertyBean
keyMaps, propertiesFields inherited from interface org.jhotdraw8.draw.figure.Figure
declaredAndInheritedKeys, JHOTDRAW_CSS_PREFIX, PARENT_PROPERTYFields inherited from interface org.jhotdraw8.draw.figure.FillableFigure
FILLFields inherited from interface org.jhotdraw8.draw.figure.LabelConnectionFigure
LABEL_CONNECTOR, LABEL_TARGETFields inherited from interface org.jhotdraw8.draw.figure.PaddableFigure
PADDING, PADDING_BOTTOM, PADDING_LEFT, PADDING_RIGHT, PADDING_TOPFields inherited from interface org.jhotdraw8.draw.figure.ShapeableFigure
SHAPE, SHAPE_BOUNDS, SHAPE_BOUNDS_HEIGHT, SHAPE_BOUNDS_WIDTH, SHAPE_BOUNDS_X, SHAPE_BOUNDS_Y, SHAPE_SLICE, SHAPE_SLICE_BOTTOM, SHAPE_SLICE_LEFT, SHAPE_SLICE_RIGHT, SHAPE_SLICE_TOP, SVG_SQUAREFields inherited from interface org.jhotdraw8.draw.figure.StrokableFigure
STROKE, STROKE_DASH_ARRAY, STROKE_DASH_OFFSET, STROKE_LINE_CAP, STROKE_LINE_JOIN, STROKE_MITER_LIMIT, STROKE_STYLE, STROKE_TYPE, STROKE_WIDTHFields inherited from interface org.jhotdraw8.draw.figure.TextFillableFigure
TEXT_FILLFields inherited from interface org.jhotdraw8.draw.figure.TextFontableFigure
FONT, FONT_FAMILY, FONT_SIZE, FONT_STYLE, FONT_WEIGHT, STRIKETHROUGH, UNDERLINEFields inherited from interface org.jhotdraw8.draw.figure.TextLayoutableFigure
LINE_SPACING, TEXT_ALIGNMENT, TEXT_VPOS, WRAPPING_WIDTHFields inherited from interface org.jhotdraw8.draw.figure.TransformableFigure
CACHE, ROTATE, ROTATION_AXIS, ROTATION_PIVOT, SCALE, SCALE_X, SCALE_Y, SCALE_Z, TRANSFORMS, TRANSLATE, TRANSLATE_X, TRANSLATE_Y, TRANSLATE_ZFields inherited from interface org.jhotdraw8.draw.figure.TransformCachingFigure
CACHE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjavafx.beans.property.ReadOnlyBooleanPropertyThis property is true when the figure is connected.voidcreateHandles(HandleType handleType, List<Handle> list) Creates handles of the specified level and adds them to the provided list.voiddoAddedToDrawing(Drawing drawing) This method is called byFigure.addedToDrawing(org.jhotdraw8.draw.figure.Drawing).protected voiddoRemovedFromDrawing(Drawing drawing) This method is called byAbstractFigure.removedFromDrawing(org.jhotdraw8.draw.figure.Drawing).Returns all figures which are connected by this figure - they provide to the layout of this figure.booleanGets the value of theconnectedproperty.booleanisGroupReshapeableWith(Set<Figure> others) Whether the figure can be reshaped as a group together with other figures.booleanWhether thelayoutmethod of this figure does anything.voidlayout(RenderContext ctx) Computes the layout bounds of this figure.protected voidIf the label has aLabelConnectionFigure.LABEL_TARGETand aLabelConnectionFigure.LABEL_CONNECTOR, computes theLABELED_LOCATION,AbstractLabelFigure.ORIGINandTransformableFigure.TRANSFORMSof the label.protected <T> voidonPropertyChanged(Key<T> key, @Nullable T oldValue, @Nullable T newValue, boolean wasAdded, boolean wasRemoved) Overrides of this method must call super!voidThis implementation is empty.voidremoveLayoutSubject(Figure subject) This implementation is empty.voidreshapeInLocal(CssSize x, CssSize y, CssSize width, CssSize height) Attempts to change the local bounds of the figure.voidsetLabelConnection(@Nullable Figure target, @Nullable Connector connector) voidtranslateInLocal(CssPoint2D delta) Attempts to translate the local bounds of the figure.voidupdateGroupNode(RenderContext ctx, javafx.scene.Group node) Updates the group node that holds all other nodes of the label.Methods inherited from class org.jhotdraw8.draw.figure.AbstractLabelFigure
createNode, findConnector, getCachedLayoutBounds, getCssLayoutBounds, getLayoutBounds, getPathIterator, getText, hasIcon, setCachedLayoutBounds, updateIconNode, updateIconNodeImage, updateIconNodeTransform, updateNode, updatePathNode, updateTextNode, updateTextNodeFontAndText, updateTextNodeLayout, updateTextNodePaintMethods inherited from class org.jhotdraw8.draw.figure.AbstractLeafFigure
getChildren, isAllowsChildren, isSuitableChild, isSuitableParentMethods inherited from class org.jhotdraw8.draw.figure.AbstractFigure
addedToDrawing, createKeyMap, getCachedLocalToParent, getCachedLocalToWorld, getCachedParentToLocal, getCachedParentToWorld, getCachedWorldToLocal, getCachedWorldToParent, getDrawing, getLayoutObservers, getPropertyChangeListeners, getReadOnlyLayoutObservers, getStyledNonNull, hasPropertyChangeListeners, parentProperty, removedFromDrawing, setCachedLocalToParent, setCachedLocalToWorld, setCachedParentToLocal, setCachedParentToWorld, setCachedWorldToLocal, setCachedWorldToParent, updateCssMethods inherited from class org.jhotdraw8.fxbase.styleable.AbstractStyleablePropertyBean
callObservers, containsMapAccessor, getProperties, getStyleableMap, getStyled, getStyled, remove, removeAll, resetStyledValues, setStyledMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jhotdraw8.draw.figure.ConnectableFigure
findConnectorMethods inherited from interface org.jhotdraw8.draw.figure.ConnectingFigure
canConnectMethods inherited from interface org.jhotdraw8.draw.figure.Figure
addChild, addedToDrawing, createNode, disconnect, firePropertyChangeEvent, firePropertyChangeEvent, getBoundsInParent, getBoundsInWorld, getCenterInLocal, getCenterInParent, getChildren, getCssLayoutBounds, getDrawing, getLayer, getLayoutBounds, getLayoutBoundsInParent, getLayoutBoundsInWorld, getLayoutObservers, getParent, getPreferredAspectRatio, getPropertyChangeListeners, getReadOnlyLayoutObservers, getRoot, getStyleableParent, getSupportedKeys, getVisualBounds, getVisualBoundsInWorld, hasPropertyChangeListeners, isAllowsChildren, isDecomposable, isDeletable, isDeletWithLastLayoutSubject, isEditable, isEditableKey, isSelectable, isShowing, isSuitableChild, isSuitableParent, isSupportedKey, isVisible, layoutChanged, layoutObserverChanged, layoutSubjectChanged, localToParent, localToWorld, localToWorld, parentProperty, propertyChanged, removeChild, removedFromDrawing, removeFromParent, reshapeInLocal, reshapeInLocal, setParent, stylesheetChanged, transformChanged, translateInParent, updateCss, updateNode, worldToLocal, worldToLocal, worldToParent, worldToParentMethods inherited from interface org.jhotdraw8.draw.figure.FillableFigure
applyFillableFigurePropertiesMethods inherited from interface org.jhotdraw8.fxbase.beans.PropertyBean
get, getNonNull, getProperties, getProperty, put, remove, set, setNonNull, valueAtMethods inherited from interface org.jhotdraw8.draw.figure.ShapeableFigure
applyShapeableProperties, applyShapeablePropertiesMethods inherited from interface org.jhotdraw8.draw.figure.StrokableFigure
applyStrokableFigureProperties, applyStrokeCapAndJoinProperties, applyStrokeColorProperties, applyStrokeDashProperties, applyStrokeTypeProperties, applyStrokeWidthProperties, getBoundsInLocal, getStyledStrokeMethods inherited from interface org.jhotdraw8.fxbase.styleable.StyleableBean
getId, getPseudoClassStates, getStyle, getStyleClasses, getTypeSelector, idPropertyMethods inherited from interface org.jhotdraw8.fxbase.styleable.StyleablePropertyBean
containsMapAccessor, getStyled, getStyled, getStyledNonNull, remove, removeAll, resetStyledValues, setStyledMethods inherited from interface org.jhotdraw8.draw.figure.TextFillableFigure
applyTextFillableFigureProperties, applyTextFillableFigurePropertiesMethods inherited from interface org.jhotdraw8.draw.figure.TextFontableFigure
applyTextFontableFigureProperties, applyTextFontableFigurePropertiesMethods inherited from interface org.jhotdraw8.draw.figure.TextLayoutableFigure
applyTextLayoutableFigureProperties, applyTextLayoutableFigurePropertiesMethods inherited from interface org.jhotdraw8.draw.figure.TransformableFigure
applyTransformableFigureProperties, clearTransforms, flattenTransforms, getInverseTransform, getLocalToParent, getLocalToParent, getLocalToParentAsList, getParentToLocal, getParentToLocal, getTransform, hasCenterTransforms, reshapeInLocal, reshapeInParent, setTransforms, transformInLocal, transformInParentMethods inherited from interface org.jhotdraw8.draw.figure.TransformCachingFigure
getCachedLocalToParent, getCachedLocalToWorld, getCachedParentToLocal, getCachedParentToWorld, getCachedWorldToLocal, getCachedWorldToParent, getLocalToWorld, getParentToWorld, getWorldToLocal, getWorldToParent, invalidateTransforms, setCachedLocalToParent, setCachedLocalToWorld, setCachedParentToLocal, setCachedParentToWorld, setCachedWorldToLocal, setCachedWorldToParentMethods inherited from interface org.jhotdraw8.fxbase.tree.TreeNode
ancestorIterable, breadthFirstIterable, depthFirstIterable, dumpTree, dumpTree, getAncestor, getChild, getDepth, getFirstChild, getLastChild, getMaxDepth, getPath, postorderIterable, preorderIterable, preorderSpliterator
-
Property Details
-
connected
public javafx.beans.property.ReadOnlyBooleanProperty connectedPropertyThis property is true when the figure is connected.- See Also:
-
-
Field Details
-
LABELED_LOCATION_X
-
LABELED_LOCATION_Y
-
LABELED_LOCATION
-
LABEL_OFFSET_Y
The perpendicular offset of the label.The offset is perpendicular to the tangent line of the figure.
-
LABEL_OFFSET_X
The tangential offset of the label.The offset is on tangent line of the figure.
-
LABEL_OFFSET
-
LABEL_AUTOROTATE
Whether the label should be rotated with the target. -
LABEL_TRANSLATE_Y
-
LABEL_TRANSLATE_X
-
LABEL_TRANSLATE
The position relative to the parent (respectively the offset).
-
-
Constructor Details
-
AbstractLabelConnectionFigure
public AbstractLabelConnectionFigure()
-
-
Method Details
-
onPropertyChanged
protected <T> void onPropertyChanged(Key<T> key, @Nullable T oldValue, @Nullable T newValue, boolean wasAdded, boolean wasRemoved) Description copied from class:AbstractFigureOverrides of this method must call super!- Overrides:
onPropertyChangedin classAbstractFigure- Type Parameters:
T- the value type of the property- Parameters:
key- the changed keyoldValue- the old valuenewValue- the new valuewasAdded- whether the value was added (hence oldValue does not matter)wasRemoved- whether the value was removed (hence newValue does not matter)
-
doAddedToDrawing
Description copied from class:AbstractFigureThis method is called byFigure.addedToDrawing(org.jhotdraw8.draw.figure.Drawing). The implementation of this class is empty.- Overrides:
doAddedToDrawingin classAbstractFigure- Parameters:
drawing- the drawing
-
doRemovedFromDrawing
Description copied from class:AbstractFigureThis method is called byAbstractFigure.removedFromDrawing(org.jhotdraw8.draw.figure.Drawing). The implementation of this class is empty.- Overrides:
doRemovedFromDrawingin classAbstractFigure- Parameters:
drawing- the drawing
-
connectedProperty
public javafx.beans.property.ReadOnlyBooleanProperty connectedProperty()This property is true when the figure is connected.- Returns:
- the connected property
- See Also:
-
createHandles
Description copied from interface:FigureCreates handles of the specified level and adds them to the provided list.- Specified by:
createHandlesin interfaceFigure- Parameters:
handleType- The desired handle typelist- The handles.
-
getLayoutSubjects
Returns all figures which are connected by this figure - they provide to the layout of this figure.- Specified by:
getLayoutSubjectsin interfaceFigure- Returns:
- a list of connected figures
-
isConnected
public boolean isConnected()Gets the value of theconnectedproperty.- Property description:
- This property is true when the figure is connected.
- Returns:
- the value of the
connectedproperty - See Also:
-
isGroupReshapeableWith
Description copied from interface:FigureWhether the figure can be reshaped as a group together with other figures.If this figure uses one of the other figures for computing its position or its layout, then it will return false.
The default implementation always returns true.
- Specified by:
isGroupReshapeableWithin interfaceFigure- Parameters:
others- A set of figures.- Returns:
- true if the user may svgStringReshapeToBuilder this figure together with those in the set.
-
isLayoutable
public boolean isLayoutable()Description copied from interface:FigureWhether thelayoutmethod of this figure does anything.The default implementation returns false.
- Specified by:
isLayoutablein interfaceFigure- Returns:
- true if the
layoutmethod is not empty.
-
layout
Description copied from class:AbstractLabelFigureComputes the layout bounds of this figure.- Specified by:
layoutin interfaceFigure- Overrides:
layoutin classAbstractLabelFigure- Parameters:
ctx- the render context
-
layoutOrigin
If the label has aLabelConnectionFigure.LABEL_TARGETand aLabelConnectionFigure.LABEL_CONNECTOR, computes theLABELED_LOCATION,AbstractLabelFigure.ORIGINandTransformableFigure.TRANSFORMSof the label.Else leaves the
AbstractLabelFigure.ORIGINand theTransformableFigure.TRANSFORMSunchanged.The following properties affect the result:
LABEL_OFFSET,LABEL_AUTOROTATE.- Parameters:
ctx-
-
removeAllLayoutSubjects
public void removeAllLayoutSubjects()Description copied from class:AbstractFigureThis implementation is empty.- Specified by:
removeAllLayoutSubjectsin interfaceFigure- Overrides:
removeAllLayoutSubjectsin classAbstractFigure
-
removeLayoutSubject
Description copied from class:AbstractFigureThis implementation is empty.- Specified by:
removeLayoutSubjectin interfaceFigure- Overrides:
removeLayoutSubjectin classAbstractFigure- Parameters:
subject- the connected figure
-
updateGroupNode
Description copied from class:AbstractLabelFigureUpdates the group node that holds all other nodes of the label.This method is empty. Subclasses may apply properties to the group node.
- Overrides:
updateGroupNodein classAbstractLabelFigure- Parameters:
ctx- the render contextnode- the group node
-
reshapeInLocal
Description copied from interface:FigureAttempts to change the local bounds of the figure.See {#link #reshapeInLocal(Transform)} for a description of this method.
This method takes parameters as
CssSizes. This can be used to avoid rounding errors when the figure is reshaped in non-pixel units.This method can forward a call to
Figure.reshapeInLocal(Transform)using the following code:void reshapeInLocal(CssSize x, CssSize y, CssSize width, CssSize height) { Transform tx = Transforms.createReshapeTransform(getCssBoundsInLocal(), x, y, width, height); reshapeInLocal(tx); }- Specified by:
reshapeInLocalin interfaceFigure- Overrides:
reshapeInLocalin classAbstractLabelFigure- Parameters:
x- desired x-position in parent coordinatesy- desired y-position in parent coordinateswidth- desired width in parent coordinates, may be negativeheight- desired height in parent coordinates, may be negative
-
translateInLocal
Description copied from interface:FigureAttempts to translate the local bounds of the figure.- Specified by:
translateInLocalin interfaceFigure- Overrides:
translateInLocalin classAbstractLabelFigure- Parameters:
delta- the translation in x and in y direction
-
setLabelConnection
-