Package com.iizix.prop.ui.table
Class DefaultTableContentProvider
- java.lang.Object
- com.iizix.prop.ui.table.DefaultTableContentProvider
- All Implemented Interfaces:
ITableContentProvider<VSColumnHeader[],VSColumnHeader,VSRow,VSField>
public class DefaultTableContentProvider extends java.lang.Object implements ITableContentProvider<VSColumnHeader[],VSColumnHeader,VSRow,VSField>
The default grid content provider.- Author:
- Christopher Mindus
Field Summary
Fields Modifier and Type Field Description protected UITableColumn[]
columns
The columns.protected UITable
uiTable
The UI table instance.protected VSColumnHeader[]
vsColumns
The VS columns.protected VSTable
vsTable
The VS table instance, null for none.
Constructor Summary
Constructors Constructor Description DefaultTableContentProvider()
Public constructor.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Called when the content provider is no longer required by the table.VSRow
getFirstSelectedRow()
Returns the first selected row for single selection table.VSColumnHeader[]
getHeader()
Gets the header object.VSColumnHeader[]
getHeaderCells(VSColumnHeader[] header)
Gets the header cells.TCell
getRowCell(VSField cell, int columnIndex, int rowIndex)
Gets the row cell information.VSField[]
getRowCells(VSRow row)
Gets the cells for a row object.VSRow[]
getRows()
Gets the row objects.int
getRowStyle(VSRow row, int filteredRowIndex)
Gets the row style.protected void
initialize()
Initializes values for columns and VirtualSpace.boolean
isRowCellSelected(VSField cell)
Returns if the cell is selected or not.boolean
isRowSelected(VSRow row)
Returns if the row is selected or not.void
onCellUpdated(VSField cell, TCell value)
Cell update event.void
onInitialize(UITable table)
Called to initialize the content provider for the UITable instance.void
onReinitialized()
This method is called when the table needs re-initialization due to e.g.void
onRowSelection(TableRow tableRow, VSRow row, boolean on)
Called when the row selection state is changed.
Field Detail
uiTable
protected UITable uiTable
The UI table instance. Use only afteronInitialize(UITable)
has been called.
columns
protected UITableColumn[] columns
The columns. Use only afterinitialize()
has been called.
vsTable
protected VSTable vsTable
The VS table instance, null for none. Use only afterinitialize()
has been called.
vsColumns
protected VSColumnHeader[] vsColumns
The VS columns. Use only afterinitialize()
has been called.
Method Detail
onInitialize
public void onInitialize(UITable table)
Called to initialize the content provider for the UITable instance.- Specified by:
onInitialize
in interfaceITableContentProvider<VSColumnHeader[],VSColumnHeader,VSRow,VSField>
onReinitialized
public void onReinitialized()
This method is called when the table needs re-initialization due to e.g. a change of the VSTable or one of the columns.- Specified by:
onReinitialized
in interfaceITableContentProvider<VSColumnHeader[],VSColumnHeader,VSRow,VSField>
initialize
protected void initialize()
Initializes values for columns and VirtualSpace.
dispose
public void dispose()
Called when the content provider is no longer required by the table.- Specified by:
dispose
in interfaceITableContentProvider<VSColumnHeader[],VSColumnHeader,VSRow,VSField>
getHeader
public VSColumnHeader[] getHeader()
Gets the header object.- Specified by:
getHeader
in interfaceITableContentProvider<VSColumnHeader[],VSColumnHeader,VSRow,VSField>
- Returns:
- The header object, or null for no header.
getHeaderCells
public VSColumnHeader[] getHeaderCells(VSColumnHeader[] header)
Gets the header cells.- Specified by:
getHeaderCells
in interfaceITableContentProvider<VSColumnHeader[],VSColumnHeader,VSRow,VSField>
- Parameters:
header
- The header object, never null.- Returns:
- The cell array.
getRows
public VSRow[] getRows()
Gets the row objects.- Specified by:
getRows
in interfaceITableContentProvider<VSColumnHeader[],VSColumnHeader,VSRow,VSField>
- Returns:
- The row object array.
getRowCells
public VSField[] getRowCells(VSRow row)
Gets the cells for a row object.- Specified by:
getRowCells
in interfaceITableContentProvider<VSColumnHeader[],VSColumnHeader,VSRow,VSField>
- Parameters:
row
- The row object.- Returns:
- The cells. Note: the array of cells may very well be shorter or longer than the actual number of columns in table.
isRowSelected
public boolean isRowSelected(VSRow row)
Returns if the row is selected or not. This method is only called if the table has row selection enabled and has multiple selection.- Specified by:
isRowSelected
in interfaceITableContentProvider<VSColumnHeader[],VSColumnHeader,VSRow,VSField>
- Returns:
- true if selected, false otherwise.
getFirstSelectedRow
public VSRow getFirstSelectedRow()
Returns the first selected row for single selection table. This method is only called if the row selection is enabled and set to single selection.- Specified by:
getFirstSelectedRow
in interfaceITableContentProvider<VSColumnHeader[],VSColumnHeader,VSRow,VSField>
- Returns:
- The selected row.
getRowStyle
public int getRowStyle(VSRow row, int filteredRowIndex)
Gets the row style.- Specified by:
getRowStyle
in interfaceITableContentProvider<VSColumnHeader[],VSColumnHeader,VSRow,VSField>
- Parameters:
row
- The row index.filteredRowIndex
- The filtered row index, not necessarily the same at the real row index.- Returns:
- The row style index registered with the table, or zero for none.
onRowSelection
public void onRowSelection(TableRow tableRow, VSRow row, boolean on)
Called when the row selection state is changed.- Specified by:
onRowSelection
in interfaceITableContentProvider<VSColumnHeader[],VSColumnHeader,VSRow,VSField>
- Parameters:
tableRow
- The table row affected.row
- The row whose selection state changed.on
- The new selection state.
isRowCellSelected
public boolean isRowCellSelected(VSField cell)
Returns if the cell is selected or not. This method is called only when the table has cell selection enabled.- Specified by:
isRowCellSelected
in interfaceITableContentProvider<VSColumnHeader[],VSColumnHeader,VSRow,VSField>
- Parameters:
cell
- The cell.- Returns:
- true if cell is selected, false otherwise.
getRowCell
public TCell getRowCell(VSField cell, int columnIndex, int rowIndex)
Gets the row cell information.- Specified by:
getRowCell
in interfaceITableContentProvider<VSColumnHeader[],VSColumnHeader,VSRow,VSField>
- Parameters:
cell
- The cell object.columnIndex
- The column index.rowIndex
- The row index before filtering.- Returns:
- The cell contents.
onCellUpdated
public void onCellUpdated(VSField cell, TCell value)
Cell update event.- Specified by:
onCellUpdated
in interfaceITableContentProvider<VSColumnHeader[],VSColumnHeader,VSRow,VSField>
- Parameters:
cell
- The cell object.value
- The new value.