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 class
StateContext.DynamicAddRemoveListener
A system event listener which is used to listen for changes on the component tree after restore view and before rendering out the view.class
StateContext.NoopAddRemoveListener
class
StateContext.StatelessAddRemoveListener
An 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 boolean
componentAddedDynamically(UIComponent c)
List<ComponentStruct>
getDynamicActions()
Get the dynamic list (of adds and removes).HashMap<String,UIComponent>
getDynamicComponents()
Get the hash map of dynamic components.int
getIndexOfDynamicallyAddedChildInParent(UIComponent c)
static StateContext
getStateContext(FacesContext ctx)
boolean
hasOneOrMoreDynamicChild(UIComponent parent)
boolean
isPartialStateSaving(FacesContext ctx, String viewId)
static void
release(FacesContext facesContext)
Release the state context.void
setTrackViewModifications(boolean trackMods)
Toggles the current modification tracking status.void
startTrackViewModifications(FacesContext ctx, UIViewRoot root)
Installs aSystemEventListener
on theUIViewRoot
to track components added to or removed from the view.boolean
trackViewModifications()
-
-
-
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
- theFacesContext
for the current request- Returns:
StateContext
for 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:
true
if partial state saving should be used for the specified view ID, otherwisefalse
-
trackViewModifications
public boolean trackViewModifications()
- Returns:
true
if view modifications outside of the initial construction of the view are being tracked.
-
startTrackViewModifications
public void startTrackViewModifications(FacesContext ctx, UIViewRoot root)
Installs aSystemEventListener
on theUIViewRoot
to 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
- iftrue
and the listener installed bystartTrackViewModifications
is* 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:
true
if 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.
-
-