myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hno...@apache.org
Subject svn commit: r1795619 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/component/ tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/ tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderk...
Date Fri, 19 May 2017 16:04:10 GMT
Author: hnoeth
Date: Fri May 19 16:04:09 2017
New Revision: 1795619

URL: http://svn.apache.org/viewvc?rev=1795619&view=rev
Log:
TOBAGO-1741 tc:out labelLayout="skip" must not render any html tags
* labelLayout=skip avoid the surrounding labelLayout html tags
* tc:out compact=true remove surrounding span

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/LabelLayout.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIFile.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIInput.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIOut.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectBooleanCheckbox.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectManyListbox.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectManyShuttle.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectOneChoice.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectOneListbox.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/DateRenderer.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/FileRenderer.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/LabelLayoutRendererBase.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutRenderer.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectBooleanCheckboxInsideCommandRenderer.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectBooleanCheckboxRenderer.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyCheckboxInsideCommandRenderer.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyCheckboxRenderer.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyShuttleRenderer.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneRadioInsideCommandRenderer.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectOneRadioRenderer.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/OutTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasLabelLayout.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/labelLayout.xhtml

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
Fri May 19 16:04:09 2017
@@ -65,6 +65,7 @@ public enum Attributes {
   column,
   columnSpacing,
   columns,
+  compact,
   confirmation,
   converter,
   customClass,

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/LabelLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/LabelLayout.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/LabelLayout.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/LabelLayout.java
Fri May 19 16:04:09 2017
@@ -25,6 +25,7 @@ public enum LabelLayout {
 
   /**
    * do not render the label
+   * same behavior as component without label attribute
    */
   none,
 

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIFile.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIFile.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIFile.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIFile.java
Fri May 19 16:04:09 2017
@@ -19,6 +19,7 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
+import org.apache.myfaces.tobago.component.LabelLayout;
 import org.apache.myfaces.tobago.component.SupportFieldId;
 import org.apache.myfaces.tobago.component.SupportsLabelLayout;
 import org.apache.myfaces.tobago.component.Visual;
@@ -72,4 +73,7 @@ public abstract class AbstractUIFile ext
     return getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "real";
   }
 
+  public boolean isLabelLayoutSkip() {
+    return getLabelLayout() == LabelLayout.skip;
+  }
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIInput.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIInput.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIInput.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIInput.java
Fri May 19 16:04:09 2017
@@ -19,12 +19,15 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
+import org.apache.myfaces.tobago.component.Facets;
+import org.apache.myfaces.tobago.component.LabelLayout;
 import org.apache.myfaces.tobago.component.SupportFieldId;
 import org.apache.myfaces.tobago.component.SupportsAccessKey;
 import org.apache.myfaces.tobago.component.SupportsLabelLayout;
 import org.apache.myfaces.tobago.component.Visual;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 
+import javax.faces.component.UIComponent;
 import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.context.FacesContext;
 
@@ -46,6 +49,17 @@ public abstract class AbstractUIInput ex
 
   @Override
   public String getFieldId(final FacesContext facesContext) {
-    return getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "field";
+    final UIComponent before = getFacet(Facets.before.name());
+    final UIComponent after = getFacet(Facets.after.name());
+
+    if (getLabelLayout() == LabelLayout.skip && before == null && after==null)
{
+      return getClientId(facesContext);
+    } else {
+      return getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "field";
+    }
+  }
+
+  public boolean isLabelLayoutSkip() {
+    return getLabelLayout() == LabelLayout.skip;
   }
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIOut.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIOut.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIOut.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIOut.java
Fri May 19 16:04:09 2017
@@ -19,8 +19,10 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
+import org.apache.myfaces.tobago.component.LabelLayout;
 import org.apache.myfaces.tobago.component.SupportsLabelLayout;
 import org.apache.myfaces.tobago.component.Visual;
+import org.apache.myfaces.tobago.sanitizer.SanitizeMode;
 
 import javax.faces.component.UIOutput;
 
@@ -28,4 +30,16 @@ import javax.faces.component.UIOutput;
  * {@link org.apache.myfaces.tobago.internal.taglib.component.OutTagDeclaration}
  */
 public abstract class AbstractUIOut extends UIOutput implements SupportsLabelLayout, Visual
{
+
+  public abstract boolean isEscape();
+
+  public abstract boolean isCreateSpan();
+
+  public abstract boolean isCompact();
+
+  public abstract SanitizeMode getSanitize();
+
+  public boolean isLabelLayoutSkip() {
+    return getLabelLayout() == LabelLayout.skip;
+  }
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectBooleanCheckbox.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectBooleanCheckbox.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectBooleanCheckbox.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectBooleanCheckbox.java
Fri May 19 16:04:09 2017
@@ -19,6 +19,7 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
+import org.apache.myfaces.tobago.component.LabelLayout;
 import org.apache.myfaces.tobago.component.SupportFieldId;
 import org.apache.myfaces.tobago.component.SupportsAccessKey;
 import org.apache.myfaces.tobago.component.SupportsLabelLayout;
@@ -83,4 +84,8 @@ public abstract class AbstractUISelectBo
   public String getFieldId(final FacesContext facesContext) {
     return getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "field";
   }
+
+  public boolean isLabelLayoutSkip() {
+    return getLabelLayout() == LabelLayout.skip;
+  }
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectManyListbox.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectManyListbox.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectManyListbox.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectManyListbox.java
Fri May 19 16:04:09 2017
@@ -19,6 +19,7 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
+import org.apache.myfaces.tobago.component.LabelLayout;
 import org.apache.myfaces.tobago.component.SupportFieldId;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 
@@ -31,6 +32,10 @@ public abstract class AbstractUISelectMa
 
   @Override
   public String getFieldId(final FacesContext facesContext) {
-    return getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "field";
+    if (getLabelLayout() == LabelLayout.skip) {
+      return getClientId(facesContext);
+    } else {
+      return getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "field";
+    }
   }
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectManyShuttle.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectManyShuttle.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectManyShuttle.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectManyShuttle.java
Fri May 19 16:04:09 2017
@@ -19,6 +19,8 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
+import org.apache.myfaces.tobago.component.LabelLayout;
+
 /**
  * {@link org.apache.myfaces.tobago.internal.taglib.component.SelectManyShuttleTagDeclaration}
  */
@@ -32,4 +34,7 @@ public abstract class AbstractUISelectMa
     return getSelectedLabel() != null || getUnselectedLabel() != null;
   }
 
+  public boolean isLabelLayoutSkip() {
+    return getLabelLayout() == LabelLayout.skip;
+  }
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectOneChoice.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectOneChoice.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectOneChoice.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectOneChoice.java
Fri May 19 16:04:09 2017
@@ -19,6 +19,7 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
+import org.apache.myfaces.tobago.component.LabelLayout;
 import org.apache.myfaces.tobago.component.SupportFieldId;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 
@@ -31,6 +32,10 @@ public abstract class AbstractUISelectOn
 
   @Override
   public String getFieldId(final FacesContext facesContext) {
-    return getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "field";
+    if (getLabelLayout() == LabelLayout.skip) {
+      return getClientId(facesContext);
+    } else {
+      return getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "field";
+    }
   }
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectOneListbox.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectOneListbox.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectOneListbox.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectOneListbox.java
Fri May 19 16:04:09 2017
@@ -19,6 +19,7 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
+import org.apache.myfaces.tobago.component.LabelLayout;
 import org.apache.myfaces.tobago.component.SupportFieldId;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 
@@ -31,6 +32,10 @@ public abstract class AbstractUISelectOn
 
   @Override
   public String getFieldId(final FacesContext facesContext) {
-    return getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "field";
+    if (getLabelLayout() == LabelLayout.skip) {
+      return getClientId(facesContext);
+    } else {
+      return getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "field";
+    }
   }
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/DateRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/DateRenderer.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/DateRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/DateRenderer.java
Fri May 19 16:04:09 2017
@@ -22,6 +22,7 @@ package org.apache.myfaces.tobago.intern
 import org.apache.myfaces.tobago.internal.component.AbstractUIDate;
 import org.apache.myfaces.tobago.internal.component.AbstractUIInput;
 import org.apache.myfaces.tobago.internal.context.DateTimeI18n;
+import org.apache.myfaces.tobago.internal.util.JsonUtils;
 import org.apache.myfaces.tobago.internal.util.StringUtils;
 import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
 import org.apache.myfaces.tobago.renderkit.css.BootstrapDateTimePickerClass;
@@ -31,7 +32,6 @@ import org.apache.myfaces.tobago.renderk
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlButtonTypes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
-import org.apache.myfaces.tobago.internal.util.JsonUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -59,9 +59,13 @@ public class DateRenderer extends InRend
 
   @Override
   protected void encodeBeginField(FacesContext facesContext, UIComponent component) throws
IOException {
+    final AbstractUIDate date = (AbstractUIDate) component;
     final TobagoResponseWriter writer = getResponseWriter(facesContext);
 
     writer.startElement(HtmlElements.DIV);
+    if (date.isLabelLayoutSkip()) {
+      writer.writeIdAttribute(date.getClientId());
+    }
     writer.writeClassAttribute(TobagoClass.INPUT__GROUP__OUTER);
 
     writer.startElement(HtmlElements.DIV);

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/FileRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/FileRenderer.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/FileRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/FileRenderer.java
Fri May 19 16:04:09 2017
@@ -121,6 +121,9 @@ public class FileRenderer extends Messag
     final TobagoResponseWriter writer = getResponseWriter(facesContext);
 
     writer.startElement(HtmlElements.DIV);
+    if (file.isLabelLayoutSkip()) {
+      writer.writeIdAttribute(clientId);
+    }
     writer.writeClassAttribute(
         TobagoClass.FILE,
         file.getCustomClass(),

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
Fri May 19 16:04:09 2017
@@ -80,6 +80,9 @@ public class InRenderer extends MessageL
 
     if (after != null || before != null) {
       writer.startElement(HtmlElements.DIV); // Wrapping the field to fix input groups with
flexLeft/flexRight
+      if (input.isLabelLayoutSkip()) {
+        writer.writeIdAttribute(clientId);
+      }
       writer.writeClassAttribute(TobagoClass.INPUT__GROUP__OUTER);
       writer.startElement(HtmlElements.DIV);
       writer.writeClassAttribute(BootstrapClass.INPUT_GROUP);

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/LabelLayoutRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/LabelLayoutRendererBase.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/LabelLayoutRendererBase.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/LabelLayoutRendererBase.java
Fri May 19 16:04:09 2017
@@ -23,6 +23,7 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.component.LabelLayout;
 import org.apache.myfaces.tobago.component.SupportsAccessKey;
 import org.apache.myfaces.tobago.component.SupportsLabelLayout;
+import org.apache.myfaces.tobago.internal.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.internal.util.StringUtils;
 import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
 import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
@@ -31,7 +32,6 @@ import org.apache.myfaces.tobago.renderk
 import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
-import org.apache.myfaces.tobago.internal.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
 
@@ -108,9 +108,12 @@ public abstract class LabelLayoutRendere
     // - segmentRight (todo)
     // - flowLeft (todo)
     // - flowRight (todo)
+    // - skip
     final LabelLayout labelLayout = getType(component);
     final CssItem divClass;
     switch (labelLayout) {
+      case skip:
+        return;
       case flexLeft:
       case flexRight:
         divClass = TobagoClass.FLEX_LAYOUT;
@@ -131,33 +134,19 @@ public abstract class LabelLayoutRendere
       case top:
       case flowLeft:
       case flowRight:
-      case skip:
       default: // none, top, segmentLeft, segmentRight, flowLeft, flowRight
         divClass = null;
     }
 
-//    if (labelLayout != LabelLayout.none) {
-    writer.startElement(LabelLayout.skip == labelLayout ? HtmlElements.SPAN : HtmlElements.DIV);
+    writer.startElement(HtmlElements.DIV);
     writer.writeIdAttribute(clientId);
-//    }
-//    writer.writeClassAttribute(divClass, BootstrapClass.maximumSeverity(component));
-    // todo: check if BootstrapClass.FORM_GROUP is needed, I've removed it, because of it's
margin-bottom: 15px;
-    // todo: so we lost too much space
-    // todo: without it, e. g. an input field in the header will not be layouted correctly
-//    CssItem extra = ComponentUtils.findAncestor(component, AbstractUILinks.class) != null
-// ? BootstrapClass.FORM_GROUP : null;
-    // TODO: optimize findAncestor() -> set a marker in AbstractUILinks?
-
-//    writer.writeClassAttribute(divClass, extra, BootstrapClass.maximumSeverity(component));
-
-    if (!(LabelLayout.skip == labelLayout)) {
-      writer.writeClassAttribute(
-          divClass,
-          TobagoClass.LABEL__CONTAINER,
-          BootstrapClass.FORM_GROUP,
-          BootstrapClass.maximumSeverity(component),
-          ComponentUtils.getBooleanAttribute(component, Attributes.required) ? TobagoClass.REQUIRED
: null);
-    }
+
+    writer.writeClassAttribute(
+        divClass,
+        TobagoClass.LABEL__CONTAINER,
+        BootstrapClass.FORM_GROUP,
+        BootstrapClass.maximumSeverity(component),
+        ComponentUtils.getBooleanAttribute(component, Attributes.required) ? TobagoClass.REQUIRED
: null);
 
     switch (labelLayout) {
       case flexLeft:
@@ -172,7 +161,7 @@ public abstract class LabelLayoutRendere
 
     switch (labelLayout) {
       case none:
-      case skip:
+        break;
       case flexRight:
       case flowRight:
         break;
@@ -198,6 +187,10 @@ public abstract class LabelLayoutRendere
     final LabelLayout labelLayout = getType(component);
 
     switch (labelLayout) {
+      case skip:
+        return;
+      case none:
+        break;
       case flexRight:
       case flowRight:
         encodeLabel(component, writer, labelLayout);
@@ -206,9 +199,7 @@ public abstract class LabelLayoutRendere
         // nothing to do
     }
 
-//    if (labelLayout != LabelLayout.none) {
-    writer.endElement(LabelLayout.skip == labelLayout ? HtmlElements.SPAN : HtmlElements.DIV);
-//    }
+    writer.endElement(HtmlElements.DIV);
   }
 
   protected void encodeLabel(UIComponent component, TobagoResponseWriter writer, LabelLayout
labelLayout)

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutRenderer.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/OutRenderer.java
Fri May 19 16:04:09 2017
@@ -21,6 +21,7 @@ package org.apache.myfaces.tobago.intern
 
 import org.apache.myfaces.tobago.component.UIOut;
 import org.apache.myfaces.tobago.config.TobagoConfig;
+import org.apache.myfaces.tobago.internal.component.AbstractUIOut;
 import org.apache.myfaces.tobago.internal.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.internal.util.RenderUtils;
 import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
@@ -46,7 +47,7 @@ public class OutRenderer extends Message
   @Override
   public void encodeBeginField(final FacesContext facesContext, final UIComponent component)
throws IOException {
 
-    final UIOut out = (UIOut) component;
+    final AbstractUIOut out = (UIOut) component;
 
     String text = RenderUtils.currentValue(out);
     if (text == null) {
@@ -56,10 +57,13 @@ public class OutRenderer extends Message
     final TobagoResponseWriter writer = getResponseWriter(facesContext);
 
     final boolean escape = out.isEscape();
-    final boolean createSpan = out.isCreateSpan();
+    final boolean compact = out.isCompact() || !out.isCreateSpan();
 
-    if (createSpan) {
+    if (!compact) {
       writer.startElement(HtmlElements.SPAN);
+      if (out.isLabelLayoutSkip()) {
+        writer.writeIdAttribute(out.getClientId());
+      }
       HtmlRendererUtils.writeDataAttributes(facesContext, writer, out);
       writer.writeStyleAttribute(out.getStyle());
 
@@ -101,9 +105,9 @@ public class OutRenderer extends Message
 
     final UIOut out = (UIOut) component;
     final TobagoResponseWriter writer = getResponseWriter(facesContext);
-    final boolean createSpan = out.isCreateSpan();
+    final boolean compact = out.isCompact() || !out.isCreateSpan();
 
-    if (createSpan) {
+    if (!compact) {
       writer.endElement(HtmlElements.SPAN);
     }
   }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectBooleanCheckboxInsideCommandRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectBooleanCheckboxInsideCommandRenderer.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectBooleanCheckboxInsideCommandRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectBooleanCheckboxInsideCommandRenderer.java
Fri May 19 16:04:09 2017
@@ -41,11 +41,6 @@ public class SelectBooleanCheckboxInside
   }
 
   @Override
-  protected boolean renderClientId() {
-    return true;
-  }
-
-  @Override
   protected void addOuterCssItems(final FacesContext facesContext, final AbstractUISelectBooleanCheckbox
select,
                                   final List<CssItem> collected) {
   }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectBooleanCheckboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectBooleanCheckboxRenderer.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectBooleanCheckboxRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectBooleanCheckboxRenderer.java
Fri May 19 16:04:09 2017
@@ -84,7 +84,7 @@ public class SelectBooleanCheckboxRender
     final String itemLabel = select.getItemLabel();
 
     writer.startElement(HtmlElements.DIV);
-    if (renderClientId()) {
+    if (select.isLabelLayoutSkip()) {
       writer.writeIdAttribute(clientId);
     }
     writer.writeStyleAttribute(select.getStyle());
@@ -144,10 +144,6 @@ public class SelectBooleanCheckboxRender
     writer.endElement(HtmlElements.DIV);
   }
 
-  protected boolean renderClientId() {
-    return false;
-  }
-
   protected void addOuterCssItems(final FacesContext facesContext, final AbstractUISelectBooleanCheckbox
select,
                                   final List<CssItem> collected) {
     collected.add(BootstrapClass.FORM_CHECK);

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyCheckboxInsideCommandRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyCheckboxInsideCommandRenderer.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyCheckboxInsideCommandRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyCheckboxInsideCommandRenderer.java
Fri May 19 16:04:09 2017
@@ -41,11 +41,6 @@ public class SelectManyCheckboxInsideCom
   }
 
   @Override
-  protected boolean renderClientId() {
-    return true;
-  }
-
-  @Override
   protected boolean renderOuterItem() {
     return false;
   }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyCheckboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyCheckboxRenderer.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyCheckboxRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyCheckboxRenderer.java
Fri May 19 16:04:09 2017
@@ -56,9 +56,7 @@ public class SelectManyCheckboxRenderer
     final boolean inline = select.isInline();
 
     writer.startElement(HtmlElements.DIV);
-    if (renderClientId()) {
-      writer.writeIdAttribute(id);
-    }
+    writer.writeIdAttribute(id);
     writer.writeStyleAttribute(select.getStyle());
 
     // TODO: optimize class attribute writing
@@ -136,10 +134,6 @@ public class SelectManyCheckboxRenderer
     writer.endElement(HtmlElements.DIV);
   }
 
-  protected boolean renderClientId() {
-    return false;
-  }
-
   protected boolean renderOuterItem() {
     return true;
   }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyShuttleRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyShuttleRenderer.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyShuttleRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyShuttleRenderer.java
Fri May 19 16:04:09 2017
@@ -47,6 +47,9 @@ public class SelectManyShuttleRenderer e
     final String clientId = select.getClientId(facesContext);
     final TobagoResponseWriter writer = getResponseWriter(facesContext);
     writer.startElement(HtmlElements.DIV);
+    if (select.isLabelLayoutSkip()) {
+      writer.writeIdAttribute(clientId);
+    }
     writer.writeClassAttribute(
         TobagoClass.SELECT_MANY_SHUTTLE,
         select.getCustomClass(),

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=1795619&r1=1795618&r2=1795619&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 May 19 16:04:09 2017
@@ -41,11 +41,6 @@ public class SelectOneRadioInsideCommand
   }
 
   @Override
-  protected boolean renderClientId() {
-    return true;
-  }
-
-  @Override
   protected boolean renderOuterItem() {
     return false;
   }

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=1795619&r1=1795618&r2=1795619&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 May 19 16:04:09 2017
@@ -58,9 +58,7 @@ public class SelectOneRadioRenderer exte
     final boolean inline = select.isInline();
 
     writer.startElement(HtmlElements.DIV);
-    if (renderClientId()) {
-      writer.writeIdAttribute(id);
-    }
+    writer.writeIdAttribute(id);
     writer.writeStyleAttribute(select.getStyle());
 
     // TODO: optimize class attribute writing
@@ -149,10 +147,6 @@ public class SelectOneRadioRenderer exte
     writer.endElement(HtmlElements.DIV);
   }
 
-  protected boolean renderClientId() {
-    return false;
-  }
-
   protected boolean renderOuterItem() {
     return true;
   }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/OutTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/OutTagDeclaration.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/OutTagDeclaration.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/OutTagDeclaration.java
Fri May 19 16:04:09 2017
@@ -73,4 +73,12 @@ public interface OutTagDeclaration
    */
   @UIComponentTagAttribute(type = "boolean", defaultValue = "true")
   void setCreateSpan(String createSpan);
+
+  /**
+   * Use true, if you enable the possibility to apply styles to the output.
+   * Use false, if you want to keep the code small (especially inside of sheets).
+   */
+  @TagAttribute
+  @UIComponentTagAttribute(type = "boolean", defaultValue = "false")
+  void setCompact(String compact);
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasLabelLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasLabelLayout.java?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasLabelLayout.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasLabelLayout.java
Fri May 19 16:04:09 2017
@@ -27,6 +27,8 @@ public interface HasLabelLayout {
   /**
    * Defines the position of the label relative to the field.
    * The default is flexLeft, if the label is set, or none, if the label isn't set.
+   * Set to 'skip' to avoid surrounding label container.
+   * Hint for tc:out: set also compact=true to render only text (without html tags).
    */
   @TagAttribute
   @UIComponentTagAttribute(

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/labelLayout.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/labelLayout.xhtml?rev=1795619&r1=1795618&r2=1795619&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/labelLayout.xhtml
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/labelLayout.xhtml
Fri May 19 16:04:09 2017
@@ -52,6 +52,7 @@
   <tc:box label="&lt;tc:out>">
     <tc:out id="out" value="123"/>
     <tc:out id="outSkip" label="Out" labelLayout="skip" value="123"/>
+    <tc:out id="outCompact" label="Out" labelLayout="skip" compact="true" value="123"/>
     <tc:out id="outNone" label="Out " labelLayout="none" value="123"/>
   </tc:box>
   <tc:box label="&lt;tc:selectBooleanCheckbox>">



Mime
View raw message