Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.platform.ui.web.component.list
Class UIEditableList

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UIOutput
              extended by javax.faces.component.UIInput
                  extended by org.nuxeo.ecm.platform.ui.web.component.list.UIEditableList
All Implemented Interfaces:
EditableValueHolder, NamingContainer, StateHolder, ValueHolder

public class UIEditableList
extends UIInput
implements NamingContainer

Editable table component.

Allows to add/remove elements from an UIEditableList, inspired from Trinidad UIXCollection component.

Author:
Anahide Tchertchian

Field Summary
static String COMPONENT_FAMILY
           
static String COMPONENT_TYPE
           
 
Fields inherited from class javax.faces.component.UIInput
CONVERSION_MESSAGE_ID, REQUIRED_MESSAGE_ID, UPDATE_MESSAGE_ID
 
Fields inherited from interface javax.faces.component.NamingContainer
SEPARATOR_CHAR
 
Constructor Summary
UIEditableList()
           
 
Method Summary
 boolean addValue(Object value)
          Adds a value to the end of the editable model.
 void broadcast(FacesEvent event)
          Delivers a wrapped event to the appropriate component.
 void encodeBegin(FacesContext context)
           
 void encodeChildren(FacesContext context)
          Repeatedly render the children as many times as needed.
 void encodeEnd(FacesContext context)
           
 String getContainerClientId(FacesContext context)
          Override container client id resolution to handle recursion.
 Object getDefaultValue()
           
 Boolean getDiff()
          Gets boolean stating if diff must be used when saving the value submitted.
 EditableModel getEditableModel()
          Gets the EditableModel to use with this component.
 String getFamily()
           
 String getModel()
          Gets model name exposed in request map.
 Integer getNumber()
           
 Boolean getRemoveEmpty()
           
 String getRendererType()
           
 boolean getRendersChildren()
           
 int getRowCount()
          Gets the total number of rows in this table.
 Object getRowData()
          Gets the data for the current row.
 int getRowIndex()
          Gets the index of the current row.
 Integer getRowKey()
          Gets the rowKey of the current row.
 Object getTemplate()
          Gets template to be used when adding new values to the model.
 Object getValue()
           
 void insertValue(int index, Object value)
          Inserts value at given index on the editable model.
 boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback)
           
 boolean isRowAvailable()
          Checks to see if the current row is available.
 boolean isRowModified()
          Checks to see if the current row is modified.
 Object moveValue(int fromIndex, int toIndex)
          Modifies value at given index on the editable model.
 void processDecodes(FacesContext context)
           
 void processUpdates(FacesContext context)
           
 void processValidators(FacesContext context)
           
 void queueEvent(FacesEvent event)
          Queues an event.
 void recordValueModified(int index, Object newValue)
          Records a value modification.
 Object removeValue(int index)
          Removes value at given index on the editable model.
 void resetCachedModel()
          Resets the cache model
 void restoreState(FacesContext context, Object state)
           
 Object saveState(FacesContext context)
           
 void setDefaultValue(Object defaultValue)
           
 void setDiff(Boolean diff)
          Sets boolean stating if diff must be used when saving the value submitted.
 void setModel(String model)
          Sets model name exposed in request map.
 void setNumber(Integer number)
           
 void setRemoveEmpty(Boolean removeEmpty)
           
 void setRendererType(String rendererType)
           
 void setRowIndex(int rowIndex)
          Makes a row current.
 void setRowKey(Integer rowKey)
          Makes a row current.
 void setTemplate(Object template)
          Sets template to be used when adding new values to the model.
 
Methods inherited from class javax.faces.component.UIInput
addValidator, addValueChangeListener, decode, getConverterMessage, getRequiredMessage, getSubmittedValue, getValidator, getValidatorMessage, getValidators, getValueChangeListener, getValueChangeListeners, isImmediate, isLocalValueSet, isRequired, isValid, removeValidator, removeValueChangeListener, resetValue, setConverterMessage, setImmediate, setLocalValueSet, setRequired, setRequiredMessage, setSubmittedValue, setValid, setValidator, setValidatorMessage, setValue, setValueChangeListener, updateModel, validate
 
Methods inherited from class javax.faces.component.UIOutput
getConverter, getLocalValue, setConverter
 
Methods inherited from class javax.faces.component.UIComponentBase
findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getValueBinding, isRendered, isTransient, processRestoreState, processSaveState, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setTransient, setValueBinding
 
Methods inherited from class javax.faces.component.UIComponent
encodeAll, getValueExpression, setValueExpression
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.faces.component.ValueHolder
getConverter, getLocalValue, setConverter
 

Field Detail

COMPONENT_TYPE

public static final String COMPONENT_TYPE

COMPONENT_FAMILY

public static final String COMPONENT_FAMILY
Constructor Detail

UIEditableList

public UIEditableList()
Method Detail

getFamily

public String getFamily()
Overrides:
getFamily in class UIInput

saveState

public Object saveState(FacesContext context)
Specified by:
saveState in interface StateHolder
Overrides:
saveState in class UIInput

getValue

public Object getValue()
Specified by:
getValue in interface ValueHolder
Overrides:
getValue in class UIOutput

getDefaultValue

public Object getDefaultValue()

setDefaultValue

public void setDefaultValue(Object defaultValue)

restoreState

public void restoreState(FacesContext context,
                         Object state)
Specified by:
restoreState in interface StateHolder
Overrides:
restoreState in class UIInput

resetCachedModel

public void resetCachedModel()
Resets the cache model

Can be useful when re-rendering a list with ajax and not wanting to keep cached values already submitted.

Since:
5.3.1

getEditableModel

public final EditableModel getEditableModel()
Gets the EditableModel to use with this component.


isRowAvailable

public final boolean isRowAvailable()
Checks to see if the current row is available. This is useful when the total number of rows is not known.

Returns:
true iff the current row is available.
See Also:
EditableModel.isRowAvailable()

isRowModified

public final boolean isRowModified()
Checks to see if the current row is modified.

Returns:
true iff the current row is modified.
See Also:
EditableModel.isRowModified()

getRowCount

public final int getRowCount()
Gets the total number of rows in this table.

Returns:
-1 if the total number is not known.
See Also:
EditableModel.getRowCount()

getRowIndex

public final int getRowIndex()
Gets the index of the current row.

Returns:
-1 if the current row is unavailable.
See Also:
EditableModel.getRowIndex()

getRowKey

public final Integer getRowKey()
Gets the rowKey of the current row.

Returns:
null if the current row is unavailable.
See Also:
EditableModel.getRowKey()

getRowData

public final Object getRowData()
Gets the data for the current row.

Returns:
null if the current row is unavailable
See Also:
EditableModel.getRowData()

setRowIndex

public void setRowIndex(int rowIndex)
Makes a row current.

This method calls preRowDataChange() and postRowDataChange() as appropriate.

Parameters:
rowIndex - The rowIndex of the row that should be made current. Use -1 to clear the current row.
See Also:
EditableModel.setRowIndex(int)

setRowKey

public void setRowKey(Integer rowKey)
Makes a row current.

This method calls preRowDataChange() and postRowDataChange() as appropriate.

Parameters:
rowKey - The rowKey of the row that should be made current. Use null to clear the current row.
See Also:
EditableModel.setRowKey(java.lang.Integer)

recordValueModified

public final void recordValueModified(int index,
                                      Object newValue)
Records a value modification.

See Also:
EditableModel.recordValueModified(int, java.lang.Object)

addValue

public boolean addValue(Object value)
Adds a value to the end of the editable model.

Parameters:
value - the value to add
Returns:
true if value was added.

insertValue

public void insertValue(int index,
                        Object value)
Inserts value at given index on the editable model.

Throws:
IllegalArgumentException - if model does not handle this index.

moveValue

public Object moveValue(int fromIndex,
                        int toIndex)
Modifies value at given index on the editable model.

Returns:
the old value at that index.
Throws:
IllegalArgumentException - if model does not handle one of given indexes.

removeValue

public Object removeValue(int index)
Removes value at given index on the editable model.

Returns:
the old value at that index.
Throws:
IllegalArgumentException - if model does not handle this index.

getModel

public String getModel()
Gets model name exposed in request map.


setModel

public void setModel(String model)
Sets model name exposed in request map.


getTemplate

public Object getTemplate()
Gets template to be used when adding new values to the model.


setTemplate

public final void setTemplate(Object template)
Sets template to be used when adding new values to the model.


getDiff

public Boolean getDiff()
Gets boolean stating if diff must be used when saving the value submitted.


setDiff

public void setDiff(Boolean diff)
Sets boolean stating if diff must be used when saving the value submitted.


getNumber

public Integer getNumber()

setNumber

public void setNumber(Integer number)

getRemoveEmpty

public Boolean getRemoveEmpty()

setRemoveEmpty

public void setRemoveEmpty(Boolean removeEmpty)

getContainerClientId

public String getContainerClientId(FacesContext context)
Override container client id resolution to handle recursion.

Overrides:
getContainerClientId in class UIComponent

getRendererType

public String getRendererType()
Overrides:
getRendererType in class UIComponentBase

setRendererType

public void setRendererType(String rendererType)
Overrides:
setRendererType in class UIComponentBase

encodeBegin

public final void encodeBegin(FacesContext context)
                       throws IOException
Overrides:
encodeBegin in class UIComponentBase
Throws:
IOException

encodeEnd

public void encodeEnd(FacesContext context)
               throws IOException
Overrides:
encodeEnd in class UIComponentBase
Throws:
IOException

getRendersChildren

public boolean getRendersChildren()
Overrides:
getRendersChildren in class UIComponentBase

encodeChildren

public void encodeChildren(FacesContext context)
                    throws IOException
Repeatedly render the children as many times as needed.

Overrides:
encodeChildren in class UIComponentBase
Throws:
IOException

broadcast

public void broadcast(FacesEvent event)
Delivers a wrapped event to the appropriate component. If the event is a special wrapped event, it is unwrapped.

Overrides:
broadcast in class UIComponentBase
Parameters:
event - a FacesEvent
Throws:
AbortProcessingException

queueEvent

public void queueEvent(FacesEvent event)
Queues an event. If there is a currency set on this table, then the event will be wrapped so that when it is finally delivered, the correct currency will be restored.

Overrides:
queueEvent in class UIComponentBase
Parameters:
event - a FacesEvent

processDecodes

public void processDecodes(FacesContext context)
Overrides:
processDecodes in class UIInput

processValidators

public void processValidators(FacesContext context)
Overrides:
processValidators in class UIInput

processUpdates

public void processUpdates(FacesContext context)
Overrides:
processUpdates in class UIInput

invokeOnComponent

public boolean invokeOnComponent(FacesContext context,
                                 String clientId,
                                 ContextCallback callback)
                          throws FacesException
Overrides:
invokeOnComponent in class UIComponentBase
Throws:
FacesException

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.