[seam-commits] Seam SVN: r13205 - examples/trunk/booking-simplified/src/main/java/org/jboss/seam/faces/component.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed Jun 16 18:16:42 EDT 2010


Author: dan.j.allen
Date: 2010-06-16 18:16:42 -0400 (Wed, 16 Jun 2010)
New Revision: 13205

Modified:
   examples/trunk/booking-simplified/src/main/java/org/jboss/seam/faces/component/UIInputContainer.java
Log:
smarter name creation


Modified: examples/trunk/booking-simplified/src/main/java/org/jboss/seam/faces/component/UIInputContainer.java
===================================================================
--- examples/trunk/booking-simplified/src/main/java/org/jboss/seam/faces/component/UIInputContainer.java	2010-06-16 22:09:52 UTC (rev 13204)
+++ examples/trunk/booking-simplified/src/main/java/org/jboss/seam/faces/component/UIInputContainer.java	2010-06-16 22:16:42 UTC (rev 13205)
@@ -276,7 +276,26 @@
    protected String generateLabel(final InputContainerElements elements, final FacesContext context)
    {
       String name = getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX) ? elements.getPropertyName(context) : getId();
-      return name.substring(0, 1).toUpperCase() + name.substring(1);
+      StringBuilder builder = new StringBuilder(name.length());
+      boolean first = true;
+      for (char c : name.toCharArray())
+      {
+         if (first)
+         {
+            builder.append(Character.toUpperCase(c));
+            first = false;
+         }
+         else if (Character.isUpperCase(c))
+         {
+            builder.append(" ");
+            builder.append(Character.toLowerCase(c));
+         }
+         else
+         {
+            builder.append(c);
+         }
+      }
+      return builder.toString();
    }
 
    /**



More information about the seam-commits mailing list