tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject git commit: Change the Label component to automatically emit the class="control-label" attribute by default
Date Tue, 20 Nov 2012 00:52:21 GMT
Updated Branches:
  refs/heads/5.4-js-rewrite 65056e868 -> b927ceb14


Change the Label component to automatically emit the class="control-label" attribute by default


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/b927ceb1
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/b927ceb1
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/b927ceb1

Branch: refs/heads/5.4-js-rewrite
Commit: b927ceb149dd72d444c7ea398ff92435e7a33a3c
Parents: 65056e8
Author: Howard M. Lewis Ship <hlship@apache.org>
Authored: Mon Nov 19 16:51:03 2012 -0800
Committer: Howard M. Lewis Ship <hlship@apache.org>
Committed: Mon Nov 19 16:51:03 2012 -0800

----------------------------------------------------------------------
 .../apache/tapestry5/corelib/components/Label.java |   15 +++++++--------
 .../tapestry5/corelib/pages/PropertyEditBlocks.tml |   14 +++++++-------
 tapestry-core/src/test/app1/AutocompleteDemo.tml   |    2 +-
 3 files changed, 15 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/b927ceb1/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.java
b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.java
index fd1abc5..828b06b 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.java
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008, 2009, 2010, 2011 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -14,11 +14,7 @@
 
 package org.apache.tapestry5.corelib.components;
 
-import org.apache.tapestry5.BindingConstants;
-import org.apache.tapestry5.ComponentResources;
-import org.apache.tapestry5.Field;
-import org.apache.tapestry5.MarkupWriter;
-import org.apache.tapestry5.ValidationDecorator;
+import org.apache.tapestry5.*;
 import org.apache.tapestry5.annotations.Environmental;
 import org.apache.tapestry5.annotations.HeartbeatDeferred;
 import org.apache.tapestry5.annotations.Parameter;
@@ -28,13 +24,14 @@ import org.apache.tapestry5.ioc.annotations.Inject;
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
 
 /**
- * Generates a &lt;label&gt; element for a particular field.
+ * Generates a &lt;label&gt; element for a particular field. It writes the CSS class
"control-label", unless
+ * an informal parameter writes a class attribute.
  * <p/>
  * A Label will render its body, if it has one. However, in most cases it will not have a
body, and will render its
  * {@linkplain org.apache.tapestry5.Field#getLabel() field's label} as it's body. Remember,
however, that it is the
  * field label that will be used in any error messages. The Label component allows for client-
and server-side
  * validation error decorations.
- * 
+ *
  * @tapestrydoc
  */
 @SupportsInformalParameters
@@ -72,6 +69,8 @@ public class Label
 
         resources.renderInformalParameters(writer);
 
+        writer.attributes("class", "control-label");
+
         // Since we don't know if the field has rendered yet, we need to defer writing the
for and id
         // attributes until we know the field has rendered (and set its clientId property).
That's
         // exactly what Heartbeat is for.

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/b927ceb1/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/PropertyEditBlocks.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/PropertyEditBlocks.tml
b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/PropertyEditBlocks.tml
index e7096ef..5e827b2 100644
--- a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/PropertyEditBlocks.tml
+++ b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/PropertyEditBlocks.tml
@@ -1,14 +1,14 @@
 <div xml:space="default" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
 
     <t:block id="text">
-        <t:label class="control-label" for="textField"/>
+        <t:label for="textField"/>
         <div class="controls">
             <input t:id="textField"/>
         </div>
     </t:block>
 
     <t:block id="number">
-        <t:label class="control-label" for="numberField"/>
+        <t:label for="numberField"/>
         <div class="controls">
             <input t:id="numberField" class="t-number"/>
         </div>
@@ -17,7 +17,7 @@
 
     <t:block id="enum">
 
-        <t:label class="control-label" for="select"/>
+        <t:label for="select"/>
         <div class="controls">
             <input t:id="select"/>
         </div>
@@ -37,7 +37,7 @@
 
     <t:block id="date">
 
-        <t:label class="control-label" for="dateField"/>
+        <t:label for="dateField"/>
         <div class="controls">
             <input t:id="dateField"/>
         </div>
@@ -46,7 +46,7 @@
 
     <t:block id="calendar">
 
-        <t:label class="control-label" for="calendarField"/>
+        <t:label for="calendarField"/>
         <div class="controls">
             <input t:id="calendarField"/>
         </div>
@@ -55,7 +55,7 @@
 
     <t:block id="password">
 
-        <t:label class="control-label" for="passwordField"/>
+        <t:label for="passwordField"/>
         <div class="controls">
             <input t:id="passwordField"/>
         </div>
@@ -63,7 +63,7 @@
     </t:block>
 
     <t:block id="longtext">
-        <t:label class="control-label" for="textarea"/>
+        <t:label for="textarea"/>
         <div class="controls">
             <textarea t:id="textarea"/>
         </div>

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/b927ceb1/tapestry-core/src/test/app1/AutocompleteDemo.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/app1/AutocompleteDemo.tml b/tapestry-core/src/test/app1/AutocompleteDemo.tml
index 18b0b9f..831e42f 100644
--- a/tapestry-core/src/test/app1/AutocompleteDemo.tml
+++ b/tapestry-core/src/test/app1/AutocompleteDemo.tml
@@ -6,7 +6,7 @@
         <t:errors/>
 
         <div class="control-group">
-            <t:label class="control-label" for="title"/>
+            <t:label  for="title"/>
             <div class="controls">
                 <t:textfield t:id="title" t:mixins="autocomplete" tokens=",;" size="60"/>
             </div>


Mime
View raw message