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 2013/06/11 11:03:40 UTC

svn commit: r1491708 - in /myfaces/tobago/branches/tobago-1.5.x: tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/ tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/html/ tobago-theme/tobago-theme-scarborough/src/main/java...

Author: lofwyr
Date: Tue Jun 11 09:03:40 2013
New Revision: 1491708

URL: http://svn.apache.org/r1491708
Log:
TOBAGO-1275: Change code style for html5 data attributes: separate words.
 - introduce the new constant names for Tobago 2.0, the values are not changed for compatibility inside the 1.5.x

Modified:
    myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java
    myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/html/DataAttributesUnitTest.java
    myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java
    myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
    myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java
    myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIconRenderer.java
    myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.java
    myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeMenuNodeRenderer.java
    myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java

Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java?rev=1491708&r1=1491707&r2=1491708&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java Tue Jun 11 09:03:40 2013
@@ -36,40 +36,68 @@ public final class DataAttributes {
    */
   public static final String RELOAD = "data-tobago-reload";
 
+  /** @deprecated Since 1.5.11 */
+  @Deprecated
   public static final String SELECTIONMODE = "data-tobago-selectionmode";
 
+  public static final String SELECTION_MODE = SELECTIONMODE;
+
   /**
    * The selectable attribute e. g. for trees.
    */
   public static final String SELECTABLE = "data-tobago-selectable";
 
-  /**
-   * Reference to a sheet.
-   */
+  /** @deprecated Since 1.5.11 */
+  @Deprecated
   public static final String SHEETID = "data-tobago-sheetid";
 
   /**
-   * Alternate to the src attribute, to implement a hover effect.
+   * Reference to a sheet.
    */
+  public static final String SHEET_ID = SHEETID;
+
+  /** @deprecated Since 1.5.11 */
+  @Deprecated
   public static final String SRCHOVER = "data-tobago-srchover";
 
   /**
    * Alternate to the src attribute, to implement a hover effect.
    */
+  public static final String SRC_HOVER = SRCHOVER;
+
+  /** @deprecated Since 1.5.11 */
+  @Deprecated
   public static final String SRCDEFAULT = "data-tobago-srcdefault";
 
   /**
-   * Alternate to the src attribute, icon open and close.
+   * Alternate to the src attribute, to implement a hover effect.
    */
+  public static final String SRC_DEFAULT = SRCDEFAULT;
+
+  /** @deprecated Since 1.5.11 */
+  @Deprecated
   public static final String SRCCLOSE = "data-tobago-srcclose";
 
   /**
    * Alternate to the src attribute, icon open and close.
    */
+  public static final String SRC_CLOSE = SRCCLOSE;
+
+  /** @deprecated Since 1.5.11 */
+  @Deprecated
   public static final String SRCOPEN = "data-tobago-srcopen";
 
   /**
-   * Id of the parent node in a tree node.
+   * Alternate to the src attribute, icon open and close.
    */
+  public static final String SRC_OPEN = SRCOPEN;
+
+  /** @deprecated Since 1.5.11 */
+  @Deprecated
   public static final String TREEPARENT = "data-tobago-treeparent";
+
+  /**
+   * Id of the parent node in a tree node.
+   */
+  public static final String TREE_PARENT = TREEPARENT;
 }

Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/html/DataAttributesUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/html/DataAttributesUnitTest.java?rev=1491708&r1=1491707&r2=1491708&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/html/DataAttributesUnitTest.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/html/DataAttributesUnitTest.java Tue Jun 11 09:03:40 2013
@@ -31,12 +31,15 @@ public class DataAttributesUnitTest {
   @Test
   public void testAttributeNames() throws IllegalAccessException {
     for (Field field : DataAttributes.class.getFields()) {
+      if (field.getAnnotation(Deprecated.class) != null) {
+        // ignore the check for deprecated fields
+        continue;
+      }
       String value = (String) field.get(null);
       Assert.assertTrue("Prefix check: value='" + value + "'", value.startsWith(PREFIX));
       String extension = value.substring(PREFIX.length());
       Assert.assertTrue("Regexp check: extension='" + extension + "'", extension.matches("[a-z]+(-[a-z]+)*"));
-      String fieldExtension = field.getName().toLowerCase().replace('_', '-');
-      Assert.assertEquals(fieldExtension, extension);
+      Assert.assertEquals(field.getName().replaceAll("_", ""), extension.toUpperCase().replaceAll("-", ""));
     }
   }
 }

Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java?rev=1491708&r1=1491707&r2=1491708&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java Tue Jun 11 09:03:40 2013
@@ -162,8 +162,8 @@ public class MenuCommandRenderer extends
         String imageHover
             = ResourceManagerUtils.getImageWithPath(facesContext, HtmlRendererUtils.createSrc(image, "Hover"), true);
         if (imageHover != null) {
-          writer.writeAttribute(DataAttributes.SRCDEFAULT, imageWithPath, false);
-          writer.writeAttribute(DataAttributes.SRCHOVER, imageHover, false);
+          writer.writeAttribute(DataAttributes.SRC_DEFAULT, imageWithPath, false);
+          writer.writeAttribute(DataAttributes.SRC_HOVER, imageHover, false);
         }
 
         writer.writeAttribute(HtmlAttributes.ALT, label.getText(), true);

Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java?rev=1491708&r1=1491707&r2=1491708&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java Tue Jun 11 09:03:40 2013
@@ -855,7 +855,7 @@ public class SheetRenderer extends Layou
     menuItem.setLabel(ResourceManagerUtils.getPropertyNotNull(facesContext, "tobago", label));
     menuItem.setMarkup(markup);
     menuItem.setOnclick("/**/"); // XXX avoid submit
-    ComponentUtils.putDataAttributeWithPrefix(menuItem, DataAttributes.SHEETID, sheetId);
+    ComponentUtils.putDataAttributeWithPrefix(menuItem, DataAttributes.SHEET_ID, sheetId);
     menu.getChildren().add(menuItem);
   }
 

Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java?rev=1491708&r1=1491707&r2=1491708&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java Tue Jun 11 09:03:40 2013
@@ -400,8 +400,8 @@ public abstract class ToolBarRendererBas
       String imageHover
           = ResourceManagerUtils.getImageWithPath(facesContext, HtmlRendererUtils.createSrc(iconName, "Hover"), true);
       if (imageHover != null) {
-        writer.writeAttribute(DataAttributes.SRCDEFAULT, image, false);
-        writer.writeAttribute(DataAttributes.SRCHOVER, imageHover, false);
+        writer.writeAttribute(DataAttributes.SRC_DEFAULT, image, false);
+        writer.writeAttribute(DataAttributes.SRC_HOVER, imageHover, false);
       }
       writer.writeAttribute(HtmlAttributes.ALT, label.getText(), true);
       writer.writeStyleAttribute(iconStyle);

Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIconRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIconRenderer.java?rev=1491708&r1=1491707&r2=1491708&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIconRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIconRenderer.java Tue Jun 11 09:03:40 2013
@@ -95,8 +95,8 @@ public class TreeIconRenderer extends La
     HtmlRendererUtils.writeDataAttributes(facesContext, writer, image);
     writer.writeAttribute(HtmlAttributes.SRC, source, true);
     if (folder) {
-      writer.writeAttribute(DataAttributes.SRCOPEN, openSource, true);
-      writer.writeAttribute(DataAttributes.SRCCLOSE, closedSource, true);
+      writer.writeAttribute(DataAttributes.SRC_OPEN, openSource, true);
+      writer.writeAttribute(DataAttributes.SRC_CLOSE, closedSource, true);
     }
     writer.writeAttribute(HtmlAttributes.ALT, "", false);
     writer.endElement(HtmlElements.IMG);

Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.java?rev=1491708&r1=1491707&r2=1491708&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.java Tue Jun 11 09:03:40 2013
@@ -130,8 +130,8 @@ public class TreeIndentRenderer extends 
     final String src = expanded ? srcOpen : srcClose;
     writer.writeAttribute(HtmlAttributes.SRC, src, true);
     if (folder) {
-      writer.writeAttribute(DataAttributes.SRCOPEN, srcOpen, true);
-      writer.writeAttribute(DataAttributes.SRCCLOSE, srcClose, true);
+      writer.writeAttribute(DataAttributes.SRC_OPEN, srcOpen, true);
+      writer.writeAttribute(DataAttributes.SRC_CLOSE, srcClose, true);
     }
     writer.writeAttribute(HtmlAttributes.ALT, "", false);
     writer.endElement(HtmlElements.IMG);

Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeMenuNodeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeMenuNodeRenderer.java?rev=1491708&r1=1491707&r2=1491708&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeMenuNodeRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeMenuNodeRenderer.java Tue Jun 11 09:03:40 2013
@@ -142,7 +142,7 @@ public class TreeMenuNodeRenderer extend
       writer.startElement(HtmlElements.DIV, null);
       writer.writeIdAttribute(id);
       writer.writeClassAttribute(Classes.create(node));
-      writer.writeAttribute(DataAttributes.TREEPARENT, parentId, false);
+      writer.writeAttribute(DataAttributes.TREE_PARENT, parentId, false);
       HtmlRendererUtils.writeDataAttributes(facesContext, writer, node);
 
       if (!root) {
@@ -205,8 +205,8 @@ public class TreeMenuNodeRenderer extend
     writer.startElement(HtmlElements.IMG, null);
     writer.writeClassAttribute(Classes.create(node, "toggle"));
     writer.writeAttribute(HtmlAttributes.SRC, src, false);
-    writer.writeAttribute(DataAttributes.SRCOPEN, srcOpen, false);
-    writer.writeAttribute(DataAttributes.SRCCLOSE, srcClose, false);
+    writer.writeAttribute(DataAttributes.SRC_OPEN, srcOpen, false);
+    writer.writeAttribute(DataAttributes.SRC_CLOSE, srcClose, false);
     writer.writeAttribute(HtmlAttributes.ALT, "", false);
     writer.endElement(HtmlElements.IMG);
   }

Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java?rev=1491708&r1=1491707&r2=1491708&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java Tue Jun 11 09:03:40 2013
@@ -166,7 +166,7 @@ public class TreeNodeRenderer extends La
         HtmlRendererUtils.renderDojoDndItem(node, writer, true);
       }
       writer.writeClassAttribute(Classes.create(node));
-      writer.writeAttribute(DataAttributes.TREEPARENT, parentId, false);
+      writer.writeAttribute(DataAttributes.TREE_PARENT, parentId, false);
       HtmlRendererUtils.writeDataAttributes(facesContext, writer, node);
 
       if (!root) {