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 2015/06/03 06:43:36 UTC

svn commit: r1683225 - in /myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html: standard/standard/tag/ util/

Author: lofwyr
Date: Wed Jun  3 04:43:36 2015
New Revision: 1683225

URL: http://svn.apache.org/r1683225
Log:
TOBAGO-1368: Create a new theme which uses Bootstrap
 - Better class writing

Modified:
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ImageRenderer.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/OutRenderer.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ImageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ImageRenderer.java?rev=1683225&r1=1683224&r2=1683225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ImageRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ImageRenderer.java Wed Jun  3 04:43:36 2015
@@ -78,6 +78,14 @@ public class ImageRenderer extends Layou
     }
 
     writer.startElement(HtmlElements.IMG, image);
+
+    if (image.getWidth() != null) {
+      writer.writeAttribute(HtmlAttributes.WIDTH, "" + image.getWidth().getPixel(), false);
+    }
+    if (image.getHeight() != null) {
+      writer.writeAttribute(HtmlAttributes.HEIGHT, "" + image.getHeight().getPixel(), false);
+    }
+
     final String clientId = image.getClientId(facesContext);
     writer.writeIdAttribute(clientId);
     HtmlRendererUtils.writeDataAttributes(facesContext, writer, image);
@@ -94,7 +102,7 @@ public class ImageRenderer extends Layou
     writer.writeStyleAttribute(style);
     if (ComponentUtils.findAncestor(image, UINav.class) != null) { // todo: may set a marker in the context in the
       // todo: NavRenderer, or the additional class, to avoid tree traversing
-      writer.writeClassAttribute(Classes.create(image).getStringValue() + " " + BootstrapClass.NAVBAR_BRAND.getName());
+      writer.writeClassAttribute(Classes.create(image), BootstrapClass.NAVBAR_BRAND);
     } else {
       writer.writeClassAttribute(Classes.create(image));
     }

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/OutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/OutRenderer.java?rev=1683225&r1=1683224&r2=1683225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/OutRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/OutRenderer.java Wed Jun  3 04:43:36 2015
@@ -61,8 +61,7 @@ public class OutRenderer extends LayoutC
       HtmlRendererUtils.writeDataAttributes(facesContext, writer, out);
       final Style style = new Style(facesContext, out);
       writer.writeStyleAttribute(style);
-      writer.writeClassAttribute(
-          Classes.create(out).getStringValue() + " " + BootstrapClass.FORM_CONTROL_STATIC.getName());
+      writer.writeClassAttribute(Classes.create(out), BootstrapClass.FORM_CONTROL_STATIC);
       final String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, out);
       if (title != null) {
         writer.writeAttribute(HtmlAttributes.TITLE, title, true);

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java?rev=1683225&r1=1683224&r2=1683225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java Wed Jun  3 04:43:36 2015
@@ -237,11 +237,8 @@ public class SheetRenderer extends Layou
     writer.writeAttribute(HtmlAttributes.CELLSPACING, "0", false);
     writer.writeAttribute(HtmlAttributes.CELLPADDING, "0", false);
     writer.writeAttribute(HtmlAttributes.SUMMARY, "", false);
-    writer.writeClassAttribute(Classes.create(sheet, "bodyTable").getStringValue()
-        + " " + BootstrapClass.TABLE.getName()
-        + " " + BootstrapClass.TABLE_BORDERED.getName()
-        + " " + BootstrapClass.TABLE_STRIPED.getName()
-        + " " + BootstrapClass.TABLE_HOVER.getName()); // XXX
+    writer.writeClassAttribute(Classes.create(sheet, "bodyTable"),
+        BootstrapClass.TABLE, BootstrapClass.TABLE_BORDERED, BootstrapClass.TABLE_STRIPED, BootstrapClass.TABLE_HOVER);
 
     writeColgroup(writer, columnWidths);
 
@@ -777,9 +774,7 @@ public class SheetRenderer extends Layou
     writer.writeAttribute(HtmlAttributes.CELLPADDING, "0", false);
     writer.writeAttribute(HtmlAttributes.SUMMARY, "", false);
     writer.writeClassAttribute(
-        Classes.create(sheet, "headerTable").getStringValue()
-            + " " + BootstrapClass.TABLE.getName()
-            + " " + BootstrapClass.TABLE_BORDERED.getName());
+        Classes.create(sheet, "headerTable"), BootstrapClass.TABLE, BootstrapClass.TABLE_BORDERED);
 
     writeColgroup(writer, columnWidths);
 

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java?rev=1683225&r1=1683224&r2=1683225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java Wed Jun  3 04:43:36 2015
@@ -182,8 +182,7 @@ public class TabGroupRenderer extends La
     writer.writeClassAttribute(Classes.create(tabGroup, "header"));
 
     writer.startElement(HtmlElements.UL, tabGroup);
-    writer.writeClassAttribute(Classes.create(tabGroup, "headerInner").getStringValue()
-      +" "  + BootstrapClass.NAV.getName() + ' ' + BootstrapClass.NAV_TABS.getName()); // XXX clean up css management
+    writer.writeClassAttribute(Classes.create(tabGroup, "headerInner"), BootstrapClass.NAV, BootstrapClass.NAV_TABS);
     writer.writeAttribute(HtmlAttributes.ROLE, HtmlRoleValues.TABLIST.toString(), false);
 
     int index = 0;
@@ -205,7 +204,7 @@ public class TabGroupRenderer extends La
           writer.startElement(HtmlElements.LI, tab);
           // todo: fix Css management
           if (activeIndex == index) {
-            writer.writeClassAttribute(Classes.create(tab).getStringValue() + " " + BootstrapClass.ACTIVE.getName());
+            writer.writeClassAttribute(Classes.create(tab), BootstrapClass.ACTIVE);
           } else {
             writer.writeClassAttribute(Classes.create(tab));
           }

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java?rev=1683225&r1=1683224&r2=1683225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java Wed Jun  3 04:43:36 2015
@@ -262,7 +262,7 @@ public final class HtmlRendererUtils {
     final UIComponent contextMenu = FacetUtils.getContextMenu(parent);
     if (contextMenu != null) {
       writer.startElement(HtmlElements.OL, contextMenu);
-      writer.writeClassAttribute("tobago-menuBar tobago-menu-contextMenu");
+      writer. writeClassAttribute("tobago-menuBar tobago-menu-contextMenu");
       RenderUtils.encode(facesContext, contextMenu);
       writer.endElement(HtmlElements.OL);
     }