Class AbstractFigure

All Implemented Interfaces:
Figure, TransformCachingFigure, PropertyBean, StyleableBean, StyleablePropertyBean, TreeNode<Figure>
Direct Known Subclasses:
AbstractCompositeFigure, AbstractLeafFigure

public abstract class AbstractFigure extends AbstractStyleablePropertyBean implements Figure, TransformCachingFigure
AbstractFigure.
Author:
Werner Randelshofer
  • Property Details

    • parent

      public javafx.beans.property.ObjectProperty<Figure> parentProperty
      Specified by:
      parentProperty in interface Figure
      Returns:
      the parent property, with getBean() returning this figure, and getName() returning PARENT_PROPERTY.
      See Also:
  • Constructor Details

    • AbstractFigure

      public AbstractFigure()
  • Method Details

    • createKeyMap

      protected Map<Key<?>,Integer> createKeyMap()
      Overrides:
      createKeyMap in class AbstractStyleablePropertyBean
    • addedToDrawing

      public final void addedToDrawing(Drawing drawing)
      Specified by:
      addedToDrawing in interface Figure
      Parameters:
      drawing - the drawing
    • doAddedToDrawing

      protected void doAddedToDrawing(Drawing drawing)
      This method is called by Figure.addedToDrawing(org.jhotdraw8.draw.figure.Drawing). The implementation of this class is empty.
      Parameters:
      drawing - the drawing
    • doRemovedFromDrawing

      protected void doRemovedFromDrawing(Drawing drawing)
      This method is called by removedFromDrawing(org.jhotdraw8.draw.figure.Drawing). The implementation of this class is empty.
      Parameters:
      drawing - the drawing
    • getDrawing

      public final @Nullable Drawing getDrawing()
      Description copied from interface: Figure
      Returns the ancestor Drawing.
      Specified by:
      getDrawing in interface Figure
      Returns:
      the drawing or null if no ancestor is a drawing. Returns this, if this figure is a drawing.
    • getLayoutObservers

      public final Set<Figure> getLayoutObservers()
      Description copied from interface: Figure
      Returns all figures which observe the layout of this figure.

      When the layout of this figure changes, then the layout of the observers figures must be updated.

      The update strategy is implemented in DrawingModel. DrawingMode observes state changes in figures and updates dependent figures. DrawingModel can coalesce multiple state changes of an observed figure into a smaller number of layout calls on the observers. DrawingModel can also detect cyclic layout dependencies and prevent endless update loops.

      This set must be synchronized, because it is accessed by other figures, when there properties are changed.

      Specified by:
      getLayoutObservers in interface Figure
      Returns:
      a list of dependent figures
    • getReadOnlyLayoutObservers

      public ReadOnlySet<Figure> getReadOnlyLayoutObservers()
      Specified by:
      getReadOnlyLayoutObservers in interface Figure
    • getPropertyChangeListeners

      public CopyOnWriteArrayList<org.jhotdraw8.base.event.Listener<FigurePropertyChangeEvent>> getPropertyChangeListeners()
      Description copied from interface: Figure
      List of property change listeners.
      Specified by:
      getPropertyChangeListeners in interface Figure
      Returns:
      a list of property change listeners
    • hasPropertyChangeListeners

      public boolean hasPropertyChangeListeners()
      Description copied from interface: Figure
      Whether this figure has property change listeners.
      Specified by:
      hasPropertyChangeListeners in interface Figure
      Returns:
      true if this figure has property change listeners
    • parentProperty

      public javafx.beans.property.ObjectProperty<Figure> parentProperty()
      Description copied from interface: Figure
      The parent figure.

      If this figure has not been added as a child to another figure, then this variable will be null.

      By convention the parent is set exclusively by a composite figure on its child figures. The composite figure sets parent to itself on a child immediately after the child figure has been added to the composite figure. The composite figure sets parent to null on a child immediately after the child figure has been removed from the composite figure.
      Specified by:
      parentProperty in interface Figure
      Returns:
      the parent property
    • removeAllLayoutSubjects

      public void removeAllLayoutSubjects()
      This implementation is empty.
      Specified by:
      removeAllLayoutSubjects in interface Figure
    • removeLayoutSubject

      public void removeLayoutSubject(Figure connectedFigure)
      This implementation is empty.
      Specified by:
      removeLayoutSubject in interface Figure
      Parameters:
      connectedFigure - the connected figure
    • removedFromDrawing

      public final void removedFromDrawing(Drawing drawing)
      Specified by:
      removedFromDrawing in interface Figure
      Parameters:
      drawing - the drawing from which this figure has been removed
    • getCachedLocalToWorld

      public @Nullable javafx.scene.transform.Transform getCachedLocalToWorld()
      Specified by:
      getCachedLocalToWorld in interface TransformCachingFigure
    • setCachedLocalToWorld

      public void setCachedLocalToWorld(@Nullable javafx.scene.transform.Transform newValue)
      Specified by:
      setCachedLocalToWorld in interface TransformCachingFigure
    • getCachedWorldToParent

      public @Nullable javafx.scene.transform.Transform getCachedWorldToParent()
      Specified by:
      getCachedWorldToParent in interface TransformCachingFigure
    • setCachedWorldToParent

      public void setCachedWorldToParent(@Nullable javafx.scene.transform.Transform newValue)
      Specified by:
      setCachedWorldToParent in interface TransformCachingFigure
    • getCachedParentToLocal

      public @Nullable javafx.scene.transform.Transform getCachedParentToLocal()
      Specified by:
      getCachedParentToLocal in interface TransformCachingFigure
    • setCachedParentToLocal

      public void setCachedParentToLocal(@Nullable javafx.scene.transform.Transform newValue)
      Specified by:
      setCachedParentToLocal in interface TransformCachingFigure
    • getCachedLocalToParent

      public @Nullable javafx.scene.transform.Transform getCachedLocalToParent()
      Specified by:
      getCachedLocalToParent in interface TransformCachingFigure
    • setCachedLocalToParent

      public void setCachedLocalToParent(@Nullable javafx.scene.transform.Transform newValue)
      Specified by:
      setCachedLocalToParent in interface TransformCachingFigure
    • getCachedWorldToLocal

      public @Nullable javafx.scene.transform.Transform getCachedWorldToLocal()
      Specified by:
      getCachedWorldToLocal in interface TransformCachingFigure
    • setCachedWorldToLocal

      public void setCachedWorldToLocal(@Nullable javafx.scene.transform.Transform newValue)
      Specified by:
      setCachedWorldToLocal in interface TransformCachingFigure
    • getCachedParentToWorld

      public @Nullable javafx.scene.transform.Transform getCachedParentToWorld()
      Specified by:
      getCachedParentToWorld in interface TransformCachingFigure
    • setCachedParentToWorld

      public void setCachedParentToWorld(@Nullable javafx.scene.transform.Transform newValue)
      Specified by:
      setCachedParentToWorld in interface TransformCachingFigure
    • updateCss

      public void updateCss(RenderContext ctx)
      Description copied from interface: Figure
      Updates the stylesheet cache of this figure depending on its property values and on the and the property values of its ancestors.

      This figure does not keep track of changes that require CSS updates. Use a DrawingModel to manage CSS updates.

      Specified by:
      updateCss in interface Figure
      Parameters:
      ctx - the render context
    • onPropertyChanged

      protected <T> void onPropertyChanged(Key<T> key, T oldValue, T newValue, boolean wasAdded, boolean wasRemoved)
      Overrides of this method must call super!
      Overrides:
      onPropertyChanged in class AbstractStyleablePropertyBean
      Type Parameters:
      T - the value type of the property
      Parameters:
      key - the changed key
      oldValue - the old value
      newValue - the new value
      wasAdded - whether the value was added (hence oldValue does not matter)
      wasRemoved - whether the value was removed (hence newValue does not matter)
    • getStyledNonNull

      public <T> T getStyledNonNull(NonNullMapAccessor<T> key)
      Specified by:
      getStyledNonNull in interface StyleablePropertyBean