[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...
Gavin King
gavin.king at jboss.com
Wed Oct 25 17:18:55 EDT 2006
User: gavin
Date: 06/10/25 17:18:55
Modified: src/main/org/jboss/seam/core Manager.java Pageflow.java
Log:
refactor
Revision Changes Path
1.103 +4 -19 jboss-seam/src/main/org/jboss/seam/core/Manager.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Manager.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Manager.java,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -b -r1.102 -r1.103
--- Manager.java 25 Oct 2006 21:08:40 -0000 1.102
+++ Manager.java 25 Oct 2006 21:18:55 -0000 1.103
@@ -41,7 +41,7 @@
*
* @author Gavin King
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision: 1.102 $
+ * @version $Revision: 1.103 $
*/
@Scope(ScopeType.EVENT)
@Name("org.jboss.seam.core.manager")
@@ -53,9 +53,6 @@
private static final String NAME = Seam.getComponentName(Manager.class);
public static final String CONVERSATION_ID = NAME + ".conversationId";
public static final String CONVERSATION_IS_LONG_RUNNING = NAME + ".conversationIsLongRunning";
- public static final String PAGEFLOW_COUNTER = NAME + ".pageflowCounter";
- public static final String PAGEFLOW_NODE_NAME = NAME + ".pageflowNodeName";
- public static final String PAGEFLOW_NAME = NAME + ".pageflowName";
//The id of the current conversation
private String currentConversationId;
@@ -357,19 +354,7 @@
if ( Contexts.isPageContextActive() && Init.instance().isJbpmInstalled() )
{
- Pageflow pageflow = Pageflow.instance();
- if ( pageflow.isInProcess() )
- {
- Contexts.getPageContext().set( PAGEFLOW_NAME, pageflow.getProcessInstance().getProcessDefinition().getName() );
- Contexts.getPageContext().set( PAGEFLOW_NODE_NAME, pageflow.getNode().getName() );
- Contexts.getPageContext().set( PAGEFLOW_COUNTER, pageflow.getPageflowCounter() );
- }
- else
- {
- Contexts.getPageContext().remove(PAGEFLOW_NAME);
- Contexts.getPageContext().remove(PAGEFLOW_NODE_NAME);
- Contexts.getPageContext().remove(PAGEFLOW_COUNTER);
- }
+ Pageflow.instance().store();
}
}
@@ -984,8 +969,8 @@
noConversation();
//stuff from jPDL takes precedence
- String pageflowName = (String) Contexts.getPageContext().get(Manager.PAGEFLOW_NAME);
- String pageflowNodeName = (String) Contexts.getPageContext().get(Manager.PAGEFLOW_NODE_NAME);
+ String pageflowName = (String) Contexts.getPageContext().get(Pageflow.PAGEFLOW_NAME);
+ String pageflowNodeName = (String) Contexts.getPageContext().get(Pageflow.PAGEFLOW_NODE_NAME);
String noConversationViewId = null;
if (pageflowName==null || pageflowNodeName==null)
1.36 +28 -4 jboss-seam/src/main/org/jboss/seam/core/Pageflow.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Pageflow.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Pageflow.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- Pageflow.java 25 Oct 2006 21:08:40 -0000 1.35
+++ Pageflow.java 25 Oct 2006 21:18:55 -0000 1.36
@@ -12,6 +12,7 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
+import org.jboss.seam.Seam;
import org.jboss.seam.annotations.Intercept;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
@@ -34,6 +35,10 @@
@Intercept(NEVER)
public class Pageflow extends AbstractMutable implements Serializable
{
+ private static final String NAME = Seam.getComponentName(Pageflow.class);
+ public static final String PAGEFLOW_COUNTER = NAME + ".counter";
+ public static final String PAGEFLOW_NODE_NAME = NAME + ".nodeName";
+ public static final String PAGEFLOW_NAME = NAME + ".name";
private static final Log log = LogFactory.getLog(Pageflow.class);
@@ -74,8 +79,8 @@
if ( processInstance!=null )
{
- String pageflowName = (String) Contexts.getPageContext().get(Manager.PAGEFLOW_NAME);
- String pageflowNodeName = (String) Contexts.getPageContext().get(Manager.PAGEFLOW_NODE_NAME);
+ String pageflowName = (String) Contexts.getPageContext().get(PAGEFLOW_NAME);
+ String pageflowNodeName = (String) Contexts.getPageContext().get(PAGEFLOW_NODE_NAME);
boolean canReposition = getPage().isBackEnabled() &&
processInstance.getProcessDefinition().getName().equals(pageflowName) && //probably not necessary
pageflowNodeName!=null; //probably not necessary
@@ -92,7 +97,7 @@
{
//check the counter to detect illegal use of backbutton
//Integer counter = (Integer) attributes.get(Manager.PAGEFLOW_COUNTER);
- Integer pageCounter = (Integer) Contexts.getPageContext().get(Manager.PAGEFLOW_COUNTER);
+ Integer pageCounter = (Integer) Contexts.getPageContext().get(PAGEFLOW_COUNTER);
if ( pageCounter!=null && getPageflowCounter()!=pageCounter )
{
illegalNavigationError();
@@ -278,4 +283,23 @@
return "Pageflow(" + name + ")";
}
+ /**
+ * Store the current pageflow state in the page context
+ */
+ public void store()
+ {
+ if ( isInProcess() )
+ {
+ Contexts.getPageContext().set( PAGEFLOW_NAME, getProcessInstance().getProcessDefinition().getName() );
+ Contexts.getPageContext().set( PAGEFLOW_NODE_NAME, getNode().getName() );
+ Contexts.getPageContext().set( PAGEFLOW_COUNTER, getPageflowCounter() );
+ }
+ else
+ {
+ Contexts.getPageContext().remove(PAGEFLOW_NAME);
+ Contexts.getPageContext().remove(PAGEFLOW_NODE_NAME);
+ Contexts.getPageContext().remove(PAGEFLOW_COUNTER);
+ }
+ }
+
}
More information about the jboss-cvs-commits
mailing list