You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mm...@apache.org on 2005/09/27 11:02:42 UTC

svn commit: r291863 - /myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/suggest/InputSuggestRenderer.java

Author: mmarinschek
Date: Tue Sep 27 02:02:21 2005
New Revision: 291863

URL: http://svn.apache.org/viewcvs?rev=291863&view=rev
Log:
render all inputSuggest attributes

Modified:
    myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/suggest/InputSuggestRenderer.java

Modified: myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/suggest/InputSuggestRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/suggest/InputSuggestRenderer.java?rev=291863&r1=291862&r2=291863&view=diff
==============================================================================
--- myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/suggest/InputSuggestRenderer.java (original)
+++ myfaces/sandbox/trunk/src/java/org/apache/myfaces/custom/suggest/InputSuggestRenderer.java Tue Sep 27 02:02:21 2005
@@ -23,6 +23,7 @@
 import javax.faces.component.UIComponent;
 import javax.faces.component.UISelectItems;
 import javax.faces.component.ValueHolder;
+import javax.faces.component.html.HtmlInputText;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 import javax.faces.render.Renderer;
@@ -31,6 +32,7 @@
 import org.apache.myfaces.component.html.util.AddResource;
 import org.apache.myfaces.renderkit.JSFAttr;
 import org.apache.myfaces.renderkit.html.HTML;
+import org.apache.myfaces.renderkit.html.HtmlRendererUtils;
 
 /**
  * Basic HTML Renderer for the inputSuggest component.
@@ -119,10 +121,11 @@
                                   String clientId, UIComponent component) throws
         IOException
     {
+
         out.startElement("input", component);
         out.writeAttribute("name", clientId, null);
         out.writeAttribute("id", clientId, null);
-        out.writeAttribute("autocomplete", "off", null);
+
         if (text != null)
         {
             out.writeAttribute("value", text, "value");
@@ -131,6 +134,17 @@
         {
             out.writeAttribute("value", "", "value");
         }
+
+        component.getAttributes().put("autocomplete","off");
+
+        HtmlRendererUtils.renderHTMLAttributes(out,
+                component, HTML.INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED);
+
+        if((component instanceof HtmlInputText) && ((HtmlInputText) component).isDisabled())
+        {
+            out.writeAttribute(HTML.DISABLED_ATTR, Boolean.TRUE, null);
+        }
+
         out.endElement("input");
     }
 
@@ -220,7 +234,7 @@
 //        throw new IllegalArgumentException(
 //            "Unsupported object type used for choices.");
     }
-    
+
 
 //  (this is not called from anywhere)
 //    /**
@@ -269,11 +283,7 @@
         }
         else
         {
-            out.startElement("link", null);
-            out.writeAttribute(HTML.TYPE_ATTR, "text/css", null);
-            out.writeAttribute(HTML.HREF_ATTR, styleLocation + "/suggest.css", null);
-            out.writeAttribute(HTML.REL_ATTR, "stylesheet", null);
-            out.endElement("link");
+            AddResource.addStyleSheet(styleLocation,"suggest.css",context);
         }
     }
 
@@ -298,11 +308,7 @@
         }
         else
         {
-            out.startElement(HTML.SCRIPT_ELEM, null);
-            out.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
-            out.writeAttribute(HTML.SRC_ATTR,
-                               javascriptLocation + "/suggest.js", null);
-            out.endElement(HTML.SCRIPT_ELEM);
+            AddResource.addJavaScriptHere(javascriptLocation,"suggest.js",context);
         }
 
         // now add javascript that depends on the component and cannot be part of javascript file