You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2009/11/06 16:10:29 UTC

svn commit: r833431 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/renderkit/html/ sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/wml/standard/standard/tag/ theme/scarborough/src/main/java/org/apache/myfaces/tobago/...

Author: lofwyr
Date: Fri Nov  6 15:10:29 2009
New Revision: 833431

URL: http://svn.apache.org/viewvc?rev=833431&view=rev
Log:
TOBAGO-412: Cleanup: Use constants for Input Type in HTML

Added:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlInputTypes.java
      - copied, changed from r833026, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlConstants.java
Modified:
    myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/wml/standard/standard/tag/InRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectBooleanCheckboxRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java

Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlInputTypes.java (from r833026, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlConstants.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlInputTypes.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlInputTypes.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlConstants.java&r1=833026&r2=833431&rev=833431&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlConstants.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlInputTypes.java Fri Nov  6 15:10:29 2009
@@ -17,47 +17,20 @@
  * limitations under the License.
  */
 
-public final class HtmlConstants {
-  public static final String LABEL = "label";
-  public static final String TABLE = "table";
-  public static final String FIELDSET = "fieldset";
-  public static final String STYLE = "style";
-  public static final String LEGEND = "legend";
-  public static final String DIV = "div";
-  public static final String BR = "br";
-  public static final String B = "b";
-  public static final String U = "u";
-  public static final String SPAN = "span";
-  public static final String IMG = "img";
-  public static final String TR = "tr";
-  public static final String TH = "th";
-  public static final String TD = "td";
+public final class HtmlInputTypes {
+
+  public static final String TEXT = "text";
+  public static final String PASSWORD = "password";
+  public static final String CHECKBOX = "checkbox";
+  public static final String RADIO = "radio";
+  public static final String SUBMIT = "submit";
+  public static final String RESET = "reset";
+  public static final String FILE = "file";
+  public static final String HIDDEN = "hidden";
+  public static final String IMAGE = "image";
   public static final String BUTTON = "button";
-  public static final String INPUT = "input";
-  public static final String SELECT = "select";
-  public static final String OPTION = "option";
-  public static final String A = "a";
-  public static final String TEXTAREA = "textarea";
-  public static final String COLGROUP = "colgroup";
-  public static final String COL = "col";
-  public static final String UL = "ul";
-  public static final String LI = "li";
-  public static final String IFRAME = "iframe";
-  public static final String HTML = "html";
-  public static final String HEAD = "head";
-  public static final String HR = "hr";
-  public static final String TITLE = "title";
-  public static final String LINK = "link";
-  public static final String BODY = "body";
-  public static final String FORM = "form";
-  public static final String SCRIPT = "script";
-  public static final String META = "meta";
-  public static final String OPTGROUP = "optgroup";
-  public static final String AREA = "area";
-  public static final String PARAM = "param";
-  public static final String BASE = "base";
 
-  private HtmlConstants() {
+  private HtmlInputTypes() {
 
   }
 }

Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/wml/standard/standard/tag/InRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/wml/standard/standard/tag/InRenderer.java?rev=833431&r1=833430&r2=833431&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/wml/standard/standard/tag/InRenderer.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/wml/standard/standard/tag/InRenderer.java Fri Nov  6 15:10:29 2009
@@ -27,6 +27,7 @@
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
+import org.apache.myfaces.tobago.renderkit.html.HtmlInputTypes;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
 import org.apache.myfaces.tobago.util.ComponentUtils;
@@ -59,7 +60,7 @@
     String currentValue = RenderUtil.currentValue(component);
 
     String type = ComponentUtils.getBooleanAttribute(
-        component, Attributes.PASSWORD) ? "password" : "text";
+        component, Attributes.PASSWORD) ? HtmlInputTypes.PASSWORD : HtmlInputTypes.TEXT;
 
     writer.startElement("input", component);
     writer.writeNameAttribute(clientId);

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java?rev=833431&r1=833430&r2=833431&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java Fri Nov  6 15:10:29 2009
@@ -32,6 +32,7 @@
 import org.apache.myfaces.tobago.renderkit.css.Style;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
+import org.apache.myfaces.tobago.renderkit.html.HtmlInputTypes;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.apache.myfaces.tobago.webapp.TobagoMultipartFormdataRequest;
@@ -113,7 +114,7 @@
     TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
 
     writer.startElement(HtmlConstants.INPUT, input);
-    writer.writeAttribute(HtmlAttributes.TYPE, "file", false);
+    writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.FILE, false);
     writer.writeClassAttribute();
     Style style = new Style(facesContext, input);
     writer.writeStyleAttribute(style);

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java?rev=833431&r1=833430&r2=833431&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java Fri Nov  6 15:10:29 2009
@@ -35,6 +35,7 @@
 import org.apache.myfaces.tobago.renderkit.css.Style;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
+import org.apache.myfaces.tobago.renderkit.html.HtmlInputTypes;
 import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.util.ComponentUtils;
@@ -92,7 +93,7 @@
       LOG.debug("currentValue = '" + currentValue + "'");
     }
     String type = ComponentUtils.getBooleanAttribute(input,
-        Attributes.PASSWORD) ? "password" : "text";
+        Attributes.PASSWORD) ? HtmlInputTypes.PASSWORD : HtmlInputTypes.TEXT;
 
     // Todo: check for valid binding
     boolean renderAjaxSuggest = false;

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java?rev=833431&r1=833430&r2=833431&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java Fri Nov  6 15:10:29 2009
@@ -33,6 +33,7 @@
 import org.apache.myfaces.tobago.renderkit.PageRendererBase;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
+import org.apache.myfaces.tobago.renderkit.html.HtmlInputTypes;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
 import org.apache.myfaces.tobago.util.AccessKeyMap;
@@ -494,7 +495,7 @@
     // avoid submit page in ie if the form contains only one input and you press the enter key in the input
     if (ClientProperties.getInstance(facesContext.getViewRoot()).getUserAgent().isMsie()) {
       writer.startElement(HtmlConstants.INPUT, null);
-      writer.writeAttribute(HtmlAttributes.TYPE, "text", false);
+      writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.TEXT, false);
       writer.writeAttribute(HtmlAttributes.NAME, "tobago.dummy", false);
       writer.writeAttribute(HtmlAttributes.TABINDEX, "-1", false);
       writer.writeAttribute(HtmlAttributes.STYLE, "visibility:hidden;display:none;", false);

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectBooleanCheckboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectBooleanCheckboxRenderer.java?rev=833431&r1=833430&r2=833431&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectBooleanCheckboxRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectBooleanCheckboxRenderer.java Fri Nov  6 15:10:29 2009
@@ -30,6 +30,7 @@
 import org.apache.myfaces.tobago.renderkit.css.Style;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
+import org.apache.myfaces.tobago.renderkit.html.HtmlInputTypes;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
@@ -91,7 +92,7 @@
     }
 
     writer.startElement(HtmlConstants.INPUT, checkbox);
-    writer.writeAttribute(HtmlAttributes.TYPE, "checkbox", false);
+    writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.CHECKBOX, false);
     writer.writeAttribute(HtmlAttributes.VALUE, "true", false);
     writer.writeNameAttribute(clientId);
     writer.writeIdAttribute(clientId);

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java?rev=833431&r1=833430&r2=833431&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java Fri Nov  6 15:10:29 2009
@@ -33,6 +33,7 @@
 import org.apache.myfaces.tobago.renderkit.css.Style;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
+import org.apache.myfaces.tobago.renderkit.html.HtmlInputTypes;
 import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.util.ComponentUtils;
@@ -204,7 +205,7 @@
       String title) throws IOException {
     Integer tabIndex = input.getTabIndex();
     writer.startElement(HtmlConstants.INPUT, null);
-    writer.writeAttribute(HtmlAttributes.TYPE, "text", false);
+    writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.TEXT, false);
     writer.writeIdAttribute(id);
     if (tabIndex != null) {
       writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);