- All Implemented Interfaces:
Figure,PathIterableFigure,TransformCachingFigure,PropertyBean,StyleableBean,StyleablePropertyBean,TreeNode<Figure>
- Direct Known Subclasses:
RegionFigure
- Author:
- Werner Randelshofer
-
Property Summary
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 @NonNull CssRectangle2DStyleableMapAccessorstatic final @NonNull CssSizeStyleableKeystatic final @NonNull NullableFXPathElementsStyleableKeystatic final NonNullBooleanStyleableKeystatic final @NonNull CssSizeStyleableKeystatic final @NonNull CssSizeStyleableKeystatic final @NonNull CssSizeStyleableKeyFields 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.TransformCachingFigure
CACHE -
Constructor Summary
ConstructorsConstructorDescriptionAbstractRegionFigure(double x, double y, double width, double height) AbstractRegionFigure(@NonNull javafx.geometry.Rectangle2D rect) -
Method Summary
Modifier and TypeMethodDescription@NonNull javafx.scene.NodecreateNode(@NonNull RenderContext drawingView) This method is invoked by aRenderContext, when it needs a node to create a JavaFX scene graph for a figure.voidlayout(@NonNull RenderContext ctx) Updates the layout of this figure, based on the layout of its children and the layout of observed layout subjects.protected voidvoidreshapeInLocal(@NonNull CssSize x, @NonNull CssSize y, @NonNull CssSize width, @NonNull CssSize height) Attempts to change the local bounds of the figure.voidupdateNode(@NonNull RenderContext ctx, @NonNull javafx.scene.Node node) This method is invoked by aRenderContext, when it needs to update the node which represents the scene graph in the figure.protected voidupdatePathNode(@NonNull RenderContext ctx, @NonNull javafx.scene.shape.Path path) Methods inherited from class org.jhotdraw8.draw.figure.AbstractLeafFigure
getChildren, isAllowsChildren, isSuitableChild, isSuitableParentMethods inherited from class org.jhotdraw8.draw.figure.AbstractFigure
addedToDrawing, createKeyMap, doAddedToDrawing, doRemovedFromDrawing, getCachedLocalToParent, getCachedLocalToWorld, getCachedParentToLocal, getCachedParentToWorld, getCachedWorldToLocal, getCachedWorldToParent, getDrawing, getLayoutObservers, getPropertyChangeListeners, getReadOnlyLayoutObservers, getStyledNonNull, hasPropertyChangeListeners, onPropertyChanged, parentProperty, removeAllLayoutSubjects, removedFromDrawing, removeLayoutSubject, 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.Figure
addChild, addedToDrawing, createHandles, disconnect, firePropertyChangeEvent, firePropertyChangeEvent, getBoundsInLocal, getBoundsInParent, getBoundsInWorld, getCenterInLocal, getCenterInParent, getChildren, getDrawing, getLayer, getLayoutBounds, getLayoutBoundsInParent, getLayoutBoundsInWorld, getLayoutObservers, getLayoutSubjects, getLocalToParent, getParent, getParentToLocal, getPreferredAspectRatio, getPropertyChangeListeners, getReadOnlyLayoutObservers, getRoot, getStyleableParent, getSupportedKeys, getVisualBounds, getVisualBoundsInWorld, hasPropertyChangeListeners, isAllowsChildren, isDecomposable, isDeletable, isDeletWithLastLayoutSubject, isEditable, isEditableKey, isGroupReshapeableWith, isLayoutable, isSelectable, isShowing, isSuitableChild, isSuitableParent, isSupportedKey, isVisible, layoutChanged, layoutObserverChanged, layoutSubjectChanged, localToParent, localToWorld, localToWorld, parentProperty, propertyChanged, removeAllLayoutSubjects, removeChild, removedFromDrawing, removeLayoutSubject, reshapeInLocal, reshapeInLocal, reshapeInLocal, reshapeInParent, setParent, stylesheetChanged, transformChanged, transformInLocal, transformInParent, translateInLocal, translateInParent, updateCss, worldToLocal, worldToLocal, worldToParent, worldToParentMethods inherited from interface org.jhotdraw8.fxbase.beans.PropertyBean
get, getNonNull, getProperties, getProperty, put, remove, set, setNonNull, valueAtMethods 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.TransformCachingFigure
getLocalToWorld, getParentToWorld, getWorldToLocal, getWorldToParent, invalidateTransformsMethods inherited from interface org.jhotdraw8.fxbase.tree.TreeNode
ancestorIterable, breadthFirstIterable, depthFirstIterable, dumpTree, dumpTree, getAncestor, getChild, getDepth, getFirstChild, getLastChild, getMaxDepth, getPath, postorderIterable, preorderIterable, preorderSpliterator
-
Field Details
-
BOUNDS
-
HEIGHT
-
SHAPE
-
WIDTH
-
X
-
Y
-
SHAPE_PRESERVE_RATIO_KEY
-
-
Constructor Details
-
AbstractRegionFigure
public AbstractRegionFigure() -
AbstractRegionFigure
public AbstractRegionFigure(double x, double y, double width, double height) -
AbstractRegionFigure
-
-
Method Details
-
createNode
Description copied from interface:FigureThis method is invoked by aRenderContext, when it needs a node to create a JavaFX scene graph for a figure.A typical implementation should look like this:
public Node createNode(@NonNull RenderContext v) { return new ...desired subclass of Node...(); }A figure may be rendered with multiple
RenderContexts simultaneously. EachRenderContextuses this method to instantiate a JavaFX node for the figure and associate it to the figure.This method must create a new instance because returning an already existing instance may cause undesired side effects on other
RenderContexts.Note that by convention this method may only be invoked by a
RenderContextobject.- Specified by:
createNodein interfaceFigure- Parameters:
drawingView- the renderer which will use the node- Returns:
- the newly created node
-
getCssLayoutBounds
- Specified by:
getCssLayoutBoundsin interfaceFigure
-
getPathIterator
public @NonNull PathIterator getPathIterator(@NonNull RenderContext ctx, @Nullable AffineTransform tx) - Specified by:
getPathIteratorin interfacePathIterableFigure
-
layout
Description copied from interface:FigureUpdates the layout of this figure, based on the layout of its children and the layout of observed layout subjects.If the layout of this figure depends on the layout of other figures, then calling layout on this figure will only result in the correct result, if layout of the other figures has been performed first.
A figure does not keep track of changes that require layout updates. Use
DrawingModelto manage layout updates.The default implementation is empty.
To layout a drawing use
Drawing.layoutAll(RenderContext). -
reshapeInLocal
public void reshapeInLocal(@NonNull CssSize x, @NonNull CssSize y, @NonNull CssSize width, @NonNull CssSize height) 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(@NonNull CssSize x, @NonNull CssSize y, @NonNull CssSize width, @NonNull CssSize height) { Transform tx = Transforms.createReshapeTransform(getCssBoundsInLocal(), x, y, width, height); reshapeInLocal(tx); }- Specified by:
reshapeInLocalin interfaceFigure- 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
-
updatePathNode
-
updateNode
Description copied from interface:FigureThis method is invoked by aRenderContext, when it needs to update the node which represents the scene graph in the figure.A figure which is composed from child figures, must addChild the nodes of its getChildren to its node. This ensures that coordinate space transformations of the composed figure are properly propagated to its getChildren.
public void updateNode(@NonNull RenderContext rc, Node n) { ObservableList<Node> group = ((Group) n).getChildren(); group.clear(); for (Figure child : children()) { group.addChild(rc.getNode(child)); }A figure may be shown in multiple
RenderContexts. EachRenderContextuses this method to update the a JavaFX node for the figure.Note that the figure must retrieve the JavaFX node from other figures from the render context by invoking
rc.getNode(child)rather than creating new nodes usingchild.createNode(rc). This convention allows to implement a cache in the render context for the Java FX node. Also, render contexts like a drawing view need to associate input events on Java FX nodes to the corresponding figure.This figure does not keep track of changes that require node updates.
DrawingModelto manage node updates.- Specified by:
updateNodein interfaceFigure- Parameters:
ctx- the render contextnode- the node which was created withFigure.createNode(org.jhotdraw8.draw.render.RenderContext)
-
layoutPath
protected void layoutPath()
-