myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bom...@apache.org
Subject svn commit: r499548 - /myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java
Date Wed, 24 Jan 2007 19:50:34 GMT
Author: bommel
Date: Wed Jan 24 11:50:32 2007
New Revision: 499548

URL: http://svn.apache.org/viewvc?view=rev&rev=499548
Log:
(TOBAGO-255) target attribute of tc:link doesn't work if you specify an action

Modified:
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java?view=diff&rev=499548&r1=499547&r2=499548
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java
(original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java
Wed Jan 24 11:50:32 2007
@@ -49,7 +49,7 @@
 import java.io.IOException;
 import java.net.URLDecoder;
 
-public class LinkRenderer extends CommandRendererBase{
+public class LinkRenderer extends CommandRendererBase {
 
   private static final Log LOG = LogFactory.getLog(LinkRenderer.class);
 
@@ -57,6 +57,7 @@
       UIComponent component) throws IOException {
     String onclick = null;
     String href;
+    boolean submitAction = false;
 
     String clientId = component.getClientId(facesContext);
     // TODO refactor it
@@ -86,17 +87,18 @@
           sb.append("=");
           Object value = parameter.getValue();
           // TODO encoding
-          sb.append(value!=null?URLDecoder.decode(value.toString()):null);
+          sb.append(value != null ? URLDecoder.decode(value.toString()) : null);
         }
       }
       href = sb.toString();
 
-    } else  if (component.getAttributes().get(ATTR_ACTION_ONCLICK) != null) {
+    } else if (component.getAttributes().get(ATTR_ACTION_ONCLICK) != null) {
       onclick = HtmlRendererUtil.prepareOnClick(facesContext, component);
       href = HtmlRendererUtil.getEmptyHref(facesContext);
     } else { // default: Action.TYPE_SUBMIT
       href = "javascript:" + HtmlRendererUtil.createOnClick(facesContext, component);
-         //"Tobago.submitAction('" + clientId + "')";
+      submitAction = true;
+      //"Tobago.submitAction('" + clientId + "')";
     }
 
     onclick = HtmlRendererUtil.appendConfirmationScript(onclick, component, facesContext);
@@ -114,7 +116,9 @@
       if (onclick != null) {
         writer.writeAttribute(HtmlAttributes.ONCLICK, onclick, null);
       }
-      writer.writeAttribute(HtmlAttributes.TARGET, null, ATTR_TARGET);
+      if (!submitAction) {
+        writer.writeAttribute(HtmlAttributes.TARGET, null, ATTR_TARGET);
+      }
     }
     writer.writeComponentClass();
     writer.writeIdAttribute(clientId);
@@ -143,15 +147,15 @@
       HtmlRendererUtil.writeLabelWithAccessKey(writer, label);
     }
 
-      if (label.getAccessKey() != null) {
-        if (LOG.isInfoEnabled()
-            && !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey())) {
-          LOG.info("dublicated accessKey : " + label.getAccessKey());
-        }
+    if (label.getAccessKey() != null) {
+      if (LOG.isInfoEnabled()
+          && !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey())) {
+        LOG.info("dublicated accessKey : " + label.getAccessKey());
+      }
 
       HtmlRendererUtil.addClickAcceleratorKey(
           facesContext, clientId, label.getAccessKey());
-      }
+    }
   }
 
   public void encodeEnd(FacesContext facesContext, UIComponent component)



Mime
View raw message