Class SimpleLayeredDrawing

All Implemented Interfaces:
Drawing, Figure, LayeredDrawing, LockableFigure, NonTransformableFigure, StyleableFigure, TransformCachingFigure, ViewBoxableDrawing, PropertyBean, StyleableBean, StyleablePropertyBean, TreeNode<Figure>

public class SimpleLayeredDrawing extends AbstractViewBoxDrawing implements LayeredDrawing, StyleableFigure, LockableFigure, NonTransformableFigure
  • Constructor Details

    • SimpleLayeredDrawing

      public SimpleLayeredDrawing()
    • SimpleLayeredDrawing

      public SimpleLayeredDrawing(double width, double height)
    • SimpleLayeredDrawing

      public SimpleLayeredDrawing(CssSize width, CssSize height)
  • Method Details

    • updateNode

      public void updateNode(@NonNull RenderContext ctx, @NonNull javafx.scene.Node n)
      Description copied from interface: Figure
      This method is invoked by a RenderContext, 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(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. Each RenderContext uses 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 using child.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. DrawingModel to manage node updates.

      Specified by:
      updateNode in interface Figure
      Overrides:
      updateNode in class AbstractViewBoxDrawing
      Parameters:
      ctx - the render context
      n - the node which was created with Figure.createNode(org.jhotdraw8.draw.render.RenderContext)