public class UIEditableList extends javax.faces.component.UIInput implements javax.faces.component.NamingContainer, ResettableComponent
Allows to add/remove elements from an UIEditableList
, inspired from Trinidad UIXCollection component.
Modifier and Type | Field and Description |
---|---|
static String |
COMPONENT_FAMILY |
static String |
COMPONENT_TYPE |
protected Boolean |
diff |
protected String |
model |
protected Integer |
number |
protected UIEditableList |
parentList |
protected boolean |
parentListSet |
protected Boolean |
removeEmpty |
protected Object |
template |
CONVERSION_MESSAGE_ID, REQUIRED_MESSAGE_ID, UPDATE_MESSAGE_ID, VALIDATE_EMPTY_FIELDS_PARAM_NAME
Constructor and Description |
---|
UIEditableList() |
Modifier and Type | Method and Description |
---|---|
boolean |
addValue(Object value)
Adds a value to the end of the editable model.
|
void |
broadcast(javax.faces.event.FacesEvent event)
Delivers a wrapped event to the appropriate component.
|
protected EditableModel |
createEditableModel(EditableModel current,
Object value)
Returns a new EditableModel from given value.
|
void |
encodeBegin(javax.faces.context.FacesContext context) |
void |
encodeChildren(javax.faces.context.FacesContext context)
Repeatedly render the children as many times as needed.
|
void |
encodeEnd(javax.faces.context.FacesContext context) |
protected void |
encodeTemplate(javax.faces.context.FacesContext context) |
protected void |
exposeRequestMapModelValue(Object oldRequestValue) |
protected void |
flushCachedModel() |
String |
getContainerClientId(javax.faces.context.FacesContext context)
Override container client id resolution to handle recursion.
|
protected Object |
getCurrencyKeyForInitialStampState()
Gets the currencyObject to setup the rowData to use to build initial stamp state.
|
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() |
protected org.nuxeo.ecm.platform.ui.web.component.list.UIEditableList.InternalState |
getInternalState(boolean create) |
String |
getModel()
Gets model name exposed in request map.
|
Integer |
getNumber() |
protected ProtectedEditableModel |
getParentList() |
ProtectedEditableModel |
getProtectedModel(EditableModel model) |
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.
|
protected org.nuxeo.ecm.platform.ui.web.component.list.StampState |
getStampState() |
Object |
getTemplate()
Gets template to be used when adding new values to the model.
|
Object |
getValue() |
protected void |
initializeState(boolean force) |
void |
insertValue(int index,
Object value)
Inserts value at given index on the editable model.
|
boolean |
invokeOnComponent(javax.faces.context.FacesContext context,
String clientId,
javax.faces.component.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.
|
protected void |
postRowDataChange(Object oldRequestValue)
Sets up this component to use the new rowData.
|
protected void |
preRowDataChange()
Prepares this component for a change in the rowData.
|
protected void |
processComponent(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
javax.faces.event.PhaseId phaseId) |
void |
processDecodes(javax.faces.context.FacesContext context) |
protected void |
processFacetsAndChildren(javax.faces.context.FacesContext context,
javax.faces.event.PhaseId phaseId) |
void |
processUpdates(javax.faces.context.FacesContext context) |
void |
processValidators(javax.faces.context.FacesContext context) |
void |
queueEvent(javax.faces.event.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
|
protected void |
restoreRequestMapModelValue(Object value)
Restores the given value in the request map for the model name.
|
void |
restoreState(javax.faces.context.FacesContext context,
Object state) |
protected Object |
saveRequestMapModelValue()
Returns the value exposed in request map for the model name.
|
Object |
saveState(javax.faces.context.FacesContext context) |
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.
|
void |
updateModel(javax.faces.context.FacesContext context)
Overridden to handle diff boolean value, see NXP-16515.
|
protected static boolean |
valueChanged(Object cached,
Object current) |
boolean |
visitTree(javax.faces.component.visit.VisitContext context,
javax.faces.component.visit.VisitCallback callback)
Rough adapt of the UI data behaviour.
|
addValidator, addValueChangeListener, clearInitialState, compareValues, decode, getConvertedValue, getConverterMessage, getRequiredMessage, getSubmittedValue, getValidator, getValidatorMessage, getValidators, getValueChangeListener, getValueChangeListeners, isEmpty, isImmediate, isLocalValueSet, isRequired, isValid, markInitialState, removeValidator, removeValueChangeListener, resetValue, setConverterMessage, setImmediate, setLocalValueSet, setRequired, setRequiredMessage, setSubmittedValue, setValid, setValidator, setValidatorMessage, setValue, setValueChangeListener, validate, validateValue
getConverter, getLocalValue, setConverter
addClientBehavior, addFacesListener, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getPassThroughAttributes, getRenderer, getValueBinding, isRendered, isTransient, processRestoreState, processSaveState, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setTransient, setValueBinding, subscribeToEvent, unsubscribeFromEvent
encodeAll, getClientId, getCompositeComponentParent, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, setValueExpression
public static final String COMPONENT_TYPE
public static final String COMPONENT_FAMILY
protected Boolean removeEmpty
protected transient UIEditableList parentList
protected transient boolean parentListSet
public UIEditableList()
protected final org.nuxeo.ecm.platform.ui.web.component.list.UIEditableList.InternalState getInternalState(boolean create)
protected final org.nuxeo.ecm.platform.ui.web.component.list.StampState getStampState()
protected final void initializeState(boolean force)
public Object saveState(javax.faces.context.FacesContext context)
saveState
in interface javax.faces.component.StateHolder
saveState
in class javax.faces.component.UIInput
public Object getValue()
getValue
in interface javax.faces.component.ValueHolder
getValue
in class javax.faces.component.UIInput
public void restoreState(javax.faces.context.FacesContext context, Object state)
restoreState
in interface javax.faces.component.StateHolder
restoreState
in class javax.faces.component.UIInput
protected static boolean valueChanged(Object cached, Object current)
protected void flushCachedModel()
public void resetCachedModel()
Can be useful when re-rendering a list with ajax and not wanting to keep cached values already submitted.
resetCachedModel
in interface ResettableComponent
protected final Object saveRequestMapModelValue()
This is useful for restoring this value in the request map.
protected final void restoreRequestMapModelValue(Object value)
protected final void exposeRequestMapModelValue(Object oldRequestValue)
protected final void preRowDataChange()
This method should be called right before the rowData changes. It saves the internal states of all the stamps of this component so that they can be restored when the rowData is reverted.
protected final void postRowDataChange(Object oldRequestValue)
This method should be called right after the rowData changes. It sets up the var EL variable to be the current rowData. It also sets up the internal states of all the stamps of this component to match this new rowData.
public ProtectedEditableModel getProtectedModel(EditableModel model)
protected ProtectedEditableModel getParentList()
protected Object getCurrencyKeyForInitialStampState()
public final EditableModel getEditableModel()
protected EditableModel createEditableModel(EditableModel current, Object value)
current
- the current CollectionModel, or null if there is none.value
- this is the value returned from getValue()
public final boolean isRowAvailable()
EditableModel.isRowAvailable()
public final boolean isRowModified()
EditableModel.isRowModified()
public final int getRowCount()
EditableModel.getRowCount()
public final int getRowIndex()
EditableModel.getRowIndex()
public final Integer getRowKey()
EditableModel.getRowKey()
public final Object getRowData()
EditableModel.getRowData()
public void setRowIndex(int rowIndex)
This method calls preRowDataChange()
and postRowDataChange(java.lang.Object)
as appropriate.
rowIndex
- The rowIndex of the row that should be made current. Use -1 to clear the current row.EditableModel.setRowIndex(int)
public void setRowKey(Integer rowKey)
This method calls preRowDataChange()
and postRowDataChange(java.lang.Object)
as appropriate.
rowKey
- The rowKey of the row that should be made current. Use null to clear the current row.EditableModel.setRowKey(java.lang.Integer)
public final void recordValueModified(int index, Object newValue)
public boolean addValue(Object value)
value
- the value to addpublic void insertValue(int index, Object value)
IllegalArgumentException
- if model does not handle this index.public Object moveValue(int fromIndex, int toIndex)
IllegalArgumentException
- if model does not handle one of given indexes.public Object removeValue(int index)
IllegalArgumentException
- if model does not handle this index.public Object getTemplate()
public final void setTemplate(Object template)
public Boolean getDiff()
public void setDiff(Boolean diff)
public Boolean getRemoveEmpty()
public void setRemoveEmpty(Boolean removeEmpty)
public String getContainerClientId(javax.faces.context.FacesContext context)
getContainerClientId
in class javax.faces.component.UIComponent
public String getRendererType()
getRendererType
in class javax.faces.component.UIComponentBase
public void setRendererType(String rendererType)
setRendererType
in class javax.faces.component.UIComponentBase
public final void encodeBegin(javax.faces.context.FacesContext context) throws IOException
encodeBegin
in class javax.faces.component.UIComponentBase
IOException
public void encodeEnd(javax.faces.context.FacesContext context) throws IOException
encodeEnd
in class javax.faces.component.UIComponentBase
IOException
public boolean getRendersChildren()
getRendersChildren
in class javax.faces.component.UIComponentBase
public void encodeChildren(javax.faces.context.FacesContext context) throws IOException
encodeChildren
in class javax.faces.component.UIComponentBase
IOException
protected void encodeTemplate(javax.faces.context.FacesContext context) throws IOException
IOException
public void broadcast(javax.faces.event.FacesEvent event)
broadcast
in class javax.faces.component.UIComponentBase
event
- a FacesEventjavax.faces.event.AbortProcessingException
public void queueEvent(javax.faces.event.FacesEvent event)
queueEvent
in class javax.faces.component.UIComponentBase
event
- a FacesEventpublic boolean visitTree(javax.faces.component.visit.VisitContext context, javax.faces.component.visit.VisitCallback callback)
visitTree
in class javax.faces.component.UIComponent
public void processDecodes(javax.faces.context.FacesContext context)
processDecodes
in class javax.faces.component.UIInput
public void processValidators(javax.faces.context.FacesContext context)
processValidators
in class javax.faces.component.UIInput
public void processUpdates(javax.faces.context.FacesContext context)
processUpdates
in class javax.faces.component.UIInput
public void updateModel(javax.faces.context.FacesContext context)
updateModel
in class javax.faces.component.UIInput
protected void processFacetsAndChildren(javax.faces.context.FacesContext context, javax.faces.event.PhaseId phaseId)
protected final void processComponent(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.event.PhaseId phaseId)
public boolean invokeOnComponent(javax.faces.context.FacesContext context, String clientId, javax.faces.component.ContextCallback callback) throws javax.faces.FacesException
invokeOnComponent
in class javax.faces.component.UIComponentBase
javax.faces.FacesException
Copyright © 2018 Nuxeo. All rights reserved.