Interface Drawing

All Superinterfaces:
Figure, PropertyBean, StyleableBean, StyleablePropertyBean, TreeNode<Figure>
All Known Subinterfaces:
LayeredDrawing, ViewBoxableDrawing
All Known Implementing Classes:
AbstractDrawing, AbstractViewBoxDrawing, SimpleDrawing, SimpleLayeredDrawing

public interface Drawing extends Figure
A drawing is an image composed of graphical (figurative) elements.

Styling. A drawing can have a style sheet which affects the style of the figures.

Layers. By convention the children of a Drawing must be Layers. To addChild figures to a drawing, first addChild a layer, and then addChild the figures to the layer.

Author:
Werner Randelshofer
  • Field Details

    • DOCUMENT_HOME

      static final @NonNull Key<URI> DOCUMENT_HOME
      Specifies the home address of all relative URLs used in a drawing.

      This property is not styleable.

    • AUTHOR_STYLESHEETS

      static final @NonNull NonNullKey<ImmutableList<URI>> AUTHOR_STYLESHEETS
      Holds a list of author stylesheets. If the value is null, then no stylesheets are used.

      Supports the following data types for list entries:

      • URI. The URI points to a CSS file. If the URI is relative, then it is relative to DOCUMENT_HOME.
      • String. The String contains a CSS as a literal.

      This property is not styleable.

    • USER_AGENT_STYLESHEETS

      static final @NonNull NonNullKey<ImmutableList<URI>> USER_AGENT_STYLESHEETS
      Holds a list of user agent stylesheets. If the value is null, then no stylesheets are used.
      • URI. The URI points to a CSS file. If the URI is relative, then it is relative to DOCUMENT_HOME.
      • String. The String contains a CSS as a literal.

      This property is not styleable.

    • INLINE_STYLESHEETS

      static final @NonNull NonNullKey<ImmutableList<String>> INLINE_STYLESHEETS
      Holds a list of inline stylesheets. If the value is null, then no stylesheets are used.

      This property is not styleable.

    • WIDTH

      static final @NonNull CssSizeStyleableKey WIDTH
      Defines the width of the canvas.
    • HEIGHT

      static final @NonNull CssSizeStyleableKey HEIGHT
      Defines the height of the canvas.
    • BACKGROUND

      static final @NonNull NullableCssColorStyleableKey BACKGROUND
      Defines the canvas color.

      A drawing typically renders a rectangle with the dimensions given by WIDTH and HEIGHT and fills it with the BACKGROUND paint.

      This property is styleable with the key Figure.JHOTDRAW_CSS_PREFIX+"background".

    • TYPE_SELECTOR

      static final String TYPE_SELECTOR
      The CSS type selector for a label object is "Drawing".
      See Also:
  • Method Details

    • getTypeSelector

      default @NonNull String getTypeSelector()
      Specified by:
      getTypeSelector in interface StyleableBean
    • getStyleManager

      @Nullable StylesheetsManager<Figure> getStyleManager()
      Gets the style manager of the drawing.
      Returns:
      the style manager
    • updateStyleManager

      void updateStyleManager()
      Updates the stylesheets in the style manager.
    • layoutAll

      default void layoutAll(@NonNull RenderContext ctx)
      Performs one layout pass over the entire drawing.

      This method lays out figures that do not depend on the layout of other figures first, and then lays out figures that depend on them, until all figures are laid out once. Circular dependencies are broken up deterministically.

      Parameters:
      ctx - the render context
    • layoutAll

      default void layoutAll(@NonNull RenderContext ctx, boolean parallel)
      Performs one layout pass over the entire drawing.

      This method lays out figures that do not depend on the layout of other figures first, and then lays out figures that depend on them, until all figures are laid out once. Circular dependencies are broken up deterministically.

      Parameters:
      ctx - the render context
      parallel - performs the layout in parallel or sequentially
    • updateAllCss

      default void updateAllCss(@NonNull RenderContext ctx)
    • layoutDependenciesIterable

      default @NonNull Iterable<Figure> layoutDependenciesIterable()
      Returns all figures in topological order according to their layout dependencies. Independent figures come first.
      Returns:
      figures in topological order according to layout dependencies