public class Node
- Object
- Node
Encapsulates a Node in the scene-graph. This wraps a component (the “renderer” of the Node) and an associated transform
that describes where, in the 3D space of the scene graph the component should be rendered.
Fields
Constructors
public Node() |
Methods
Inherited methods
Field details
scaleX
public final Property<Double, Node> scaleXThe scale to apply to the node, along the x-axis.
scaleY
public final Property<Double, Node> scaleYThe scale to apply to the node along the y-axis.
scaleZ
public final Property<Double, Node> scaleZThe scale to apply to the node along the z-axis.
layoutX
public final Property<Double, Node> layoutXX-coordinate in the Scene-graph where node should be rendered.
layoutY
public final Property<Double, Node> layoutYY-coordinate in the scene graph where node should be rendered.
layoutZ
public final Property<Double, Node> layoutZZ-coordinate in the scene graph where node should be rendered.
translateX
public final Property<Double, Node> translateXX-translation to apply to the node.
translateY
public final Property<Double, Node> translateYY-translation to apply to the node.
translateZ
public final Property<Double, Node> translateZZ-translation to apply to the node.
rotate
public final Property<Double, Node> rotateRotation to apply to the node. In degrees. Node is always rotated around its center.
localCanvasZ
public final Property<Double, Node> localCanvasZThe depth of the coordinate at which the renderer should paint itself.
By default nodes will have no depth, and renderer will be painted onto
a rectangle on the Z=0 plane. If you need to perform 3D rotations, you may want to
give the node depth by setting the depth of
#boundsInLocal and changing the
#localCanvasZ to something other than 0 since the node will be rotated at its
center point.opacity
public final Property<Double, Node> opacityrotationAxis
public final Property<Point3D, Node> rotationAxisThe rotation axis around which rotations should be performed. (0, 0, 1) results in a rotation
around the z-axis, (1, 0, 0) results in a rotation around the x-axis, and (0, 1, 0) a rotation
around the y-axis.
boundsInLocal
public final Property<Bounds, Node> boundsInLocalThe local bounds of the node (without any of the transforms applied to it).
visible
public final Property<Boolean, Node> visibleFlag to indicate whether the node should be visible or not.
paintingRect
public final Property<Rectangle, Node> paintingRectThe painting rectangle, into which the renderer should be painted inside the
node’s local bounds.
Constructor details
Node
public Node()Method details
setRenderAsImage
public void setRenderAsImage(boolean t)Sets the render as image flag. True to render this Node as an image.
addTags
public void addTags(String... tags)Adds tags to this node.
getBoundsInScene
public Rectangle2D getBoundsInScene(Rectangle2D out)removeTags
public void removeTags(String... tags)Removes tags from this node.
hasTag
public boolean hasTag(String tag)Check if this node has a tag.
getLocalToParentTransform
public Transform getLocalToParentTransform()Gets the transform to use to transform the Node into its parent node’s space.
getLocalToSceneTransform
public Transform getLocalToSceneTransform()Gets the transform to use to go from the local coordinates to scene coordinates.
getScene
public Scene getScene()Gets the scene that this node is attached to.
Returns
the scene
isNeedsLayout
public boolean isNeedsLayout()Returns true if this node needs to have its children re-laid out before rendering
Returns
the needsLayout
setNeedsLayout
public void setNeedsLayout(boolean needsLayout)Parameters
needsLayoutboolean- the needsLayout to set
getStyle
public Style getStyle()Returns
the style
setStyle
public void setStyle(Style style)Parameters
styleStyle- the style to set
contains
public boolean contains(int x, int y)This can be used to hit test pointer events against this node. It checks whether
a given absolute (x, y) coordinate hits the node.
findNodesWithTag
public Collection<Node> findNodesWithTag(String tag)getLocalToScreenTransform
public Transform getLocalToScreenTransform()render
public void render(Graphics g)Renders the node onto a graphics context.
renderChildren
public void renderChildren(Graphics g)Renders the node’s children.
getRenderer
public NodePainter getRenderer()Gets the renderer component for this node.
setRenderer
public void setRenderer(NodePainter comp)Sets the component that should be used to render the node’s contents.
add
public void add(Node child)Adds a child node.
remove
public void remove(Node child)Removes a child node.
layoutChildren
protected void layoutChildren()Can be overridden by subclasses to layout children. Called before node is rendered.
getChildNodes
public Iterable<Node> getChildNodes()Gets the child nodes of this node.
getChildCount
public int getChildCount()Gets number of children in this node.
getChildAt
public Node getChildAt(int index)Gets child node at index.
hasChildren
public boolean hasChildren()Checks if node has children.
removeAll
public void removeAll()Removes all child nodes.