smile.swing.table
Class PageTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- smile.swing.table.PageTableModel
-
- All Implemented Interfaces:
- java.io.Serializable, javax.swing.table.TableModel
public abstract class PageTableModel extends javax.swing.table.AbstractTableModelA table model that performs "paging" of its data. This model reports a small number of rows (like 100 or so) as a "page" of data. You can switch pages to view all of the rows as needed using the pageDown() and pageUp() methods. Presumably, access to the other pages of data is dictated by other GUI elements such as up/down buttons, or maybe a text field that allows you to enter the page number you want to display.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description PageTableModel()Default constructor.PageTableModel(int pageSize)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description intgetPage()Returns the current page.intgetPageCount()Returns the number of pages.intgetPageSize()Returns the page size.intgetRealRow(int row)Returns the row number of data given the row number of current page.abstract intgetRealRowCount()The sub class should implement this method to return the real number of rows in the model.intgetRowCount()javax.swing.JToolBargetToolbar()Returns a tool bar to control the plot.java.lang.ObjectgetValueAt(int row, int col)abstract java.lang.ObjectgetValueAtRealRow(int row, int col)Returns the value for the cell at real row index.booleanpageDown()Moves to next page and fire a data changed (all rows).booleanpageUp()Moves to previous page and fire a data changed (all rows).booleansetPage(int p)Moves to specific page and fire a data changed (all rows).voidsetPageSize(int s)Sets the page size.-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
-
-
-
-
Constructor Detail
-
PageTableModel
public PageTableModel()
Default constructor.
-
PageTableModel
public PageTableModel(int pageSize)
Constructor.- Parameters:
pageSize- The number of rows per page.
-
-
Method Detail
-
getRowCount
public int getRowCount()
-
getRealRowCount
public abstract int getRealRowCount()
The sub class should implement this method to return the real number of rows in the model.- Returns:
- The real number of rows in the model.
-
getRealRow
public int getRealRow(int row)
Returns the row number of data given the row number of current page.- Parameters:
row- the row number in the current page.- Returns:
- the row number in the whole date set.
-
getValueAt
public java.lang.Object getValueAt(int row, int col)
-
getValueAtRealRow
public abstract java.lang.Object getValueAtRealRow(int row, int col)Returns the value for the cell at real row index.- Parameters:
row- the real row whose value is to be queried.col- the column whose value is to be queried.- Returns:
- the value Object at the specified cell
-
getPage
public int getPage()
Returns the current page.- Returns:
- the current page.
-
setPage
public boolean setPage(int p)
Moves to specific page and fire a data changed (all rows).- Returns:
- true if we can move to the page.
-
getPageCount
public int getPageCount()
Returns the number of pages.- Returns:
- the number of pages.
-
getPageSize
public int getPageSize()
Returns the page size.- Returns:
- the page size.
-
setPageSize
public void setPageSize(int s)
Sets the page size.- Parameters:
s- the page size.
-
pageDown
public boolean pageDown()
Moves to next page and fire a data changed (all rows).- Returns:
- true if we can move to next page.
-
pageUp
public boolean pageUp()
Moves to previous page and fire a data changed (all rows).- Returns:
- true if we can move to previous page.
-
getToolbar
public javax.swing.JToolBar getToolbar()
Returns a tool bar to control the plot.- Returns:
- a tool bar to control the plot.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG