public class EditableModelImpl extends javax.faces.model.DataModel implements EditableModel, Serializable
Only accepts lists or arrays of Serializable objects for now.
Modifier and Type | Field and Description |
---|---|
protected List |
data |
protected int |
index |
protected Map<Integer,Integer> |
keyMap |
protected ListDiff |
listDiff |
protected Object |
originalData |
protected Object |
template |
Constructor and Description |
---|
EditableModelImpl(Object value,
Object template) |
Modifier and Type | Method and Description |
---|---|
void |
addTemplateValue() |
boolean |
addValue(Object value)
Adds new value at the end of the model.
|
ListDiff |
getListDiff()
Returns the list diff, ignoring all data that has not changed.
|
protected int |
getNewRowKey()
Returns a new row key that is not already used.
|
Object |
getOriginalData()
Returns original data used for data model creation.
|
protected Object |
getOriginalRowDataForKey(int key)
Returns the initial data for the given key.
|
int |
getRowCount() |
Object |
getRowData() |
int |
getRowIndex() |
Integer |
getRowKey()
Gets unique key identifier for this row.
|
Object |
getUnreferencedTemplate() |
Object |
getWrappedData()
Gets wrapped data.
|
protected void |
initializeData(Object originalData) |
void |
insertTemplateValue(int index) |
void |
insertValue(int index,
Object value)
Inserts value at given index on the model.
|
boolean |
isDirty()
Returns true if any changes occurred on the model.
|
boolean |
isRowAvailable() |
boolean |
isRowModified()
Returns true if row data has changed from its original value.
|
boolean |
isRowNew()
Returns true if row data is not in the original list.
|
Object |
moveValue(int fromIndex,
int toIndex)
Modifies value at given index on the model.
|
void |
recordValueModified(int index,
Object newValue)
Records a value has been modified at given index.
|
Object |
removeValue(int index)
Removes value at given index.
|
void |
setListDiff(ListDiff listDiff)
Sets list diff.
|
void |
setRowData(Object rowData)
Sets row data using given value.
|
void |
setRowIndex(int rowIndex) |
void |
setRowKey(Integer key)
Sets unique key identifier for this row.
|
void |
setWrappedData(Object data)
Sets wrapped data.
|
int |
size()
Returns the model size.
|
String |
toString() |
addDataModelListener, getDataModelListeners, iterator, removeDataModelListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
protected final Object originalData
protected int index
public EditableModelImpl(Object value, Object template)
protected void initializeData(Object originalData)
public Object getUnreferencedTemplate()
getUnreferencedTemplate
in interface EditableModel
public Object getOriginalData()
EditableModel
getOriginalData
in interface EditableModel
public Object getWrappedData()
EditableModel
This data may be different from the original one if any changes occured on the model.
getWrappedData
in interface EditableModel
getWrappedData
in class javax.faces.model.DataModel
public void setWrappedData(Object data)
EditableModel
setWrappedData
in interface EditableModel
setWrappedData
in class javax.faces.model.DataModel
protected Object getOriginalRowDataForKey(int key)
Returns null marker if key is invalid or data did not exist for given key in the original data.
protected int getNewRowKey()
public boolean isRowAvailable()
isRowAvailable
in interface EditableModel
isRowAvailable
in class javax.faces.model.DataModel
DataModel.isRowAvailable()
public boolean isRowModified()
EditableModel
isRowModified
in interface EditableModel
public boolean isRowNew()
EditableModel
isRowNew
in interface EditableModel
public void recordValueModified(int index, Object newValue)
EditableModel
recordValueModified
in interface EditableModel
public int getRowCount()
getRowCount
in interface EditableModel
getRowCount
in class javax.faces.model.DataModel
DataModel.getRowCount()
public Object getRowData()
getRowData
in interface EditableModel
getRowData
in class javax.faces.model.DataModel
DataModel.getRowData()
public void setRowData(Object rowData)
EditableModel
setRowData
in interface EditableModel
public int getRowIndex()
getRowIndex
in interface EditableModel
getRowIndex
in class javax.faces.model.DataModel
DataModel.getRowIndex()
public void setRowIndex(int rowIndex)
setRowIndex
in interface EditableModel
setRowIndex
in class javax.faces.model.DataModel
DataModel.setRowIndex(int)
public Integer getRowKey()
EditableModel
getRowKey
in interface EditableModel
public void setRowKey(Integer key)
EditableModel
setRowKey
in interface EditableModel
public ListDiff getListDiff()
EditableModel
The list diff tracks chronologically all changes that were made to the original (and changing) model.
getListDiff
in interface EditableModel
public void setListDiff(ListDiff listDiff)
EditableModel
setListDiff
in interface EditableModel
public boolean isDirty()
EditableModel
isDirty
in interface EditableModel
public void addTemplateValue()
addTemplateValue
in interface EditableModel
public boolean addValue(Object value)
EditableModel
addValue
in interface EditableModel
public void insertTemplateValue(int index)
insertTemplateValue
in interface EditableModel
public void insertValue(int index, Object value)
EditableModel
insertValue
in interface EditableModel
public Object moveValue(int fromIndex, int toIndex)
EditableModel
moveValue
in interface EditableModel
public Object removeValue(int index)
EditableModel
removeValue
in interface EditableModel
public int size()
EditableModel
size
in interface EditableModel
Copyright © 2015 Nuxeo SA. All rights reserved.