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 HierarchicalrowNumber - 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 HierarchicalrowNumber - 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 Hierarchicalrow - 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 Hierarchicalrow - 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 EditablebeforeRow - 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 EditablerowNumber - 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 EditablerowNumber - is a row number.IllegalArgumentException - if the row number is invalid.public void addColumn(int beforeColumn,
Object[] column)
throws IllegalArgumentException
addColumn in interface EditablebeforeColumn - 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 EditablebeforeColumn - 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 EditablecolumnNumber - 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 Editablename - a column name.column - a column data set.public void removeColumn(int columnNumber)
throws IllegalArgumentException
removeColumn in interface EditablecolumnNumber - a column number.IllegalArgumentException - if the column number is invalid.public void removeColumn(String name)
removeColumn in interface Editablename - a column name.public void removeAll()
public void update(int row,
int column,
Object data)
throws IllegalArgumentException
update in interface Editablerow - 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 EditablesortColumn - is a sort column.comparator - is a column comparator.public DataModelCallbackHandler<Editable> getHandler()
getHandler in interface Editablepublic void update(Object[][] data)
public void setHandler(DataModelCallbackHandler<Editable> handler)
setHandler in interface Editablehandler - a callback handler.public int getTotalColumnCount()
getTotalColumnCount in interface Editablepublic Object[][] getRemovedRows()
getRemovedRows in interface Editablepublic void clearRemovedRows()
clearRemovedRows in interface Editablepublic GridRow[] getRows()
public GridColumn[] getColumns()
getColumns in interface Editablepublic GridRow getRow(int index)
public GridColumn getGridColumn(int index)
getGridColumn in interface Editableindex - is an index value.public String[] getColumnNames()
getColumnNames in interface Editablepublic void setColumNames(String[] names)
Editable.update(Object[][]) for details.setColumNames in interface Editablenames - is a list of column names.public void addListener(EditableModelListener listener)
addListener in interface Editablelistener - is a model listener to register.public void removeListener(EditableModelListener listener)
removeListener in interface Editablelistener - is a model listener to be removed.public int getTotalRowCount()
getTotalRowCount in interface GridDataModelpublic int getStartRow()
getStartRow in interface GridDataModelpublic int getEndRow()
getEndRow in interface GridDataModelpublic int getSortColumn()
getSortColumn in interface GridDataModelpublic boolean isAscending()
It returns true if direction is ascending.
isAscending in interface GridDataModelfalse if sorting is descending.public Object[] getRowData(int rowNumber)
getRowData in interface GridDataModelrowNumber - is a number of row to be returned.public void setSortColumn(int sortColumn)
setSortColumn in interface GridDataModelsortColumn - a number of sort column.public void setAscending(boolean ascending)
setAscending in interface GridDataModelascending - sort direction.public boolean isEmpty()
isEmpty in interface GridDataModeltrue if the model is empty.public Object[][] getData()
getData in interface GridDataModelpublic void setPageSize(int pageSize)
setPageSize in interface PageablepageSize - is a page size.public void setCurrentPageNumber(int currentPageNumber)
throws IllegalArgumentException
setCurrentPageNumber in interface PageablecurrentPageNumber - 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 Pageablepublic int getStartPage()
getStartPage in interface Pageablepublic int getEndPage()
getEndPage in interface Pageablepublic int getDisplayedPages()
getDisplayedPages in interface Pageablepublic void setDisplayedPages(int displayedPages)
setDisplayedPages in interface PageabledisplayedPages - is a number of pages.public int getPageSize()
getPageSize in interface Pageablepublic int getCurrentPageNumber()
getCurrentPageNumber in interface Pageableprotected EditableGridDataModel getDelegate()
protected void setDelegate(EditableGridDataModel delegate)
delegate - Value to set for property 'delegate'.Copyright © 2008–2013. All rights reserved.