Class Node
java.lang.Object
com.codename1.ui.scene.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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe local bounds of the node (without any of the transforms applied to it).X-coordinate in the Scene-graph where node should be rendered.Y-coordinate in the scene graph where node should be rendered.Z-coordinate in the scene graph where node should be rendered.The depth of the coordinate at which the renderer should paint itself.The painting rectangle, into which the renderer should be painted inside the node's local bounds.Rotation to apply to the node.The rotation axis around which rotations should be performed.The scale to apply to the node, along the x-axis.The scale to apply to the node along the y-axis.The scale to apply to the node along the z-axis.X-translation to apply to the node.Y-translation to apply to the node.Z-translation to apply to the node.Flag to indicate whether the node should be visible or not. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a child node.voidAdds tags to this node.booleancontains(int x, int y) This can be used to hit test pointer events against this node.findNodesWithTag(String tag) getChildAt(int index) Gets child node at index.intGets number of children in this node.Gets the child nodes of this node.Gets the transform to use to transform the Node into its parent node's space.Gets the transform to use to go from the local coordinates to scene coordinates.Gets the renderer component for this node.getScene()Gets the scene that this node is attached to.getStyle()Returns
booleanChecks if node has children.booleanCheck if this node has a tag.booleanReturns true if this node needs to have its children re-laid out before renderingprotected voidCan be overridden by subclasses to layout children.voidRemoves a child node.voidRemoves all child nodes.voidremoveTags(String... tags) Removes tags from this node.voidRenders the node onto a graphics context.voidRenders the node's children.voidsetNeedsLayout(boolean needsLayout) Parameters
voidsetRenderAsImage(boolean t) Sets the render as image flag.voidsetRenderer(NodePainter comp) Sets the component that should be used to render the node's contents.voidParameters
-
Field Details
-
scaleX
-
scaleY
-
scaleZ
-
layoutX
-
layoutY
-
layoutZ
-
translateX
-
translateY
-
translateZ
-
rotate
-
localCanvasZ
The 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#boundsInLocaland changing the#localCanvasZto something other than 0 since the node will be rotated at its center point. -
opacity
-
rotationAxis
-
boundsInLocal
-
visible
-
paintingRect
-
-
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.
Parameters
t
-
addTags
Adds tags to this node.
Parameters
tags
-
getBoundsInScene
-
removeTags
Removes tags from this node.
Parameters
tags
-
hasTag
Check if this node has a tag.
Parameters
tag
-
getLocalToParentTransform
Gets the transform to use to transform the Node into its parent node's space. -
getLocalToSceneTransform
Gets the transform to use to go from the local coordinates to scene coordinates. -
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
needsLayout: the needsLayout to set
-
getStyle
Returns
the style
-
setStyle
Parameters
style: 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.
Parameters
-
x -
y
-
-
findNodesWithTag
-
getLocalToScreenTransform
-
render
Renders the node onto a graphics context.
Parameters
g
-
renderChildren
Renders the node's children.
Parameters
g
-
getRenderer
Gets the renderer component for this node. -
setRenderer
Sets the component that should be used to render the node's contents.
Parameters
comp
-
add
Adds a child node.
Parameters
child
-
remove
Removes a child node.
Parameters
child
-
layoutChildren
protected void layoutChildren()Can be overridden by subclasses to layout children. Called before node is rendered. -
getChildNodes
-
getChildCount
public int getChildCount()Gets number of children in this node. -
getChildAt
Gets child node at index.
Parameters
index
-
hasChildren
public boolean hasChildren()Checks if node has children. -
removeAll
public void removeAll()Removes all child nodes.
-