Top Description Inners Fields Constructors Methods
com.sun.faces.application.view

public Class FaceletFullStateManagementStrategy

extends StateManagementStrategy
Class Inheritance
Static Imports
com.sun.faces.RIConstants.DYNAMIC_ACTIONS, .RIConstants.DYNAMIC_COMPONENT, com.sun.faces.util.ComponentStruct.ADD, .ComponentStruct.REMOVE, .Util.isAnyNull, .Util.isEmpty, .Util.loadClass, java.util.logging.Level.FINEST, .Level.WARNING, javax.faces.application.ProjectStage.Development, javax.faces.component.visit.VisitHint.SKIP_ITERATION, .VisitResult.ACCEPT, .VisitResult.COMPLETE, .VisitResult.REJECT

A state management strategy for FSS.
Author
Manfred Riem ([email protected])

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
FaceletFullStateManagementStrategy.FacetNode

Inner class used to store a facet in the saved component tree.

private static class
FaceletFullStateManagementStrategy.TreeNode

Inner class used to store a node in the saved component tree.

Field Summary

Modifier and TypeField and Description
private Map<String, Class<?>>
classMap

Stores the class map.

private boolean
isDevelopmentMode

Are we in development mode.

private static final Logger
LOGGER

Stores the logger.

private static final String
SKIP_ITERATION_HINT

Stores the skip hint.

Constructor Summary

AccessConstructor and Description
public
public
FaceletFullStateManagementStrategy(FacesContext
the Faces context.
context
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
private void
captureChild(List<FaceletFullStateManagementStrategy.TreeNode>
the tree.
tree
,
int
the parent.
parent
,
UIComponent
the component.
component
)

Capture the child.

private void
captureFacet(List<FaceletFullStateManagementStrategy.TreeNode>
the tree.
tree
,
int
the parent.
parent
,
String
the facet name.
name
,
UIComponent
the component.
component
)

Capture the facet.

private void
captureRest(List<FaceletFullStateManagementStrategy.TreeNode>
the tree.
tree
,
int
the position.
pos
,
UIComponent
the component.
component
)

Capture the rest.

private int

Returns:

the calculated index.
getProperChildIndex
(UIComponent
the UI component.
component
)

Helper method that determines what the index of the given child component will be taking transient siblings into account.

private UIComponent
locateComponentByClientId(final FacesContext
the Faces context.
context
,
final UIComponent subTree, final String
the client id of the component to find.
clientId
)

Find the given component in the component tree.

private UIComponent

Returns:

the UI component.
newInstance
(FaceletFullStateManagementStrategy.TreeNode
the tree node.
treeNode
)

Create a new component instance.

private void
pruneAndReAddToDynamicActions(List<ComponentStruct>
the dynamic action list.
dynamicActionList
,
ComponentStruct
the component struct to add.
struct
)

Methods that takes care of pruning and re-adding an action to the dynamic action list.

private void
restoreComponentState(final FacesContext
the Faces context.
context
,
final HashMap<String, Object>
the component state.
state
)

Restore the component state.

private void
restoreDynamicActions(FacesContext
the Faces context.
context
,
StateContext
the state context.
stateContext
,
HashMap<String, Object>
the state.
state
)

Restore the list of dynamic actions and replay them.

private void
restoreDynamicAdd(FacesContext
the Faces context.
context
,
Map<String, Object>
the state.
state
,
ComponentStruct
the component struct.
struct
)

Method that takes care of restoring a dynamic add.

private void
restoreDynamicRemove(FacesContext
the Faces context.
context
,
ComponentStruct
the component struct.
struct
)

Method that takes care of restoring a dynamic remove.

private UIViewRoot

Returns:

the view root.
restoreTree
(FacesContext
the Faces context.
context
,
String
the render kit id.
renderKitId
,
Object[]
the saved tree.
tree
)

Restore the component tree.

public UIViewRoot

Returns:

the view root.
restoreView
(FacesContext
the Faces context.
context
,
String
the view id.
viewId
,
String
the render kit id.
renderKitId
)

Implements abstract javax.faces.view.StateManagementStrategy.restoreView.

Restore the view.
private Object

Returns:

the saved state.
saveComponentState
(FacesContext
the Faces context.
context
)

Save the component state.

private void
saveDynamicActions(FacesContext
the Faces context.
context
,
StateContext
the state context.
stateContext
,
UIViewRoot
the state.
viewRoot
)

Save the dynamic actions.

public Object

Returns:

the saved view.
saveView
(FacesContext
the Faces context.
context
)

Implements abstract javax.faces.view.StateManagementStrategy.saveView.

Save the view.

Field Detail

classMapback to summary
private Map<String, Class<?>> classMap

Stores the class map.

isDevelopmentModeback to summary
private boolean isDevelopmentMode

Are we in development mode.

LOGGERback to summary
private static final Logger LOGGER

Stores the logger.

SKIP_ITERATION_HINTback to summary
private static final String SKIP_ITERATION_HINT

Stores the skip hint.

Constructor Detail

FaceletFullStateManagementStrategyback to summary
public FaceletFullStateManagementStrategy()

Constructor.

FaceletFullStateManagementStrategyback to summary
public FaceletFullStateManagementStrategy(FacesContext context)

Constructor.

Parameters
context:FacesContext

the Faces context.

Method Detail

captureChildback to summary
private void captureChild(List<FaceletFullStateManagementStrategy.TreeNode> tree, int parent, UIComponent component)

Capture the child.

Parameters
tree:List<FaceletFullStateManagementStrategy.TreeNode>

the tree.

parent:int

the parent.

component:UIComponent

the component.

captureFacetback to summary
private void captureFacet(List<FaceletFullStateManagementStrategy.TreeNode> tree, int parent, String name, UIComponent component)

Capture the facet.

Parameters
tree:List<FaceletFullStateManagementStrategy.TreeNode>

the tree.

parent:int

the parent.

name:String

the facet name.

component:UIComponent

the component.

captureRestback to summary
private void captureRest(List<FaceletFullStateManagementStrategy.TreeNode> tree, int pos, UIComponent component)

Capture the rest.

Parameters
tree:List<FaceletFullStateManagementStrategy.TreeNode>

the tree.

pos:int

the position.

component:UIComponent

the component.

getProperChildIndexback to summary
private int getProperChildIndex(UIComponent component)

Helper method that determines what the index of the given child component will be taking transient siblings into account.

Parameters
component:UIComponent

the UI component.

Returns:int

the calculated index.

locateComponentByClientIdback to summary
private UIComponent locateComponentByClientId(final FacesContext context, final UIComponent subTree, final String clientId)

Find the given component in the component tree.

Parameters
context:FacesContext

the Faces context.

clientId:String

the client id of the component to find.

newInstanceback to summary
private UIComponent newInstance(FaceletFullStateManagementStrategy.TreeNode treeNode) throws FacesException

Create a new component instance.

Parameters
treeNode:FaceletFullStateManagementStrategy.TreeNode

the tree node.

Returns:UIComponent

the UI component.

Exceptions
FacesException:
when a serious error occurs.
pruneAndReAddToDynamicActionsback to summary
private void pruneAndReAddToDynamicActions(List<ComponentStruct> dynamicActionList, ComponentStruct struct)

Methods that takes care of pruning and re-adding an action to the dynamic action list.

If you remove a component, re-add it to the same parent and then remove it again, you only have to capture the FIRST remove. Similarly if you add a component, remove it, and then re-add it to the same parent you only need to capture the LAST add.

Parameters
dynamicActionList:List<ComponentStruct>

the dynamic action list.

struct:ComponentStruct

the component struct to add.

restoreComponentStateback to summary
private void restoreComponentState(final FacesContext context, final HashMap<String, Object> state)

Restore the component state.

Parameters
context:FacesContext

the Faces context.

state:HashMap<String, Object>

the component state.

restoreDynamicActionsback to summary
private void restoreDynamicActions(FacesContext context, StateContext stateContext, HashMap<String, Object> state)

Restore the list of dynamic actions and replay them.

Parameters
context:FacesContext

the Faces context.

stateContext:StateContext

the state context.

state:HashMap<String, Object>

the state.

restoreDynamicAddback to summary
private void restoreDynamicAdd(FacesContext context, Map<String, Object> state, ComponentStruct struct)

Method that takes care of restoring a dynamic add.

Parameters
context:FacesContext

the Faces context.

state:Map<String, Object>

the state.

struct:ComponentStruct

the component struct.

restoreDynamicRemoveback to summary
private void restoreDynamicRemove(FacesContext context, ComponentStruct struct)

Method that takes care of restoring a dynamic remove.

Parameters
context:FacesContext

the Faces context.

struct:ComponentStruct

the component struct.

restoreTreeback to summary
private UIViewRoot restoreTree(FacesContext context, String renderKitId, Object[] tree) throws FacesException

Restore the component tree.

Parameters
context:FacesContext

the Faces context.

renderKitId:String

the render kit id.

tree:Object[]

the saved tree.

Returns:UIViewRoot

the view root.

Exceptions
FacesException:
when a serious error occurs.
restoreViewback to summary
public UIViewRoot restoreView(FacesContext context, String viewId, String renderKitId)

Implements abstract javax.faces.view.StateManagementStrategy.restoreView.

Restore the view.

Parameters
context:FacesContext

the Faces context.

viewId:String

the view id.

renderKitId:String

the render kit id.

Returns:UIViewRoot

the view root.

Annotations
@Override
saveComponentStateback to summary
private Object saveComponentState(FacesContext context)

Save the component state.

Parameters
context:FacesContext

the Faces context.

Returns:Object

the saved state.

saveDynamicActionsback to summary
private void saveDynamicActions(FacesContext context, StateContext stateContext, UIViewRoot viewRoot)

Save the dynamic actions.

Parameters
context:FacesContext

the Faces context.

stateContext:StateContext

the state context.

viewRoot:UIViewRoot

the state.

saveViewback to summary
public Object saveView(FacesContext context)

Implements abstract javax.faces.view.StateManagementStrategy.saveView.

Save the view.

Parameters
context:FacesContext

the Faces context.

Returns:Object

the saved view.

Annotations
@Override
com.sun.faces.application.view back to summary

private final Class FaceletFullStateManagementStrategy.FacetNode

extends TreeNode
Class Inheritance

Inner class used to store a facet in the saved component tree.

Field Summary

Modifier and TypeField and Description
private String
facetName

Stores the facet name.

private static final long

Constructor Summary

AccessConstructor and Description
public
FacetNode()

Constructor.

public
FacetNode(int
the parent.
parent
,
String
the facet name.
name
,
UIComponent
the component.
c
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public void
public void
Inherited from com.sun.faces.application.view.FaceletFullStateManagementStrategy.TreeNode:
getParent

Field Detail

facetNameback to summary
private String facetName

Stores the facet name.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.sun.faces.application.view.FaceletFullStateManagementStrategy.TreeNode.serialVersionUID.

Stores the serial version UID.

Constructor Detail

FacetNodeback to summary
public FacetNode()

Constructor.

FacetNodeback to summary
public FacetNode(int parent, String name, UIComponent c)

Constructor.

Parameters
parent:int

the parent.

name:String

the facet name.

c:UIComponent

the component.

Method Detail

readExternalback to summary
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException

Overrides com.sun.faces.application.view.FaceletFullStateManagementStrategy.TreeNode.readExternal.

Implements java.io.Externalizable.readExternal.

Read the facet node in.

Parameters
in:ObjectInput

the object input.

Annotations
@Override
Exceptions
IOException:
when an I/O error occurs.
ClassNotFoundException:
when the class could not be found.
writeExternalback to summary
public void writeExternal(ObjectOutput out) throws IOException

Overrides com.sun.faces.application.view.FaceletFullStateManagementStrategy.TreeNode.writeExternal.

Implements java.io.Externalizable.writeExternal.

Write the facet node out.

Parameters
out:ObjectOutput

the object output.

Annotations
@Override
Exceptions
IOException:
when an I/O error occurs.
com.sun.faces.application.view back to summary

private Class FaceletFullStateManagementStrategy.TreeNode

extends Object
implements Externalizable
Class Inheritance
  • java.lang.Object
  • com.sun.faces.application.view.FaceletFullStateManagementStrategy.TreeNode
All Implemented Interfaces
java.io.Externalizable, java.io.Serializable
Known Direct Subclasses
com.sun.faces.application.view.FaceletFullStateManagementStrategy.FacetNode

Inner class used to store a node in the saved component tree.

Field Summary

Modifier and TypeField and Description
private String
componentType

Stores the component type.

private String
id

Stores the id.

private static final String
NULL_ID

Stores the NULL_ID constant.

private int
parent

Stores the parent.

private static final long
serialVersionUID

Stores the serial version UID.

Constructor Summary

AccessConstructor and Description
public
TreeNode()

Constructor.

public
TreeNode(int
the parent.
parent
,
UIComponent
the component.
c
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public int
public void
readExternal(ObjectInput
the object input.
in
)

Implements java.io.Externalizable.readExternal.

Read the tree node in.
public void
writeExternal(ObjectOutput
the object output.
out
)

Implements java.io.Externalizable.writeExternal.

Write the tree node out.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

componentTypeback to summary
private String componentType

Stores the component type.

idback to summary
private String id

Stores the id.

NULL_IDback to summary
private static final String NULL_ID

Stores the NULL_ID constant.

parentback to summary
private int parent

Stores the parent.

serialVersionUIDback to summary
private static final long serialVersionUID

Stores the serial version UID.

Constructor Detail

TreeNodeback to summary
public TreeNode()

Constructor.

TreeNodeback to summary
public TreeNode(int parent, UIComponent c)

Constructor.

Parameters
parent:int

the parent.

c:UIComponent

the component.

Method Detail

getParentback to summary
public int getParent()
readExternalback to summary
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException

Implements java.io.Externalizable.readExternal.

Read the tree node in.

Parameters
in:ObjectInput

the object input.

Annotations
@Override
Exceptions
IOException:
when an I/O error occurs.
ClassNotFoundException:
when the class could not be found.
writeExternalback to summary
public void writeExternal(ObjectOutput out) throws IOException

Implements java.io.Externalizable.writeExternal.

Write the tree node out.

Parameters
out:ObjectOutput

the object output.

Annotations
@Override
Exceptions
IOException:
when an I/O error occurs.