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 2017/09/14 14:12:44 UTC

[myfaces-tobago] branch master updated: TOBAGO-1723: tc:segmentLayout can't be direct child of tc:segmentLayout TOBAGO-1678: Override default layout for SegementLayout

This is an automated email from the ASF dual-hosted git repository.

lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/master by this push:
     new ffbf378  TOBAGO-1723: tc:segmentLayout can't be direct child of tc:segmentLayout TOBAGO-1678: Override default layout for SegementLayout
     new e045846  Merge remote-tracking branch 'origin/master'
ffbf378 is described below

commit ffbf37854e833b410a319a60c2765820c01f4664
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Thu Sep 14 16:12:25 2017 +0200

    TOBAGO-1723: tc:segmentLayout can't be direct child of tc:segmentLayout
    TOBAGO-1678: Override default layout for SegementLayout
---
 .../myfaces/tobago/component/Attributes.java       | 16 +++++++
 .../facelets/SegmentLayoutConstraintHandler.java   | 56 +++++++++++-----------
 .../SegmentLayoutConstraintTagDeclaration.java     |  8 ++--
 .../tobago/renderkit/css/BootstrapClass.java       | 10 ++--
 .../16-layout/30-segment/segment-layout.xhtml      |  2 +-
 5 files changed, 54 insertions(+), 38 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
index 0066c36..6cbc3c7 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
@@ -184,6 +184,22 @@ public enum Attributes {
    * Used by a layout manager
    */
   offsetSmall,
+  /**
+   * Used by a layout manager
+   */
+  overwriteExtraSmall,
+  /**
+   * Used by a layout manager
+   */
+  overwriteLarge,
+  /**
+   * Used by a layout manager
+   */
+  overwriteMedium,
+  /**
+   * Used by a layout manager
+   */
+  overwriteSmall,
   omit,
   /** @deprecated */
   @Deprecated
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SegmentLayoutConstraintHandler.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SegmentLayoutConstraintHandler.java
index a90fdb5..498a216 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SegmentLayoutConstraintHandler.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SegmentLayoutConstraintHandler.java
@@ -35,10 +35,10 @@ public class SegmentLayoutConstraintHandler extends TagHandler {
   private final TagAttribute offsetSmall;
   private final TagAttribute offsetMedium;
   private final TagAttribute offsetLarge;
-  private final TagAttribute extraSmall;
-  private final TagAttribute small;
-  private final TagAttribute medium;
-  private final TagAttribute large;
+  private final TagAttribute overwriteExtraSmall;
+  private final TagAttribute overwriteSmall;
+  private final TagAttribute overwriteMedium;
+  private final TagAttribute overwriteLarge;
 
   public SegmentLayoutConstraintHandler(TagConfig config) {
     super(config);
@@ -46,10 +46,10 @@ public class SegmentLayoutConstraintHandler extends TagHandler {
     offsetSmall = getAttribute(Attributes.offsetSmall.getName());
     offsetMedium = getAttribute(Attributes.offsetMedium.getName());
     offsetLarge = getAttribute(Attributes.offsetLarge.getName());
-    extraSmall = getAttribute(Attributes.extraSmall.getName());
-    small = getAttribute(Attributes.small.getName());
-    medium = getAttribute(Attributes.medium.getName());
-    large = getAttribute(Attributes.large.getName());
+    overwriteExtraSmall = getAttribute(Attributes.overwriteExtraSmall.getName());
+    overwriteSmall = getAttribute(Attributes.overwriteSmall.getName());
+    overwriteMedium = getAttribute(Attributes.overwriteMedium.getName());
+    overwriteLarge = getAttribute(Attributes.overwriteLarge.getName());
   }
 
   @Override
@@ -92,39 +92,39 @@ public class SegmentLayoutConstraintHandler extends TagHandler {
       }
     }
 
-    if (extraSmall != null) {
-      if (extraSmall.isLiteral()) {
-        attributes.put(Attributes.extraSmall.getName(), extraSmall.getValue());
+    if (overwriteExtraSmall != null) {
+      if (overwriteExtraSmall.isLiteral()) {
+        attributes.put(Attributes.overwriteExtraSmall.getName(), overwriteExtraSmall.getValue());
       } else {
-        parent.setValueExpression(Attributes.extraSmall.getName(),
-            extraSmall.getValueExpression(faceletContext, Integer.TYPE));
+        parent.setValueExpression(Attributes.overwriteExtraSmall.getName(),
+            overwriteExtraSmall.getValueExpression(faceletContext, Integer.TYPE));
       }
     }
 
-    if (small != null) {
-      if (small.isLiteral()) {
-        attributes.put(Attributes.small.getName(), small.getValue());
+    if (overwriteSmall != null) {
+      if (overwriteSmall.isLiteral()) {
+        attributes.put(Attributes.overwriteSmall.getName(), overwriteSmall.getValue());
       } else {
-        parent.setValueExpression(Attributes.small.getName(),
-            small.getValueExpression(faceletContext, Integer.TYPE));
+        parent.setValueExpression(Attributes.overwriteSmall.getName(),
+            overwriteSmall.getValueExpression(faceletContext, Integer.TYPE));
       }
     }
 
-    if (medium != null) {
-      if (medium.isLiteral()) {
-        attributes.put(Attributes.medium.getName(), medium.getValue());
+    if (overwriteMedium != null) {
+      if (overwriteMedium.isLiteral()) {
+        attributes.put(Attributes.overwriteMedium.getName(), overwriteMedium.getValue());
       } else {
-        parent.setValueExpression(Attributes.medium.getName(),
-            medium.getValueExpression(faceletContext, Integer.TYPE));
+        parent.setValueExpression(Attributes.overwriteMedium.getName(),
+            overwriteMedium.getValueExpression(faceletContext, Integer.TYPE));
       }
     }
 
-    if (large != null) {
-      if (large.isLiteral()) {
-        attributes.put(Attributes.large.getName(), large.getValue());
+    if (overwriteLarge != null) {
+      if (overwriteLarge.isLiteral()) {
+        attributes.put(Attributes.overwriteLarge.getName(), overwriteLarge.getValue());
       } else {
-        parent.setValueExpression(Attributes.large.getName(),
-            large.getValueExpression(faceletContext, Integer.TYPE));
+        parent.setValueExpression(Attributes.overwriteLarge.getName(),
+            overwriteLarge.getValueExpression(faceletContext, Integer.TYPE));
       }
     }
   }
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SegmentLayoutConstraintTagDeclaration.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SegmentLayoutConstraintTagDeclaration.java
index 9373cf3..aa5f4af 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SegmentLayoutConstraintTagDeclaration.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SegmentLayoutConstraintTagDeclaration.java
@@ -68,23 +68,23 @@ public interface SegmentLayoutConstraintTagDeclaration {
    * Overwrite the default layout for extra small devices.
    */
   @TagAttribute(type = "java.lang.Integer")
-  void setExtraSmall(final ValueExpression extraSmall);
+  void setOverwriteExtraSmall(final ValueExpression overwriteExtraSmall);
 
   /**
    * Overwrite the default layout for small devices.
    */
   @TagAttribute(type = "java.lang.Integer")
-  void setSmall(final ValueExpression small);
+  void setOverwriteSmall(final ValueExpression overwriteSmall);
 
   /**
    * Overwrite the default layout for medium devices.
    */
   @TagAttribute(type = "java.lang.Integer")
-  void setMedium(final ValueExpression medium);
+  void setOverwriteMedium(final ValueExpression overwriteMedium);
 
   /**
    * Overwrite the default layout for large devices.
    */
   @TagAttribute(type = "java.lang.Integer")
-  void setLarge(final ValueExpression large);
+  void setOverwriteLarge(final ValueExpression overwriteLarge);
 }
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
index d343643..a0fc43b 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
@@ -559,12 +559,12 @@ public enum BootstrapClass implements CssItem {
     }
 
     public BootstrapClass[] generate(final UIComponent child) {
-      ArrayList<BootstrapClass> result = new ArrayList<BootstrapClass>(4);
+      ArrayList<BootstrapClass> result = new ArrayList<>(4);
       final Map<String, Object> attributes = child.getAttributes();
-      generate(result, extraSmall, EXTRA_SMALL, attributes.get(Attributes.extraSmall.name()));
-      generate(result, small, SMALL, attributes.get(Attributes.small.name()));
-      generate(result, medium, MEDIUM, attributes.get(Attributes.medium.name()));
-      generate(result, large, LARGE, attributes.get(Attributes.large.name()));
+      generate(result, extraSmall, EXTRA_SMALL, attributes.get(Attributes.overwriteExtraSmall.name()));
+      generate(result, small, SMALL, attributes.get(Attributes.overwriteSmall.name()));
+      generate(result, medium, MEDIUM, attributes.get(Attributes.overwriteMedium.name()));
+      generate(result, large, LARGE, attributes.get(Attributes.overwriteLarge.name()));
       generateOffset(result, attributes.get(Attributes.offsetExtraSmall.name()), OFFSET_EXTRA_SMALL);
       generateOffset(result, attributes.get(Attributes.offsetSmall.name()), OFFSET_SMALL);
       generateOffset(result, attributes.get(Attributes.offsetMedium.name()), OFFSET_MEDIUM);
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/16-layout/30-segment/segment-layout.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/16-layout/30-segment/segment-layout.xhtml
index ab41680..ec47960 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/16-layout/30-segment/segment-layout.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/16-layout/30-segment/segment-layout.xhtml
@@ -139,7 +139,7 @@
       <tc:in/>
       <tc:in/>
       <tc:in>
-        <tc:segmentLayoutConstraint medium="3"/>
+        <tc:segmentLayoutConstraint overwriteMedium="3"/>
       </tc:in>
       <tc:in/>
     </tc:segmentLayout>

-- 
To stop receiving notification emails like this one, please contact
['"commits@myfaces.apache.org" <co...@myfaces.apache.org>'].