Package com.sun.faces.context
Class StateContext
- java.lang.Object
-
- com.sun.faces.context.StateContext
-
public class StateContext extends Object
Context for dealing with partial state saving mechanics.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classStateContext.DynamicAddRemoveListenerA system event listener which is used to listen for changes on the component tree after restore view and before rendering out the view.classStateContext.NoopAddRemoveListenerclassStateContext.StatelessAddRemoveListenerAn AddRemoveListener that implements the new dynamic component strategy where no state is managed by the listener itself.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancomponentAddedDynamically(UIComponent c)List<ComponentStruct>getDynamicActions()Get the dynamic list (of adds and removes).HashMap<String,UIComponent>getDynamicComponents()Get the hash map of dynamic components.intgetIndexOfDynamicallyAddedChildInParent(UIComponent c)static StateContextgetStateContext(FacesContext ctx)booleanhasOneOrMoreDynamicChild(UIComponent parent)booleanisPartialStateSaving(FacesContext ctx, String viewId)static voidrelease(FacesContext facesContext)Release the state context.voidsetTrackViewModifications(boolean trackMods)Toggles the current modification tracking status.voidstartTrackViewModifications(FacesContext ctx, UIViewRoot root)Installs aSystemEventListeneron theUIViewRootto track components added to or removed from the view.booleantrackViewModifications()
-
-
-
Method Detail
-
release
public static void release(FacesContext facesContext)
Release the state context.- Parameters:
facesContext- the Faces context.
-
getStateContext
public static StateContext getStateContext(FacesContext ctx)
- Parameters:
ctx- theFacesContextfor the current request- Returns:
StateContextfor this request
-
isPartialStateSaving
public boolean isPartialStateSaving(FacesContext ctx, String viewId)
- Parameters:
ctx- FacesContext.viewId- the view ID to check or null if viewId is unknown.- Returns:
trueif partial state saving should be used for the specified view ID, otherwisefalse
-
trackViewModifications
public boolean trackViewModifications()
- Returns:
trueif view modifications outside of the initial construction of the view are being tracked.
-
startTrackViewModifications
public void startTrackViewModifications(FacesContext ctx, UIViewRoot root)
Installs aSystemEventListeneron theUIViewRootto track components added to or removed from the view.- Parameters:
ctx- the involved faces contextroot- the involved view root
-
setTrackViewModifications
public void setTrackViewModifications(boolean trackMods)
Toggles the current modification tracking status.- Parameters:
trackMods- iftrueand the listener installed bystartTrackViewModificationsis* present, then view modifications will be tracked. Iffalse, then modification events will be ignored.
-
componentAddedDynamically
public boolean componentAddedDynamically(UIComponent c)
- Parameters:
c- the UIComponent to check- Returns:
trueif the component was added after the initial view construction
-
getIndexOfDynamicallyAddedChildInParent
public int getIndexOfDynamicallyAddedChildInParent(UIComponent c)
-
hasOneOrMoreDynamicChild
public boolean hasOneOrMoreDynamicChild(UIComponent parent)
-
getDynamicActions
public List<ComponentStruct> getDynamicActions()
Get the dynamic list (of adds and removes).- Returns:
- the dynamic list
-
getDynamicComponents
public HashMap<String,UIComponent> getDynamicComponents()
Get the hash map of dynamic components.- Returns:
- the hash map of dynamic components.
-
-