All Implemented Interfaces:
ICompositeElement, IContainer, IElement, Serializable

public class Table extends TableElement
Table is a Container object representing a table. For internal use only. The TableBuilder class may be used to create a table container structure.
Since:
5.0
Author:
Jon van Leuven
See Also:
  • Constructor Details

    • Table

      public Table(int columnCount, Container basedOn)
      Constructs the table with the specified amount of columns.
      Parameters:
      columnCount - The number of columns of the table.
      basedOn - The container that should be used to copy parameters from.
    • Table

      protected Table(Table other)
    • Table

      public Table(int columnCount)
      Constructs the table with the specified amount of columns.
      Parameters:
      columnCount - The number of columns of the table.
    • Table

      public Table(TableHeader header)
      Constructs the table with a header.
      Parameters:
      header - The table header that should be used.
  • Method Details

    • duplicate

      public Element duplicate()
      Description copied from class: Container
      This method duplicates the container element.
      Specified by:
      duplicate in interface IElement
      Overrides:
      duplicate in class TableElement
      Returns:
      A clone of this element.
    • sortRows

      public void sortRows(Comparator<TableRow> comparator)
      This method can be used to sort the table rows.
      Parameters:
      comparator - The comparator that should be used to sort the rows.
    • getColumnCount

      public int getColumnCount()
      This method returns the number of columns of the table.
      Returns:
      the number of columns of the table.
    • getHeader

      public TableHeader getHeader()
      This method returns the header that is used by the table.
      Returns:
      the header that is used by the table.
    • setHeader

      public void setHeader(TableHeader header)
      This method can be used to specify the table header.
      Parameters:
      header - The table header that should be used.
    • getRowIdentifier

      public String getRowIdentifier()
      This method returns the ID that is used to identify a row.
      Returns:
      the ID that is used to identify a row.
    • setRowIdentifier

      public void setRowIdentifier(String id)
      This method can be used to set the ID that should be used to identify rows.
      Parameters:
      id - the ID that should be used to identify rows.
    • addRow

      public void addRow(TableRow row)
      this method can be used to add a row to the table.
      Parameters:
      row - The row that should be added.
    • addRow

      public void addRow(Serializable id, Serializable[] cells)
      This method can be used to add a row to the table.
      Parameters:
      id - The id of the row.
      cells - The cells of the row.
    • getRows

      public TableRow[] getRows()
      This method returns an array containing all the rows of the table.
      Returns:
      an array containing all the rows of the table.
    • getRowAt

      public TableRow getRowAt(int index)
      This method returns the row at the specified index.
      Parameters:
      index - The index of the requested row.
      Returns:
      The row at the specified index.
    • getRowCount

      public int getRowCount()
      This method returns the number of rows that are present in the table.
      Returns:
      the number of rows that are present in the table.
    • accept

      public IVisitor accept(IVisitor visitor)
      Description copied from class: Element
      This method will invoke the visitor for this runtime element.
      Specified by:
      accept in interface ICompositeElement
      Specified by:
      accept in interface IElement
      Overrides:
      accept in class TableElement
      Parameters:
      visitor - The visitor that should be invoked.
      Returns:
      The visitor passed to this method.
    • equals

      public boolean equals(Object other)
      Description copied from class: Container
      Compare this container to another (not its elements, @see CompositeElement.equalsContent(com.aquima.interactions.composer.ICompositeElement) to compare its elements).
      Overrides:
      equals in class Container
      Parameters:
      other - The object this instance should be compared to.
      Returns:
      boolean indicating if the object is considered equal to this instance.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Container
    • equalsContent

      public boolean equalsContent(ICompositeElement other)
      This methods checks if this table equals the content of another table. The content will be checked recursive, for example if a table cell contains a container which contains a sub container which contains a field with a different value false will be returned. If other is no instance of Table false is returned.
      Specified by:
      equalsContent in interface ICompositeElement
      Overrides:
      equalsContent in class CompositeElement
      Parameters:
      other - Table to compare to
      Returns:
      boolean if content of this table equals the content of another table.