myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r600216 - /myfaces/shared/trunk_3.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
Date Sat, 01 Dec 2007 23:56:10 GMT
Author: lu4242
Date: Sat Dec  1 15:56:09 2007
New Revision: 600216

URL: http://svn.apache.org/viewvc?rev=600216&view=rev
Log:
fixes MYFACES-1766 JSR-252 Issue 74: disabled property for outputLink does not work

Modified:
    myfaces/shared/trunk_3.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java

Modified: myfaces/shared/trunk_3.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_3.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java?rev=600216&r1=600215&r2=600216&view=diff
==============================================================================
--- myfaces/shared/trunk_3.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
(original)
+++ myfaces/shared/trunk_3.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
Sat Dec  1 15:56:09 2007
@@ -446,24 +446,33 @@
     {
         ResponseWriter writer = facesContext.getResponseWriter();
 
-        //calculate href
-        String href = org.apache.myfaces.shared.renderkit.RendererUtils.getStringValue(facesContext,
output);
-        if (getChildCount(output) > 0)
+        if (HtmlRendererUtils.isDisabled(output))
         {
-            StringBuffer hrefBuf = new StringBuffer(href);
-            addChildParametersToHref(facesContext, output, hrefBuf,
+            writer.startElement(HTML.SPAN_ELEM, output);
+            HtmlRendererUtils.writeIdIfNecessary(writer, output, facesContext);
+            HtmlRendererUtils.renderHTMLAttributes(writer, output, HTML.ANCHOR_PASSTHROUGH_ATTRIBUTES);
+        }
+        else
+        {
+            //calculate href
+            String href = org.apache.myfaces.shared.renderkit.RendererUtils.getStringValue(facesContext,
output);
+            if (getChildCount(output) > 0)
+            {
+                StringBuffer hrefBuf = new StringBuffer(href);
+                addChildParametersToHref(facesContext, output, hrefBuf,
                                      (href.indexOf('?') == -1), //first url parameter?
                                      writer.getCharacterEncoding());
-            href = hrefBuf.toString();
-        }
-        href = facesContext.getExternalContext().encodeResourceURL(href);    //TODO: or encodeActionURL
?
+                href = hrefBuf.toString();
+            }
+            href = facesContext.getExternalContext().encodeResourceURL(href);    //TODO:
or encodeActionURL ?
 
-        //write anchor
-        writer.startElement(HTML.ANCHOR_ELEM, output);
-        HtmlRendererUtils.writeIdAndNameIfNecessary(writer, output, facesContext);
-        writer.writeURIAttribute(HTML.HREF_ATTR, href, null);
-        HtmlRendererUtils.renderHTMLAttributes(writer, output, org.apache.myfaces.shared.renderkit.html.HTML.ANCHOR_PASSTHROUGH_ATTRIBUTES);
-        writer.flush();
+            //write anchor
+            writer.startElement(HTML.ANCHOR_ELEM, output);
+            HtmlRendererUtils.writeIdAndNameIfNecessary(writer, output, facesContext);
+            writer.writeURIAttribute(HTML.HREF_ATTR, href, null);
+            HtmlRendererUtils.renderHTMLAttributes(writer, output, org.apache.myfaces.shared.renderkit.html.HTML.ANCHOR_PASSTHROUGH_ATTRIBUTES);
+            writer.flush();
+        }
     }
 
     private void renderLinkParameter(String name,
@@ -519,23 +528,33 @@
             throws IOException
     {
         ResponseWriter writer = facesContext.getResponseWriter();
-        // force separate end tag
-        writer.writeText("", null);
-        writer.endElement(HTML.ANCHOR_ELEM);
+        
+        if (HtmlRendererUtils.isDisabled(component))
+        {
+            writer.endElement(HTML.SPAN_ELEM);
+        }
+        else
+        {
+            // force separate end tag
+            writer.writeText("", null);
+            writer.endElement(HTML.ANCHOR_ELEM);            
+        }
     }
 
     protected void renderCommandLinkEnd(FacesContext facesContext, UIComponent component)
             throws IOException
     {
-         if (HtmlRendererUtils.isDisabled(component))
-         {
-             ResponseWriter writer = facesContext.getResponseWriter();
-             writer.endElement(HTML.SPAN_ELEM);
-         }
-         else
-         {
-             renderOutputLinkEnd(facesContext, component);
-         }
+        ResponseWriter writer = facesContext.getResponseWriter();
+        if (HtmlRendererUtils.isDisabled(component))
+        {
+             
+            writer.endElement(HTML.SPAN_ELEM);
+        }
+        else
+        {
+            writer.writeText("", null);
+            writer.endElement(HTML.ANCHOR_ELEM);
+        }
     }
 
 }



Mime
View raw message