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 2010/06/07 16:42:38 UTC

svn commit: r952254 - 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/taglib/c...

Author: lofwyr
Date: Mon Jun  7 14:42:38 2010
New Revision: 952254

URL: http://svn.apache.org/viewvc?rev=952254&view=rev
Log:
TOBAGO-828: Working on the layout manager for the sheet

Added:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumnSelector.java
      - copied, changed from r952170, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumn.java
Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/ComponentTypes.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIData.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumn.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheetLayout.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ColumnSelectorTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutableRendererBaseWrapper.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRenderer.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRendererBase.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/ComponentTypes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/ComponentTypes.java?rev=952254&r1=952253&r2=952254&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/ComponentTypes.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/ComponentTypes.java Mon Jun  7 14:42:38 2010
@@ -25,6 +25,7 @@ public final class ComponentTypes {
   // TODO: make a complete list.
 
   public static final String COLUMN = "org.apache.myfaces.tobago.Column";
+  public static final String COLUMN_SELECTOR = "org.apache.myfaces.tobago.ColumnSelector";
   public static final String GRID_LAYOUT = "org.apache.myfaces.tobago.GridLayout";
   public static final String OUT = "org.apache.myfaces.tobago.Out";
   public static final String SELECT_BOOLEAN_CHECKBOX = "org.apache.myfaces.tobago.SelectBooleanCheckbox";

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIData.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIData.java?rev=952254&r1=952253&r2=952254&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIData.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIData.java Mon Jun  7 14:42:38 2010
@@ -25,4 +25,14 @@ import org.apache.myfaces.tobago.event.S
  */
 public interface UIData extends SortActionSource2, SupportsMarkup, SortActionSource {
 
+  /**
+   * @deprecated
+   */
+  public static final int DEFAULT_DIRECT_LINK_COUNT = 9;
+
+  /**
+   * @deprecated
+   */
+  public static final int DEFAULT_ROW_COUNT = 100;
+
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumn.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumn.java?rev=952254&r1=952253&r2=952254&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumn.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumn.java Mon Jun  7 14:42:38 2010
@@ -20,4 +20,6 @@ package org.apache.myfaces.tobago.intern
 import javax.faces.component.UIColumn;
 
 public abstract class AbstractUIColumn extends UIColumn {
+
+  public abstract String getWidth();
 }

Copied: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumnSelector.java (from r952170, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumn.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumnSelector.java?p2=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumnSelector.java&p1=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumn.java&r1=952170&r2=952254&rev=952254&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumn.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIColumnSelector.java Mon Jun  7 14:42:38 2010
@@ -1,5 +1,7 @@
 package org.apache.myfaces.tobago.internal.component;
 
+import javax.faces.component.UIColumn;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -17,7 +19,5 @@ package org.apache.myfaces.tobago.intern
  * limitations under the License.
  */
 
-import javax.faces.component.UIColumn;
-
-public abstract class AbstractUIColumn extends UIColumn {
+public abstract class AbstractUIColumnSelector extends UIColumn {
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java?rev=952254&r1=952253&r2=952254&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java Mon Jun  7 14:42:38 2010
@@ -33,12 +33,12 @@ import org.apache.myfaces.tobago.event.S
 import org.apache.myfaces.tobago.event.SheetStateChangeSource;
 import org.apache.myfaces.tobago.event.SortActionEvent;
 import org.apache.myfaces.tobago.event.SortActionSource;
-import org.apache.myfaces.tobago.internal.layout.LayoutUtils;
 import org.apache.myfaces.tobago.layout.LayoutComponent;
 import org.apache.myfaces.tobago.layout.LayoutContainer;
 import org.apache.myfaces.tobago.layout.LayoutManager;
 import org.apache.myfaces.tobago.layout.LayoutTokens;
 import org.apache.myfaces.tobago.model.SheetState;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -80,8 +80,6 @@ public abstract class AbstractUISheet ex
   public static final String NONE = "none";
   public static final String SINGLE = "single";
   public static final String MULTI = "multi";
-  public static final int DEFAULT_DIRECT_LINK_COUNT = 9;
-  public static final int DEFAULT_ROW_COUNT = 100;
 
   private SheetState sheetState;
   private List<Integer> widthList;
@@ -89,6 +87,10 @@ public abstract class AbstractUISheet ex
 
   private transient int ajaxResponseCode;
 
+  public LayoutComponentRenderer getLayoutComponentRenderer(FacesContext context) {
+    return (LayoutComponentRenderer) getRenderer(context);
+  }
+
   @Override
   public void encodeBegin(FacesContext facesContext) throws IOException {
     SheetState state = getSheetState(facesContext);
@@ -525,7 +527,20 @@ public abstract class AbstractUISheet ex
 
   // LAYOUT Begin
   public List<LayoutComponent> getComponents() {
-    return LayoutUtils.findLayoutChildren(this);
+    List<LayoutComponent> result = new ArrayList<LayoutComponent>();
+    for (UIComponent column : getChildren()) {
+      if (column instanceof AbstractUIColumnSelector) {
+        result.add(null);// XXX UIColumnSelector is currently not an instance of LayoutComponent
+      } else if (column instanceof UIColumn) {
+        for (UIComponent component : column.getChildren()) {
+          if (component instanceof LayoutComponent) {
+            result.add((LayoutComponent) component);
+            break;
+          }
+        }
+      }
+    }
+    return result;
   }
 
   public void onComponentPopulated(FacesContext facesContext, UIComponent parent) {

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheetLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheetLayout.java?rev=952254&r1=952253&r2=952254&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheetLayout.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheetLayout.java Mon Jun  7 14:42:38 2010
@@ -17,21 +17,36 @@ package org.apache.myfaces.tobago.intern
  * limitations under the License.
  */
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.internal.layout.Interval;
 import org.apache.myfaces.tobago.internal.layout.IntervalList;
 import org.apache.myfaces.tobago.internal.layout.LayoutUtils;
+import org.apache.myfaces.tobago.internal.util.StringUtils;
+import org.apache.myfaces.tobago.layout.AutoLayoutToken;
 import org.apache.myfaces.tobago.layout.Display;
 import org.apache.myfaces.tobago.layout.LayoutComponent;
 import org.apache.myfaces.tobago.layout.LayoutContainer;
 import org.apache.myfaces.tobago.layout.LayoutManager;
+import org.apache.myfaces.tobago.layout.LayoutToken;
+import org.apache.myfaces.tobago.layout.LayoutTokens;
 import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.layout.Orientation;
+import org.apache.myfaces.tobago.layout.RelativeLayoutToken;
+import org.apache.myfaces.tobago.model.SheetState;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
+import org.apache.myfaces.tobago.util.LayoutInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.util.List;
+import java.util.Map;
 
 /**
- * XXX: Not really implemented yet.
- */
+ * XXX: Not completely implemented yet.
+ */ 
 public abstract class AbstractUISheetLayout extends UILayoutBase implements LayoutManager {
 
   private static final Logger LOG = LoggerFactory.getLogger(AbstractUIGridLayout.class);
@@ -49,6 +64,10 @@ public abstract class AbstractUISheetLay
 
   public void fixRelativeInsideAuto(Orientation orientation, boolean auto) {
 
+    if (orientation.equals(Orientation.VERTICAL)) {
+      return; // do not vertical layout yet.
+    }
+
     if (orientation == Orientation.HORIZONTAL) {
       horizontalAuto = auto;
     } else {
@@ -64,18 +83,24 @@ public abstract class AbstractUISheetLay
 
   public void preProcessing(Orientation orientation) {
 
+    if (orientation.equals(Orientation.VERTICAL)) {
+      return; // do not vertical layout yet.
+    }
+
     // process auto tokens
     int i = 0;
     IntervalList intervals = new IntervalList();
     for (LayoutComponent component : getLayoutContainer().getComponents()) {
 
-      if (component instanceof LayoutContainer) {
-        ((LayoutContainer) component).getLayoutManager().preProcessing(orientation);
-      }
+      if (component != null) {
+        if (component instanceof LayoutContainer) {
+          ((LayoutContainer) component).getLayoutManager().preProcessing(orientation);
+        }
 
-      if (orientation == Orientation.HORIZONTAL && horizontalAuto 
-          || orientation == Orientation.VERTICAL && verticalAuto) {
-        intervals.add(new Interval(component, orientation));
+        if (orientation == Orientation.HORIZONTAL && horizontalAuto
+            || orientation == Orientation.VERTICAL && verticalAuto) {
+          intervals.add(new Interval(component, orientation));
+        }
       }
     }
 
@@ -84,12 +109,16 @@ public abstract class AbstractUISheetLay
       Measure size = intervals.getCurrent();
       size = size.add(LayoutUtils.getOffsetBegin(orientation, getLayoutContainer()));
       size = size.add(LayoutUtils.getOffsetEnd(orientation, getLayoutContainer()));
-// todo      LayoutUtils.setSize(orientation, getLayoutContainer(), size);
+      LayoutUtils.setCurrentSize(orientation, getLayoutContainer(), size);
     }
   }
 
   public void mainProcessing(Orientation orientation) {
 
+    if (orientation.equals(Orientation.VERTICAL)) {
+      return; // do not vertical layout yet.
+    }
+
     // find *
     if (orientation == Orientation.HORIZONTAL && !horizontalAuto 
         || orientation == Orientation.VERTICAL && !verticalAuto) {
@@ -102,13 +131,16 @@ public abstract class AbstractUISheetLay
 
         for (LayoutComponent component : getLayoutContainer().getComponents()) {
 
-          component.setDisplay(Display.BLOCK); // TODO: use CSS via classes and style.css
-// todo          LayoutUtils.setSize(orientation, component, available);
+          if (component != null) {
+            // XXX incorrect
+            component.setDisplay(Display.BLOCK); // TODO: use CSS via classes and style.css
+            LayoutUtils.setCurrentSize(orientation, component, available);
 
 
-          // call sub layout manager
-          if (component instanceof LayoutContainer) {
-            ((LayoutContainer) component).getLayoutManager().mainProcessing(orientation);
+            // call sub layout manager
+            if (component instanceof LayoutContainer) {
+              ((LayoutContainer) component).getLayoutManager().mainProcessing(orientation);
+            }
           }
         }
       } else {
@@ -119,26 +151,46 @@ public abstract class AbstractUISheetLay
 
   public void postProcessing(Orientation orientation) {
 
+    if (orientation.equals(Orientation.VERTICAL)) {
+      return; // do not vertical layout yet.
+    }
+
+    final FacesContext facesContext = FacesContext.getCurrentInstance();
+    final AbstractUISheet sheet = (AbstractUISheet) getLayoutContainer();
+    ensureColumnWidthList(facesContext, sheet);
+
+    final List<Integer> widthList = sheet.getWidthList();
+
     // set positions to all sub-layout-managers
 
-    for (LayoutComponent component : getLayoutContainer().getComponents()) {
+    int index = 0;
+    for (LayoutComponent component : sheet.getComponents()) {
 
-      component.setDisplay(Display.BLOCK); // TODO: use CSS via classes and style.css
+      if (component != null) {
+        component.setDisplay(Display.BLOCK); // TODO: use CSS via classes and style.css
 
-      // compute the position of the cell
-      Measure position = LayoutUtils.getOffsetBegin(orientation, getLayoutContainer());
-      if (orientation == Orientation.HORIZONTAL) {
-        component.setLeft(position);
-      } else {
-        component.setTop(position);
-      }
+        Measure width = Measure.valueOf(widthList.get(index));
+        width = width.subtractNotNegative(LayoutUtils.getOffsetBegin(orientation, sheet));
+        width = width.subtractNotNegative(LayoutUtils.getOffsetEnd(orientation, sheet));
+        component.setCurrentWidth(width);
+
+        // compute the position of the cell
+        Measure position = LayoutUtils.getOffsetBegin(orientation, sheet);
+        if (orientation == Orientation.HORIZONTAL) {
+          component.setLeft(position);
+        } else {
+          component.setTop(position);
+        }
 
-      // call sub layout manager
-      if (component instanceof LayoutContainer) {
-        ((LayoutContainer) component).getLayoutManager().postProcessing(orientation);
+        // call sub layout manager
+        if (component instanceof LayoutContainer) {
+          ((LayoutContainer) component).getLayoutManager().postProcessing(orientation);
+        }
+
+        // todo: optimize: the AutoLayoutTokens with columnSpan=1 are already called
       }
 
-      // todo: optimize: the AutoLayoutTokens with columnSpan=1 are already called
+      index++;
     }
   }
 
@@ -151,4 +203,153 @@ public abstract class AbstractUISheetLay
   public boolean getRendersChildren() {
     return false;
   }
+
+  private void ensureColumnWidthList(FacesContext facesContext, AbstractUISheet data) {
+    List<Integer> currentWidthList = null;
+    List<UIColumn> renderedColumns = data.getRenderedColumns();
+
+    final Map attributes = data.getAttributes();
+    String widthListString = null;
+    SheetState state = data.getSheetState(facesContext);
+    if (state != null) {
+      widthListString = state.getColumnWidths();
+    }
+    if (widthListString == null) {
+      widthListString = (String) attributes.get(Attributes.WIDTH_LIST_STRING);
+    }
+
+    if (widthListString != null) {
+      currentWidthList = StringUtils.parseIntegerList(widthListString);
+    }
+    if (currentWidthList != null && currentWidthList.size() != renderedColumns.size()) {
+      currentWidthList = null;
+    }
+
+    if (currentWidthList == null) {
+      LayoutTokens tokens = data.getColumnLayout();
+      List<UIColumn> allColumns = data.getAllColumns();
+      LayoutTokens newTokens = new LayoutTokens();
+      for (int i = 0; i < allColumns.size(); i++) {
+        UIColumn column = allColumns.get(i);
+        if (column.isRendered()) {
+          if (tokens == null) {
+            if (column instanceof AbstractUIColumn) {
+              newTokens.addToken(LayoutTokens.parseToken(((AbstractUIColumn) column).getWidth()));
+            } else {
+              newTokens.addToken(RelativeLayoutToken.DEFAULT_INSTANCE);
+            }
+          } else {
+            if (i < tokens.getSize()) {
+              newTokens.addToken(tokens.get(i));
+            } else {
+              newTokens.addToken(RelativeLayoutToken.DEFAULT_INSTANCE);
+            }
+          }
+        }
+      }
+
+      Measure space = data.getCurrentWidth();
+      final LayoutComponentRenderer renderer = data.getLayoutComponentRenderer(facesContext);
+      space = space.subtractNotNegative(renderer.getOffsetLeft(facesContext, data));
+      space = space.subtractNotNegative(renderer.getOffsetRight(facesContext, data));
+      if (needVerticalScrollbar(facesContext, data)) {
+        space = space.subtractNotNegative(renderer.getVerticalScrollbarWeight(facesContext, data));
+      }
+/*
+      // todo: not nice: 1 left + 1 right border
+      space = space.subtract(renderedColumns.size() * 2);
+*/
+      LayoutInfo layoutInfo =
+          new LayoutInfo(newTokens.getSize(), space.getPixel(), newTokens, data.getClientId(facesContext), false);
+      parseFixedWidth(layoutInfo, renderedColumns);
+      layoutInfo.parseColumnLayout(space.getPixel());
+      currentWidthList = layoutInfo.getSpaceList();
+    }
+
+    if (currentWidthList != null) {
+      if (renderedColumns.size() != currentWidthList.size()) {
+        LOG.warn("widthList.size() = " + currentWidthList.size()
+            + " != columns.size() = " + renderedColumns.size() + "  widthList : "
+            + LayoutInfo.listToTokenString(currentWidthList));
+      } else {
+        data.setWidthList(currentWidthList);
+      }
+    }
+  }
+
+  private boolean needVerticalScrollbar(FacesContext facesContext, AbstractUISheet sheet) {
+    // estimate need of height-scrollbar on client, if yes we have to consider
+    // this when calculating column width's
+
+    final Object forceScrollbar = sheet.getAttributes().get(Attributes.FORCE_VERTICAL_SCROLLBAR);
+    if (forceScrollbar != null) {
+      if ("true".equals(forceScrollbar)) {
+        return true;
+      } else if ("false".equals(forceScrollbar)) {
+        return false;
+      } else if (!"auto".equals(forceScrollbar)) {
+        LOG.warn("Illegal value for attribute 'forceVerticalScrollbar': '" + forceScrollbar + "'");
+      }
+    }
+
+    if (!sheet.hasRowCount()) {
+      return true;
+    }
+
+    if (sheet.getCurrentHeight() != null) {
+      int first = sheet.getFirst();
+      int rows = sheet.hasRows()
+          ? Math.min(sheet.getRowCount(), first + sheet.getRows()) - first
+          : sheet.getRowCount();
+      final LayoutComponentRenderer renderer = sheet.getLayoutComponentRenderer(facesContext);
+      final Measure rowPadding = renderer.getCustomMeasure(facesContext, sheet, "rowPadding");
+      LOG.error("20; // FIXME: make dynamic (was removed by changing the layout");
+      Measure heightNeeded = getFooterHeight(facesContext, sheet)
+              .add(rowPadding.add(20/*fixme*/).multiply(rows))
+              .add(20); // FIXME: make dynamic (was removed by changing the layouting
+      return heightNeeded.greaterThan(sheet.getCurrentHeight());
+    } else {
+      return false;
+    }
+  }
+
+  private void parseFixedWidth(LayoutInfo layoutInfo, List<UIColumn> rendereredColumns) {
+    LayoutTokens tokens = layoutInfo.getLayoutTokens();
+    for (int i = 0; i < tokens.getSize(); i++) {
+      LayoutToken token = tokens.get(i);
+      if (token instanceof AutoLayoutToken) {
+        int width = 0;
+        if (!rendereredColumns.isEmpty()) {
+          if (i < rendereredColumns.size()) {
+            UIColumn column = rendereredColumns.get(i);
+            if (column instanceof AbstractUIColumnSelector) {
+              width = 20; // FIXME: make dynamic (was removed by changing the layout
+              LOG.error("20; // FIXME: make dynamic (was removed by changing the layout");
+
+            } else {
+              for (UIComponent component : (List<UIComponent>) column.getChildren()) {
+                width += 100; // FIXME: make dynamic (was removed by changing the layout
+                LOG.error("100; // FIXME: make dynamic (was removed by changing the layout");
+              }
+            }
+            layoutInfo.update(width, i);
+          } else {
+            layoutInfo.update(0, i);
+            if (LOG.isWarnEnabled()) {
+              LOG.warn("More LayoutTokens found than rows! skipping!");
+            }
+          }
+        }
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("set column " + i + " from fixed to with " + width);
+        }
+      }
+    }
+  }
+
+  private Measure getFooterHeight(FacesContext facesContext, AbstractUISheet sheet) {
+    return sheet.isPagingVisible()
+        ? sheet.getLayoutComponentRenderer(facesContext).getCustomMeasure(facesContext, sheet, "footerHeight")
+        : Measure.ZERO;
+  }
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ColumnSelectorTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ColumnSelectorTagDeclaration.java?rev=952254&r1=952253&r2=952254&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ColumnSelectorTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ColumnSelectorTagDeclaration.java Mon Jun  7 14:42:38 2010
@@ -20,24 +20,20 @@ package org.apache.myfaces.tobago.intern
 import org.apache.myfaces.tobago.apt.annotation.BodyContent;
 import org.apache.myfaces.tobago.apt.annotation.Tag;
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
+import org.apache.myfaces.tobago.component.ComponentTypes;
 import org.apache.myfaces.tobago.component.RendererTypes;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasBinding;
 import org.apache.myfaces.tobago.internal.taglib.declaration.IsDisabled;
 import org.apache.myfaces.tobago.internal.taglib.declaration.IsRendered;
 
-/*
- * Date: 30.03.2006
- * Time: 21:37:36
- */
-
 /**
  * Renders a column with checkboxes to mark selected rows.
  */
 @Tag(name = "columnSelector", bodyContent = BodyContent.EMPTY)
 @UIComponentTag(
     uiComponent = "org.apache.myfaces.tobago.component.UIColumnSelector",
-    uiComponentBaseClass = "org.apache.myfaces.tobago.component.UIColumn",
-    componentType = "org.apache.myfaces.tobago.ColumnSelector",
+    uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUIColumnSelector",
+    componentType = ComponentTypes.COLUMN_SELECTOR,
     rendererType = RendererTypes.COLUMN_SELECTOR,
     allowedChildComponenents = "NONE")
 public interface ColumnSelectorTagDeclaration extends IsDisabled, IsRendered, HasBinding {

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutableRendererBaseWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutableRendererBaseWrapper.java?rev=952254&r1=952253&r2=952254&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutableRendererBaseWrapper.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutableRendererBaseWrapper.java Mon Jun  7 14:42:38 2010
@@ -26,6 +26,10 @@ import javax.faces.context.FacesContext;
 public abstract class AbstractLayoutableRendererBaseWrapper extends AbstractRendererBaseWrapper
     implements LayoutComponentRenderer {
 
+  public Measure getCustomMeasure(FacesContext facesContext, Configurable component, String name) {
+    return ((LayoutComponentRenderer) getRenderer(facesContext)).getCustomMeasure(facesContext, component, name);
+  }
+
   public Measure getWidth(FacesContext facesContext, Configurable component) {
     return ((LayoutComponentRenderer) getRenderer(facesContext)).getWidth(facesContext, component);
   }
@@ -73,4 +77,8 @@ public abstract class AbstractLayoutable
   public Measure getOffsetBottom(FacesContext facesContext, Configurable component) {
     return ((LayoutComponentRenderer) getRenderer(facesContext)).getOffsetBottom(facesContext, component);
   }
+
+  public Measure getVerticalScrollbarWeight(FacesContext facesContext, Configurable component) {
+    return ((LayoutComponentRenderer) getRenderer(facesContext)).getVerticalScrollbarWeight(facesContext, component);
+  }
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRenderer.java?rev=952254&r1=952253&r2=952254&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRenderer.java Mon Jun  7 14:42:38 2010
@@ -24,6 +24,8 @@ import javax.faces.context.FacesContext;
 
 public interface LayoutComponentRenderer {
 
+  Measure getCustomMeasure(FacesContext facesContext, Configurable component, String name);
+
   Measure getWidth(FacesContext facesContext, Configurable component);
 
   Measure getHeight(FacesContext facesContext, Configurable component);
@@ -47,4 +49,6 @@ public interface LayoutComponentRenderer
   Measure getOffsetTop(FacesContext facesContext, Configurable component);
 
   Measure getOffsetBottom(FacesContext facesContext, Configurable component);
+
+  Measure getVerticalScrollbarWeight(FacesContext facesContext, Configurable component);
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRendererBase.java?rev=952254&r1=952253&r2=952254&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRendererBase.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRendererBase.java Mon Jun  7 14:42:38 2010
@@ -19,12 +19,18 @@ package org.apache.myfaces.tobago.render
 
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.config.Configurable;
+import org.apache.myfaces.tobago.context.ClientProperties;
 import org.apache.myfaces.tobago.layout.Measure;
+import org.apache.myfaces.tobago.util.VariableResolverUtils;
 
 import javax.faces.context.FacesContext;
 
 public abstract class LayoutComponentRendererBase extends RendererBase implements LayoutComponentRenderer {
 
+  public Measure getCustomMeasure(FacesContext facesContext, Configurable component, String name) {
+    return getResourceManager().getThemeMeasure(facesContext, component, name);
+  }
+
   public Measure getWidth(FacesContext facesContext, Configurable component) {
     return getResourceManager().getThemeMeasure(facesContext, component, Attributes.WIDTH);
   }
@@ -72,4 +78,14 @@ public abstract class LayoutComponentRen
   public Measure getOffsetBottom(FacesContext facesContext, Configurable component) {
     return getResourceManager().getThemeMeasure(facesContext, component, Attributes.OFFSET_BOTTOM);
   }
+
+  public Measure getVerticalScrollbarWeight(FacesContext facesContext, Configurable component) {
+    final ClientProperties clientProperties = VariableResolverUtils.resolveClientProperties(facesContext);
+    final Measure weight = clientProperties.getVerticalScrollbarWeight();
+    if (weight != null) {
+      return weight;
+    } else { // default
+      return getResourceManager().getThemeMeasure(facesContext, component, "verticalScrollbarWeight");
+    }
+  }
 }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java?rev=952254&r1=952253&r2=952254&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java Mon Jun  7 14:42:38 2010
@@ -28,19 +28,14 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.component.UIMenuCommand;
 import org.apache.myfaces.tobago.component.UIReload;
 import org.apache.myfaces.tobago.component.UISheet;
-import org.apache.myfaces.tobago.context.ClientProperties;
 import org.apache.myfaces.tobago.context.ResourceManager;
 import org.apache.myfaces.tobago.context.ResourceManagerFactory;
 import org.apache.myfaces.tobago.context.ResourceManagerUtils;
 import org.apache.myfaces.tobago.context.TobagoFacesContext;
 import org.apache.myfaces.tobago.event.PageAction;
 import org.apache.myfaces.tobago.internal.util.StringUtils;
-import org.apache.myfaces.tobago.layout.AutoLayoutToken;
 import org.apache.myfaces.tobago.layout.LayoutBase;
-import org.apache.myfaces.tobago.layout.LayoutToken;
-import org.apache.myfaces.tobago.layout.LayoutTokens;
 import org.apache.myfaces.tobago.layout.Measure;
-import org.apache.myfaces.tobago.layout.RelativeLayoutToken;
 import org.apache.myfaces.tobago.model.SheetState;
 import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
 import org.apache.myfaces.tobago.renderkit.css.Position;
@@ -52,8 +47,6 @@ import org.apache.myfaces.tobago.renderk
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
 import org.apache.myfaces.tobago.util.ComponentUtils;
-import org.apache.myfaces.tobago.util.LayoutInfo;
-import org.apache.myfaces.tobago.util.VariableResolverUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -97,8 +90,6 @@ public class SheetRenderer extends Layou
 
     Style style = new Style(facesContext, sheet);
 
-    ensureColumnWidthList(facesContext, sheet, style);
-
     final String sheetId = sheet.getClientId(facesContext);
 
     TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
@@ -581,8 +572,9 @@ public class SheetRenderer extends Layou
           ? Math.min(sheet.getRowCount(), first + sheet.getRows()) - first
           : sheet.getRowCount();
       LOG.error("20; // FIXME: make dynamic (was removed by changing the layout");
+      final Measure rowPadding = getCustomMeasure(facesContext, sheet, "rowPadding");
       Measure heightNeeded = getFooterHeight(facesContext, sheet)
-              .add(getRowPadding(facesContext, sheet).add(20/*fixme*/).multiply(rows))
+              .add(rowPadding.add(20/*fixme*/).multiply(rows))
               .add(20); // FIXME: make dynamic (was removed by changing the layouting
       return heightNeeded.greaterThan(style.getHeight());
     } else {
@@ -590,20 +582,6 @@ public class SheetRenderer extends Layou
     }
   }
 
-  private Measure getRowPadding(FacesContext facesContext, UISheet data) {
-    return getResourceManager().getThemeMeasure(facesContext, data, "rowPadding");
-  }
-
-  private Measure getVerticalScrollbarWeight(FacesContext facesContext, UISheet data) {
-    final ClientProperties clientProperties = VariableResolverUtils.resolveClientProperties(facesContext);
-    final Measure weight = clientProperties.getVerticalScrollbarWeight();
-    if (weight != null) {
-      return weight;
-    } else { // default
-      return getResourceManager().getThemeMeasure(facesContext, data, "verticalScrollbarWeight");
-    }
-  }
-
   private Measure getFooterHeight(FacesContext facesContext, UISheet sheet) {
     return sheet.isPagingVisible()
         ? getResourceManager().getThemeMeasure(facesContext, sheet, "footerHeight")
@@ -983,112 +961,6 @@ public class SheetRenderer extends Layou
     // DO Nothing
   }
 
-  private void ensureColumnWidthList(FacesContext facesContext, UISheet data, Style style) {
-    List<Integer> currentWidthList = null;
-    List<UIColumn> rendererdColumns = data.getRenderedColumns();
-
-    final Map attributes = data.getAttributes();
-    String widthListString = null;
-    SheetState state = data.getSheetState(facesContext);
-    if (state != null) {
-      widthListString = state.getColumnWidths();
-    }
-    if (widthListString == null) {
-      widthListString = (String) attributes.get(Attributes.WIDTH_LIST_STRING);
-    }
-
-    if (widthListString != null) {
-      currentWidthList = StringUtils.parseIntegerList(widthListString);
-    }
-    if (currentWidthList != null && currentWidthList.size() != rendererdColumns.size()) {
-      currentWidthList = null;
-    }
-
-    if (currentWidthList == null) {
-      LayoutTokens tokens = data.getColumnLayout();
-      List<UIColumn> allColumns = data.getAllColumns();
-      LayoutTokens newTokens = new LayoutTokens();
-      for (int i = 0; i < allColumns.size(); i++) {
-        UIColumn column = allColumns.get(i);
-        if (column.isRendered()) {
-          if (tokens == null) {
-            if (column instanceof org.apache.myfaces.tobago.component.UIColumn) {
-              newTokens.addToken(
-                  LayoutTokens.parseToken(((org.apache.myfaces.tobago.component.UIColumn) column).getWidth()));
-            } else {
-              newTokens.addToken(RelativeLayoutToken.DEFAULT_INSTANCE);
-            }
-          } else {
-            if (i < tokens.getSize()) {
-              newTokens.addToken(tokens.get(i));
-            } else {
-              newTokens.addToken(RelativeLayoutToken.DEFAULT_INSTANCE);
-            }
-          }
-        }
-      }
-
-      Measure space = data.getCurrentWidth();
-      space = space.subtractNotNegative(getContentBorder(facesContext, data));
-      if (needVerticalScrollbar(facesContext, data, style)) {
-        space = space.subtractNotNegative(getVerticalScrollbarWeight(facesContext, data));
-      }
-/*
-      // todo: not nice: 1 left + 1 right border
-      space = space.subtract(rendererdColumns.size() * 2);
-*/
-      LayoutInfo layoutInfo =
-          new LayoutInfo(newTokens.getSize(), space.getPixel(), newTokens, data.getClientId(facesContext), false);
-      parseFixedWidth(facesContext, layoutInfo, rendererdColumns);
-      layoutInfo.parseColumnLayout(space.getPixel());
-      currentWidthList = layoutInfo.getSpaceList();
-    }
-
-    if (currentWidthList != null) {
-      if (rendererdColumns.size() != currentWidthList.size()) {
-        LOG.warn("widthList.size() = " + currentWidthList.size()
-            + " != columns.size() = " + rendererdColumns.size() + "  widthList : "
-            + LayoutInfo.listToTokenString(currentWidthList));
-      } else {
-        data.setWidthList(currentWidthList);
-      }
-    }
-  }
-
-  private void parseFixedWidth(FacesContext facesContext, LayoutInfo layoutInfo, List<UIColumn> rendereredColumns) {
-    LayoutTokens tokens = layoutInfo.getLayoutTokens();
-    for (int i = 0; i < tokens.getSize(); i++) {
-      LayoutToken token = tokens.get(i);
-      if (token instanceof AutoLayoutToken) {
-        int width = 0;
-        if (!rendereredColumns.isEmpty()) {
-          if (i < rendereredColumns.size()) {
-            UIColumn column = rendereredColumns.get(i);
-            if (column instanceof UIColumnSelector) {
-              width = 20; // FIXME: make dynamic (was removed by changing the layout
-              LOG.error("20; // FIXME: make dynamic (was removed by changing the layout");
-
-            } else {
-              for (UIComponent component : (List<UIComponent>) column.getChildren()) {
-                width += 100; // FIXME: make dynamic (was removed by changing the layout
-                LOG.error("100; // FIXME: make dynamic (was removed by changing the layout");
-              }
-            }
-            layoutInfo.update(width, i);
-          } else {
-            layoutInfo.update(0, i);
-            if (LOG.isWarnEnabled()) {
-              LOG.warn("More LayoutTokens found than rows! skipping!");
-            }
-          }
-        }
-        if (LOG.isDebugEnabled()) {
-          LOG.debug("set column " + i + " from fixed to with " + width);
-        }
-      }
-    }
-  }
-
   @Override
   public boolean getPrepareRendersChildren() {
     return true;