myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hno...@apache.org
Subject [myfaces-tobago] branch master updated: TOBAGO-1933 Attribute 'vertical-align' for tc:column
Date Fri, 21 Sep 2018 15:02:49 GMT
This is an automated email from the ASF dual-hosted git repository.

hnoeth 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 5f866bf  TOBAGO-1933 Attribute 'vertical-align' for tc:column
5f866bf is described below

commit 5f866bf234a42c2f9c64e6cb75d04d7b07f23a93
Author: Henning Noeth <hnoeth@apache.org>
AuthorDate: Fri Sep 21 16:52:58 2018 +0200

    TOBAGO-1933 Attribute 'vertical-align' for tc:column
    
    * use org.apache.myfaces.tobago.layout.VerticalAlign enum instead of
      string
---
 .../internal/component/AbstractUIColumn.java       |  4 +++
 .../component/AbstractUIColumnSelector.java        |  7 ++----
 .../internal/component/AbstractUITreeNode.java     |  5 ----
 .../internal/component/AbstractUITreeNodeBase.java |  3 +--
 .../internal/renderkit/renderer/SheetRenderer.java | 29 ++++++++++++----------
 .../taglib/component/ColumnTagDeclaration.java     |  8 ++++--
 6 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumn.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumn.java
index 296b48e..5817721 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumn.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumn.java
@@ -19,6 +19,8 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
+import org.apache.myfaces.tobago.layout.VerticalAlign;
+
 /**
  * {@link org.apache.myfaces.tobago.internal.taglib.component.ColumnTagDeclaration}
  */
@@ -27,4 +29,6 @@ public abstract class AbstractUIColumn extends AbstractUIColumnBase {
 //  public abstract Measure getWidth();
 
   public abstract String getLabel();
+
+  public abstract VerticalAlign getVerticalAlign();
 }
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumnSelector.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumnSelector.java
index 73be1c0..9250ebd 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumnSelector.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumnSelector.java
@@ -22,7 +22,7 @@ package org.apache.myfaces.tobago.internal.component;
 /**
  * {@link org.apache.myfaces.tobago.internal.taglib.component.ColumnSelectorTagDeclaration}
  */
-public abstract class AbstractUIColumnSelector extends AbstractUIColumn {
+public abstract class AbstractUIColumnSelector extends AbstractUIColumnBase {
 
 /* TBD
   @Override
@@ -31,8 +31,5 @@ public abstract class AbstractUIColumnSelector extends AbstractUIColumn
{
   }
 */
 
-  @Override
-  public String getLabel() {
-    return null;
-  }
+  public abstract boolean isDisabled();
 }
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNode.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNode.java
index a07f166..0b4faf1 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNode.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNode.java
@@ -23,9 +23,4 @@ package org.apache.myfaces.tobago.internal.component;
  * {@link org.apache.myfaces.tobago.internal.taglib.component.TreeNodeTagDeclaration}
  */
 public abstract class AbstractUITreeNode extends AbstractUITreeNodeBase {
-
-  @Override
-  public String getLabel() {
-    return null;
-  }
 }
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNodeBase.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNodeBase.java
index 1ee8541..6a17927 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNodeBase.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITreeNodeBase.java
@@ -32,8 +32,7 @@ import java.util.List;
 /**
  * Base class for tree node.
  */
-public abstract class AbstractUITreeNodeBase
-    extends AbstractUIColumn implements Visual {
+public abstract class AbstractUITreeNodeBase extends AbstractUIColumnBase implements Visual
{
 
   @Override
   public void encodeBegin(final FacesContext facesContext) throws IOException {
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java
index dd20103..5830322 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SheetRenderer.java
@@ -36,6 +36,7 @@ import org.apache.myfaces.tobago.event.SheetAction;
 import org.apache.myfaces.tobago.event.SortActionEvent;
 import org.apache.myfaces.tobago.internal.component.AbstractUIColumn;
 import org.apache.myfaces.tobago.internal.component.AbstractUIColumnBase;
+import org.apache.myfaces.tobago.internal.component.AbstractUIColumnSelector;
 import org.apache.myfaces.tobago.internal.component.AbstractUIData;
 import org.apache.myfaces.tobago.internal.component.AbstractUIOut;
 import org.apache.myfaces.tobago.internal.component.AbstractUIRow;
@@ -703,24 +704,26 @@ public class SheetRenderer extends RendererBase {
           rowClass,
           sheet.isRowVisible() ? null : BootstrapClass.D_NONE);
 
-      for (final UIColumn column : columns) {
+      for (final AbstractUIColumnBase column : columns) {
         if (column.isRendered()) {
-          if (column instanceof AbstractUIColumn) {
-            final AbstractUIColumn normalColumn = (AbstractUIColumn) column;
+          if (column instanceof AbstractUIColumn || column instanceof AbstractUIColumnSelector)
{
             writer.startElement(HtmlElements.TD);
-            Markup markup = normalColumn.getMarkup();
+            Markup markup = column.getMarkup();
             if (markup == null) {
               markup = Markup.NULL;
             }
-            markup = markup.add(getMarkupForAlign(normalColumn));
-            markup = markup.add(getMarkupForVerticalAlign(normalColumn));
+            if (column instanceof AbstractUIColumn) {
+              final AbstractUIColumn normalColumn = (AbstractUIColumn) column;
+              markup = markup.add(getMarkupForAlign(normalColumn));
+              markup = markup.add(getMarkupForVerticalAlign(normalColumn));
+            }
             writer.writeClassAttribute(
                 TobagoClass.SHEET__CELL,
                 TobagoClass.SHEET__CELL.createMarkup(markup),
-                normalColumn.getCustomClass());
+                column.getCustomClass());
 
-            if (normalColumn instanceof UIColumnSelector) {
-              final UIColumnSelector selector = (UIColumnSelector) normalColumn;
+            if (column instanceof AbstractUIColumnSelector) {
+              final AbstractUIColumnSelector selector = (AbstractUIColumnSelector) column;
               writer.startElement(HtmlElements.INPUT);
               writer.writeNameAttribute(sheetId + "_data_row_selector_" + rowIndex);
               if (selectable.isSingle()) {
@@ -735,7 +738,7 @@ public class SheetRenderer extends RendererBase {
                   TobagoClass.SHEET__COLUMN_SELECTOR);
               writer.endElement(HtmlElements.INPUT);
             } else /*if (normalColumn instanceof AbstractUIColumnNode)*/ {
-              normalColumn.encodeAll(facesContext);
+              column.encodeAll(facesContext);
             } /*else {
               final List<UIComponent> children = sheet.getRenderedChildrenOf(normalColumn);
               for (final UIComponent grandKid : children) {
@@ -845,10 +848,10 @@ public class SheetRenderer extends RendererBase {
     return null;
   }
 
-  private Markup getMarkupForVerticalAlign(final UIColumn column) {
-    final String verticalAlign = ComponentUtils.getStringAttribute(column, Attributes.verticalAlign);
+  private Markup getMarkupForVerticalAlign(final AbstractUIColumn column) {
+    final VerticalAlign verticalAlign = column.getVerticalAlign();
     if (verticalAlign != null) {
-      switch (VerticalAlign.valueOf(verticalAlign)) {
+      switch (verticalAlign) {
         case bottom:
           return Markup.BOTTOM;
         case middle:
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ColumnTagDeclaration.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ColumnTagDeclaration.java
index 82437d4..2de2e23 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ColumnTagDeclaration.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ColumnTagDeclaration.java
@@ -28,6 +28,7 @@ import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRend
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasLabel;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasTip;
 import org.apache.myfaces.tobago.internal.taglib.declaration.IsVisual;
+import org.apache.myfaces.tobago.layout.VerticalAlign;
 
 import javax.faces.component.UIColumn;
 
@@ -64,9 +65,12 @@ public interface ColumnTagDeclaration
    * {@link org.apache.myfaces.tobago.layout.VerticalAlign#middle}
    */
   @TagAttribute
-  @UIComponentTagAttribute()
+  @UIComponentTagAttribute(
+      type = {"org.apache.myfaces.tobago.layout.VerticalAlign"},
+      allowedValues = {
+          VerticalAlign.TOP, VerticalAlign.BOTTOM, VerticalAlign.MIDDLE
+      })
   void setVerticalAlign(String verticalAlign);
-  //TODO: use org.apache.myfaces.tobago.layout.VerticalAlign enum instead of string
 
   /**
    * Flag indicating whether or not this column is sortable.


Mime
View raw message