public class HierarchicalGridDataModel extends Object implements Hierarchical
Modifier | Constructor and Description |
---|---|
protected |
HierarchicalGridDataModel(DataModelCallbackHandler<Editable> handler)
Creates a new instnace of this class and defines the handler.
|
|
HierarchicalGridDataModel(Object[][] data)
Initializes the model with the preloaded piece of data set.
|
Modifier and Type | Method and Description |
---|---|
void |
addColumn(int beforeColumn,
Object[] column)
This method adds a column into the model.
|
void |
addColumn(int beforeColumn,
String name,
Object[] column)
This method adds a column into the model.
|
void |
addListener(EditableModelListener listener)
This method registers the specified listener to receive model events.
|
void |
addRow(int beforeRow,
Object[] row)
This method adds a row into the model.
|
void |
addSubgridModel(int rowNumber,
int columnNumber,
GridDataModel model)
Adds a subgrid model to the specified cell.
|
void |
clearRemovedRows()
This method clears removed rows from the model history
|
String[] |
getColumnNames()
This method gets a list of column names.
|
GridColumn[] |
getColumns()
Gets an array of all model columns.
|
int |
getCurrentPageNumber()
This method gets a current page number.
|
Object[][] |
getData()
This method returns all the data contained in the model.
|
protected EditableGridDataModel |
getDelegate()
Getter for property 'delegate'.
|
int |
getDisplayedPages()
This method gets the number of pages links to be displayed.
|
int |
getEndPage()
This method returns an end page number.
|
int |
getEndRow()
This method returns an end row number.
|
GridColumn |
getGridColumn(int index)
Gets a grid column by index.
|
DataModelCallbackHandler<Editable> |
getHandler()
This method returns a callback handler instance.
|
int |
getPageSize()
This method returns a page size.
|
Object[][] |
getRemovedRows()
This method returns removed rows.
|
GridRow |
getRow(int index)
Gets a grid row by index.
|
Object[] |
getRowData(int rowNumber)
This method returns row data by the specified row number.
|
GridRow[] |
getRows()
This method returns all rows of the model.
|
int |
getSortColumn()
This method returns a sorted column number.
|
int |
getStartPage()
This method returns a start page number.
|
int |
getStartRow()
This method returns a start row number.
|
GridDataModel |
getSubgridModel(int rowNumber,
int columnNumber)
This method gets a subgrid model associated with the specified cell.
|
int |
getTotalColumnCount()
This method returns a total row count.
|
int |
getTotalPagesNumber()
This method returns a number of existing pages.
|
int |
getTotalRowCount()
This method returns total row count value.
|
boolean |
isAscending()
This method defines sorting direction.
|
boolean |
isEmpty()
This method checks whether the data model is empty.
|
boolean |
isExpanded(int row,
int column)
This method checks whether the specified cell is expanded.
|
void |
removeAll()
This method removes all rows from the model.
|
void |
removeColumn(int columnNumber)
This method removes a column from the model.
|
void |
removeColumn(String name)
This method removes a column from the model.
|
void |
removeListener(EditableModelListener listener)
This method unregisters the specified listener to stop model events receiving.
|
void |
removeRow(int rowNumber)
This method removes a row from the model.
|
void |
setAscending(boolean ascending)
This method sets sort direction.
|
protected void |
setAssociatedSubgrids(Map<SubgridKey,GridDataModel> associatedSubgrids)
Setter for property 'associatedSubgrids'.
|
void |
setColumNames(String[] names)
This method sets a list of column names
This list must be in the same order like the data array columns (see
Editable.update(Object[][]) for details. |
void |
setCurrentPageNumber(int currentPageNumber)
This method sets the current page number.
|
protected void |
setDelegate(EditableGridDataModel delegate)
Setter for property 'delegate'.
|
void |
setDisplayedPages(int displayedPages)
This method sets the number of pages links to be displayed.
|
void |
setExpanded(int row,
int column,
boolean expanded)
This method sets expanded flag for the specified cell.
|
protected void |
setExpandedCells(Map<SubgridKey,Boolean> expandedCells)
Setter for property 'expandedCells'.
|
void |
setHandler(DataModelCallbackHandler<Editable> handler)
This method sets a callback handler.
|
void |
setPageSize(int pageSize)
This method sets a page size.
|
void |
setSortColumn(int sortColumn)
This method sets a number of sort column.
|
void |
setSortColumn(int sortColumn,
Comparator<Object> comparator)
This method sets a sort column and uses the specified comparator.
|
void |
update(int row,
int column,
Object data)
This method updates the specified cell with the value.
|
void |
update(Object[][] data)
This method updates data in the model using the specified value.
|
void |
updateColumn(int columnNumber,
Object[] column)
This method updates a column with the specified data set.
|
void |
updateColumn(String name,
Object[] column)
This method updates a column with the specified data set.
|
void |
updateRow(int rowNumber,
Object[] row)
This method updates a row with the specified data set.
|
public HierarchicalGridDataModel(Object[][] data)
data
- is a data set piece.protected HierarchicalGridDataModel(DataModelCallbackHandler<Editable> handler)
handler
- is a callback handler to be invoked on changes.public void addSubgridModel(int rowNumber, int columnNumber, GridDataModel model) throws IllegalArgumentException
addSubgridModel
in interface Hierarchical
rowNumber
- is a row number.columnNumber
- is a column number.model
- is a model to add.IllegalArgumentException
- if the row / column number is out of range.public GridDataModel getSubgridModel(int rowNumber, int columnNumber) throws IllegalArgumentException
If there is no such model, it returns null
.
getSubgridModel
in interface Hierarchical
rowNumber
- is a row number.columnNumber
- is a column number.IllegalArgumentException
- if the row / column number is out of range.public void setExpanded(int row, int column, boolean expanded)
setExpanded
in interface Hierarchical
row
- is a row number.column
- is a column number.expanded
- is an expanded flag value.public boolean isExpanded(int row, int column)
isExpanded
in interface Hierarchical
row
- is a row number.column
- is a column number.protected void setAssociatedSubgrids(Map<SubgridKey,GridDataModel> associatedSubgrids)
associatedSubgrids
- Value to set for property 'associatedSubgrids'.protected void setExpandedCells(Map<SubgridKey,Boolean> expandedCells)
expandedCells
- Value to set for property 'expandedCells'.public void addRow(int beforeRow, Object[] row) throws IllegalArgumentException
addRow
in interface Editable
beforeRow
- is a row number.row
- is row data.IllegalArgumentException
- if the row number is invalid.public void updateRow(int rowNumber, Object[] row) throws IllegalArgumentException
updateRow
in interface Editable
rowNumber
- is a row number.row
- is row data.IllegalArgumentException
- if the row number is invalid.public void removeRow(int rowNumber) throws IllegalArgumentException
removeRow
in interface Editable
rowNumber
- is a row number.IllegalArgumentException
- if the row number is invalid.public void addColumn(int beforeColumn, Object[] column) throws IllegalArgumentException
addColumn
in interface Editable
beforeColumn
- a column number.column
- a column data set.IllegalArgumentException
- if the column number is invalid.public void addColumn(int beforeColumn, String name, Object[] column) throws IllegalArgumentException
addColumn
in interface Editable
beforeColumn
- a column number.name
- a column name.column
- a column data set.IllegalArgumentException
- if the column number is invalid.public void updateColumn(int columnNumber, Object[] column) throws IllegalArgumentException
updateColumn
in interface Editable
columnNumber
- a column number.column
- a column data set.IllegalArgumentException
- if the column number is invalid.public void updateColumn(String name, Object[] column)
updateColumn
in interface Editable
name
- a column name.column
- a column data set.public void removeColumn(int columnNumber) throws IllegalArgumentException
removeColumn
in interface Editable
columnNumber
- a column number.IllegalArgumentException
- if the column number is invalid.public void removeColumn(String name)
removeColumn
in interface Editable
name
- a column name.public void removeAll()
public void update(int row, int column, Object data) throws IllegalArgumentException
update
in interface Editable
row
- is a row number.column
- is a column number.data
- is a data to be applied.IllegalArgumentException
- if row and / or column number is invalid.public void setSortColumn(int sortColumn, Comparator<Object> comparator)
setSortColumn
in interface Editable
sortColumn
- is a sort column.comparator
- is a column comparator.public DataModelCallbackHandler<Editable> getHandler()
getHandler
in interface Editable
public void update(Object[][] data)
public void setHandler(DataModelCallbackHandler<Editable> handler)
setHandler
in interface Editable
handler
- a callback handler.public int getTotalColumnCount()
getTotalColumnCount
in interface Editable
public Object[][] getRemovedRows()
getRemovedRows
in interface Editable
public void clearRemovedRows()
clearRemovedRows
in interface Editable
public GridRow[] getRows()
public GridColumn[] getColumns()
getColumns
in interface Editable
public GridRow getRow(int index)
public GridColumn getGridColumn(int index)
getGridColumn
in interface Editable
index
- is an index value.public String[] getColumnNames()
getColumnNames
in interface Editable
public void setColumNames(String[] names)
Editable.update(Object[][])
for details.setColumNames
in interface Editable
names
- is a list of column names.public void addListener(EditableModelListener listener)
addListener
in interface Editable
listener
- is a model listener to register.public void removeListener(EditableModelListener listener)
removeListener
in interface Editable
listener
- is a model listener to be removed.public int getTotalRowCount()
getTotalRowCount
in interface GridDataModel
public int getStartRow()
getStartRow
in interface GridDataModel
public int getEndRow()
getEndRow
in interface GridDataModel
public int getSortColumn()
getSortColumn
in interface GridDataModel
public boolean isAscending()
It returns true
if direction is ascending.
isAscending
in interface GridDataModel
false
if sorting is descending.public Object[] getRowData(int rowNumber)
getRowData
in interface GridDataModel
rowNumber
- is a number of row to be returned.public void setSortColumn(int sortColumn)
setSortColumn
in interface GridDataModel
sortColumn
- a number of sort column.public void setAscending(boolean ascending)
setAscending
in interface GridDataModel
ascending
- sort direction.public boolean isEmpty()
isEmpty
in interface GridDataModel
true
if the model is empty.public Object[][] getData()
getData
in interface GridDataModel
public void setPageSize(int pageSize)
setPageSize
in interface Pageable
pageSize
- is a page size.public void setCurrentPageNumber(int currentPageNumber) throws IllegalArgumentException
setCurrentPageNumber
in interface Pageable
currentPageNumber
- is a current page number.IllegalArgumentException
- if current page number less then zero or greater then
actual number of pages.public int getTotalPagesNumber()
getTotalPagesNumber
in interface Pageable
public int getStartPage()
getStartPage
in interface Pageable
public int getEndPage()
getEndPage
in interface Pageable
public int getDisplayedPages()
getDisplayedPages
in interface Pageable
public void setDisplayedPages(int displayedPages)
setDisplayedPages
in interface Pageable
displayedPages
- is a number of pages.public int getPageSize()
getPageSize
in interface Pageable
public int getCurrentPageNumber()
getCurrentPageNumber
in interface Pageable
protected EditableGridDataModel getDelegate()
protected void setDelegate(EditableGridDataModel delegate)
delegate
- Value to set for property 'delegate'.Copyright © 2008–2013. All rights reserved.