- All Implemented Interfaces:
Figure,FillableFigure,Grouping,HideableFigure,LockableFigure,Page,ResizableFigure,StrokableFigure,StyleableFigure,TransformableFigure,TransformCachingFigure,PropertyBean,StyleableBean,StyleablePropertyBean,TreeNode<Figure>
- Author:
- Werner Randelshofer
-
Property Summary
Properties inherited from class org.jhotdraw8.draw.figure.AbstractFigure
parentProperties inherited from interface org.jhotdraw8.draw.figure.StyleableFigure
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 CssRectangle2DStyleableMapAccessorstatic final @NonNull CssSizeStyleableKeystatic final @NonNull DoubleStyleableKeyThe computed number of pages along the x-axis.static final @NonNull Point2DStyleableMapAccessorstatic final @NonNull DoubleStyleableKeyThe computed number of pages along the y-axis.static final @NonNull CssInsetsStyleableMapAccessorstatic final @NonNull CssSizeStyleableKeystatic final @NonNull CssSizeStyleableKeystatic final @NonNull CssSizeStyleableKeystatic final @NonNull CssSizeStyleableKeystatic final @NonNull CssPoint2DStyleableMapAccessorstatic final @NonNull CssSizeStyleableKeystatic final @NonNull CssSizeStyleableKeystatic final @NonNull CssSizeStyleableKeystatic final @NonNull PaperSizeStyleableMapAccessorstatic final @NonNull CssSizeStyleableKeystatic final StringThe CSS type selector for this object is "Page".static final CssSizeStyleableKeystatic final CssSizeStyleableKeystatic final 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.FillableFigure
FILLFields inherited from interface org.jhotdraw8.draw.figure.HideableFigure
VISIBLEFields inherited from interface org.jhotdraw8.draw.figure.LockableFigure
LOCKEDFields 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.StyleableFigure
ID, PSEUDO_CLASS, STYLE, STYLE_CLASS, TYPE_SELECTOR_NODE_KEYFields 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 TypeMethodDescription@NonNull javafx.scene.NodeThis method is invoked by aRenderContext, when it needs a node to create a JavaFX scene graph for a figure.@NonNull javafx.scene.NodecreatePageNode(int internalPageNumber) Returns a node which will be placed on the paper.@NonNull javafx.geometry.BoundsThe bounds that should be used for transformations of this figure.intReturns the number of sub-pages defined by this page.@NonNull javafx.geometry.BoundsgetPageBounds(int internalPageNumber) Returns the bounds for the page content.@NonNull javafx.scene.shape.ShapegetPageClip(int internalPageNumber) Returns the clip for the page content.@NonNull javafx.scene.transform.TransformgetPageTransform(int internalPageNumber) Returns a transform which will position the drawing contents inside the clip on the page.Returns the paper size.booleanWhether thelayoutmethod of this figure does anything.booleanisSuitableChild(@NonNull Figure newChild) This method returns whether the provided figure is a suitable child for this 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.voidreshapeInLocal(@NonNull javafx.scene.transform.Transform transform) Attempts to change the local bounds of the figure.voidreshapeInLocal(@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.Methods inherited from class org.jhotdraw8.draw.figure.AbstractCompositeFigure
firePropertyChangeEvent, firePropertyChangeEvent, getBoundsInLocal, getChildren, getLayoutBoundsInParent, isAllowsChildrenMethods 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, getBoundsInParent, getBoundsInWorld, getCenterInLocal, getCenterInParent, getChildren, getDrawing, getLayer, getLayoutBoundsInParent, getLayoutBoundsInWorld, getLayoutObservers, getLayoutSubjects, getParent, getPreferredAspectRatio, getPropertyChangeListeners, getReadOnlyLayoutObservers, getRoot, getStyleableParent, getSupportedKeys, getVisualBounds, getVisualBoundsInWorld, hasPropertyChangeListeners, isDecomposable, isDeletWithLastLayoutSubject, isEditableKey, isGroupReshapeableWith, isShowing, isSupportedKey, isVisible, layoutChanged, layoutObserverChanged, layoutSubjectChanged, localToParent, localToWorld, localToWorld, parentProperty, propertyChanged, removeAllLayoutSubjects, removeChild, removedFromDrawing, removeLayoutSubject, reshapeInLocal, reshapeInLocal, setParent, stylesheetChanged, transformChanged, translateInLocal, translateInParent, updateCss, worldToLocal, worldToLocal, worldToParent, worldToParentMethods inherited from interface org.jhotdraw8.draw.figure.FillableFigure
applyFillableFigurePropertiesMethods inherited from interface org.jhotdraw8.draw.figure.HideableFigure
applyHideableFigurePropertiesMethods inherited from interface org.jhotdraw8.draw.figure.LockableFigure
isDeletable, isEditable, isSelectableMethods inherited from interface org.jhotdraw8.draw.figure.Page
createPaper, isAllowsChildren, isSuitableParentMethods inherited from interface org.jhotdraw8.fxbase.beans.PropertyBean
get, getNonNull, getProperties, getProperty, put, remove, set, setNonNull, valueAtMethods inherited from interface org.jhotdraw8.draw.figure.StrokableFigure
applyStrokableFigureProperties, applyStrokeCapAndJoinProperties, applyStrokeColorProperties, applyStrokeDashProperties, applyStrokeTypeProperties, applyStrokeWidthProperties, getBoundsInLocal, getStyledStrokeMethods inherited from interface org.jhotdraw8.draw.figure.StyleableFigure
applyStyleableFigureProperties, getId, getPseudoClassStates, getStyle, getStyleClasses, idPropertyMethods inherited from interface org.jhotdraw8.fxbase.styleable.StyleablePropertyBean
containsMapAccessor, getStyled, getStyled, getStyledNonNull, remove, removeAll, resetStyledValues, setStyledMethods inherited from interface org.jhotdraw8.draw.figure.TransformableFigure
applyTransformableFigureProperties, clearTransforms, flattenTransforms, getInverseTransform, getLocalToParent, getLocalToParent, getLocalToParentAsList, getParentToLocal, getParentToLocal, getTransform, hasCenterTransforms, 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
-
Field Details
-
HEIGHT
-
NUM_PAGES_X
The computed number of pages along the x-axis. -
NUM_PAGES_Y
The computed number of pages along the y-axis. -
NUM_PAGES_X_Y
-
PAGE_INSETS_BOTTOM
-
PAGE_INSETS_LEFT
-
PAGE_INSETS_RIGHT
-
PAGE_INSETS_TOP
-
PAGE_INSETS
-
PAGE_OVERLAP_X
-
PAGE_OVERLAP_Y
-
PAGE_OVERLAP
-
PAPER_HEIGHT
-
PAPER_WIDTH
-
PAPER_SIZE
-
TYPE_SELECTOR
The CSS type selector for this object is "Page".- See Also:
-
WIDTH
-
X
-
Y
-
BOUNDS
-
-
Constructor Details
-
PageFigure
public PageFigure()
-
-
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:
ctx- the renderer which will use the node- Returns:
- the newly created node
-
createPageNode
Description copied from interface:PageReturns a node which will be placed on the paper.- Specified by:
createPageNodein interfacePage- Parameters:
internalPageNumber- the internal page number- Returns:
- a new node
-
getLayoutBounds
Description copied from interface:FigureThe bounds that should be used for transformations of this figure.The bounds are given in the untransformed local coordinate space of the figure.
This method may use caching and return incorrect results if the cache is stale. Invoke
Figure.layout(org.jhotdraw8.draw.render.RenderContext)if you are not sure that the cache is valid.- Specified by:
getLayoutBoundsin interfaceFigure- Overrides:
getLayoutBoundsin classAbstractCompositeFigure- Returns:
- the local bounds
-
getCssLayoutBounds
- Specified by:
getCssLayoutBoundsin interfaceFigure- Overrides:
getCssLayoutBoundsin classAbstractCompositeFigure
-
getNumberOfSubPages
public int getNumberOfSubPages()Description copied from interface:PageReturns the number of sub-pages defined by this page.- Specified by:
getNumberOfSubPagesin interfacePage- Returns:
- number of internal pages
-
getPageBounds
Description copied from interface:PageReturns the bounds for the page content.- Specified by:
getPageBoundsin interfacePage- Parameters:
internalPageNumber- the internal page number- Returns:
- the clipping region
-
getPageClip
Description copied from interface:PageReturns the clip for the page content.- Specified by:
getPageClipin interfacePage- Parameters:
internalPageNumber- the internal page number- Returns:
- the clipping region
-
getPaperSize
Description copied from interface:PageReturns the paper size.- Specified by:
getPaperSizein interfacePage- Returns:
- the page size
-
getPageTransform
Description copied from interface:PageReturns a transform which will position the drawing contents inside the clip on the page.- Specified by:
getPageTransformin interfacePage- Parameters:
internalPageNumber- the internal page number- Returns:
- the transform
-
getTypeSelector
- Specified by:
getTypeSelectorin interfaceStyleableBean
-
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.
-
isSuitableChild
Description copied from interface:FigureThis method returns whether the provided figure is a suitable child for this figure.- Specified by:
isSuitableChildin interfaceFigure- Specified by:
isSuitableChildin interfaceTreeNode<Figure>- Parameters:
newChild- The new child figure.- Returns:
- true if
newChildis an acceptable child
-
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
-
reshapeInLocal
Description copied from interface:FigureAttempts to change the local bounds of the figure.The figure may choose to only partially change its local bounds.
- Specified by:
reshapeInLocalin interfaceFigure- Specified by:
reshapeInLocalin interfaceTransformableFigure- Parameters:
transform- the desired transformation in local coordinates
-
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)
-