Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.platform.ui.web.model.impl
Class EditableModelImpl

java.lang.Object
  extended by javax.faces.model.DataModel
      extended by org.nuxeo.ecm.platform.ui.web.model.impl.EditableModelImpl
All Implemented Interfaces:
Serializable, EditableModel

public class EditableModelImpl
extends DataModel
implements EditableModel, Serializable

Editable data model that handles value changes.

Only accepts lists or arrays of Serializable objects for now.

Author:
Anahide Tchertchian
See Also:
Serialized Form

Constructor Summary
EditableModelImpl(Object value)
           
 
Method Summary
 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.
 Object getOriginalData()
          Returns original data used for data model creation.
 int getRowCount()
           
 Object getRowData()
           
 int getRowIndex()
           
 Integer getRowKey()
          Gets unique key identifier for this row.
 Object getWrappedData()
          Gets wrapped data.
 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()
           
 
Methods inherited from class javax.faces.model.DataModel
addDataModelListener, getDataModelListeners, removeDataModelListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EditableModelImpl

public EditableModelImpl(Object value)
Method Detail

getOriginalData

public Object getOriginalData()
Description copied from interface: EditableModel
Returns original data used for data model creation.

Specified by:
getOriginalData in interface EditableModel

getWrappedData

public Object getWrappedData()
Description copied from interface: EditableModel
Gets wrapped data.

This data may be different from the original one if any changes occured on the model.

Specified by:
getWrappedData in interface EditableModel
Specified by:
getWrappedData in class DataModel

setWrappedData

public void setWrappedData(Object data)
Description copied from interface: EditableModel
Sets wrapped data.

Specified by:
setWrappedData in interface EditableModel
Specified by:
setWrappedData in class DataModel

isRowAvailable

public boolean isRowAvailable()
Specified by:
isRowAvailable in interface EditableModel
Specified by:
isRowAvailable in class DataModel
See Also:
DataModel.isRowAvailable()

isRowModified

public boolean isRowModified()
Description copied from interface: EditableModel
Returns true if row data has changed from its original value.

Specified by:
isRowModified in interface EditableModel

isRowNew

public boolean isRowNew()
Description copied from interface: EditableModel
Returns true if row data is not in the original list.

Specified by:
isRowNew in interface EditableModel

recordValueModified

public void recordValueModified(int index,
                                Object newValue)
Description copied from interface: EditableModel
Records a value has been modified at given index.

Specified by:
recordValueModified in interface EditableModel

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface EditableModel
Specified by:
getRowCount in class DataModel
See Also:
DataModel.getRowCount()

getRowData

public Object getRowData()
Specified by:
getRowData in interface EditableModel
Specified by:
getRowData in class DataModel
See Also:
DataModel.getRowData()

setRowData

public void setRowData(Object rowData)
Description copied from interface: EditableModel
Sets row data using given value.

Specified by:
setRowData in interface EditableModel

getRowIndex

public int getRowIndex()
Specified by:
getRowIndex in interface EditableModel
Specified by:
getRowIndex in class DataModel
See Also:
DataModel.getRowIndex()

setRowIndex

public void setRowIndex(int rowIndex)
Specified by:
setRowIndex in interface EditableModel
Specified by:
setRowIndex in class DataModel
See Also:
DataModel.setRowIndex(int)

getRowKey

public Integer getRowKey()
Description copied from interface: EditableModel
Gets unique key identifier for this row.

Specified by:
getRowKey in interface EditableModel

setRowKey

public void setRowKey(Integer key)
Description copied from interface: EditableModel
Sets unique key identifier for this row.

Specified by:
setRowKey in interface EditableModel

getListDiff

public ListDiff getListDiff()
Description copied from interface: EditableModel
Returns the list diff, ignoring all data that has not changed.

The list diff tracks chronologically all changes that were made to the original (and changing) model.

Specified by:
getListDiff in interface EditableModel

setListDiff

public void setListDiff(ListDiff listDiff)
Description copied from interface: EditableModel
Sets list diff.

Specified by:
setListDiff in interface EditableModel

isDirty

public boolean isDirty()
Description copied from interface: EditableModel
Returns true if any changes occurred on the model.

Specified by:
isDirty in interface EditableModel

addValue

public boolean addValue(Object value)
Description copied from interface: EditableModel
Adds new value at the end of the model.

Specified by:
addValue in interface EditableModel

insertValue

public void insertValue(int index,
                        Object value)
Description copied from interface: EditableModel
Inserts value at given index on the model.

Specified by:
insertValue in interface EditableModel

moveValue

public Object moveValue(int fromIndex,
                        int toIndex)
Description copied from interface: EditableModel
Modifies value at given index on the model.

Specified by:
moveValue in interface EditableModel
Returns:
the old value at that index.

removeValue

public Object removeValue(int index)
Description copied from interface: EditableModel
Removes value at given index.

Specified by:
removeValue in interface EditableModel
Returns:
the old value at that index.

size

public int size()
Description copied from interface: EditableModel
Returns the model size.

Specified by:
size in interface EditableModel

toString

public String toString()
Overrides:
toString in class Object

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.