You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2007/10/05 11:47:29 UTC

svn commit: r582167 - in /myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation: _ConversationUtils.java jsf/_JsfConversationUtils.java jsf/components/UIEndConversation.java

Author: skitching
Date: Fri Oct  5 02:47:28 2007
New Revision: 582167

URL: http://svn.apache.org/viewvc?rev=582167&view=rev
Log:
Move jsf-specific utility methods into jsf package.

Added:
    myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/jsf/_JsfConversationUtils.java
Modified:
    myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/_ConversationUtils.java
    myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/jsf/components/UIEndConversation.java

Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/_ConversationUtils.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/_ConversationUtils.java?rev=582167&r1=582166&r2=582167&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/_ConversationUtils.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/_ConversationUtils.java Fri Oct  5 02:47:28 2007
@@ -19,16 +19,6 @@
 
 package org.apache.myfaces.orchestra.conversation;
 
-import org.apache.myfaces.orchestra.conversation.jsf.components.AbstractConversationComponent;
-import org.apache.myfaces.orchestra.conversation.jsf.components.UIEndConversation;
-import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapter;
-
-import javax.faces.component.UICommand;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.el.MethodBinding;
-import java.util.Iterator;
-
 /**
  * <p>Various utilities used by the conversation framework</p>
  * <p>Notice: this class is not meant to be used outside of this library</p>
@@ -37,79 +27,5 @@
 {
 	private _ConversationUtils()
 	{
-	}
-
-	/**
-	 * Find the first parent which is a command
-	 */
-	public static UICommand findParentCommand(UIComponent base)
-	{
-		UIComponent parent = base;
-		do
-		{
-			parent = parent.getParent();
-			if (parent instanceof UICommand)
-			{
-				return (UICommand) parent;
-			}
-		}
-		while (parent != null);
-
-		return null;
-	}
-
-	/**
-	 * Find a child start or end conversation component for the given conversation name
-	 */
-	public static AbstractConversationComponent findEndConversationComponent(UIComponent component, String conversationName)
-	{
-		Iterator iterComponents = component.getFacetsAndChildren();
-		while (iterComponents.hasNext())
-		{
-			Object child = iterComponents.next();
-			AbstractConversationComponent conversation;
-
-			if (child instanceof UIEndConversation)
-			{
-				conversation = (AbstractConversationComponent) child;
-				if (conversation.getName().equals(conversationName))
-				{
-					return conversation;
-				}
-			}
-			else if (child instanceof UIComponent)
-			{
-				conversation = findEndConversationComponent((UIComponent) child, conversationName);
-				if (conversation != null)
-				{
-					return conversation;
-				}
-			}
-		}
-
-		return null;
-	}
-
-	/**
-	 * end and restart a conversation
-	 */
-	public static void endAndRestartConversation(FacesContext context, String conversationName, Boolean restart, MethodBinding restartAction)
-	{
-		ConversationManager conversationManager = ConversationManager.getInstance();
-		Conversation conversation = conversationManager.getConversation(conversationName);
-		if (conversation != null)
-		{
-			conversation.invalidate();
-		}
-
-		if (restart != null && restart.booleanValue())
-		{
-			FrameworkAdapter.getInstance().getBean(conversationName);
-
-			if (restartAction != null)
-			{
-				restartAction.invoke(context, null);
-			}
-		}
 	}
 }

Added: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/jsf/_JsfConversationUtils.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/jsf/_JsfConversationUtils.java?rev=582167&view=auto
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/jsf/_JsfConversationUtils.java (added)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/jsf/_JsfConversationUtils.java Fri Oct  5 02:47:28 2007
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.orchestra.conversation.jsf;
+
+import java.util.Iterator;
+
+import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+
+import org.apache.myfaces.orchestra.conversation.Conversation;
+import org.apache.myfaces.orchestra.conversation.ConversationManager;
+import org.apache.myfaces.orchestra.conversation.jsf.components.AbstractConversationComponent;
+import org.apache.myfaces.orchestra.conversation.jsf.components.UIEndConversation;
+import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapter;
+
+/**
+ * <p>Various utilities used by the conversation framework</p>
+ * <p>Notice: this class is not meant to be used outside of this library</p>
+ */
+public class _JsfConversationUtils
+{
+	private _JsfConversationUtils()
+	{
+	}
+
+	/**
+	 * Find the first parent which is a command
+	 */
+	public static UICommand findParentCommand(UIComponent base)
+	{
+		UIComponent parent = base;
+		do
+		{
+			parent = parent.getParent();
+			if (parent instanceof UICommand)
+			{
+				return (UICommand) parent;
+			}
+		}
+		while (parent != null);
+
+		return null;
+	}
+
+	/**
+	 * Find a child start or end conversation component for the given conversation name
+	 */
+	public static AbstractConversationComponent findEndConversationComponent(UIComponent component, String conversationName)
+	{
+		Iterator iterComponents = component.getFacetsAndChildren();
+		while (iterComponents.hasNext())
+		{
+			Object child = iterComponents.next();
+			AbstractConversationComponent conversation;
+
+			if (child instanceof UIEndConversation)
+			{
+				conversation = (AbstractConversationComponent) child;
+				if (conversation.getName().equals(conversationName))
+				{
+					return conversation;
+				}
+			}
+			else if (child instanceof UIComponent)
+			{
+				conversation = findEndConversationComponent((UIComponent) child, conversationName);
+				if (conversation != null)
+				{
+					return conversation;
+				}
+			}
+		}
+
+		return null;
+	}
+
+	/**
+	 * end and restart a conversation
+	 */
+	public static void endAndRestartConversation(FacesContext context, String conversationName, Boolean restart, MethodBinding restartAction)
+	{
+		ConversationManager conversationManager = ConversationManager.getInstance();
+		Conversation conversation = conversationManager.getConversation(conversationName);
+		if (conversation != null)
+		{
+			conversation.invalidate();
+		}
+
+		if (restart != null && restart.booleanValue())
+		{
+			FrameworkAdapter.getInstance().getBean(conversationName);
+
+			if (restartAction != null)
+			{
+				restartAction.invoke(context, null);
+			}
+		}
+	}
+}

Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/jsf/components/UIEndConversation.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/jsf/components/UIEndConversation.java?rev=582167&r1=582166&r2=582167&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/jsf/components/UIEndConversation.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/jsf/components/UIEndConversation.java Fri Oct  5 02:47:28 2007
@@ -29,7 +29,7 @@
 import javax.faces.el.ValueBinding;
 
 import org.apache.myfaces.orchestra.conversation.ConversationUtils;
-import org.apache.myfaces.orchestra.conversation._ConversationUtils;
+import org.apache.myfaces.orchestra.conversation.jsf._JsfConversationUtils;
 import org.apache.myfaces.orchestra.conversation.jsf.lib._EndConversationMethodBindingFacade;
 import org.apache.myfaces.shared_orchestra.util.StringUtils;
 
@@ -91,7 +91,7 @@
 	{
 		super.encodeBegin(context);
 
-		UICommand command = _ConversationUtils.findParentCommand(this);
+		UICommand command = _JsfConversationUtils.findParentCommand(this);
 		if (command != null)
 		{
 			// This component has a UICommand ancestor. Replace its "action" MethodBinding