com.orsoncharts.table

## Class GridElement<R extends java.lang.Comparable<R>,C extends java.lang.Comparable<C>>

- java.lang.Object
- - com.orsoncharts.table.AbstractTableElement
  - - com.orsoncharts.table.GridElement<R,C>

- All Implemented Interfaces:
    TableElement, java.io.Serializable

      public class GridElement<R extends java.lang.Comparable<R>,C extends java.lang.Comparable<C>>
      extends AbstractTableElement
      implements TableElement, java.io.Serializable

  A table element that contains a grid of elements.
  NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from interface com.orsoncharts.table.TableElement

      `CLASS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GridElement()` Creates a new empty grid.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D bounds)` Draws the element within the specified bounds.
    `void` | `draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D bounds, TableElementOnDraw onDrawHandler)` Draws the element within the specified bounds.
    `boolean` | `equals(java.lang.Object obj)` Tests this element for equality with an arbitrary object.
    `java.util.List<java.awt.geom.Rectangle2D>` | `layoutElements(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D bounds, java.util.Map<java.lang.String,java.lang.Object> constraints)` Performs a layout of this table element, returning a list of bounding rectangles for the element and its subelements.
    `java.awt.geom.Dimension2D` | `preferredSize(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D bounds, java.util.Map<java.lang.String,java.lang.Object> constraints)` Returns the preferred size of the element (including insets).
    `void` | `receive(TableElementVisitor visitor)` Receives a visitor by calling the visitor's `visit()` method for each of the children in the grid, and finally for the grid itself.
    `void` | `setElement(TableElement element, R rowKey, C columnKey)` Adds (or updates) a cell in the grid.
    `java.lang.String` | `toString()` Returns a string representation of this element, primarily for debugging purposes.

    - ### Methods inherited from class com.orsoncharts.table.AbstractTableElement

      `getBackground, getInsets, getProperty, getRefPoint, getTag, preferredSize, setBackground, setBackgroundColor, setInsets, setProperty, setRefPoint, setTag`

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

      `clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.orsoncharts.table.TableElement

      `getProperty, getRefPoint, preferredSize, setProperty`

- - ### Constructor Detail

    - #### GridElement

          public GridElement()

      Creates a new empty grid.

  - ### Method Detail

    - #### setElement

          public void setElement(TableElement element,
                                 R rowKey,
                                 C columnKey)

      Adds (or updates) a cell in the grid.
      Parameters:
        `element` - the element (`null` permitted).
        `rowKey` - the row key (`null` not permitted).
        `columnKey` - the column key (`null` not permitted).

    - #### receive

          public void receive(TableElementVisitor visitor)

      Receives a visitor by calling the visitor's `visit()` method for each of the children in the grid, and finally for the grid itself.
      Specified by:
        `receive` in interface `TableElement`
      Parameters:
        `visitor` - the visitor (`null` not permitted).
      Since:
        1.2

    - #### preferredSize

          public java.awt.geom.Dimension2D preferredSize(java.awt.Graphics2D g2,
                                                         java.awt.geom.Rectangle2D bounds,
                                                         java.util.Map<java.lang.String,java.lang.Object> constraints)

      Returns the preferred size of the element (including insets).
      Specified by:
        `preferredSize` in interface `TableElement`
      Specified by:
        `preferredSize` in class `AbstractTableElement`
      Parameters:
        `g2` - the graphics target.
        `bounds` - the bounds.
        `constraints` - the constraints (ignored for now).
      Returns:
        The preferred size.

    - #### layoutElements

          public java.util.List<java.awt.geom.Rectangle2D> layoutElements(java.awt.Graphics2D g2,
                                                                          java.awt.geom.Rectangle2D bounds,
                                                                          java.util.Map<java.lang.String,java.lang.Object> constraints)

      Performs a layout of this table element, returning a list of bounding rectangles for the element and its subelements.
      Specified by:
        `layoutElements` in interface `TableElement`
      Parameters:
        `g2` - the graphics target.
        `bounds` - the bounds.
        `constraints` - the constraints (if any).
      Returns:
        A list of bounding rectangles.

    - #### draw

          public void draw(java.awt.Graphics2D g2,
                           java.awt.geom.Rectangle2D bounds)

      Draws the element within the specified bounds.
      Specified by:
        `draw` in interface `TableElement`
      Parameters:
        `g2` - the graphics target.
        `bounds` - the bounds.

    - #### draw

          public void draw(java.awt.Graphics2D g2,
                           java.awt.geom.Rectangle2D bounds,
                           TableElementOnDraw onDrawHandler)

      Draws the element within the specified bounds. If the `recordBounds` flag is set, this element and each of its children will have their `BOUNDS_2D` property updated with the current bounds.
      Specified by:
        `draw` in interface `TableElement`
      Parameters:
        `g2` - the graphics target (`null` not permitted).
        `bounds` - the bounds (`null` not permitted).
        `onDrawHandler` - an object that will receive notification before and after the element is drawn (`null` permitted).
      Since:
        1.3

    - #### equals

          public boolean equals(java.lang.Object obj)

      Tests this element for equality with an arbitrary object.
      Overrides:
        `equals` in class `AbstractTableElement`
      Parameters:
        `obj` - the object (`null` permitted).
      Returns:
        A boolean.

    - #### toString

          public java.lang.String toString()

      Returns a string representation of this element, primarily for debugging purposes.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        A string representation of this element.