com.sun.faces.context
public class StateContext.AddRemoveListener extends java.lang.Object implements javax.faces.event.SystemEventListener
Modifier and Type | Field and Description |
---|---|
private java.util.List<ComponentStruct> |
dynamicActions
Stores the list of adds/removes.
|
private java.util.HashMap<java.lang.String,javax.faces.component.UIComponent> |
dynamicComponents
Stores the hash map of dynamic components.
|
private StateContext |
stateCtx
Stores the state context we work for,
|
Constructor and Description |
---|
StateContext.AddRemoveListener(javax.faces.context.FacesContext context)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
findFacetNameForComponent(javax.faces.component.UIComponent component)
Return the facet name for the given component or null if the
component is not the value of a facets map entry.
|
java.util.List<ComponentStruct> |
getDynamicActions()
Get the list of adds/removes.
|
java.util.HashMap<java.lang.String,javax.faces.component.UIComponent> |
getDynamicComponents()
Get the hash map of dynamic components.
|
private void |
handleAdd(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Handle the add.
|
private void |
handleAddRemoveWithAutoPrune(javax.faces.component.UIComponent component,
ComponentStruct struct)
Methods that takes care of pruning and adding an action to the
dynamic action list.
|
private void |
handleRemove(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Handle the remove.
|
boolean |
isListenerForSource(java.lang.Object source)
Are we listening for these particular changes.
|
void |
processEvent(javax.faces.event.SystemEvent event)
Process the add/remove event.
|
private StateContext stateCtx
private java.util.List<ComponentStruct> dynamicActions
private transient java.util.HashMap<java.lang.String,javax.faces.component.UIComponent> dynamicComponents
public StateContext.AddRemoveListener(javax.faces.context.FacesContext context)
context
- the Faces context.public java.util.List<ComponentStruct> getDynamicActions()
public java.util.HashMap<java.lang.String,javax.faces.component.UIComponent> getDynamicComponents()
public void processEvent(javax.faces.event.SystemEvent event) throws javax.faces.event.AbortProcessingException
processEvent
in interface javax.faces.event.SystemEventListener
event
- the add/remove event.javax.faces.event.AbortProcessingException
- when processing should be aborted.public boolean isListenerForSource(java.lang.Object source)
Note we are only interested in UIComponent adds/removes that are not the UIViewRoot itself.
isListenerForSource
in interface javax.faces.event.SystemEventListener
source
- the source object we might be listening for.private void handleRemove(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
context
- the Faces context.component
- the UI component to add to the list as a REMOVE.private void handleAdd(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
context
- the Faces context.component
- the UI component to add to the list as an ADD.private java.lang.String findFacetNameForComponent(javax.faces.component.UIComponent component)
component
- the component to look for in the facets map entry value.private void handleAddRemoveWithAutoPrune(javax.faces.component.UIComponent component, ComponentStruct struct)
If you add a component and the dynamic action list does not contain the component yet then add it to the dynamic action list, regardless whether or not if was an ADD or REMOVE.
Else if you add a component and it is already in the dynamic action list and it is the only action for that client id in the dynamic action list then: 1) If the previous action was an ADD then a) If the current action is a REMOVE then remove the component out of the dynamic action list. b) If the current action is an ADD then throw a FacesException. 2) If the previous action was a REMOVE then a) If the current action is an ADD then add it to the dynamic action list. b) If the current action is a REMOVE then throw a FacesException.
Else if a REMOVE and ADD where captured before then: 1) If the current action is REMOVE then remove the last dynamic action out of the dynamic action list. 2) If the current action is ADD then throw a FacesException.
component
- the UI component.struct
- the dynamic action.Copyright © 2002-2010 Oracle America, Inc. All Rights Reserved.