C - public abstract class APojoEditableGridModel<C> extends java.lang.Object implements IPojoEditableGridModel<C>, IPojoGridModel<C>, IOrderedGridModel, java.io.Serializable
IEditableGridModel interface with an
PojoGridModel instance.| Constructor and Description |
|---|
APojoEditableGridModel(PojoGridModel<C> model,
IPojoForm<C> form) |
APojoEditableGridModel(PojoGridModel<C> model,
IPojoForm<C> form,
java.util.Comparator<? super C> univocityComparator) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
areRowsSwappable(int row1,
int row2) |
void |
cancel()
Cancel any pending or insert operations, if there are none, nothing happens.
|
boolean |
canRemoveCurrentRow() |
IForm |
edit()
Edit the current row.
|
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.
The ui is simply saying that it wants to get access to the given rows. |
IColumn |
getColumn(int columnIndex) |
int |
getColumnCount() |
IColumnGroup |
getColumnGroup(java.lang.String groupId) |
int |
getColumnIndex(java.lang.String columnName) |
java.lang.String |
getColumnName(int columnIndex) |
C |
getCurrentPojo() |
int |
getCurrentRow() |
int |
getCurrentRowCount() |
java.util.List<C> |
getData()
Any modification maded to the returned collection is reflected
into the model.
|
int |
getDataVersion() |
java.util.List<C> |
getDataView()
If an insert or edit operation is pending, the pojo is not contained in the
returned collection.
|
IPojoForm<C> |
getForm() |
C |
getPojo(int rowIndex) |
java.lang.Class<C> |
getPojoType() |
java.lang.String |
getPropertyName(int columnIndex) |
int |
getRowCount() |
java.lang.Object |
getValue(C pojo,
int columnIndex) |
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex) |
IForm |
insert(java.lang.Object param,
boolean afterCurrentRow) |
boolean |
isCurrentRowEditable() |
boolean |
isCurrentRowFreezed() |
boolean |
isEditing(C pojo) |
boolean |
isEditPending() |
boolean |
isInsertAllowed(java.lang.Object param,
boolean afterCurrentRow) |
boolean |
isInserting(C pojo) |
boolean |
isInsertPending() |
boolean |
post()
If in edit mode, the current record instance is replaced.
|
boolean |
remove() |
IForm |
replaceInsertedPojo(C pojo) |
int |
rowIndexOf(C pojo) |
void |
setCurrentRow(int rowIndex) |
void |
swapRows(int row1,
int row2)
Swaps the given rows, care should be taken to restore the current row.
|
void |
sync()
Keeps the internal
IForm and the internal IGridModel in sync. |
public APojoEditableGridModel(PojoGridModel<C> model, IPojoForm<C> form, java.util.Comparator<? super C> univocityComparator)
model - form - univocityComparator - - if specified, when an insert or a change is confirmed,
any pojo matching the new or changed pojo is removed.public APojoEditableGridModel(PojoGridModel<C> model, IPojoForm<C> form)
public boolean canRemoveCurrentRow()
canRemoveCurrentRow in interface IEditableGridModelpublic void cancel()
IEditableGridModelcancel in interface IEditableGridModelpublic IForm edit()
IEditableGridModeledit in interface IEditableGridModelIForm, it must be the same returned by IEditableGridModel.getForm()
at least until a IEditableGridModel.cancel()public final IPojoForm<C> getForm()
getForm in interface IEditableGridModelIForm usable to edit current row values.IForm must be returned.public IForm insert(java.lang.Object param, boolean afterCurrentRow)
insert in interface IEditableGridModelparam - - a generic parameter, the model can use to determine the
type of row to insert.afterCurrentRow - - false: the object is inserted in place of the current row,
true: it is inserted after the current row.IForm, it must be the same returned by IEditableGridModel.getForm()
at least until a IEditableGridModel.cancel()public IForm replaceInsertedPojo(C pojo)
replaceInsertedPojo in interface IPojoEditableGridModel<C>pojo - - replaces the inserted pojo, the form is refreshed.public boolean isCurrentRowEditable()
isCurrentRowEditable in interface IEditableGridModelpublic final boolean isInsertPending()
isInsertPending in interface IEditableGridModelIEditableGridModel.cancel()
to abort the operation.public final boolean isEditPending()
isEditPending in interface IEditableGridModelIEditableGridModel.cancel()
to abort the operation.public boolean isInsertAllowed(java.lang.Object param,
boolean afterCurrentRow)
isInsertAllowed in interface IEditableGridModelpublic boolean post()
post in interface IEditableGridModelIForm instance and
the model doesn't exit from the pending insert or edit state.
It is possible for the model to open a message dialog in case of errors
(see FlowContext.modalDialog(net.infordata.ifw2.web.ctrl.IFlowAsDialog, net.infordata.ifw2.web.ctrl.IDialogCallback)).public boolean remove()
remove in interface IEditableGridModelFlowContext.modalDialog(net.infordata.ifw2.web.ctrl.IFlowAsDialog, net.infordata.ifw2.web.ctrl.IDialogCallback)).public int fetchRows(int rowIndex,
int count)
IGridModelfetchRows in interface IGridModelrowIndex - - starting from this index ...count - - ... we want this number of rowsIGridModel.getRowCount() must return the
real rows counter and a call to IGridModel.getCurrentRow() a valid
row index.public IColumnGroup getColumnGroup(java.lang.String groupId)
getColumnGroup in interface IGridModelpublic IColumn getColumn(int columnIndex)
getColumn in interface IGridModelpublic int getColumnCount()
getColumnCount in interface IGridModelpublic int getColumnIndex(java.lang.String columnName)
getColumnIndex in interface IGridModelpublic java.lang.String getColumnName(int columnIndex)
getColumnName in interface IGridModelpublic int getCurrentRow()
getCurrentRow in interface IGridModelpublic int getCurrentRowCount()
getCurrentRowCount in interface IGridModelIGridModel.getRowCount() but can be less if the model supports paging.public int getRowCount()
getRowCount in interface IGridModelInteger.MAX_VALUE.public java.lang.Object getValueAt(int rowIndex,
int columnIndex)
getValueAt in interface IGridModelpublic final java.lang.String getPropertyName(int columnIndex)
getPropertyName in interface IPojoGridModel<C>public C getPojo(int rowIndex)
getPojo in interface IPojoGridModel<C>public int rowIndexOf(C pojo)
rowIndexOf in interface IPojoGridModel<C>public final java.lang.Object getValue(C pojo, int columnIndex)
getValue in interface IPojoGridModel<C>pojo - - the pojo to extract value from.columnIndex - - the columnIndex which must be mapped to a pojo property
or to a computed value.public final C getCurrentPojo()
getCurrentPojo in interface IPojoGridModel<C>public boolean isCurrentRowFreezed()
isCurrentRowFreezed in interface IGridModelpublic void setCurrentRow(int rowIndex)
setCurrentRow in interface IGridModelpublic final java.util.List<C> getData()
java.lang.IllegalStateException - if an edit or insert operation is pending.public final java.util.List<C> getDataView()
getDataView in interface IPojoEditableGridModel<C>getDataView in interface IPojoGridModel<C>public final boolean isEditing(C pojo)
isEditing in interface IPojoEditableGridModel<C>public final boolean isInserting(C pojo)
isInserting in interface IPojoEditableGridModel<C>public void sync()
IForm and the internal IGridModel in sync.sync in interface IGridModelpublic final int getDataVersion()
getDataVersion in interface IPojoGridModel<C>IGridModel.sync().public java.lang.Class<C> getPojoType()
getPojoType in interface IPojoGridModel<C>public void swapRows(int row1,
int row2)
IOrderedGridModelswapRows in interface IOrderedGridModelpublic boolean areRowsSwappable(int row1,
int row2)
areRowsSwappable in interface IOrderedGridModel