lv.lumii.layoutengine

## Class Container

- java.lang.Object
- - lv.lumii.layoutengine.Element
  - - lv.lumii.layoutengine.AbstractContainer
    - - lv.lumii.layoutengine.Container

- Direct Known Subclasses:
    Box

      public class Container
      extends AbstractContainer

  The `Container` class specifies a group of diagram elements. The geometrical layout of the elements is specified by its `AbstractContainer.layoutConstraints`.

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Box` | `convertToBox(java.awt.geom.Point2D.Double newCenter, Container newOwner, java.awt.geom.Point2D.Double growPoint)` Converts this container to a box, keeping all the common properties intact.
    `Box` | `convertToBox(java.awt.geom.Point2D.Double newCenter, Container newOwner, java.awt.geom.Point2D.Double growPoint, java.lang.Integer row, java.lang.Integer column)` Converts this container to a box, keeping all the common properties intact.
    `Container` | `convertToContainer(java.awt.geom.Point2D.Double moveVector, Container newOwner)` Converts this box to a container, keeping all the common properties intact.
    `Container` | `convertToContainer(java.awt.geom.Point2D.Double moveVector, Container newOwner, java.lang.Integer row, java.lang.Integer column)` Converts this box to a container, keeping all the common properties intact.
    `Box` | `createBox(java.awt.geom.Rectangle2D.Double rectangle, ArrangeData.ArrangeStyle arrangeStyle, LayoutConstraints.ConstraintType constraintType, double spacing)` Creates a new box as a child of this container.
    `Box` | `createBox(java.awt.geom.Rectangle2D.Double rectangle, ArrangeData.ArrangeStyle arrangeStyle, LayoutConstraints.ConstraintType constraintType, double spacing, java.lang.Integer row, java.lang.Integer column)` Creates a new box as a child of this container.
    `Box` | `createBox(java.awt.geom.Rectangle2D.Double rectangle, double spacing)` Creates a new box as a child of this container.
    `Container` | `createContainer()` Creates a new container as a child of this container.
    `Container` | `createContainer(ArrangeData.ArrangeStyle arrangeStyle, LayoutConstraints.ConstraintType constraintType)` Creates a new container as a child of this container.
    `java.awt.geom.Rectangle2D.Double` | `findChildContainerEnclosingRectangle()` Finds the smallest rectangle containing all of the container's direct descendant child containers, including the spacing of the container bounds.
    `java.awt.geom.Rectangle2D.Double` | `findDescendantEnclosingRectangle()` Finds the smallest rectangle containing all of the container's children, including the spacing of the children.
    `ArrangeData` | `getArrangeData()` Returns the currently set arrange data for this container.
    `ArrangeData.ArrangeStyle` | `getArrangeStyle()` Gets the style set for this container, including possibly `ArrangeData.ArrangeStyle.INHERITED`.
    `java.util.ArrayList<Box>` | `getBoxes()` Returns all child boxes of this container.
    `java.util.ArrayList<Element>` | `getChildren()` Returns the children of this element.
    `java.util.ArrayList<Container>` | `getContainers()` Returns all containers that are children of this container.
    `java.util.ArrayList<Box>` | `getDescendantBoxes()` Returns the set containing all descendant boxes of the container.
    `java.util.ArrayList<Box>` | `getDescendantBoxes(boolean inclusive)` Returns the set containing all descendant boxes of the container.
    `java.util.ArrayList<OutsideLabel.BoxOutsideLabel>` | `getDescendantBoxOutsideLabels()` Returns the set containing all descendant labels of the container.
    `java.util.ArrayList<Container>` | `getDescendantContainers()` Returns the set containing all descendant containers of the container.
    `java.util.ArrayList<Line>` | `getDescendantLines()` Returns the set containing all descendant lines of the container.
    `java.util.ArrayList<OutsideLabel>` | `getDescendantOutsideLabels()` Returns the set containing all descendant labels of the container.
    `java.util.ArrayList<Line>` | `getLines()` Returns all child lines of this container.
    `Container` | `getOwner()` Each element can be owned by some other element.
    `java.util.ArrayList<Container>` | `getPureContainers()` Returns all containers that are owned by this container.
    `java.awt.geom.Path2D.Double` | `getShape()` Returns the approximate geometric shape of this container.
    `ArrangeData` | `getUsedArrangeData()` Returns the currently used arrange data for this container.
    `ArrangeData.ArrangeStyle` | `getUsedArrangeStyle()` Gets the style of the container according to which its elements will be arranged.
    `void` | `move(java.awt.geom.Point2D.Double moveVector, Container newOwner)` Moves the container (its grid and children) by the given vector.
    `void` | `move(java.awt.geom.Point2D.Double moveVector, Container newOwner, java.lang.Integer row, java.lang.Integer column)` Moves the container (its grid and children) by the given vector.
    `void` | `setArrangeStyle(ArrangeData.ArrangeStyle arrangeStyle)` Sets the style for the container according to which to arrange its elements.
    `void` | `setSpacing(double spacing)` Sets the spacing of the element.

    - ### Methods inherited from class lv.lumii.layoutengine.AbstractContainer

      `contains, createInsideLabel, createInsideLabel, createInsideLabel, findNextRectangleEnclosingRectangle, getBottom, getBounds, getCenter, getCenterX, getCenterY, getHeight, getInsideLabels, getLayoutConstraints, getLeft, getMinHeight, getMinWidth, getRight, getTop, getWidth, remove, setConstraintType`

    - ### Methods inherited from class lv.lumii.layoutengine.Element

      `getDiagram, getSpacing, remove`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### setSpacing

          public void setSpacing(double spacing)

      Description copied from class: `Element`
      Sets the spacing of the element.
      Specified by:
        `setSpacing` in class `Element`
      Parameters:
        `spacing` - the value to set

    - #### getChildren

          public java.util.ArrayList<Element> getChildren()

      Description copied from class: `Element`
      Returns the children of this element.
      Returns:
        the children of this element.

    - #### getBoxes

          public java.util.ArrayList<Box> getBoxes()

      Returns all child boxes of this container.
      Returns:
        all child boxes of this container.

    - #### getDescendantBoxes

          public java.util.ArrayList<Box> getDescendantBoxes()

      Returns the set containing all descendant boxes of the container.
      Returns:
        the set containing all descendant boxes of the container.

    - #### getDescendantBoxes

          public java.util.ArrayList<Box> getDescendantBoxes(boolean inclusive)

      Returns the set containing all descendant boxes of the container.
      Parameters:
        `inclusive` - whether to include this container in the result if it is a box
      Returns:
        the set containing all descendant boxes of the container.

    - #### getDescendantContainers

          public java.util.ArrayList<Container> getDescendantContainers()

      Returns the set containing all descendant containers of the container.
      Returns:
        the set containing all descendant containers of the container.

    - #### getDescendantOutsideLabels

          public java.util.ArrayList<OutsideLabel> getDescendantOutsideLabels()

      Returns the set containing all descendant labels of the container.
      Returns:
        the set containing all descendant labels of the container.

    - #### getDescendantBoxOutsideLabels

          public java.util.ArrayList<OutsideLabel.BoxOutsideLabel> getDescendantBoxOutsideLabels()

      Returns the set containing all descendant labels of the container.
      Returns:
        the set containing all descendant labels of the container.

    - #### getDescendantLines

          public java.util.ArrayList<Line> getDescendantLines()

      Returns the set containing all descendant lines of the container.
      Returns:
        the set containing all descendant lines of the container.

    - #### getContainers

          public java.util.ArrayList<Container> getContainers()

      Returns all containers that are children of this container. The returned set contains boxes and containers that are not instantiated by another class extending the `Container` class. To get boxes and non-box containers separately, use the direct access `getBoxes()` and `getPureContainers()` methods.
      Returns:
        the set of all this container's child containers.

    - #### getPureContainers

          public java.util.ArrayList<Container> getPureContainers()

      Returns all containers that are owned by this container. Note that this method does not return the boxes that are owned by this container though they also are instances of `Container` class (for that purpose use the `getContainers()` method).
      Returns:
        the set of all this container's child pure containers.

    - #### getLines

          public java.util.ArrayList<Line> getLines()

      Returns all child lines of this container.
      Returns:
        all child lines of this container.

    - #### getOwner

          public Container getOwner()

      Description copied from class: `Element`
      Each element can be owned by some other element. When an owner is deleted, it deletes all objects owned by it. A box's owner is a container (or one of its derived classes — another box or diagram), a line is owned by a container. A label is owned by a box, a line, a label or a container. Container's owner is a container. A diagram is not owned by any other element.
      Overrides:
        `getOwner` in class `Element`
      Returns:
        the owner of this object, or possibly `null`, if this element is a diagram.

    - #### getArrangeData

          public ArrangeData getArrangeData()

      Returns the currently set arrange data for this container. If this returns `INHERITED`, use `#getUsedArrangeData` to find the arrange data to be actually used.
      Returns:
        the currently set arrange data for this container

    - #### getUsedArrangeData

          public ArrangeData getUsedArrangeData()

      Returns the currently used arrange data for this container.
      Returns:
        the currently used arrange data for this container

    - #### setArrangeStyle

          public final void setArrangeStyle(ArrangeData.ArrangeStyle arrangeStyle)

      Sets the style for the container according to which to arrange its elements.
      Parameters:
        `arrangeStyle` - the new arrange style for the container

    - #### getArrangeStyle

          public ArrangeData.ArrangeStyle getArrangeStyle()

      Gets the style set for this container, including possibly `ArrangeData.ArrangeStyle.INHERITED`. Use `getUsedArrangeStyle()` to get the style actually used.
      Returns:
        the style of the container according to which to arrange its elements.

    - #### getUsedArrangeStyle

          public ArrangeData.ArrangeStyle getUsedArrangeStyle()

      Gets the style of the container according to which its elements will be arranged. The same as `getArrangeStyle()` unless that is `ArrangeData.ArrangeStyle.INHERITED`, in which case goes up the element hierarchy until the first element wit ha different style.
      Returns:
        the style of the container according to which to arrange its elements.

    - #### createBox

          public Box createBox(java.awt.geom.Rectangle2D.Double rectangle,
                               double spacing)

      Creates a new box as a child of this container. The minimum size of the new box is the size of the given rectangle. The whole diagram is reordered afterwards, or at the end of the current transaction.
      Parameters:
        `rectangle` - the position of the new box
        `spacing` - the spacing value for the new box
      Returns:
        the new box object.

    - #### createBox

          public Box createBox(java.awt.geom.Rectangle2D.Double rectangle,
                               ArrangeData.ArrangeStyle arrangeStyle,
                               LayoutConstraints.ConstraintType constraintType,
                               double spacing)

      Creates a new box as a child of this container. The minimum size of the new box is the size of the given rectangle. The whole diagram is reordered afterwards, or at the end of the current transaction.
      Parameters:
        `rectangle` - the position of the new box
        `arrangeStyle` - the style according to which to arrange the elements of the new box
        `constraintType` - the type of the layout constraints for the new box
        `spacing` - the spacing value for the new box
      Returns:
        the new box object.

    - #### createBox

          public Box createBox(java.awt.geom.Rectangle2D.Double rectangle,
                               ArrangeData.ArrangeStyle arrangeStyle,
                               LayoutConstraints.ConstraintType constraintType,
                               double spacing,
                               java.lang.Integer row,
                               java.lang.Integer column)

      Creates a new box as a child of this container. The minimum size of the new box is the size of the given rectangle. The whole diagram is reordered afterwards, or at the end of the current transaction.
      Parameters:
        `rectangle` - the position of the new box
        `arrangeStyle` - the style according to which to arrange the elements of the new box
        `constraintType` - the type of the layout constraints for the new box
        `spacing` - the spacing value for the new box
        `row` - the row of the new box in this container's grid
        `column` - the column of the new box in this container's grid
      Returns:
        the new box object.

    - #### createContainer

          public Container createContainer()

      Creates a new container as a child of this container.
      Returns:
        the new container object.

    - #### createContainer

          public Container createContainer(ArrangeData.ArrangeStyle arrangeStyle,
                                           LayoutConstraints.ConstraintType constraintType)

      Creates a new container as a child of this container.
      Parameters:
        `arrangeStyle` - the style according to which to arrange the elements of the new container
        `constraintType` - the type of the layout constraints for the new container
      Returns:
        the new container object.

    - #### move

          public void move(java.awt.geom.Point2D.Double moveVector,
                           Container newOwner,
                           java.lang.Integer row,
                           java.lang.Integer column)

      Moves the container (its grid and children) by the given vector. The actual size may differ due to children. The new owner of the container will be stretched to accommodate the container children at its desired new position. The whole diagram is reordered afterwards, or at the end of the current transaction.
      Parameters:
        `moveVector` - the move vector for the container grid and children
        `newOwner` - the new owner of the container
        `row` - the row of the container in new owner's grid
        `column` - the column of the container in new owner's grid

    - #### move

          public void move(java.awt.geom.Point2D.Double moveVector,
                           Container newOwner)

      Moves the container (its grid and children) by the given vector. The actual size may differ due to children. The new owner of the container will be stretched to accommodate the container children at its desired new position. The whole diagram is reordered afterwards, or at the end of the current transaction.
      Parameters:
        `moveVector` - the move vector for the container grid and children
        `newOwner` - the new owner of the container

    - #### convertToBox

          public Box convertToBox(java.awt.geom.Point2D.Double newCenter,
                                  Container newOwner,
                                  java.awt.geom.Point2D.Double growPoint)

      Converts this container to a box, keeping all the common properties intact. Places it at the given position, along with its children. The actual size may differ due to children. The new owner of the box will be stretched to accommodate the box at its desired new position. The whole diagram is reordered afterwards, or at the end of the current transaction.
      Parameters:
        `newCenter` - the new center of the box
        `newOwner` - the new owner of the box
        `growPoint` - the exact point at which to insert the box, it will then be grow from that point to its desired position as per `Box.resize(java.awt.geom.Rectangle2D.Double)`
      Returns:
        the box converted from this container and placed at the given position

    - #### convertToBox

          public Box convertToBox(java.awt.geom.Point2D.Double newCenter,
                                  Container newOwner,
                                  java.awt.geom.Point2D.Double growPoint,
                                  java.lang.Integer row,
                                  java.lang.Integer column)

      Converts this container to a box, keeping all the common properties intact. Places it at the given position, along with its children. The actual size may differ due to children. The new owner of the box will be stretched to accommodate the box at its desired new position. The whole diagram is reordered afterwards, or at the end of the current transaction. If the new owner has grid constraints, puts the new box into the given cell.
      Parameters:
        `newCenter` - the new center of the box
        `newOwner` - the new owner of the box
        `growPoint` - the exact point at which to insert the box, it will then be grow from that point to its desired position as per `Box.resize(java.awt.geom.Rectangle2D.Double)`
        `row` - the row of the box in new owner's grid
        `column` - the column of the box in new owner's grid
      Returns:
        the box converted from this container and placed at the given position

    - #### convertToContainer

          public Container convertToContainer(java.awt.geom.Point2D.Double moveVector,
                                              Container newOwner)

      Converts this box to a container, keeping all the common properties intact. Moves its grid and children by the given vector. The new owner of the container will be stretched to accommodate the children and grid of the container at its desired new position. The whole diagram is reordered afterwards, or at the end of the current transaction.
      Parameters:
        `moveVector` - the move vector for the container grid and children
        `newOwner` - the new owner of the container
      Returns:
        the container converted from this box and placed at the given position

    - #### convertToContainer

          public Container convertToContainer(java.awt.geom.Point2D.Double moveVector,
                                              Container newOwner,
                                              java.lang.Integer row,
                                              java.lang.Integer column)

      Converts this box to a container, keeping all the common properties intact. Moves its grid and children by the given vector. The new owner of the container will be stretched to accommodate the children and grid of the container at its desired new position. The whole diagram is reordered afterwards, or at the end of the current transaction.
      Parameters:
        `moveVector` - the move vector for the container grid and children
        `newOwner` - the new owner of the container
        `row` - the row of the container in new owner's grid
        `column` - the column of the container in new owner's grid
      Returns:
        the container converted from this box and placed at the given position

    - #### findDescendantEnclosingRectangle

          public java.awt.geom.Rectangle2D.Double findDescendantEnclosingRectangle()

      Finds the smallest rectangle containing all of the container's children, including the spacing of the children.
      Overrides:
        `findDescendantEnclosingRectangle` in class `AbstractContainer`
      Returns:
        the smallest children enclosing rectangle, or `null` is the container has no children with dimensions

    - #### findChildContainerEnclosingRectangle

          public java.awt.geom.Rectangle2D.Double findChildContainerEnclosingRectangle()

      Finds the smallest rectangle containing all of the container's direct descendant child containers, including the spacing of the container bounds.
      Returns:
        the smallest child container enclosing rectangle, or `null` is the container has no child containers

    - #### getShape

          public java.awt.geom.Path2D.Double getShape()

      Returns the approximate geometric shape of this container. If container has grid constraints, returns an orthogonal rectangle bounding the grid. Otherwise returns a convex hull enclosing all descendants of the container. If the container is empty, returns `null`.
      Returns:
        the approximate geometric shape of this container