Class RegionFigure

All Implemented Interfaces:
CompositableFigure, ConnectableFigure, Figure, FillableFigure, HideableFigure, LockableFigure, PathIterableFigure, ResizableFigure, StrokableFigure, StyleableFigure, TransformableFigure, TransformCachingFigure, PropertyBean, StyleableBean, StyleablePropertyBean, TreeNode<Figure>

  • Field Details

    • TYPE_SELECTOR

      public static final String TYPE_SELECTOR
      The CSS type selector for this object is "Region".
      See Also:
  • Constructor Details

    • RegionFigure

      public RegionFigure()
  • Method Details

    • findConnector

      public @Nullable Connector findConnector(@NonNull javafx.geometry.Point2D pointInLocal, Figure connectingFigure, double tolerance)
      Description copied from interface: ConnectableFigure
      Gets a connector for this figure at the given location.
      Specified by:
      findConnector in interface ConnectableFigure
      Parameters:
      pointInLocal - the location of the connector in local coordinates.
      connectingFigure - The connecting figure or null if unknown. This allows for specific connectors for different connection figures.
      tolerance - tolerance in world coordinates
      Returns:
      Returns the connector. Returns null if there is no connector at the given location.
    • updateNode

      public void updateNode(@NonNull RenderContext ctx, @NonNull javafx.scene.Node node)
      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 AbstractRegionFigure
      Parameters:
      ctx - the render context
      node - the node which was created with Figure.createNode(org.jhotdraw8.draw.render.RenderContext)
    • updatePathNode

      protected void updatePathNode(@NonNull RenderContext ctx, @NonNull javafx.scene.shape.Path path)
      Overrides:
      updatePathNode in class AbstractRegionFigure
    • getTypeSelector

      public @NonNull String getTypeSelector()
      Specified by:
      getTypeSelector in interface StyleableBean