lv.lumii.layoutengine

## Class Box

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

- All Implemented Interfaces:
    Connectible
  Direct Known Subclasses:
    Diagram

      public class Box
      extends Container
      implements Connectible

  This class specifies the box element type.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Box.BoxSide` Stores the side of a box that a points lies on.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Line` | `connectTo(Connectible element, Line.LineType lineType, double spacing)` Adds a line to this diagram.
    `Line` | `connectTo(Connectible element, Line.LineType lineType, double spacing, java.util.ArrayList<java.awt.geom.Point2D.Double> points)` Adds a line to this diagram going along the given points.
    `Line` | `connectTo(Connectible element, Line.LineType lineType, double spacing, java.util.ArrayList<java.awt.geom.Point2D.Double> points, boolean cleanup)` Adds a line to this diagram going along the given points.
    `OutsideLabel.BoxOutsideLabel` | `createOutsideLabel(double width, double height, Box.BoxSide side, double position, LayoutConstraints.ConstraintType constraintType, double spacing)` Creates a new outside label for this box.
    `OutsideLabel.BoxOutsideLabel` | `createOutsideLabel(double width, double height, java.awt.geom.Point2D.Double center, LayoutConstraints.ConstraintType constraintType, double spacing)` Creates a new outside label for this box.
    `java.util.ArrayList<Element>` | `getChildren()` Returns the children of this element.
    `java.util.ArrayList<Line>` | `getIncidentLines()` Returns a list of all lines incident to this element.
    `java.util.ArrayList<OutsideLabel.BoxOutsideLabel>` | `getOutsideLabels()` Returns the outside labels that belong to this box.
    `java.awt.geom.Path2D.Double` | `getShape()` Returns the bounding rectangle of the box.
    `void` | `move(java.awt.geom.Point2D.Double moveVector, Container newOwner)` Moves the box by the given vector, along with its children.
    `void` | `move(java.awt.geom.Point2D.Double moveVector, Container newOwner, java.lang.Integer row, java.lang.Integer column)` Moves the box by the given vector, along with its children.
    `void` | `move(java.awt.geom.Point2D.Double newCenter, Container newOwner, java.awt.geom.Point2D.Double growPoint)` Moves the box, taking it from its current position and placing it at the given position, along with its children.
    `void` | `move(java.awt.geom.Point2D.Double newCenter, Container newOwner, java.awt.geom.Point2D.Double growPoint, java.lang.Integer row, java.lang.Integer column)` Moves the box, taking it from its current position and placing it at the given position, along with its children.
    `void` | `remove()` Removes the element and its descendant elements.
    `void` | `resize(java.awt.geom.Rectangle2D.Double rectangle)` Resizes the box, moving it from its current position to the given rectangle, pushing aside other elements as needed.
    `void` | `setMinHeight(double minHeight)` Sets the minimum height.
    `void` | `setMinSize(double width, double height)` Sets the minimum size of the box.
    `void` | `setMinWidth(double minWidth)` Sets the minimum width.
    `void` | `setSpacing(double spacing)` Sets the spacing value of the box.

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

      `convertToBox, convertToBox, convertToContainer, convertToContainer, createBox, createBox, createBox, createContainer, createContainer, findChildContainerEnclosingRectangle, findDescendantEnclosingRectangle, getArrangeData, getArrangeStyle, getBoxes, getContainers, getDescendantBoxes, getDescendantBoxes, getDescendantBoxOutsideLabels, getDescendantContainers, getDescendantLines, getDescendantOutsideLabels, getLines, getOwner, getPureContainers, getUsedArrangeData, getUsedArrangeStyle, setArrangeStyle`

    - ### 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, 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)

      Sets the spacing value of the box. The whole diagram is reordered afterwards, or at the end of the current transaction.
      Overrides:
        `setSpacing` in class `Container`
      Parameters:
        `spacing` - the new spacing value

    - #### setMinHeight

          public void setMinHeight(double minHeight)

      Sets the minimum height. The whole diagram is reordered afterwards, or at the end of the current transaction.
      Parameters:
        `minHeight` - the new minimum height

    - #### setMinWidth

          public void setMinWidth(double minWidth)

      Sets the minimum width. The whole diagram is reordered afterwards, or at the end of the current transaction.
      Parameters:
        `minWidth` - the new minimum width

    - #### setMinSize

          public void setMinSize(double width,
                                 double height)

      Sets the minimum size of the box.
      Parameters:
        `width` - the new minimum width
        `height` - the new minimum height

    - #### getChildren

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

      Description copied from class: `Element`
      Returns the children of this element.
      Overrides:
        `getChildren` in class `Container`
      Returns:
        the children of this element.

    - #### getIncidentLines

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

      Description copied from interface: `Connectible`
      Returns a list of all lines incident to this element.
      Specified by:
        `getIncidentLines` in interface `Connectible`
      Returns:
        a list of all lines incident to this element.

    - #### getOutsideLabels

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

      Returns the outside labels that belong to this box.
      Returns:
        the outside labels that belong to this box.

    - #### resize

          public void resize(java.awt.geom.Rectangle2D.Double rectangle)

      Resizes the box, moving it from its current position to the given rectangle, pushing aside other elements as needed. Changes the minimum size of the box to the given size. The actual size may differ due to children. The whole diagram is reordered afterwards, or at the end of the current transaction.
      Parameters:
        `rectangle` - the new position of the box to resize it to

    - #### move

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

      Moves the box, taking it from its current position and placing 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 desired 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 `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

    - #### move

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

      Moves the box, taking it from its current position and placing 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 desired 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 `resize(java.awt.geom.Rectangle2D.Double)`

    - #### move

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

      Moves the box by the given vector, 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.
      Overrides:
        `move` in class `Container`
      Parameters:
        `moveVector` - the move vector for the box
        `newOwner` - the new owner of the box
        `row` - the row of the box in new owner's grid
        `column` - the column of the box in new owner's grid

    - #### move

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

      Moves the box by the given vector, 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.
      Overrides:
        `move` in class `Container`
      Parameters:
        `moveVector` - the move vector for the box
        `newOwner` - the new owner of the box

    - #### getShape

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

      Returns the bounding rectangle of the box.
      Overrides:
        `getShape` in class `Container`
      Returns:
        the bounding rectangle of the box.

    - #### createOutsideLabel

          public OutsideLabel.BoxOutsideLabel createOutsideLabel(double width,
                                                                 double height,
                                                                 java.awt.geom.Point2D.Double center,
                                                                 LayoutConstraints.ConstraintType constraintType,
                                                                 double spacing)

      Creates a new outside label for this box. The position and the box side for the new label is determined by the given point, which is moved to the box perimeter if necessary. The minimum size of the new label is the size of the given rectangle. The whole diagram is reordered afterwards, or at the end of the current transaction.
      Parameters:
        `width` - the width for the new label
        `height` - the height for the new label
        `center` - the point from which to determine the position of the label relative to some box side; the center of the new label will try to be as close to this point as possible
        `constraintType` - the type of the layout constraints for the new label
        `spacing` - the spacing value for the new label
      Returns:
        the new inside label object.

    - #### createOutsideLabel

          public OutsideLabel.BoxOutsideLabel createOutsideLabel(double width,
                                                                 double height,
                                                                 Box.BoxSide side,
                                                                 double position,
                                                                 LayoutConstraints.ConstraintType constraintType,
                                                                 double spacing)

      Creates a new outside label for this box. The minimum size of the new label is the size of the given rectangle. The whole diagram is reordered afterwards, or at the end of the current transaction.
      Parameters:
        `width` - the width for the new label
        `height` - the height for the new label
        `side` - the box side for the new label
        `position` - the relative position on the box side for the new label
        `constraintType` - the type of the layout constraints for the new label
        `spacing` - the spacing value for the new label
      Returns:
        the new inside label object.

    - #### connectTo

          public Line connectTo(Connectible element,
                                Line.LineType lineType,
                                double spacing)

      Description copied from interface: `Connectible`
      Adds a line to this diagram. A line can connect boxes or other lines. The whole diagram is reordered afterwards, or at the end of the current transaction.
      Specified by:
        `connectTo` in interface `Connectible`
      Parameters:
        `element` - the element to connect to this Connectible
        `lineType` - the type of the new line
        `spacing` - the width of the empty buffer around the line
      Returns:
        the new line connecting this Connectible with the given element.

    - #### connectTo

          public Line connectTo(Connectible element,
                                Line.LineType lineType,
                                double spacing,
                                java.util.ArrayList<java.awt.geom.Point2D.Double> points)

      Description copied from interface: `Connectible`
      Adds a line to this diagram going along the given points. A line can connect boxes or other lines. The whole diagram is reordered afterwards, or at the end of the current transaction.
      Specified by:
        `connectTo` in interface `Connectible`
      Parameters:
        `element` - the element to connect to this Connectible
        `lineType` - the type of the new line
        `spacing` - the width of the empty buffer around the line
        `points` - the desired vertices of the new line
      Returns:
        the new line connecting this Connectible with the given element.

    - #### connectTo

          public Line connectTo(Connectible element,
                                Line.LineType lineType,
                                double spacing,
                                java.util.ArrayList<java.awt.geom.Point2D.Double> points,
                                boolean cleanup)

      Description copied from interface: `Connectible`
      Adds a line to this diagram going along the given points. A line can connect boxes or other lines. The whole diagram is reordered afterwards, or at the end of the current transaction.
      Specified by:
        `connectTo` in interface `Connectible`
      Parameters:
        `element` - the element to connect to this Connectible
        `lineType` - the type of the new line
        `spacing` - the width of the empty buffer around the line
        `points` - the desired vertices of the new line
        `cleanup` - whether to clean up the given line, removing unnecessary corners
      Returns:
        the new line connecting this Connectible with the given element.

    - #### remove

          public void remove()

      Description copied from class: `Element`
      Removes the element and its descendant elements. The whole diagram is reordered afterwards, or at the end of the current transaction.
      Overrides:
        `remove` in class `AbstractContainer`