java.lang.Object
io.github.somesourcecode.someguiapi.scene.Scene

public class Scene extends Object
The Scene class is the container for all content in a scene graph. The background of the scene is filled as specified by the background property.

For content to be rendered the application must specify a root Node by setting the root property.

Since:
1.0.0
  • Constructor Details

    • Scene

      public Scene()
      Constructs a new empty scene.
      Since:
      1.0.0
    • Scene

      public Scene(Parent root)
      Constructs a new scene with the given root.
      Parameters:
      root - the root of the scene
      Since:
      1.0.0
  • Method Details

    • getDataHolder

      public ContextDataHolder getDataHolder()
      Returns the data holder of this scene.
      Returns:
      the data holder of this scene
      Since:
      2.0.0
    • getGui

      public Gui getGui()
      Returns the GUI that this scene is attached to.
      Returns:
      the GUI that this scene is attached to
      Since:
      2.0.0
    • fireOnClick

      public void fireOnClick(NodeClickContext context)
      Fires the onClick event for the node at the given coordinates. The listeners a called for the clicked node and all of its parents, respectively.
      Parameters:
      context - the click context
      Since:
      1.0.0
    • getRoot

      public Parent getRoot()
      Returns the root of the scene.
      Returns:
      the root of the scene
      Since:
      1.0.0
    • setRoot

      public void setRoot(Parent root)
      Sets the root of the scene.
      Parameters:
      root - the new root of the scene
      Since:
      1.0.0
    • lookup

      public Node lookup(String selector)
      Looks for any node in the scene that matches the given selector. If multiple nodes are found, the first one found is returned. If no node is found, null is returned.
      Parameters:
      selector - the selector
      Returns:
      the first node on the scene graph that matches the selector, null if no node matches the selector
      Since:
      2.0.0
      See Also:
    • lookupAll

      public Set<Node> lookupAll(String selector)
      Looks for all nodes in the scene that match the given selector. If no node is found, an empty set is returned.
      Parameters:
      selector - the selector
      Returns:
      a set of nodes that match the selector. This is always non-null and unmodifiable.
      Since:
      2.0.0
      See Also:
    • getBackground

      public Background getBackground()
      Returns the background of the scene.
      Returns:
      the background of the scene
      Since:
      1.0.0
    • setBackground

      public void setBackground(Background background)
      Sets the background of the scene.
      Parameters:
      background - the new background of the scene
      Since:
      1.0.0