org.omnaest.utils.structure.table.view.concrete
Class TableViewImpl<E>

java.lang.Object
  extended by org.omnaest.utils.structure.table.view.concrete.TableViewImpl<E>
All Implemented Interfaces:
Serializable, TableCloneable<E>, TableCoreImmutable<E>, TableDataSource<E>, TableView<E>

public class TableViewImpl<E>
extends Object
implements TableView<E>

Author:
Omnaest
See Also:
TableView, Table, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.omnaest.utils.structure.table.subspecification.TableCloneable
TableCloneable.TableCloner<E>
 
Field Summary
protected  TableSelectable.Selection<E> selection
           
protected  Table<E> table
           
 
Constructor Summary
TableViewImpl(TableSelectable.Selection<E> selection)
           
 
Method Summary
 Iterable<Table.Cell<E>> cells()
          Iterable for the Tables Table.Cells.
 TableCloneable.TableCloner<E> clone()
          Returns the TableCloneable.TableCloner for the Table which allows to clone it.
 Iterable<Table.Column<E>> columns()
          Iterable over all Table.Columns
 boolean contains(E element)
          Returns true, if the whole Table contains the given element.
<TO> Table<TO>
convert(Table.TableCellConverter<E,TO> tableCellConverter)
          Converts the current Table into a new Table instance with another element type.
 boolean equals(Object obj)
           
 boolean equals(TableCoreImmutable<E> table)
          Compares the data of two Table instances, if they are the same true is returned.
 boolean equals(TableView<E> tableView)
           
 Table.Cell<E> getCell(int cellIndexPosition)
          Returns the Table.Cell determined by the given Table.Cell index position.
 Table.Cell<E> getCell(int rowIndexPosition, int columnIndexPosition)
          Resolves the Table.Cell for the given index positions.
 Table.Cell<E> getCell(int rowIndexPosition, Object columnTitleValue)
           
 Table.Cell<E> getCell(Object rowTitleValue, int columnIndexPosition)
           
 Table.Cell<E> getCell(String rowTitleValue, String columnTitleValue)
           
 E getCellElement(int cellIndexPosition)
          Returns the Table.CellImmutable.getElement() for the given Table.Cell index position
 E getCellElement(int rowIndexPosition, int columnIndexPosition)
          Resolves an element from the table at the given index positions.
 List<E> getCellElementList()
          Returns a new List of all Table.Cell instances of the Table serialized .
 List<Table.Cell<E>> getCellList()
          Returns a to the table backed list of all cells.
 Table.Column<E> getColumn(int columnIndexPosition)
          Returns a Table.Column for the given Table.Column index position.
 Table.Column<E> getColumn(Object columnTitleValue)
          Returns a Table.Column for the given Table.Column title value.
 List<Table.Column<E>> getColumnList()
          Returns a List of all Table.Columns
 Object getColumnTitleValue(int columnIndexPosition)
           
 List<Object> getColumnTitleValueList()
          Returns a new List of all Table.Columns Table.Stripe.Title.getValue() for the Table.
 Table.Column<E> getFirstColumn()
          Returns the first Table.Column of the Table
 Table.Row<E> getFirstRow()
          Returns the first Table.Row of the Table
 Table.Column<E> getLastColumn()
          Returns the last Table.Column of the Table
 Table.Row<E> getLastRow()
          Returns the last Table.Row of the Table
 Table.Row<E> getRow(int rowIndexPosition)
          Returns a new list that holds the object of the row pointed to.
 Table.Row<E> getRow(Object rowTitleValue)
          Returns a Table.Row of the Table identified by the title of a row.
 List<Table.Row<E>> getRowList()
          Returns a List of all Table.Rows
 Object getRowTitleValue(int rowIndexPosition)
           
 List<Object> getRowTitleValueList()
          Returns a new List with all the Table.Stripe.getTitleValue() for the Table.
 Object getTableName()
          Returns the name for the whole table.
 Table.TableSize getTableSize()
          Returns a Table.TableSize object for the table.
 boolean hasColumnTitles()
          Returns true if at least one Table.Column has a Table.Stripe.Title
 int hashCode()
           
 boolean hasRowTitles()
          Returns true if at least one Table.Row has a Table.Stripe.Title
 boolean hasTableName()
          Returns true if the TableCoreImmutable.getTableName() is not null
 Iterator<Table.Row<E>> iterator()
          The same as #iteratorRow()
 Iterator<Table.Cell<E>> iteratorCell()
          Returns an Iterator that goes through every Table.Column for every Table.Row.
 Iterator<Table.Column<E>> iteratorColumn()
          Returns an Iterator over all Table.Columns
 Table<E> processTableCells(Table.TableCellVisitor<E> tableCellVisitor)
          Helper method to do arbitrary stuff on the Table Table.Cells.
 TableView<E> refresh()
          Recalculates the underlying TableSelectable.Selection and updates the TableView with the new results
 ListIterable<Table.Row<E>> rows()
          ListIterable over all Table.Rows
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

selection

protected TableSelectable.Selection<E> selection

table

protected Table<E> table
Constructor Detail

TableViewImpl

public TableViewImpl(TableSelectable.Selection<E> selection)
Parameters:
selection -
Method Detail

refresh

public TableView<E> refresh()
Description copied from interface: TableView
Recalculates the underlying TableSelectable.Selection and updates the TableView with the new results

Specified by:
refresh in interface TableView<E>
Returns:

equals

public boolean equals(TableView<E> tableView)
Specified by:
equals in interface TableView<E>
Returns:

equals

public boolean equals(TableCoreImmutable<E> table)
Description copied from interface: TableCoreImmutable
Compares the data of two Table instances, if they are the same true is returned.
Titles are not compared.

Specified by:
equals in interface TableCoreImmutable<E>
Returns:

getRowTitleValueList

public List<Object> getRowTitleValueList()
Description copied from interface: TableCoreImmutable
Returns a new List with all the Table.Stripe.getTitleValue() for the Table.

Specified by:
getRowTitleValueList in interface TableCoreImmutable<E>
Specified by:
getRowTitleValueList in interface TableDataSource<E>
Returns:
See Also:
TableCoreImmutable.getRowTitleValue(int)

getRowTitleValue

public Object getRowTitleValue(int rowIndexPosition)
Specified by:
getRowTitleValue in interface TableCoreImmutable<E>
Returns:
See Also:
TableCoreImmutable.getRowTitleValueList()

getColumnTitleValueList

public List<Object> getColumnTitleValueList()
Description copied from interface: TableCoreImmutable
Returns a new List of all Table.Columns Table.Stripe.Title.getValue() for the Table.

Specified by:
getColumnTitleValueList in interface TableCoreImmutable<E>
Specified by:
getColumnTitleValueList in interface TableDataSource<E>
Returns:
See Also:
TableCoreImmutable.getColumnTitleValue(int)

getColumnTitleValue

public Object getColumnTitleValue(int columnIndexPosition)
Specified by:
getColumnTitleValue in interface TableCoreImmutable<E>
Returns:
See Also:
TableCoreImmutable.getColumnTitleValueList()

getTableSize

public Table.TableSize getTableSize()
Description copied from interface: TableCoreImmutable
Returns a Table.TableSize object for the table. The object will have always actual results, that will change if the data of the Table is changed.

Specified by:
getTableSize in interface TableCoreImmutable<E>
Returns:

getCellElement

public E getCellElement(int rowIndexPosition,
                        int columnIndexPosition)
Description copied from interface: TableCoreImmutable
Resolves an element from the table at the given index positions.

Specified by:
getCellElement in interface TableCoreImmutable<E>
Returns:
See Also:
TableCoreImmutable.getCellElement(int)

getCellElement

public E getCellElement(int cellIndexPosition)
Description copied from interface: TableCoreImmutable
Returns the Table.CellImmutable.getElement() for the given Table.Cell index position

Specified by:
getCellElement in interface TableCoreImmutable<E>
Returns:
See Also:
TableCoreImmutable.getCellElement(int, int), TableCoreImmutable.getCellElementList()

getCellElementList

public List<E> getCellElementList()
Description copied from interface: TableCoreImmutable
Returns a new List of all Table.Cell instances of the Table serialized .

Specified by:
getCellElementList in interface TableCoreImmutable<E>
Returns:
See Also:
TableCoreImmutable.getCellElement(int)

getCell

public Table.Cell<E> getCell(int rowIndexPosition,
                             int columnIndexPosition)
Description copied from interface: TableCoreImmutable
Resolves the Table.Cell for the given index positions.

Specified by:
getCell in interface TableCoreImmutable<E>
Returns:

getCell

public Table.Cell<E> getCell(int cellIndexPosition)
Description copied from interface: TableCoreImmutable
Returns the Table.Cell determined by the given Table.Cell index position. The Table.Cell index position starts with 0 and increases horizontally with each Table.Column and this through every single Table.Row down to the bottom of the Table. Returns null if the Table.Cell index position is out of Table bounds.

Specified by:
getCell in interface TableCoreImmutable<E>
Returns:

getCell

public Table.Cell<E> getCell(String rowTitleValue,
                             String columnTitleValue)
Specified by:
getCell in interface TableCoreImmutable<E>
Returns:
See Also:
TableCoreImmutable.getCell(int, int)

getCell

public Table.Cell<E> getCell(Object rowTitleValue,
                             int columnIndexPosition)
Specified by:
getCell in interface TableCoreImmutable<E>
Returns:
See Also:
TableCoreImmutable.getCell(int, int)

getCell

public Table.Cell<E> getCell(int rowIndexPosition,
                             Object columnTitleValue)
Specified by:
getCell in interface TableCoreImmutable<E>
Returns:
See Also:
TableCoreImmutable.getCell(int, int)

getCellList

public List<Table.Cell<E>> getCellList()
Description copied from interface: TableCoreImmutable
Returns a to the table backed list of all cells. The cells are ordered from the first row from the left column to right column, to the last row from the left column to the right column.

Specified by:
getCellList in interface TableCoreImmutable<E>
Returns:
See Also:
TableCore

getRow

public Table.Row<E> getRow(int rowIndexPosition)
Description copied from interface: TableCoreImmutable
Returns a new list that holds the object of the row pointed to.

Specified by:
getRow in interface TableCoreImmutable<E>
Returns:

getRowList

public List<Table.Row<E>> getRowList()
Description copied from interface: TableCoreImmutable
Returns a List of all Table.Rows

Specified by:
getRowList in interface TableCoreImmutable<E>

getRow

public Table.Row<E> getRow(Object rowTitleValue)
Description copied from interface: TableCoreImmutable
Returns a Table.Row of the Table identified by the title of a row. Before this can be used, the titles have to be set by #setRowTitleValues(List)

Specified by:
getRow in interface TableCoreImmutable<E>
Returns:
See Also:
TableCoreImmutable.getRow(int)

getColumn

public Table.Column<E> getColumn(int columnIndexPosition)
Description copied from interface: TableCoreImmutable
Returns a Table.Column for the given Table.Column index position.

Specified by:
getColumn in interface TableCoreImmutable<E>
Returns:
See Also:
TableCoreImmutable.getColumn(Object)

getColumnList

public List<Table.Column<E>> getColumnList()
Description copied from interface: TableCoreImmutable
Returns a List of all Table.Columns

Specified by:
getColumnList in interface TableCoreImmutable<E>
Returns:

getColumn

public Table.Column<E> getColumn(Object columnTitleValue)
Description copied from interface: TableCoreImmutable
Returns a Table.Column for the given Table.Column title value. The Table.Column titles have to be set before with #setColumnTitleValues(List)

Specified by:
getColumn in interface TableCoreImmutable<E>
Returns:
See Also:
TableCoreImmutable.getColumn(int)

contains

public boolean contains(E element)
Description copied from interface: TableCoreImmutable
Returns true, if the whole Table contains the given element.

Specified by:
contains in interface TableCoreImmutable<E>
Returns:

iteratorCell

public Iterator<Table.Cell<E>> iteratorCell()
Description copied from interface: TableCoreImmutable
Returns an Iterator that goes through every Table.Column for every Table.Row. Starting from left to right and then downwards all the Table.Rows.

Specified by:
iteratorCell in interface TableCoreImmutable<E>
Returns:
See Also:
#iteratorRow(), TableCoreImmutable.iterator()

cells

public Iterable<Table.Cell<E>> cells()
Description copied from interface: TableCoreImmutable
Iterable for the Tables Table.Cells.

Specified by:
cells in interface TableCoreImmutable<E>
Returns:
See Also:
TableCoreImmutable.iteratorCell()

rows

public ListIterable<Table.Row<E>> rows()
Description copied from interface: TableCoreImmutable
ListIterable over all Table.Rows

Specified by:
rows in interface TableCoreImmutable<E>
Specified by:
rows in interface TableDataSource<E>
Returns:

columns

public Iterable<Table.Column<E>> columns()
Description copied from interface: TableCoreImmutable
Iterable over all Table.Columns

Specified by:
columns in interface TableCoreImmutable<E>
Returns:

iteratorColumn

public Iterator<Table.Column<E>> iteratorColumn()
Description copied from interface: TableCoreImmutable
Returns an Iterator over all Table.Columns

Specified by:
iteratorColumn in interface TableCoreImmutable<E>
Returns:

iterator

public Iterator<Table.Row<E>> iterator()
Description copied from interface: TableCoreImmutable
The same as #iteratorRow()

Specified by:
iterator in interface TableCoreImmutable<E>
Returns:
See Also:
#iteratorRow(), TableCoreImmutable.iteratorCell()

convert

public <TO> Table<TO> convert(Table.TableCellConverter<E,TO> tableCellConverter)
Description copied from interface: TableCoreImmutable
Converts the current Table into a new Table instance with another element type.

Specified by:
convert in interface TableCoreImmutable<E>
Returns:
See Also:
Table.TableCellConverter

processTableCells

public Table<E> processTableCells(Table.TableCellVisitor<E> tableCellVisitor)
Description copied from interface: TableCoreImmutable
Helper method to do arbitrary stuff on the Table Table.Cells. The processor loops through every Table.Column of each Table.Row, giving a visitor the possibility to do various actions.

Specified by:
processTableCells in interface TableCoreImmutable<E>
See Also:
Table.TableCellVisitor

hasColumnTitles

public boolean hasColumnTitles()
Description copied from interface: TableCoreImmutable
Returns true if at least one Table.Column has a Table.Stripe.Title

Specified by:
hasColumnTitles in interface TableCoreImmutable<E>
Returns:

hasRowTitles

public boolean hasRowTitles()
Description copied from interface: TableCoreImmutable
Returns true if at least one Table.Row has a Table.Stripe.Title

Specified by:
hasRowTitles in interface TableCoreImmutable<E>
Returns:

hasTableName

public boolean hasTableName()
Description copied from interface: TableCoreImmutable
Returns true if the TableCoreImmutable.getTableName() is not null

Specified by:
hasTableName in interface TableCoreImmutable<E>
Returns:

getTableName

public Object getTableName()
Description copied from interface: TableCoreImmutable
Returns the name for the whole table.

Specified by:
getTableName in interface TableCoreImmutable<E>
Specified by:
getTableName in interface TableDataSource<E>
Returns:

getLastRow

public Table.Row<E> getLastRow()
Description copied from interface: TableCoreImmutable
Returns the last Table.Row of the Table

Specified by:
getLastRow in interface TableCoreImmutable<E>
Returns:
See Also:
TableCoreImmutable.getLastRow()

getLastColumn

public Table.Column<E> getLastColumn()
Description copied from interface: TableCoreImmutable
Returns the last Table.Column of the Table

Specified by:
getLastColumn in interface TableCoreImmutable<E>
Returns:
See Also:
TableCoreImmutable.getLastColumn()

getFirstRow

public Table.Row<E> getFirstRow()
Description copied from interface: TableCoreImmutable
Returns the first Table.Row of the Table

Specified by:
getFirstRow in interface TableCoreImmutable<E>
Returns:
See Also:
TableCoreImmutable.getFirstRow()

getFirstColumn

public Table.Column<E> getFirstColumn()
Description copied from interface: TableCoreImmutable
Returns the first Table.Column of the Table

Specified by:
getFirstColumn in interface TableCoreImmutable<E>
Returns:
See Also:
TableCoreImmutable.getFirstColumn()

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

clone

public TableCloneable.TableCloner<E> clone()
                                    throws CloneNotSupportedException
Description copied from interface: TableCloneable
Returns the TableCloneable.TableCloner for the Table which allows to clone it.

Specified by:
clone in interface TableCloneable<E>
Overrides:
clone in class Object
Returns:
Throws:
CloneNotSupportedException


Copyright © 2011. All Rights Reserved.