myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hno...@apache.org
Subject svn commit: r1804785 [2/2] - in /myfaces/tobago/trunk/tobago-core/src/main: java/org/apache/myfaces/tobago/internal/renderkit/renderer/ java/org/apache/myfaces/tobago/internal/util/ java/org/apache/myfaces/tobago/renderkit/css/ java/org/apache/myfaces/...
Date Fri, 11 Aug 2017 12:25:41 GMT
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneListboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneListboxRenderer.java?rev=1804785&r1=1804784&r2=1804785&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneListboxRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneListboxRenderer.java Fri Aug 11 12:25:41 2017
@@ -25,7 +25,6 @@ import org.apache.myfaces.tobago.interna
 import org.apache.myfaces.tobago.internal.util.RenderUtils;
 import org.apache.myfaces.tobago.internal.util.SelectItemUtils;
 import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
-import org.apache.myfaces.tobago.renderkit.css.CssItem;
 import org.apache.myfaces.tobago.renderkit.css.TobagoClass;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
@@ -36,8 +35,6 @@ import javax.faces.component.UIComponent
 import javax.faces.context.FacesContext;
 import javax.faces.model.SelectItem;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
 public class SelectOneListboxRenderer extends SelectOneRendererBase {
@@ -71,21 +68,18 @@ public class SelectOneListboxRenderer ex
     writer.writeAttribute(HtmlAttributes.TABINDEX, select.getTabIndex());
     writer.writeStyleAttribute(select.getStyle());
 
-    // TODO: optimize class attribute writing
-    final List<CssItem> classAttributes = new ArrayList<CssItem>();
-    classAttributes.add(TobagoClass.SELECT_ONE_LISTBOX);
-    classAttributes.addAll(Arrays.asList(
-        TobagoClass.SELECT_ONE_LISTBOX.createMarkup(ComponentUtils.updateMarkup(select, select.getMarkup()))));
-    classAttributes.add(BootstrapClass.FORM_CONTROL);
-    classAttributes.add(select.getCustomClass());
-    writer.writeClassAttribute(null, null, classAttributes.toArray(new CssItem[classAttributes.size()]));
+    writer.writeClassAttribute(
+        TobagoClass.SELECT_ONE_LISTBOX,
+        TobagoClass.SELECT_ONE_LISTBOX.createMarkup(select.getMarkup()),
+        TobagoClass.SELECT_ONE_LISTBOX.createDefaultMarkups(select),
+        BootstrapClass.FORM_CONTROL,
+        select.getCustomClass());
     final String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, select);
     writer.writeAttribute(HtmlAttributes.TITLE, title, true);
     writer.writeAttribute(HtmlAttributes.SIZE, size);
     writer.writeCommandMapAttribute(JsonUtils.encode(RenderUtils.getBehaviorCommands(facesContext, select)));
-    HtmlRendererUtils.renderSelectItems(select, items, select.getValue(), (String) select.getSubmittedValue(),
-        writer, facesContext);
-
+    HtmlRendererUtils.renderSelectItems(select, TobagoClass.SELECT_ONE_LISTBOX__OPTION, items, select.getValue(),
+        (String) select.getSubmittedValue(), writer, facesContext);
   }
 
   @Override

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneRadioInsideCommandRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneRadioInsideCommandRenderer.java?rev=1804785&r1=1804784&r2=1804785&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneRadioInsideCommandRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneRadioInsideCommandRenderer.java Fri Aug 11 12:25:41 2017
@@ -26,7 +26,6 @@ import org.apache.myfaces.tobago.renderk
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import java.io.IOException;
-import java.util.List;
 
 public class SelectOneRadioInsideCommandRenderer extends SelectOneRadioRenderer {
 
@@ -46,8 +45,7 @@ public class SelectOneRadioInsideCommand
   }
 
   @Override
-  protected void addCssItems(final FacesContext facesContext, final AbstractUISelectOneRadio select,
-                             final List<CssItem> collected) {
-    collected.add(BootstrapClass.DROPDOWN_ITEM);
+  protected CssItem[] getCssItems(final FacesContext facesContext, final AbstractUISelectOneRadio select) {
+    return new CssItem[]{BootstrapClass.DROPDOWN_ITEM};
   }
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneRadioRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneRadioRenderer.java?rev=1804785&r1=1804784&r2=1804785&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneRadioRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneRadioRenderer.java Fri Aug 11 12:25:41 2017
@@ -38,9 +38,6 @@ import javax.faces.component.UIComponent
 import javax.faces.context.FacesContext;
 import javax.faces.model.SelectItem;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
 
 public class SelectOneRadioRenderer extends SelectOneRendererBase {
 
@@ -63,14 +60,12 @@ public class SelectOneRadioRenderer exte
     }
     writer.writeStyleAttribute(select.getStyle());
 
-    // TODO: optimize class attribute writing
-    final List<CssItem> classAttributes = new ArrayList<CssItem>();
-    classAttributes.add(TobagoClass.SELECT_ONE_RADIO);
-    classAttributes.addAll(Arrays.asList(
-        TobagoClass.SELECT_ONE_RADIO.createMarkup(ComponentUtils.updateMarkup(select, select.getMarkup()))));
-    classAttributes.add(inline ? TobagoClass.SELECT_ONE_RADIO__INLINE : null);
-    classAttributes.add(select.getCustomClass());
-    writer.writeClassAttribute(null, null, classAttributes.toArray(new CssItem[classAttributes.size()]));
+    writer.writeClassAttribute(
+        TobagoClass.SELECT_ONE_RADIO,
+        TobagoClass.SELECT_ONE_RADIO.createMarkup(select.getMarkup()),
+        TobagoClass.SELECT_ONE_RADIO.createDefaultMarkups(select),
+        inline ? TobagoClass.SELECT_ONE_RADIO__INLINE : null,
+        select.getCustomClass());
     HtmlRendererUtils.writeDataAttributes(facesContext, writer, select);
     if (title != null) {
       writer.writeAttribute(HtmlAttributes.TITLE, title, true);
@@ -90,11 +85,8 @@ public class SelectOneRadioRenderer exte
             itemDisabled ? BootstrapClass.DISABLED : null);
       }
       writer.startElement(HtmlElements.LABEL);
-      final List<CssItem> cssItems = new ArrayList<CssItem>();
-      addCssItems(facesContext, select, cssItems);
       writer.writeClassAttribute(BootstrapClass.FORM_CHECK_LABEL,
-          null,
-          cssItems.toArray(new CssItem[cssItems.size()]));
+          getCssItems(facesContext, select));
       writer.startElement(HtmlElements.INPUT);
       writer.writeClassAttribute(BootstrapClass.FORM_CHECK_INPUT);
       writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.RADIO);
@@ -153,7 +145,7 @@ public class SelectOneRadioRenderer exte
     return true;
   }
 
-  protected void addCssItems(final FacesContext facesContext, final AbstractUISelectOneRadio select,
-                             final List<CssItem> collected) {
+  protected CssItem[] getCssItems(final FacesContext facesContext, final AbstractUISelectOneRadio select) {
+    return null;
   }
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SeparatorRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SeparatorRenderer.java?rev=1804785&r1=1804784&r2=1804785&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SeparatorRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SeparatorRenderer.java Fri Aug 11 12:25:41 2017
@@ -47,8 +47,9 @@ public class SeparatorRenderer extends R
       writer.writeIdAttribute(clientId);
       writer.writeClassAttribute(
           TobagoClass.SEPARATOR,
-          separator.getCustomClass(),
-          TobagoClass.SEPARATOR.createMarkup(ComponentUtils.updateMarkup(separator, separator.getMarkup())));
+          TobagoClass.SEPARATOR.createMarkup(separator.getMarkup()),
+          TobagoClass.SEPARATOR.createDefaultMarkups(separator),
+          separator.getCustomClass());
       writer.writeText(label);
       writer.endElement(HtmlElements.P);
     } else {
@@ -56,8 +57,9 @@ public class SeparatorRenderer extends R
       writer.writeIdAttribute(clientId);
       writer.writeClassAttribute(
           TobagoClass.SEPARATOR,
-          separator.getCustomClass(),
-          TobagoClass.SEPARATOR.createMarkup(ComponentUtils.updateMarkup(separator, separator.getMarkup())));
+          TobagoClass.SEPARATOR.createMarkup(separator.getMarkup()),
+          TobagoClass.SEPARATOR.createDefaultMarkups(separator),
+          separator.getCustomClass());
       writer.endElement(HtmlElements.HR);
     }
   }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java?rev=1804785&r1=1804784&r2=1804785&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java Fri Aug 11 12:25:41 2017
@@ -57,7 +57,6 @@ import org.apache.myfaces.tobago.model.S
 import org.apache.myfaces.tobago.model.TreePath;
 import org.apache.myfaces.tobago.renderkit.RendererBase;
 import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
-import org.apache.myfaces.tobago.renderkit.css.Classes;
 import org.apache.myfaces.tobago.renderkit.css.CssItem;
 import org.apache.myfaces.tobago.renderkit.css.CustomClass;
 import org.apache.myfaces.tobago.renderkit.css.Icons;
@@ -187,8 +186,9 @@ public class SheetRenderer extends Rende
     HtmlRendererUtils.writeDataAttributes(facesContext, writer, sheet);
     writer.writeClassAttribute(
         TobagoClass.SHEET,
-        sheet.getCustomClass(),
-        TobagoClass.SHEET.createMarkup(ComponentUtils.updateMarkup(sheet, sheet.getMarkup())));
+        TobagoClass.SHEET.createMarkup(sheet.getMarkup()),
+        TobagoClass.SHEET.createDefaultMarkups(sheet),
+        sheet.getCustomClass());
     writer.writeStyleAttribute(sheet.getStyle());
     final UIComponent facetReload = ComponentUtils.getFacet(sheet, Facets.reload);
     if (facetReload != null && facetReload instanceof UIReload && facetReload.isRendered()) {
@@ -282,7 +282,8 @@ public class SheetRenderer extends Rende
         final String pagerCommandId = command.getClientId(facesContext);
 
         writer.startElement(HtmlElements.UL);
-        writer.writeClassAttribute(Classes.create(sheet, "paging", showRowRange), BootstrapClass.PAGINATION);
+        writer.writeClassAttribute(TobagoClass.SHEET__PAGING, TobagoClass.SHEET__PAGING.createMarkup(showRowRange),
+            BootstrapClass.PAGINATION);
         writer.startElement(HtmlElements.LI);
         writer.writeClassAttribute(BootstrapClass.PAGE_ITEM);
         writer.writeAttribute(HtmlAttributes.TITLE,
@@ -348,8 +349,8 @@ public class SheetRenderer extends Rende
       final Markup showDirectLinks = markupForLeftCenterRight(sheet.getShowDirectLinks());
       if (showDirectLinks != Markup.NULL) {
         writer.startElement(HtmlElements.UL);
-        writer.writeClassAttribute(
-            Classes.create(sheet, "paging", showDirectLinks), BootstrapClass.PAGINATION);
+        writer.writeClassAttribute(TobagoClass.SHEET__PAGING, TobagoClass.SHEET__PAGING.createMarkup(showDirectLinks),
+            BootstrapClass.PAGINATION);
         if (sheet.isShowDirectLinksArrows()) {
           final boolean disabled = sheet.isAtBeginning();
           encodeLink(facesContext, sheet, application, disabled, SheetAction.first, null, Icons.STEP_BACKWARD, null);
@@ -373,8 +374,8 @@ public class SheetRenderer extends Rende
         final String pagerCommandId = command.getClientId(facesContext);
 
         writer.startElement(HtmlElements.UL);
-        writer.writeClassAttribute(Classes.create(sheet, "paging", showPageRange), BootstrapClass.PAGINATION);
-
+        writer.writeClassAttribute(TobagoClass.SHEET__PAGING, TobagoClass.SHEET__PAGING.createMarkup(showPageRange),
+            BootstrapClass.PAGINATION);
         if (sheet.isShowPageRangeArrows()) {
           final boolean disabled = sheet.isAtBeginning();
           encodeLink(facesContext, sheet, application, disabled, SheetAction.first, null, Icons.STEP_BACKWARD, null);
@@ -605,7 +606,8 @@ public class SheetRenderer extends Rende
         }
       }
       writer.writeClassAttribute(
-          Classes.create(sheet, "row", rowMarkup),
+          TobagoClass.SHEET__ROW,
+          TobagoClass.SHEET__ROW.createMarkup(rowMarkup),
           selected ? BootstrapClass.TABLE_INFO : null,
           rowClass);
 
@@ -619,7 +621,10 @@ public class SheetRenderer extends Rende
               markup = Markup.NULL;
             }
             markup = markup.add(getMarkupForAlign(normalColumn));
-            writer.writeClassAttribute(Classes.create(sheet, "cell", markup), normalColumn.getCustomClass());
+            writer.writeClassAttribute(
+                TobagoClass.SHEET__CELL,
+                TobagoClass.SHEET__CELL.createMarkup(markup),
+                normalColumn.getCustomClass());
             writer.writeStyleAttribute(normalColumn.getStyle());
 
             if (normalColumn instanceof UIColumnSelector) {
@@ -653,7 +658,7 @@ public class SheetRenderer extends Rende
 
       if (!autoLayout) {
         writer.startElement(HtmlElements.TD);
-        writer.writeClassAttribute(Classes.create(sheet, "cell", Markup.FILLER));
+        writer.writeClassAttribute(TobagoClass.SHEET__CELL, TobagoClass.SHEET__CELL.createMarkup(Markup.FILLER));
 //      writer.write("&nbsp;");
         writer.startElement(HtmlElements.DIV);
         writer.endElement(HtmlElements.DIV);
@@ -677,7 +682,7 @@ public class SheetRenderer extends Rende
       }
       if (!autoLayout) {
         writer.startElement(HtmlElements.TD);
-        writer.writeClassAttribute(Classes.create(sheet, "cell", Markup.FILLER));
+        writer.writeClassAttribute(TobagoClass.SHEET__CELL, TobagoClass.SHEET__CELL.createMarkup(Markup.FILLER));
 //      writer.write("&nbsp;");
         writer.startElement(HtmlElements.DIV);
         writer.endElement(HtmlElements.DIV);
@@ -782,20 +787,20 @@ public class SheetRenderer extends Rende
 
             final UIComponent cellComponent = cell.getComponent();
 
-            final CssItem align;
+            Markup align;
             final String alignString = ComponentUtils.getStringAttribute(column, Attributes.align);
             if (multiHeader && cell.getColumnSpan() > 1) {
-              align = TobagoClass.SHEET__CELL__MARKUP__CENTER;
+              align = Markup.CENTER;
             } else if (alignString != null) {
               switch (TextAlign.valueOf(alignString)) {
                 case right:
-                  align = TobagoClass.SHEET__CELL__MARKUP__RIGHT;
+                  align = Markup.RIGHT;
                   break;
                 case center:
-                  align = TobagoClass.SHEET__CELL__MARKUP__CENTER;
+                  align = Markup.CENTER;
                   break;
                 case justify:
-                  align = TobagoClass.SHEET__CELL__MARKUP__JUSTIFY;
+                  align = Markup.JUSTIFY;
                   break;
                 default:
                   align = null;
@@ -803,7 +808,10 @@ public class SheetRenderer extends Rende
             } else {
               align = null;
             }
-            writer.writeClassAttribute(TobagoClass.SHEET__HEADER_CELL, column.getCustomClass(), align);
+            writer.writeClassAttribute(
+                TobagoClass.SHEET__HEADER_CELL,
+                TobagoClass.SHEET__CELL.createMarkup(align),
+                column.getCustomClass());
             writer.writeStyleAttribute(column.getStyle());
             writer.startElement(HtmlElements.SPAN);
             Icons sorterIcon = null;
@@ -857,7 +865,7 @@ public class SheetRenderer extends Rende
               }
             }
 
-            writer.writeClassAttribute(Classes.create(sheet, "header", markup));
+            writer.writeClassAttribute(TobagoClass.SHEET__HEADER, TobagoClass.SHEET__HEADER.createMarkup(markup));
             writer.writeAttribute(HtmlAttributes.TITLE, tip, true);
 
             if (column instanceof UIColumnSelector && selectable.isMulti()) {
@@ -901,7 +909,9 @@ public class SheetRenderer extends Rende
 
   private void encodeHeaderFiller(final TobagoResponseWriter writer, final UISheet sheet) throws IOException {
     writer.startElement(HtmlElements.TH);
-    writer.writeClassAttribute(Classes.create(sheet, "headerCell", Markup.FILLER));
+    writer.writeClassAttribute(
+        TobagoClass.SHEET__HEADER_CELL,
+        TobagoClass.SHEET__HEADER_CELL.createMarkup(Markup.FILLER));
     writer.startElement(HtmlElements.SPAN);
     writer.writeClassAttribute(TobagoClass.SHEET__HEADER);
     final Style headerStyle = new Style();

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TabGroupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TabGroupRenderer.java?rev=1804785&r1=1804784&r2=1804785&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TabGroupRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TabGroupRenderer.java Fri Aug 11 12:25:41 2017
@@ -39,7 +39,6 @@ import org.apache.myfaces.tobago.model.S
 import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
 import org.apache.myfaces.tobago.renderkit.RendererBase;
 import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
-import org.apache.myfaces.tobago.renderkit.css.Classes;
 import org.apache.myfaces.tobago.renderkit.css.TobagoClass;
 import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
@@ -152,8 +151,9 @@ public class TabGroupRenderer extends Re
     writer.writeIdAttribute(clientId);
     writer.writeClassAttribute(
         TobagoClass.TAB_GROUP,
-        tabGroup.getCustomClass(),
-        TobagoClass.TAB_GROUP.createMarkup(ComponentUtils.updateMarkup(tabGroup, tabGroup.getMarkup())));
+        TobagoClass.TAB_GROUP.createMarkup(tabGroup.getMarkup()),
+        TobagoClass.TAB_GROUP.createDefaultMarkups(tabGroup),
+        tabGroup.getCustomClass());
     HtmlRendererUtils.writeDataAttributes(facesContext, writer, tabGroup);
     writer.writeStyleAttribute(tabGroup.getStyle());
     writer.writeAttribute(HtmlAttributes.SWITCHTYPE, switchType.name(), false);
@@ -239,7 +239,9 @@ public class TabGroupRenderer extends Re
           writer.startElement(HtmlElements.LI);
           writer.writeIdAttribute(tabId);
           writer.writeClassAttribute(
-              Classes.create(tab, markup),
+              TobagoClass.TAB,
+              TobagoClass.TAB.createMarkup(markup),
+              TobagoClass.TAB.createDefaultMarkups(tab),
               BootstrapClass.NAV_ITEM,
               tab.getCustomClass());
           writer.writeStyleAttribute(tab.getStyle());
@@ -320,8 +322,10 @@ public class TabGroupRenderer extends Re
           }
 
           writer.startElement(HtmlElements.DIV);
-          writer.writeClassAttribute(TobagoClass.TAB__CONTENT,
-              BootstrapClass.TAB_PANE, index == activeIndex ? BootstrapClass.ACTIVE : null);
+          writer.writeClassAttribute(
+              TobagoClass.TAB__CONTENT,
+              BootstrapClass.TAB_PANE,
+              index == activeIndex ? BootstrapClass.ACTIVE : null);
           writer.writeAttribute(HtmlAttributes.ROLE, HtmlRoleValues.TABPANEL.toString(), false);
           writer.writeIdAttribute(getTabPanelId(facesContext, (UITab) tab));
 

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TextareaRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TextareaRenderer.java?rev=1804785&r1=1804784&r2=1804785&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TextareaRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TextareaRenderer.java Fri Aug 11 12:25:41 2017
@@ -28,7 +28,6 @@ import org.apache.myfaces.tobago.interna
 import org.apache.myfaces.tobago.internal.util.RenderUtils;
 import org.apache.myfaces.tobago.internal.util.StringUtils;
 import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
-import org.apache.myfaces.tobago.renderkit.css.CssItem;
 import org.apache.myfaces.tobago.renderkit.css.TobagoClass;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
@@ -46,9 +45,6 @@ import javax.faces.validator.LengthValid
 import javax.faces.validator.RegexValidator;
 import javax.faces.validator.Validator;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
 
 public class TextareaRenderer extends MessageLayoutRendererBase {
 
@@ -56,7 +52,7 @@ public class TextareaRenderer extends Me
 
   @Override
   protected void setSubmittedValue(
-          final FacesContext facesContext, final EditableValueHolder component, final String newValue) {
+      final FacesContext facesContext, final EditableValueHolder component, final String newValue) {
 
     String value = newValue;
 
@@ -107,14 +103,12 @@ public class TextareaRenderer extends Me
       AccessKeyLogger.addAccessKey(facesContext, input.getAccessKey(), clientId);
     }
 
-    // TODO: optimize class attribute writing
-    final List<CssItem> classAttributes = new ArrayList<CssItem>();
-    classAttributes.add(TobagoClass.TEXTAREA);
-    classAttributes.addAll(Arrays.asList(
-        TobagoClass.TEXTAREA.createMarkup(ComponentUtils.updateMarkup(input, input.getMarkup()))));
-    classAttributes.add(BootstrapClass.FORM_CONTROL);
-    classAttributes.add(input.getCustomClass());
-    writer.writeClassAttribute(null, null, classAttributes.toArray(new CssItem[classAttributes.size()]));
+    writer.writeClassAttribute(
+        TobagoClass.TEXTAREA,
+        TobagoClass.TEXTAREA.createMarkup(input.getMarkup()),
+        TobagoClass.TEXTAREA.createDefaultMarkups(input),
+        BootstrapClass.FORM_CONTROL,
+        input.getCustomClass());
     writer.writeStyleAttribute(input.getStyle());
     int maxLength = 0;
     int minLength = 0;

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeLabelRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeLabelRenderer.java?rev=1804785&r1=1804784&r2=1804785&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeLabelRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeLabelRenderer.java Fri Aug 11 12:25:41 2017
@@ -57,8 +57,8 @@ public class TreeLabelRenderer extends R
       writer.startElement(HtmlElements.LABEL);
       writer.writeClassAttribute(
           TobagoClass.TREE_LABEL,
-          null,
-          TobagoClass.TREE_LABEL.createMarkup(ComponentUtils.updateMarkup(label, label.getMarkup())));
+          TobagoClass.TREE_LABEL.createMarkup(label.getMarkup()),
+          TobagoClass.TREE_LABEL.createDefaultMarkups(label));
       HtmlRendererUtils.writeDataAttributes(facesContext, writer, label);
       writer.writeStyleAttribute(label.getStyle());
       final String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, label);

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeListboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeListboxRenderer.java?rev=1804785&r1=1804784&r2=1804785&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeListboxRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeListboxRenderer.java Fri Aug 11 12:25:41 2017
@@ -67,8 +67,8 @@ public class TreeListboxRenderer extends
     writer.startElement(HtmlElements.DIV);
     writer.writeClassAttribute(
         TobagoClass.TREE_LISTBOX,
-        null,
-        TobagoClass.TREE_LISTBOX.createMarkup(ComponentUtils.updateMarkup(tree, tree.getMarkup())));
+        TobagoClass.TREE_LISTBOX.createMarkup(tree.getMarkup()),
+        TobagoClass.TREE_LISTBOX.createDefaultMarkups(tree));
     HtmlRendererUtils.writeDataAttributes(facesContext, writer, tree);
     writer.writeStyleAttribute(tree.getStyle());
 

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeNodeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeNodeRenderer.java?rev=1804785&r1=1804784&r2=1804785&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeNodeRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeNodeRenderer.java Fri Aug 11 12:25:41 2017
@@ -32,8 +32,8 @@ import org.apache.myfaces.tobago.layout.
 import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.model.Selectable;
 import org.apache.myfaces.tobago.renderkit.RendererBase;
-import org.apache.myfaces.tobago.renderkit.css.Classes;
 import org.apache.myfaces.tobago.renderkit.css.Style;
+import org.apache.myfaces.tobago.renderkit.css.TobagoClass;
 import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
@@ -146,7 +146,10 @@ public class TreeNodeRenderer extends Re
         }
       }
 
-      writer.writeClassAttribute(Classes.create(node, markup));
+      writer.writeClassAttribute(
+          TobagoClass.TREE_NODE,
+          TobagoClass.TREE_NODE.createMarkup(markup),
+          TobagoClass.TREE_NODE.createDefaultMarkups(node));
       HtmlRendererUtils.writeDataAttributes(facesContext, writer, node);
       if (parentId != null) {
         writer.writeAttribute(DataAttributes.TREE_PARENT, parentId, false);

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeRenderer.java?rev=1804785&r1=1804784&r2=1804785&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeRenderer.java Fri Aug 11 12:25:41 2017
@@ -88,8 +88,9 @@ public class TreeRenderer extends Render
     writer.startElement(HtmlElements.DIV);
     writer.writeClassAttribute(
         TobagoClass.TREE,
-        tree.getCustomClass(),
-        TobagoClass.TREE.createMarkup(ComponentUtils.updateMarkup(tree, tree.getMarkup())));
+        TobagoClass.TREE.createMarkup(tree.getMarkup()),
+        TobagoClass.TREE.createDefaultMarkups(tree),
+        tree.getCustomClass());
     writer.writeStyleAttribute(tree.getStyle());
     writer.writeIdAttribute(clientId);
     HtmlRendererUtils.writeDataAttributes(facesContext, writer, tree);

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeSelectRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeSelectRenderer.java?rev=1804785&r1=1804784&r2=1804785&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeSelectRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeSelectRenderer.java Fri Aug 11 12:25:41 2017
@@ -108,8 +108,8 @@ public class TreeSelectRenderer extends
     writer.startElement(HtmlElements.SPAN);
     writer.writeClassAttribute(
         TobagoClass.TREE_SELECT,
-        null,
-        TobagoClass.TREE_SELECT.createMarkup(ComponentUtils.updateMarkup(select, select.getMarkup())));
+        TobagoClass.TREE_SELECT.createMarkup(select.getMarkup()),
+        TobagoClass.TREE_SELECT.createDefaultMarkups(select));
     HtmlRendererUtils.writeDataAttributes(facesContext, writer, select);
 
     if (select.isShowCheckbox()

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/HtmlRendererUtils.java?rev=1804785&r1=1804784&r2=1804785&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/HtmlRendererUtils.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/HtmlRendererUtils.java Fri Aug 11 12:25:41 2017
@@ -24,9 +24,9 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.context.Markup;
 import org.apache.myfaces.tobago.internal.webapp.TobagoResponseWriterWrapper;
 import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
-import org.apache.myfaces.tobago.renderkit.css.Classes;
 import org.apache.myfaces.tobago.renderkit.css.FontAwesomeIconEncoder;
 import org.apache.myfaces.tobago.renderkit.css.Style;
+import org.apache.myfaces.tobago.renderkit.css.TobagoClass;
 import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
@@ -159,27 +159,29 @@ public final class HtmlRendererUtils {
    * @deprecated Since Tobago 2.0.7
    */
   @Deprecated
-  public static void renderSelectItems(final UIInput component, final Iterable<SelectItem> items, final Object[] values,
-      final TobagoResponseWriter writer, final FacesContext facesContext) throws IOException {
-    renderSelectItems(component, items, values, null, null, writer, facesContext);
+  public static void renderSelectItems(final UIInput component, final TobagoClass optionClass,
+      final Iterable<SelectItem> items, final Object[] values, final TobagoResponseWriter writer,
+      final FacesContext facesContext) throws IOException {
+    renderSelectItems(component, optionClass, items, values, null, null, writer, facesContext);
   }
 
-  public static void renderSelectItems(final UIInput component, final Iterable<SelectItem> items, final Object[] values,
-      final String[] submittedValues, final TobagoResponseWriter writer, final FacesContext facesContext)
-      throws IOException {
-    renderSelectItems(component, items, values, submittedValues, null, writer, facesContext);
+  public static void renderSelectItems(final UIInput component, final TobagoClass optionClass,
+      final Iterable<SelectItem> items, final Object[] values, final String[] submittedValues,
+      final TobagoResponseWriter writer, final FacesContext facesContext) throws IOException {
+    renderSelectItems(component, optionClass, items, values, submittedValues, null, writer, facesContext);
   }
 
-  public static void renderSelectItems(final UIInput component, final Iterable<SelectItem> items, final Object value,
-      final String submittedValue, final TobagoResponseWriter writer, final FacesContext facesContext)
-      throws IOException {
-    renderSelectItems(component, items, value != null ? new Object[] {value}: null,
-        submittedValue != null ?  new String[] {submittedValue}: null, null, writer, facesContext);
+  public static void renderSelectItems(final UIInput component, final TobagoClass optionClass,
+      final Iterable<SelectItem> items, final Object value, final String submittedValue,
+      final TobagoResponseWriter writer, final FacesContext facesContext) throws IOException {
+    renderSelectItems(component, optionClass, items, value != null ? new Object[]{value} : null,
+        submittedValue != null ? new String[]{submittedValue} : null, null, writer, facesContext);
   }
 
-  public static void renderSelectItems(final UIInput component, final Iterable<SelectItem> items, final Object[] values,
-      final String[] submittedValues, final Boolean onlySelected, final TobagoResponseWriter writer,
-      final FacesContext facesContext) throws IOException {
+  public static void renderSelectItems(final UIInput component, final TobagoClass optionClass,
+      final Iterable<SelectItem> items, final Object[] values, final String[] submittedValues,
+      final Boolean onlySelected, final TobagoResponseWriter writer, final FacesContext facesContext)
+      throws IOException {
 
     if (LOG.isDebugEnabled()) {
       LOG.debug("component id = '{}'", component.getId());
@@ -194,7 +196,7 @@ public final class HtmlRendererUtils {
           writer.writeAttribute(HtmlAttributes.DISABLED, true);
         }
         final SelectItem[] selectItems = ((SelectItemGroup) item).getSelectItems();
-        renderSelectItems(component, Arrays.asList(selectItems), values, submittedValues,
+        renderSelectItems(component, optionClass, Arrays.asList(selectItems), values, submittedValues,
             onlySelected, writer, facesContext);
         writer.endElement(HtmlElements.OPTGROUP);
       } else {
@@ -241,7 +243,7 @@ public final class HtmlRendererUtils {
           writer.writeAttribute(HtmlAttributes.DISABLED, true);
           markup = Markup.DISABLED.add(markup);
         }
-        writer.writeClassAttribute(Classes.create(component, "option", markup));
+        writer.writeClassAttribute(optionClass, optionClass.createMarkup(markup));
 
         writer.writeText(item.getLabel());
         writer.endElement(HtmlElements.OPTION);

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/FontAwesomeIconEncoder.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/FontAwesomeIconEncoder.java?rev=1804785&r1=1804784&r2=1804785&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/FontAwesomeIconEncoder.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/FontAwesomeIconEncoder.java Fri Aug 11 12:25:41 2017
@@ -55,7 +55,7 @@ public class FontAwesomeIconEncoder impl
       throws IOException {
     writer.startElement(HtmlElements.I);
     writer.writeStyleAttribute(style);
-    writer.writeClassAttribute(FA, generateClass(icon), cssItems);
+    writer.writeClassAttribute(FA, cssItems, generateClass(icon));
     writer.endElement(HtmlElements.I);
   }
 

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java?rev=1804785&r1=1804784&r2=1804785&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java Fri Aug 11 12:25:41 2017
@@ -26,9 +26,11 @@ import org.apache.myfaces.tobago.context
 import org.apache.myfaces.tobago.internal.util.Deprecation;
 import org.apache.myfaces.tobago.layout.AlignItems;
 import org.apache.myfaces.tobago.layout.JustifyContent;
+import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import java.util.ArrayList;
 import java.util.List;
@@ -103,6 +105,7 @@ public enum TobagoClass implements CssIt
   PAGE("tobago-page"),
   PAGE__MENU_STORE("tobago-page-menuStore"),
   PAGE__NOSCRIPT("tobago-page-noscript"),
+  PAGE__PREVENT_FRAME_ATTACKS("tobago-page-preventFrameAttacks"),
   PANEL("tobago-panel"),
   POPUP("tobago-popup"),
   PROGRESS("tobago-progress"),
@@ -114,10 +117,12 @@ public enum TobagoClass implements CssIt
   SELECT_MANY_CHECKBOX("tobago-selectManyCheckbox"),
   SELECT_MANY_CHECKBOX__INLINE("tobago-selectManyCheckbox-inline"),
   SELECT_MANY_LISTBOX("tobago-selectManyListbox"),
+  SELECT_MANY_LISTBOX__OPTION("tobago-selectManyListbox-option"),
   SELECT_MANY_SHUTTLE("tobago-selectManyShuttle"),
   SELECT_MANY_SHUTTLE__ADD("tobago-selectManyShuttle-add"),
   SELECT_MANY_SHUTTLE__ADD_ALL("tobago-selectManyShuttle-addAll"),
   SELECT_MANY_SHUTTLE__HIDDEN("tobago-selectManyShuttle-hidden"),
+  SELECT_MANY_SHUTTLE__OPTION("tobago-selectManyShuttle-option"),
   SELECT_MANY_SHUTTLE__REMOVE("tobago-selectManyShuttle-remove"),
   SELECT_MANY_SHUTTLE__REMOVE_ALL("tobago-selectManyShuttle-removeAll"),
   SELECT_MANY_SHUTTLE__SELECTED("tobago-selectManyShuttle-selected"),
@@ -126,11 +131,14 @@ public enum TobagoClass implements CssIt
   SELECT_MANY_SHUTTLE__UNSELECTED("tobago-selectManyShuttle-unselected"),
   SELECT_MANY_SHUTTLE__UNSELECTED_LABEL("tobago-selectManyShuttle-unselectedLabel"),
   SELECT_ONE_CHOICE("tobago-selectOneChoice"),
+  SELECT_ONE_CHOICE__OPTION("tobago-selectOneChoice-option"),
   SELECT_ONE_LISTBOX("tobago-selectOneListbox"),
+  SELECT_ONE_LISTBOX__OPTION("tobago-selectOneListbox-option"),
   SELECT_ONE_RADIO("tobago-selectOneRadio"),
   SELECT_ONE_RADIO__INLINE("tobago-selectOneRadio-inline"),
   SEPARATOR("tobago-separator"),
   SHEET("tobago-sheet"),
+  SHEET__CELL("tobago-sheet-cell"),
   SHEET__FOOTER("tobago-sheet-footer"),
   SHEET__BODY("tobago-sheet-body"),
   SHEET__HEADER_CELL("tobago-sheet-headerCell"),
@@ -141,12 +149,12 @@ public enum TobagoClass implements CssIt
   SHEET__BODY_TABLE("tobago-sheet-bodyTable"),
   SHEET__COLUMN_SELECTOR("tobago-sheet-columnSelector"),
   SHEET__HEADER_TABLE("tobago-sheet-headerTable"),
+  SHEET__PAGING("tobago-sheet-paging"),
   SHEET__PAGING_INPUT("tobago-sheet-pagingInput"),
   SHEET__PAGING_OUTPUT("tobago-sheet-pagingOutput"),
-  SHEET__CELL__MARKUP__RIGHT("tobago-sheet-cell-markup-right"),
-  SHEET__CELL__MARKUP__CENTER("tobago-sheet-cell-markup-center"),
-  SHEET__CELL__MARKUP__JUSTIFY("tobago-sheet-cell-markup-justify"),
+  SHEET__ROW("tobago-sheet-row"),
   SUGGEST("tobago-suggest"),
+  TAB("tobago-tab"),
   TAB__CONTENT("tobago-tab-content"),
   TAB_GROUP("tobago-tabGroup"),
   TAB_GROUP__HEADER("tobago-tabGroup-header"),
@@ -159,6 +167,7 @@ public enum TobagoClass implements CssIt
   TREE_LISTBOX("tobago-treeListbox"),
   TREE_LISTBOX__LEVEL("tobago-treeListbox-level"),
   TREE_LISTBOX__SELECT("tobago-treeListbox-select"),
+  TREE_NODE("tobago-treeNode"),
   TREE_NODE__TOGGLE("tobago-treeNode-toggle"),
   TREE_SELECT("tobago-treeSelect"),
   TREE_SELECT__LABEL("tobago-treeSelect-label");
@@ -233,6 +242,10 @@ public enum TobagoClass implements CssIt
     }
   }
 
+  public CssItem[] createDefaultMarkups(final UIComponent component) {
+    return createMarkup(ComponentUtils.updateMarkup(component, null));
+  }
+
   private static class MarkupClass implements CssItem {
 
     private final TobagoClass rendererClass;
@@ -247,7 +260,8 @@ public enum TobagoClass implements CssIt
     public String getName() {
       // These values are statistically tested length of the html class attribute
       final StringBuilder builder = new StringBuilder(80);
-      final String rendererName = rendererClass.getName().substring("tobago-".length());
+      final String name = rendererClass.getName().substring("tobago-".length());
+      final String rendererName = name.contains("-") ? name.substring(0, name.indexOf("-")) : name;
       final Theme theme = TobagoContext.getInstance(FacesContext.getCurrentInstance()).getTheme();
 
       if (theme.getRenderersConfig().isMarkupSupported(rendererName, markup)) {

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriter.java?rev=1804785&r1=1804784&r2=1804785&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriter.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriter.java Fri Aug 11 12:25:41 2017
@@ -148,19 +148,6 @@ public abstract class TobagoResponseWrit
   }
 
   /**
-   * Write the class attribute. The value will not escaped.
-   */
-  public void writeClassAttribute(final CssItem first) throws IOException {
-    if (first != null) {
-      // todo: optimize me, do not use StringBuilder
-      final StringBuilder builder = new StringBuilder();
-      builder.append(first.getName());
-      builder.append(' ');
-      writeAttribute(HtmlAttributes.CLASS, builder.deleteCharAt(builder.length() - 1).toString(), false);
-    }
-  }
-
-  /**
    * Write the command map data attribute.
    */
   public void writeCommandMapAttribute(final String map) throws IOException { // XXX use CommandMap instead of String
@@ -173,29 +160,36 @@ public abstract class TobagoResponseWrit
   /**
    * Write the class attribute. The value will not escaped.
    */
-  public void writeClassAttribute(final CssItem first, final CssItem second) throws IOException {
-    final StringBuilder builder = new StringBuilder();
-    boolean render = false;
-    if (first != null) {
-      builder.append(first.getName());
-      builder.append(' ');
-      render = true;
-    }
-    if (second != null) {
-      builder.append(second.getName());
-      builder.append(' ');
-      render = true;
-    }
-    if (render) {
-      writeAttribute(HtmlAttributes.CLASS, builder.deleteCharAt(builder.length() - 1).toString(), false);
-    }
+  public void writeClassAttribute(final CssItem... first) throws IOException {
+    writeClassAttribute(null, null, null, null, null, first);
   }
 
   /**
    * Write the class attribute. The value will not escaped.
    */
-  public void writeClassAttribute(final CssItem first, final CssItem second, final CssItem... others)
+  public void writeClassAttribute(final CssItem first, final CssItem[] second, final CssItem... third)
       throws IOException {
+    writeClassAttribute(first, second, null, null, null, third);
+  }
+
+  /**
+   * Write the class attribute. The value will not escaped.
+   */
+  public void writeClassAttribute(final CssItem first, final CssItem[] second, final CssItem[] third,
+      final CssItem... fourth) throws IOException {
+    writeClassAttribute(first, second, third, null, null, fourth);
+  }
+
+  /**
+   * Write the class attribute. The value will not escaped.
+   */
+  public void writeClassAttribute(final CssItem first, final CssItem[] second, final CssItem[] third,
+      final CssItem[] fourth, final CssItem... fifth) throws IOException {
+    writeClassAttribute(first, second, third, fourth, null, fifth);
+  }
+
+  public void writeClassAttribute(final CssItem first, final CssItem[] second, final CssItem[] third,
+      final CssItem[] fourth, final CssItem[] fifth, final CssItem... sixth) throws IOException {
     final StringBuilder builder = new StringBuilder();
     boolean render = false;
     if (first != null) {
@@ -204,24 +198,37 @@ public abstract class TobagoResponseWrit
       render = true;
     }
     if (second != null) {
-      builder.append(second.getName());
-      builder.append(' ');
-      render = true;
+      render |= writeCssItem(builder, second);
     }
-    if (others != null) {
-      for (CssItem other : others) {
-        if (other != null) {
-          builder.append(other.getName());
-          builder.append(' ');
-          render = true;
-        }
-      }
+    if (third != null) {
+      render |= writeCssItem(builder, third);
+    }
+    if (fourth != null) {
+      render |= writeCssItem(builder, fourth);
+    }
+    if (fifth != null) {
+      render |= writeCssItem(builder, fifth);
+    }
+    if (sixth != null) {
+      render |= writeCssItem(builder, sixth);
     }
     if (render) {
       writeAttribute(HtmlAttributes.CLASS, builder.deleteCharAt(builder.length() - 1).toString(), false);
     }
   }
 
+  private boolean writeCssItem(final StringBuilder builder, final CssItem... cssItems) {
+    boolean render = false;
+    for (CssItem cssItem : cssItems) {
+      if (cssItem != null) {
+        builder.append(cssItem.getName());
+        builder.append(' ');
+        render = true;
+      }
+    }
+    return render;
+  }
+
   /**
    * Write the style attribute. The value may be escaped (depending of the content).
    */

Modified: myfaces/tobago/trunk/tobago-core/src/main/resources/scss/_tobago.scss
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/resources/scss/_tobago.scss?rev=1804785&r1=1804784&r2=1804785&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/resources/scss/_tobago.scss (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/resources/scss/_tobago.scss Fri Aug 11 12:25:41 2017
@@ -717,13 +717,15 @@ h1, h2, h3, h4, h5, h6 {
 }
 
 /* selectManyListbox ----------------------------------------------------------- */
-.tobago-selectManyListbox {
+.tobago-selectManyListbox,
+.tobago-selectManyListbox-option {
 }
 
 /* selectManyShuttle ----------------------------------------------------------- */
 
 .tobago-selectManyShuttle-add,
 .tobago-selectManyShuttle-addAll,
+.tobago-selectManyShuttle-option,
 .tobago-selectManyShuttle-remove,
 .tobago-selectManyShuttle-removeAll,
 .tobago-selectManyShuttle-selectedLabel,
@@ -783,6 +785,9 @@ h1, h2, h3, h4, h5, h6 {
 
 /* selectOneChoice ---------------------------------------------------------- */
 
+.tobago-selectOneChoice-option {
+}
+
 .input-group-btn:not(:last-child) > .tobago-selectOneChoice { /* before facet */
   width: 100%;
   -webkit-appearance: none;
@@ -800,7 +805,8 @@ h1, h2, h3, h4, h5, h6 {
 }
 
 /* selectOneListbox -------------------------------------------------------- */
-.tobago-selectOneListbox {
+.tobago-selectOneListbox,
+.tobago-selectOneListbox-option {
 }
 
 /* selectOneRadio, selectManyCheckbox -------------------------------------- */
@@ -858,7 +864,8 @@ p.tobago-separator {
 }
 
 /* sheet -------------------------------------------------------------- */
-.tobago-sheet-expanded {
+.tobago-sheet-expanded,
+.tobago-sheet-row {
 }
 
 th.tobago-sheet-headerCell {
@@ -1080,6 +1087,7 @@ th.tobago-sheet-headerCell {
 .tobago-treeListbox,
 .tobago-treeListbox-level,
 .tobago-treeListbox-select,
+.tobago-treeNode,
 .tobago-treeSelect,
 .tobago-treeSelect-label {
 }



Mime
View raw message