echopointng.table
Class DefaultPageableSortableTableModel

java.lang.Object
  extended by nextapp.echo2.app.table.AbstractTableModel
      extended by nextapp.echo2.app.table.DefaultTableModel
          extended by echopointng.table.DefaultSortableTableModel
              extended by echopointng.table.DefaultPageableSortableTableModel
All Implemented Interfaces:
PageableTableModel, SortableTableModel, java.io.Serializable, TableModel

public class DefaultPageableSortableTableModel
extends DefaultSortableTableModel
implements PageableTableModel

The default implementation for the PageableTableModel and SortableTableModel interfaces.

This uses a linked list for the data entries and is unsuitable for very large data sets.

See Also:
Serialized Form

Field Summary
static int DEFAULT_INITAL_PAGE_INDEX
           
static int DEFAULT_ROWS_PER_PAGE
           
 
Constructor Summary
DefaultPageableSortableTableModel(TableColumnModel columnModel)
           
 
Method Summary
 int getCurrentPage()
          Returns the currently displayed page
 int getRowCount()
          Returns the number of rows in the table.
protected  java.util.List getRows()
          Returns a List of Lists representing the table's data
 int getRowsPerPage()
          Returns the number of viewable rows per each displayed page
 int getTotalPages()
          Returns the total number of pages this model contains based on total rows / rows per page.
 int getTotalRows()
          Returns the total number of rows backing the model.
 java.lang.Object getValueAt(int column, int row)
          Returns the value found at the given coordinate within the table.
 void setCurrentPage(int page)
          Sets the current page this model should reflect.
protected  void setRows(java.util.List rows)
          Sets the List of Lists representing the table's data.
 void setRowsPerPage(int rows)
          Sets the number of viewable rows per each displayed page.
 void setValueAt(java.lang.Object newValue, int column, int row)
          Sets the contents of the table cell at the specified coordinate.
 
Methods inherited from class echopointng.table.DefaultSortableTableModel
getCurrentSortColumn, isCurrentSortAscending, sortByColumn
 
Methods inherited from class nextapp.echo2.app.table.DefaultTableModel
addRow, deleteRow, getColumnCount, getColumnName, insertRow, setColumnCount, setColumnName, setRowCount
 
Methods inherited from class nextapp.echo2.app.table.AbstractTableModel
addTableModelListener, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getEventListenerList, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nextapp.echo2.app.table.TableModel
addTableModelListener, getColumnClass, getColumnCount, getColumnName, removeTableModelListener
 

Field Detail

DEFAULT_ROWS_PER_PAGE

public static final int DEFAULT_ROWS_PER_PAGE
See Also:
Constant Field Values

DEFAULT_INITAL_PAGE_INDEX

public static final int DEFAULT_INITAL_PAGE_INDEX
See Also:
Constant Field Values
Constructor Detail

DefaultPageableSortableTableModel

public DefaultPageableSortableTableModel(TableColumnModel columnModel)
Method Detail

setValueAt

public void setValueAt(java.lang.Object newValue,
                       int column,
                       int row)
Description copied from class: DefaultTableModel
Sets the contents of the table cell at the specified coordinate.

Overrides:
setValueAt in class DefaultTableModel
Parameters:
newValue - the new value
column - the column index
row - the row index
See Also:
DefaultTableModel.setValueAt(java.lang.Object, int, int)

getValueAt

public java.lang.Object getValueAt(int column,
                                   int row)
Description copied from interface: TableModel
Returns the value found at the given coordinate within the table. Column and row values are 0-based. WARNING: Take note that the column is the first parameter passed to this method, and the row is the second parameter.

Specified by:
getValueAt in interface TableModel
Overrides:
getValueAt in class DefaultTableModel
Parameters:
column - the column index (0-based)
row - the row index (0-based)
See Also:
TableModel.getValueAt(int, int)

getRows

protected java.util.List getRows()
Returns a List of Lists representing the table's data

Overrides:
getRows in class DefaultSortableTableModel

setRows

protected void setRows(java.util.List rows)
Sets the List of Lists representing the table's data. This implementation makes use of the fact that the super implementation modifies this List in place as needed, so setting it is unnecessary.

Overrides:
setRows in class DefaultSortableTableModel

getRowCount

public int getRowCount()
Description copied from interface: TableModel
Returns the number of rows in the table.

Specified by:
getRowCount in interface TableModel
Overrides:
getRowCount in class DefaultTableModel
Returns:
the row count
See Also:
TableModel.getRowCount()

setCurrentPage

public void setCurrentPage(int page)
Description copied from interface: PageableTableModel
Sets the current page this model should reflect. Implementations that sublcass DefaultTableModel should call fireTableDataChanged()

Specified by:
setCurrentPage in interface PageableTableModel
Parameters:
page - the page to display
See Also:
PageableTableModel.setCurrentPage(int)

getCurrentPage

public int getCurrentPage()
Description copied from interface: PageableTableModel
Returns the currently displayed page

Specified by:
getCurrentPage in interface PageableTableModel
Returns:
the page
See Also:
PageableTableModel.getCurrentPage()

setRowsPerPage

public void setRowsPerPage(int rows)
Description copied from interface: PageableTableModel
Sets the number of viewable rows per each displayed page. Implementations that sublcass DefaultTableModel should call fireTableDataChanged()

Specified by:
setRowsPerPage in interface PageableTableModel
Parameters:
rows - the number of rows to display
See Also:
PageableTableModel.setRowsPerPage(int)

getRowsPerPage

public int getRowsPerPage()
Description copied from interface: PageableTableModel
Returns the number of viewable rows per each displayed page

Specified by:
getRowsPerPage in interface PageableTableModel
Returns:
the rows displayed per page
See Also:
PageableTableModel.getRowsPerPage()

getTotalRows

public int getTotalRows()
Description copied from interface: PageableTableModel
Returns the total number of rows backing the model.

Specified by:
getTotalRows in interface PageableTableModel
Returns:
the total number of rows
See Also:
PageableTableModel.getTotalRows()

getTotalPages

public int getTotalPages()
Description copied from interface: PageableTableModel
Returns the total number of pages this model contains based on total rows / rows per page.

Specified by:
getTotalPages in interface PageableTableModel
Returns:
the number of rows per page
See Also:
PageableTableModel.getTotalPages()