org.apache.myfaces.custom.conversation
Class UIEnsureConversation

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UICommand
              extended by org.apache.myfaces.custom.conversation.AbstractConversationComponent
                  extended by org.apache.myfaces.custom.conversation.UIEnsureConversation
All Implemented Interfaces:
javax.faces.component.ActionSource, javax.faces.component.ActionSource2, javax.faces.component.StateHolder

public class UIEnsureConversation
extends AbstractConversationComponent

Ensures a named conversation is running

check if a conversation is active.

The way this is done here is sub-optimal, once we are on jsf 1.2 it should be possible to check this before ANY rendering - and maybe to invoke a navigation then

Author:
imario@apache.org

Field Summary
static java.lang.String COMPONENT_TYPE
           
 
Fields inherited from class org.apache.myfaces.custom.conversation.AbstractConversationComponent
COMPONENT_FAMILY
 
Fields inherited from class javax.faces.component.UIComponent
bindings
 
Constructor Summary
UIEnsureConversation()
           
 
Method Summary
protected  void checkConversation(javax.faces.context.FacesContext context, java.lang.String name)
           
 void decode(javax.faces.context.FacesContext context)
           
 void encodeBegin(javax.faces.context.FacesContext context)
           
 java.lang.Boolean getPreCheck()
          Delegate the check to the action method at all.
 java.lang.String getRedirectTo()
          redirect to the given view if the conversation is not running
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
           
 java.lang.Object saveState(javax.faces.context.FacesContext context)
           
 void setPreCheck(java.lang.Boolean preCheck)
           
 void setRedirectTo(java.lang.String redirectTo)
           
 
Methods inherited from class org.apache.myfaces.custom.conversation.AbstractConversationComponent
getFamily, getName, setName
 
Methods inherited from class javax.faces.component.UICommand
addActionListener, broadcast, getAction, getActionExpression, getActionListener, getActionListeners, getValue, isImmediate, queueEvent, removeActionListener, setAction, setActionExpression, setActionListener, setImmediate, setValue
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, invokeOnComponent, isRendered, isTransient, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding
 
Methods inherited from class javax.faces.component.UIComponent
encodeAll, getContainerClientId, getValueExpression, setValueExpression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPONENT_TYPE

public static final java.lang.String COMPONENT_TYPE
See Also:
Constant Field Values
Constructor Detail

UIEnsureConversation

public UIEnsureConversation()
Method Detail

encodeBegin

public void encodeBegin(javax.faces.context.FacesContext context)
                 throws java.io.IOException
Overrides:
encodeBegin in class javax.faces.component.UIComponentBase
Throws:
java.io.IOException

decode

public void decode(javax.faces.context.FacesContext context)
Overrides:
decode in class javax.faces.component.UIComponentBase

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class AbstractConversationComponent

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class AbstractConversationComponent

checkConversation

protected void checkConversation(javax.faces.context.FacesContext context,
                                 java.lang.String name)
                          throws java.io.IOException
Throws:
java.io.IOException

getRedirectTo

public java.lang.String getRedirectTo()
redirect to the given view if the conversation is not running

Returns:

setRedirectTo

public void setRedirectTo(java.lang.String redirectTo)

getPreCheck

public java.lang.Boolean getPreCheck()
Delegate the check to the action method at all. The user has to check if a conversation is running. A action method is mandatory.

Returns:

setPreCheck

public void setPreCheck(java.lang.Boolean preCheck)


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.