net.infordata.ifw2.web.grds
Class MultiSelectionGridFlow.Model

java.lang.Object
  extended by net.infordata.ifw2.web.grds.MultiSelectionGridFlow.Model
All Implemented Interfaces:
java.io.Serializable, IDataGridModel, IGridModel, IOrderedGridModel
Enclosing class:
MultiSelectionGridFlow

public static class MultiSelectionGridFlow.Model
extends java.lang.Object
implements IDataGridModel, IOrderedGridModel, java.io.Serializable

See Also:
Serialized Form

Constructor Summary
MultiSelectionGridFlow.Model(IOrderedGridModel wrapped)
           
 
Method Summary
 void applyFilters(java.lang.String filteredColumnName, java.util.Map<java.lang.String,AFilterDefinition<?>> filters)
          If IDataGridModel.isFilterable() then this method can be used to change data filter definitions, otherwise you can assume that it is never used.
 boolean areRowsSwappable(int row1, int row2)
           
 boolean canDoContainsSearch()
           
 boolean canSearchOnSortedColumn()
           
 int containsSearch(java.lang.String columnName, java.lang.String value, boolean forward, int startFrom)
           
 int fetchRows(int rowIndex, int count)
          Used by the ui to ensure that the request rows really exist without the need to retrieve any column value.
 IColumn getColumn(int columnIndex)
           
 int getColumnCount()
           
 IColumnGroup getColumnGroup(java.lang.String groupId)
           
 int getColumnIndex(java.lang.String columnName)
           
 java.lang.String getColumnName(int columnIndex)
           
 int getCurrentRow()
           
 int getCurrentRowCount()
           
 IDataGridModel getDataGridModel()
           
 java.util.Map<java.lang.String,AFilterDefinition<?>> getFilters()
           
 IOrderedGridModel getOrderedGridModel()
           
 int getRowCount()
           
 java.lang.Boolean getSortedAscendingIndicator()
           
 java.lang.String getSortedColumn()
           
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
           
 boolean isCurrentRowFreezed()
           
 boolean isFilterable()
           
 boolean isSortable()
           
 int searchOnSortedColumn(java.lang.Object value)
          Searches the given value between values of the currently sorted column.
 void setCurrentRow(int rowIndex)
           
 void setSortedColumn(java.lang.String columnName, boolean ascending)
          If IDataGridModel.isSortable() then this method is used to change the sort order otherwise you can assume that it is never used.
 void swapRows(int row1, int row2)
          Swaps the given rows, care should be taken to restore the current row.
 void sync()
          Called by the framework just before displaying the AGridFlow.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiSelectionGridFlow.Model

public MultiSelectionGridFlow.Model(IOrderedGridModel wrapped)
Method Detail

getDataGridModel

public final IDataGridModel getDataGridModel()

getOrderedGridModel

public final IOrderedGridModel getOrderedGridModel()

setSortedColumn

public void setSortedColumn(java.lang.String columnName,
                            boolean ascending)
Description copied from interface: IDataGridModel
If IDataGridModel.isSortable() then this method is used to change the sort order otherwise you can assume that it is never used.

Specified by:
setSortedColumn in interface IDataGridModel

isSortable

public boolean isSortable()
Specified by:
isSortable in interface IDataGridModel
Returns:
true if the model supports changing of the sort order.

searchOnSortedColumn

public int searchOnSortedColumn(java.lang.Object value)
Description copied from interface: IDataGridModel
Searches the given value between values of the currently sorted column.

Specified by:
searchOnSortedColumn in interface IDataGridModel
Returns:
should be "compatible" with Collections.binarySearch(java.util.List, Object).

canSearchOnSortedColumn

public boolean canSearchOnSortedColumn()
Specified by:
canSearchOnSortedColumn in interface IDataGridModel
Returns:
true if IDataGridModel.searchOnSortedColumn(Object) can used.

containsSearch

public int containsSearch(java.lang.String columnName,
                          java.lang.String value,
                          boolean forward,
                          int startFrom)
Specified by:
containsSearch in interface IDataGridModel
Returns:
less than zero if nothing has been found

canDoContainsSearch

public boolean canDoContainsSearch()
Specified by:
canDoContainsSearch in interface IDataGridModel
Returns:
true if #containsSearch(int, String, boolean, int) can be used.

applyFilters

public void applyFilters(java.lang.String filteredColumnName,
                         java.util.Map<java.lang.String,AFilterDefinition<?>> filters)
Description copied from interface: IDataGridModel
If IDataGridModel.isFilterable() then this method can be used to change data filter definitions, otherwise you can assume that it is never used.

Specified by:
applyFilters in interface IDataGridModel
Parameters:
filteredColumnName - - used in case a the filter has been applied on a specific column, otherwise null.
Implementors must clone any AFilterDefinition.
filters - - filters to be applied per column

isFilterable

public boolean isFilterable()
Specified by:
isFilterable in interface IDataGridModel
Returns:
true if the model supports data filtering.

getColumnGroup

public IColumnGroup getColumnGroup(java.lang.String groupId)
Specified by:
getColumnGroup in interface IGridModel
Returns:
if null then default behaviors and values are assumed.

getColumn

public IColumn getColumn(int columnIndex)
Specified by:
getColumn in interface IGridModel
Returns:
always not null otherwise an exception is thrown if the column doesn't exist.

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface IGridModel

getColumnIndex

public int getColumnIndex(java.lang.String columnName)
Specified by:
getColumnIndex in interface IGridModel
Returns:
less than 0 if not found.

getColumnName

public java.lang.String getColumnName(int columnIndex)
Specified by:
getColumnName in interface IGridModel

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)
Specified by:
getValueAt in interface IGridModel
Returns:
the value for the given coordinates.

getFilters

public java.util.Map<java.lang.String,AFilterDefinition<?>> getFilters()
Specified by:
getFilters in interface IDataGridModel
Returns:
an unmodifiable map or null if no filter has been applied.

getSortedAscendingIndicator

public java.lang.Boolean getSortedAscendingIndicator()
Specified by:
getSortedAscendingIndicator in interface IDataGridModel
Returns:
true if sorted in ascending order, false if in descending and null if not sorted.
It is called even if IDataGridModel.isSortable() == false, because the model can be sorted but not sortable (ie the sort order is not changeable with the ui).

getSortedColumn

public java.lang.String getSortedColumn()
Specified by:
getSortedColumn in interface IDataGridModel
Returns:
the sorted column, null if none.
It is called even if IDataGridModel.isSortable() == false, because the model can be sorted but not sortable (ie the sort order is not changeable with the gui).

fetchRows

public int fetchRows(int rowIndex,
                     int count)
Description copied from interface: IGridModel
Used by the ui to ensure that the request rows really exist without the need to retrieve any column value.
The ui is simply saying that it wants to get access to the given rows.

Specified by:
fetchRows in interface IGridModel
Parameters:
rowIndex - - starting from this index ...
count - - ... we want this number of rows
Returns:
the real number of rows founded.
Returning a number less than the requested number of rows means that the last row has been finally reached, in this case a following call to IGridModel.getRowCount() must return the real rows counter and a call to IGridModel.getCurrentRow() a valid row index.

getCurrentRow

public int getCurrentRow()
Specified by:
getCurrentRow in interface IGridModel
Returns:
the current row, a number less than 0 means none.

getCurrentRowCount

public int getCurrentRowCount()
Specified by:
getCurrentRowCount in interface IGridModel
Returns:
the currently loaded rows, generally it is equal to IGridModel.getRowCount() but can be less if the model supports paging.

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface IGridModel
Returns:
the row count, if not known yet Integer.MAX_VALUE.

isCurrentRowFreezed

public boolean isCurrentRowFreezed()
Specified by:
isCurrentRowFreezed in interface IGridModel
Returns:
true if some sort of editing is happening on the current row, this freezes the current row.

setCurrentRow

public void setCurrentRow(int rowIndex)
Specified by:
setCurrentRow in interface IGridModel

sync

public void sync()
Description copied from interface: IGridModel
Called by the framework just before displaying the AGridFlow.
Here is where the model can, as an example, ensure that depending sub models are synchronized or to restore data after a serialization.
Keep in mind that after synchronizing the model internal state can be changed.

Specified by:
sync in interface IGridModel

swapRows

public void swapRows(int row1,
                     int row2)
Description copied from interface: IOrderedGridModel
Swaps the given rows, care should be taken to restore the current row.

Specified by:
swapRows in interface IOrderedGridModel

areRowsSwappable

public boolean areRowsSwappable(int row1,
                                int row2)
Specified by:
areRowsSwappable in interface IOrderedGridModel
Returns:
true if rows are swappable.