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/11/09 08:12:43 UTC

svn commit: r472799 - in /myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation: AbstractConversationComponent.java EnsureConversationTag.java UIEnsureConversation.java

Author: imario
Date: Wed Nov  8 23:12:42 2006
New Revision: 472799

URL: http://svn.apache.org/viewvc?view=rev&rev=472799
Log:
changed to UICommand as base for easier use of action attribute with facelets. Thanks to Tom Innes for the tip.

Modified:
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/AbstractConversationComponent.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/EnsureConversationTag.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UIEnsureConversation.java

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/AbstractConversationComponent.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/AbstractConversationComponent.java?view=diff&rev=472799&r1=472798&r2=472799
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/AbstractConversationComponent.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/AbstractConversationComponent.java Wed Nov  8 23:12:42 2006
@@ -18,7 +18,7 @@
  */
 package org.apache.myfaces.custom.conversation;
 
-import javax.faces.component.UIComponentBase;
+import javax.faces.component.UICommand;
 import javax.faces.context.FacesContext;
 import javax.faces.el.ValueBinding;
 
@@ -26,7 +26,7 @@
  * base class for all the conversation components
  * @author imario@apache.org
  */
-public class AbstractConversationComponent extends UIComponentBase
+public class AbstractConversationComponent extends UICommand
 {
 	public static final String COMPONENT_FAMILY = "javax.faces.Component";
 
@@ -40,7 +40,7 @@
 	public void restoreState(FacesContext context, Object state)
 	{
 		Object[] states = (Object[]) state;
-		
+
 		super.restoreState(context, states[0]);
 		name = (String) states[1];
 	}

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/EnsureConversationTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/EnsureConversationTag.java?view=diff&rev=472799&r1=472798&r2=472799
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/EnsureConversationTag.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/EnsureConversationTag.java Wed Nov  8 23:12:42 2006
@@ -18,10 +18,7 @@
  */
 package org.apache.myfaces.custom.conversation;
 
-import org.apache.myfaces.shared_tomahawk.el.SimpleActionMethodBinding;
-
 import javax.faces.component.UIComponent;
-import javax.faces.el.MethodBinding;
 
 /**
  * Checks if a conversation is active, else redirects to another view
@@ -41,26 +38,9 @@
     protected void setProperties(UIComponent component)
     {
         super.setProperties(component);
-		UIEnsureConversation ensureConversation = (UIEnsureConversation) component;
 
 		setStringProperty(component, "redirectTo", getRedirectTo());
-		if (getAction() != null)
-		{
-			if (isValueReference(getAction()))
-			{
-				MethodBinding mb = getFacesContext().getApplication().createMethodBinding(
-					getAction(), null);
-				ensureConversation.setAction(mb);
-			}
-			else
-			{
-				ensureConversation.setAction(new SimpleActionMethodBinding(getAction()));
-			}
-		}
-		else
-		{
-				ensureConversation.setAction(null);
-		}
+		setActionProperty(component, getAction());
     }
 
 	public String getRedirectTo()

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UIEnsureConversation.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UIEnsureConversation.java?view=diff&rev=472799&r1=472798&r2=472799
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UIEnsureConversation.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/conversation/UIEnsureConversation.java Wed Nov  8 23:12:42 2006
@@ -22,7 +22,6 @@
 
 import javax.faces.context.FacesContext;
 import javax.faces.el.ValueBinding;
-import javax.faces.el.MethodBinding;
 import java.io.IOException;
 
 /**
@@ -41,7 +40,6 @@
 	public static final String COMPONENT_TYPE = "org.apache.myfaces.EnsureConversation";
 
 	private String redirectTo;
-	private MethodBinding action;
 
 	public void encodeBegin(FacesContext context) throws IOException
 	{
@@ -70,7 +68,6 @@
 
 		super.restoreState(context, states[0]);
 		redirectTo = (String) states[1];
-		action = (MethodBinding) restoreAttachedState(context, states[2]);
 	}
 
 	public Object saveState(FacesContext context)
@@ -78,8 +75,7 @@
 		return new Object[]
 			{
 				super.saveState(context),
-				redirectTo,
-				saveAttachedState(context, action)
+				redirectTo
 			};
 	}
 
@@ -135,15 +131,5 @@
 	public void setRedirectTo(String redirectTo)
 	{
 		this.redirectTo = redirectTo;
-	}
-
-	public MethodBinding getAction()
-	{
-		return action;
-	}
-
-	public void setAction(MethodBinding action)
-	{
-		this.action = action;
 	}
 }