You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by im...@apache.org on 2006/05/19 20:38:37 UTC
svn commit: r407879 - in /myfaces/tomahawk/trunk/sandbox:
core/src/main/java/org/apache/myfaces/custom/conversation/
core/src/main/resources-facesconfig/META-INF/ core/src/main/tld/
examples/src/main/webapp/WEB-INF/ examples/src/main/webapp/conversation/
Author: imario
Date: Fri May 19 11:38:36 2006
New Revision: 407879
URL: http://svn.apache.org/viewvc?rev=407879&view=rev
Log:
added s:separateConversationContext which allows you to render links which will start a new conversation context
Added:
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/SeparateConversationContextTag.java (with props)
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UISeparateConversationContext.java (with props)
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/index.jsp (with props)
Modified:
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/ConversationManager.java
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/ConversationRequestParameterProvider.java
myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml
myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/pageConversation.jsp
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardFinish.jsp
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardPage1.jsp
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardPage2.jsp
myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardPage3.jsp
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/ConversationManager.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/ConversationManager.java?rev=407879&r1=407878&r2=407879&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/ConversationManager.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/ConversationManager.java Fri May 19 11:38:36 2006
@@ -164,7 +164,7 @@
throw new IllegalStateException("cant find a requestMap or requestParameterMap");
}
}
-
+
Long conversationContextId = (Long) requestMap.get(CONVERSATION_CONTEXT_REQ);
if (conversationContextId == null)
{
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/ConversationRequestParameterProvider.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/ConversationRequestParameterProvider.java?rev=407879&r1=407878&r2=407879&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/ConversationRequestParameterProvider.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/ConversationRequestParameterProvider.java Fri May 19 11:38:36 2006
@@ -31,6 +31,11 @@
public String getFieldValue(String field)
{
+ if (UISeparateConversationContext.isInSeparationMode())
+ {
+ return null;
+ }
+
ConversationManager conversationManager = ConversationManager.getInstance();
if (conversationManager == null)
{
@@ -46,6 +51,11 @@
public String[] getFields()
{
+ if (UISeparateConversationContext.isInSeparationMode())
+ {
+ return null;
+ }
+
ConversationManager conversationManager = ConversationManager.getInstance();
if (conversationManager == null)
{
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/SeparateConversationContextTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/SeparateConversationContextTag.java?rev=407879&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/SeparateConversationContextTag.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/SeparateConversationContextTag.java Fri May 19 11:38:36 2006
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.myfaces.custom.conversation;
+
+import org.apache.myfaces.shared_tomahawk.taglib.UIComponentTagBase;
+
+/**
+ * Ends a conversation
+ *
+ * @author imario@apache.org
+ */
+public class SeparateConversationContextTag extends UIComponentTagBase
+{
+ public String getComponentType()
+ {
+ return UISeparateConversationContext.COMPONENT_TYPE;
+ }
+
+ public String getRendererType()
+ {
+ return null;
+ }
+}
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/SeparateConversationContextTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/SeparateConversationContextTag.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/SeparateConversationContextTag.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UISeparateConversationContext.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UISeparateConversationContext.java?rev=407879&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UISeparateConversationContext.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UISeparateConversationContext.java Fri May 19 11:38:36 2006
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.myfaces.custom.conversation;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
+
+/**
+ * separate the current context from the to be rendered children.
+ * E.g. when you render commandLinks they will start a new conversationContext
+ *
+ * @author imario@apache.org
+ */
+public class UISeparateConversationContext extends UIComponentBase
+{
+ public static final String COMPONENT_FAMILY = "javax.faces.Component";
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.SeparateConversationContext";
+
+ private final static ThreadLocal inSeperationMode = new ThreadLocal();
+
+ public static void setInSeparationMode(boolean seperationMode)
+ {
+ inSeperationMode.set(seperationMode?Boolean.TRUE:Boolean.FALSE);
+ }
+
+ public static boolean isInSeparationMode()
+ {
+ return Boolean.TRUE.equals(inSeperationMode.get());
+ }
+
+ public void encodeBegin(FacesContext context) throws IOException
+ {
+ super.encodeBegin(context);
+
+ setInSeparationMode(true);
+ }
+
+ public void encodeChildren(FacesContext context) throws IOException
+ {
+ try
+ {
+ RendererUtils.renderChildren(context, this);
+ }
+ finally
+ {
+ setInSeparationMode(false);
+ }
+ }
+
+ public boolean getRendersChildren()
+ {
+ return true;
+ }
+
+ public String getFamily()
+ {
+ return COMPONENT_FAMILY;
+ }
+}
\ No newline at end of file
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UISeparateConversationContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UISeparateConversationContext.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UISeparateConversationContext.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml?rev=407879&r1=407878&r2=407879&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources-facesconfig/META-INF/faces-config.xml Fri May 19 11:38:36 2006
@@ -138,6 +138,10 @@
<component-class>org.apache.myfaces.custom.conversation.UIEndConversation</component-class>
</component>
<component>
+ <component-type>org.apache.myfaces.SeparateConversationContext</component-type>
+ <component-class>org.apache.myfaces.custom.conversation.UISeparateConversationContext</component-class>
+ </component>
+ <component>
<component-type>org.apache.myfaces.Conversation</component-type>
<component-class>org.apache.myfaces.custom.conversation.UIConversation</component-class>
</component>
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld?rev=407879&r1=407878&r2=407879&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/tld/myfaces_sandbox.tld Fri May 19 11:38:36 2006
@@ -1097,6 +1097,12 @@
&standard_conversation_attributes;
</tag>
<tag>
+ <name>separateConversationContext</name>
+ <tag-class>org.apache.myfaces.custom.conversation.SeparateConversationContextTag</tag-class>
+ <body-content>JSP</body-content>
+ <description>Separates the current context from the children. e.g. commandLinks will start a new conversation context</description>
+ </tag>
+ <tag>
<name>conversation</name>
<tag-class>org.apache.myfaces.custom.conversation.ConversationTag</tag-class>
<body-content>JSP</body-content>
Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml?rev=407879&r1=407878&r2=407879&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/WEB-INF/examples-config.xml Fri May 19 11:38:36 2006
@@ -667,22 +667,27 @@
<from-action>#{wizardController.save}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/conversation/wizardPage1.jsp</to-view-id>
+ <redirect/>
</navigation-case>
<navigation-case>
<from-outcome>wizardPage1</from-outcome>
<to-view-id>/conversation/wizardPage1.jsp</to-view-id>
+ <redirect/>
</navigation-case>
<navigation-case>
<from-outcome>wizardPage2</from-outcome>
<to-view-id>/conversation/wizardPage2.jsp</to-view-id>
+ <redirect/>
</navigation-case>
<navigation-case>
<from-outcome>wizardPage3</from-outcome>
<to-view-id>/conversation/wizardPage3.jsp</to-view-id>
+ <redirect/>
</navigation-case>
<navigation-case>
<from-outcome>wizardFinish</from-outcome>
<to-view-id>/conversation/wizardFinish.jsp</to-view-id>
+ <redirect/>
</navigation-case>
</navigation-rule>
Added: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/index.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/index.jsp?rev=407879&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/index.jsp (added)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/index.jsp Fri May 19 11:38:36 2006
@@ -0,0 +1,4 @@
+<%@ page session="false" contentType="text/html;charset=utf-8"%>
+<%
+response.sendRedirect("home.jsf");
+%>
\ No newline at end of file
Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/index.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/index.jsp
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/index.jsp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/pageConversation.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/pageConversation.jsp?rev=407879&r1=407878&r2=407879&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/pageConversation.jsp (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/pageConversation.jsp Fri May 19 11:38:36 2006
@@ -33,6 +33,8 @@
<s:startConversation name="page" />
<s:conversation name="page" value="#{convData}" />
+<h:outputLink value="home.jsf"><h:outputText value="Menu" /></h:outputLink>
+
<h:form>
<h:panelGrid columns="2">
<h:outputText value="Enter something into this field: " />
Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardFinish.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardFinish.jsp?rev=407879&r1=407878&r2=407879&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardFinish.jsp (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardFinish.jsp Fri May 19 11:38:36 2006
@@ -32,6 +32,11 @@
<t:htmlTag value="h1">Registration Wizard</t:htmlTag>
+<h:outputLink value="home.jsf"><h:outputText value="Menu" /></h:outputLink>
+<s:separateConversationContext>
+ <h:outputLink value="home.jsf"><h:outputText value="Menu (with new conversationContext)" /></h:outputLink>
+</s:separateConversationContext>
+
<h:form>
<h:outputText value="Whatever the page might tell you, no data will ever be saved ;-)." />
<h:panelGrid columns="2">
Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardPage1.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardPage1.jsp?rev=407879&r1=407878&r2=407879&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardPage1.jsp (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardPage1.jsp Fri May 19 11:38:36 2006
@@ -35,6 +35,11 @@
<s:startConversation name="wizard" />
<s:conversation name="wizard" value="#{wizardData}" />
+<h:outputLink value="home.jsf"><h:outputText value="Menu" /></h:outputLink>
+<s:separateConversationContext>
+ <h:outputLink value="home.jsf"><h:outputText value="Menu (with new conversationContext)" /></h:outputLink>
+</s:separateConversationContext>
+
<h:form>
<h:outputText value="Whatever the page might tell you, no data will ever be saved ;-)." />
<h:panelGrid columns="2">
Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardPage2.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardPage2.jsp?rev=407879&r1=407878&r2=407879&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardPage2.jsp (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardPage2.jsp Fri May 19 11:38:36 2006
@@ -32,6 +32,11 @@
<t:htmlTag value="h1">Registration Wizard</t:htmlTag>
+<h:outputLink value="home.jsf"><h:outputText value="Menu" /></h:outputLink>
+<s:separateConversationContext>
+ <h:outputLink value="home.jsf"><h:outputText value="Menu (with new conversationContext)" /></h:outputLink>
+</s:separateConversationContext>
+
<h:form>
<h:outputText value="Whatever the page might tell you, no data will ever be saved ;-)." />
<h:panelGrid columns="2">
Modified: myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardPage3.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardPage3.jsp?rev=407879&r1=407878&r2=407879&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardPage3.jsp (original)
+++ myfaces/tomahawk/trunk/sandbox/examples/src/main/webapp/conversation/wizardPage3.jsp Fri May 19 11:38:36 2006
@@ -32,6 +32,11 @@
<t:htmlTag value="h1">Registration Wizard</t:htmlTag>
+<h:outputLink value="home.jsf"><h:outputText value="Menu" /></h:outputLink>
+<s:separateConversationContext>
+ <h:outputLink value="home.jsf"><h:outputText value="Menu (with new conversationContext)" /></h:outputLink>
+</s:separateConversationContext>
+
<h:form>
<h:outputText value="Whatever the page might tell you, no data will ever be saved ;-)." />
<h:panelGrid columns="2">