[jboss-cvs] jboss-seam/src/ui/org/jboss/seam/ui ...
Gavin King
gavin.king at jboss.com
Thu Mar 8 19:59:57 EST 2007
User: gavin
Date: 07/03/08 19:59:57
Modified: src/ui/org/jboss/seam/ui HtmlButton.java HtmlLink.java
UIAction.java UIConversationId.java
Log:
fix some bugs with natural conversation ids
Revision Changes Path
1.11 +22 -3 jboss-seam/src/ui/org/jboss/seam/ui/HtmlButton.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: HtmlButton.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/ui/org/jboss/seam/ui/HtmlButton.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- HtmlButton.java 22 Feb 2007 16:03:05 -0000 1.10
+++ HtmlButton.java 9 Mar 2007 00:59:57 -0000 1.11
@@ -20,6 +20,7 @@
import org.jboss.seam.core.Conversation;
import org.jboss.seam.core.Pages;
+import org.jboss.seam.pages.Page;
public class HtmlButton extends HtmlOutputButton implements ActionSource
{
@@ -105,7 +106,7 @@
}
else
{
- viewId = context.getViewRoot().getViewId();
+ viewId = Pages.getViewId(context);
}
String url = context.getApplication().getViewHandler().getActionURL(context, viewId);
@@ -116,6 +117,9 @@
boolean first = true;
Set<String> usedParameters = new HashSet<String>();
+ boolean conversationIdEncoded = false;
+ Page page = Pages.instance().getPage(viewId);
+
for (Object child: getChildren())
{
if (child instanceof UIParameter)
@@ -125,6 +129,11 @@
{
encodedUrl += getParameterString(characterEncoding, uip, first);
first = false;
+
+ if (uip.getName().equals(page.getConversationIdParameter().getParameterName()))
+ {
+ conversationIdEncoded = true;
+ }
}
usedParameters.add( uip.getName() );
}
@@ -140,6 +149,11 @@
uip.setValue( me.getValue() );
encodedUrl += getParameterString(characterEncoding, uip, first);
first = false;
+
+ if (!conversationIdEncoded && me.getKey().equals(page.getConversationIdParameter().getParameterName()))
+ {
+ conversationIdEncoded = true;
+ }
}
}
@@ -154,8 +168,13 @@
if ( "default".equals(propagation) || "join".equals(propagation) || "nest".equals(propagation) || "end".equals(propagation) )
{
//always add the id, since conversations could begin after link is rendered
- encodedUrl += getParameterString(characterEncoding, new UIConversationId(), first);
+ if ( !conversationIdEncoded )
+ {
+ UIConversationId uiConversationId = new UIConversationId();
+ uiConversationId.setViewId(viewId);
+ encodedUrl += getParameterString(characterEncoding, uiConversationId, first);
first = false;
+ }
if ( Conversation.instance().isLongRunning() || Conversation.instance().isNested() )
{
encodedUrl += getParameterString(characterEncoding, new UIConversationIsLongRunning(), first);
1.31 +4 -2 jboss-seam/src/ui/org/jboss/seam/ui/HtmlLink.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: HtmlLink.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/ui/org/jboss/seam/ui/HtmlLink.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- HtmlLink.java 8 Mar 2007 07:34:37 -0000 1.30
+++ HtmlLink.java 9 Mar 2007 00:59:57 -0000 1.31
@@ -90,7 +90,7 @@
}
else
{
- viewId = context.getViewRoot().getViewId();
+ viewId = Pages.getViewId(context);
}
String url = context.getApplication().getViewHandler().getActionURL(context, viewId);
@@ -155,7 +155,9 @@
//always add the id, since conversations could begin after link is rendered
if ( !conversationIdEncoded )
{
- encodedUrl += getParameterString(characterEncoding, new UIConversationId(viewId), first);
+ UIConversationId uiConversationId = new UIConversationId();
+ uiConversationId.setViewId(viewId);
+ encodedUrl += getParameterString(characterEncoding, uiConversationId, first);
first = false;
}
if ( Conversation.instance().isLongRunning() || Conversation.instance().isNested() )
1.5 +2 -1 jboss-seam/src/ui/org/jboss/seam/ui/UIAction.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UIAction.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/ui/org/jboss/seam/ui/UIAction.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- UIAction.java 19 Nov 2006 17:36:11 -0000 1.4
+++ UIAction.java 9 Mar 2007 00:59:57 -0000 1.5
@@ -3,6 +3,7 @@
import javax.faces.component.UIParameter;
import javax.faces.context.FacesContext;
+import org.jboss.seam.core.Pages;
import org.jboss.seam.core.SafeActions;
public class UIAction extends UIParameter
@@ -36,7 +37,7 @@
@Override
public Object getValue()
{
- String viewId = getFacesContext().getViewRoot().getViewId();
+ String viewId = Pages.getCurrentViewId();
if ( isMethodBinding() )
{
String actionId = SafeActions.toActionId( viewId, action );
1.5 +25 -24 jboss-seam/src/ui/org/jboss/seam/ui/UIConversationId.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UIConversationId.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/ui/org/jboss/seam/ui/UIConversationId.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- UIConversationId.java 8 Mar 2007 07:34:37 -0000 1.4
+++ UIConversationId.java 9 Mar 2007 00:59:57 -0000 1.5
@@ -1,29 +1,20 @@
package org.jboss.seam.ui;
import javax.faces.component.UIParameter;
-import javax.faces.context.FacesContext;
+
import org.jboss.seam.core.Conversation;
-import org.jboss.seam.core.Pages;
import org.jboss.seam.core.Manager;
+import org.jboss.seam.core.Pages;
import org.jboss.seam.pages.Page;
public class UIConversationId extends UIParameter
{
private String viewId;
public static final String COMPONENT_TYPE = "org.jboss.seam.ui.UIConversationId";
- public UIConversationId()
- {
-
- }
-
- public UIConversationId(String viewId)
- {
- this.viewId = viewId;
- }
-
@Override
public String getName()
{
- if (viewId != null && !Manager.instance().isLongRunningConversation())
+ Conversation conversation = Conversation.instance();
+ if (viewId!=null && ( !conversation.isNested() || conversation.isLongRunning() ) )
{
Page page = Pages.instance().getPage(viewId);
return page.getConversationIdParameter().getParameterName();
@@ -37,22 +28,32 @@
@Override
public Object getValue()
{
- if (viewId != null && !Manager.instance().isLongRunningConversation())
+ Conversation conversation = Conversation.instance();
+ if ( !conversation.isNested() || conversation.isLongRunning() )
+ {
+ if (viewId!=null)
{
Page page = Pages.instance().getPage(viewId);
return page.getConversationIdParameter().getParameterValue();
}
else
{
- Conversation conversation = Conversation.instance();
- if ( !conversation.isNested() || conversation.isLongRunning() )
- {
return conversation.getId();
}
+ }
else
{
return conversation.getParentId();
}
}
+
+ public String getViewId()
+ {
+ return viewId;
+ }
+
+ public void setViewId(String viewId)
+ {
+ this.viewId = viewId;
}
}
More information about the jboss-cvs-commits
mailing list