Class SimpleDrawingModel

All Implemented Interfaces:
javafx.beans.Observable, DrawingModel, ObservableMixin, TreeModel<Figure>

public class SimpleDrawingModel extends AbstractDrawingModel
A DrawingModel for drawings which can handle TransformableFigures, ChildLayoutingFigure and layout observing figures, like LineConnectionFigure.
Author:
Werner Randelshofer
  • Property Details

    • drawing

      public javafx.beans.property.ObjectProperty<Drawing> drawingProperty
      Returns:
      the root
      See Also:
    • root

      public javafx.beans.property.ObjectProperty<Figure> rootProperty
      See Also:
    • validating

      public javafx.beans.property.ReadOnlyBooleanProperty validatingProperty
      Returns:
      property that returns true if validation is in progress
      See Also:
  • Constructor Details

    • SimpleDrawingModel

      public SimpleDrawingModel()
    • SimpleDrawingModel

      public SimpleDrawingModel(boolean listenOnDrawing)
  • Method Details

    • drawingProperty

      public javafx.beans.property.ObjectProperty<Drawing> drawingProperty()
      Description copied from interface: DrawingModel
      The root of the drawing model.
      Returns:
      the drawing property
      See Also:
    • rootProperty

      public javafx.beans.property.ObjectProperty<Figure> rootProperty()
      Returns:
      the root property
    • removeFromParent

      public void removeFromParent(Figure child)
      Description copied from interface: DrawingModel
      Removes the specified child from its parent and fires appropriate DrawingModelEvents.
      Parameters:
      child - the figure
    • removeFromParent

      public Figure removeFromParent(Figure parent, int index)
      Description copied from interface: DrawingModel
      Removes the specified child from its parent and fires appropriate DrawingModelEvents.
      Parameters:
      parent - the parent figure
      index - the index
    • insertChildAt

      public void insertChildAt(Figure child, Figure parent, int index)
      Description copied from interface: DrawingModel
      Adds the specified child to a parent and fires appropriate DrawingModelEvents.
      Parameters:
      child - the new child
      parent - the parent.
      index - the index
    • setNonNull

      public <T> T setNonNull(Figure figure, NonNullMapAccessor<T> key, T newValue)
      Description copied from interface: DrawingModel
      Sets the specified property on the figure and fires appropriate DrawingModelEvents.
      Type Parameters:
      T - the value type
      Parameters:
      figure - the figure
      key - the key
      newValue - the new value
      Returns:
      the old value
    • set

      public <T> T set(Figure figure, MapAccessor<T> key, @Nullable T newValue)
      Description copied from interface: DrawingModel
      Sets the specified property on the figure and fires appropriate DrawingModelEvents.
      Type Parameters:
      T - the value type
      Parameters:
      figure - the figure
      key - the key
      newValue - the new value
      Returns:
      the old value
    • remove

      public <T> T remove(Figure figure, MapAccessor<T> key)
    • remove

      public <T> T remove(Figure figure, Key<T> key)
      Description copied from interface: DrawingModel
      Removes the specified key from the figure.
      Type Parameters:
      T - the value type
      Parameters:
      figure - a figure
      key - a key
      Returns:
      the old value
    • propertyAt

      public <T> javafx.beans.property.Property<T> propertyAt(Figure f, Key<T> key)
      Description copied from interface: DrawingModel
      Creates a property for the specified figure and property key.
      Type Parameters:
      T - the property type
      Parameters:
      f - a figure
      key - a property key
      Returns:
      a property
    • reshapeInLocal

      public void reshapeInLocal(Figure f, javafx.scene.transform.Transform transform)
      Description copied from interface: DrawingModel
      Attempts to change the local bounds of the figure and fires appropriate DrawingModelEvents.
      Parameters:
      f - the figure
      transform - the desired transformation in the local coordinate system
    • reshapeInParent

      public void reshapeInParent(Figure f, javafx.scene.transform.Transform transform)
      Description copied from interface: DrawingModel
      Attempts to change the parent bounds of the figure and fires appropriate DrawingModelEvents.
      Parameters:
      f - the figure
      transform - the desired transformation in the parent coordinate system
    • translateInParent

      public void translateInParent(Figure f, CssPoint2D delta)
    • transformInParent

      public void transformInParent(Figure f, javafx.scene.transform.Transform transform)
      Description copied from interface: DrawingModel
      Invokes "transformInParent" on the specified figure.
      Parameters:
      f - a figure
      transform - the desired transformation
    • transformInLocal

      public void transformInLocal(Figure f, javafx.scene.transform.Transform transform)
      Description copied from interface: DrawingModel
      Invokes "transformInLocal" on the specified figure.
      Parameters:
      f - a figure
      transform - the desired transformation
    • reshapeInLocal

      public void reshapeInLocal(Figure f, double x, double y, double width, double height)
      Description copied from interface: DrawingModel
      Attempts to change the local bounds of the figure and fires appropriate DrawingModelEvents.
      Parameters:
      f - the figure
      x - desired x-position in the local coordinate system
      y - desired y-position in the local coordinate system
      width - desired width in the local coordinate system, may be negative
      height - desired height in the local coordinat system, may be negative
    • reshapeInLocal

      public void reshapeInLocal(Figure f, CssSize x, CssSize y, CssSize width, CssSize height)
    • layout

      public void layout(Figure f, RenderContext ctx)
      Description copied from interface: DrawingModel
      Invokes the layout method of the figure and fires appropriate / DrawingModelEvents.
      Parameters:
      f - the figure
      ctx - the render context (optional)
    • isValidating

      public boolean isValidating()
      Gets the value of the validating property.
      Property description:
      Returns:
      the value of the validating property
      See Also:
    • validatingProperty

      public javafx.beans.property.ReadOnlyBooleanProperty validatingProperty()
      Description copied from interface: DrawingModel
      This property returns true if the drawing model is validating its figures.
      Returns:
      the validating property
      See Also:
    • disconnect

      public void disconnect(Figure f)
      Description copied from interface: DrawingModel
      Invokes the disconnect method of the figure and fires appropriate DrawingModelEvents.
      Parameters:
      f - the figure
    • updateCss

      public void updateCss(Figure figure)
      Description copied from interface: DrawingModel
      Invokes the updateCss method of the figure and fires appropriate DrawingModelEvents.
      Parameters:
      figure - the figure
    • validate

      public void validate(RenderContext ctx)
      Description copied from interface: DrawingModel
      Validates the model. This method is invoked by DrawingView each time before it renders the model.
      Parameters:
      ctx - the render context (optional)
    • fireDrawingModelEvent

      public void fireDrawingModelEvent(DrawingModelEvent event)
      Description copied from interface: DrawingModel
      Fires the specified event.
      Parameters:
      event - the event
    • fireTreeModelEvent

      public void fireTreeModelEvent(TreeModelEvent<Figure> event)
    • onDrawingModelEvent

      protected void onDrawingModelEvent(DrawingModelEvent event)
    • onTreeModelEvent

      protected void onTreeModelEvent(TreeModelEvent<Figure> event)