public class StateContext.DynamicAddRemoveListener extends StateContext.AddRemoveListener
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.
|
Constructor and Description |
---|
DynamicAddRemoveListener(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.
|
protected 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.
|
protected void |
handleRemove(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Handle the remove.
|
isListenerForSource, processEvent
private java.util.List<ComponentStruct> dynamicActions
private transient java.util.HashMap<java.lang.String,javax.faces.component.UIComponent> dynamicComponents
public DynamicAddRemoveListener(javax.faces.context.FacesContext context)
context
- the Faces context.public java.util.List<ComponentStruct> getDynamicActions()
getDynamicActions
in class StateContext.AddRemoveListener
public java.util.HashMap<java.lang.String,javax.faces.component.UIComponent> getDynamicComponents()
getDynamicComponents
in class StateContext.AddRemoveListener
protected void handleRemove(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
handleRemove
in class StateContext.AddRemoveListener
context
- the Faces context.component
- the UI component to add to the list as a REMOVE.protected void handleAdd(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
handleAdd
in class StateContext.AddRemoveListener
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-2013 Oracle America, Inc. All Rights Reserved.