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/03/11 09:31:12 UTC

svn commit: r921720 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/component/ core/src/main/java/org/apache/myfaces/tobago/internal/layout/ core/src/main/java/org/apache/myfaces/tobago/layout/ core/src/test/java/org/apache/myf...

Author: lofwyr
Date: Thu Mar 11 08:31:12 2010
New Revision: 921720

URL: http://svn.apache.org/viewvc?rev=921720&view=rev
Log:
TOBAOG-606: Layout: support for rendered=false
 - if all components of a row/column have rendered=false, the whole row/column will not be rendered, and the space will be used for the other rows/columns.

Added:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/BankHead.java   (with props)
    myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/nested-v.xhtml
      - copied, changed from r917992, myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/nested.xhtml
    myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-empty.xhtml   (with props)
    myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-horizontal-6.xhtml   (with props)
    myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-horizontal.xhtml   (with props)
    myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-vertical-6.xhtml   (with props)
    myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-vertical.xhtml
      - copied, changed from r917992, myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/position-2x2.xhtml
    myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-much-components.xhtml   (with props)
Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/Grid.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/Interval.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/LayoutContext.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/LayoutUtils.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponent.java
    myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridUnitTest.java
    myfaces/tobago/trunk/example/test/src/main/webapp/navigation.xhtml
    myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/nested.xhtml

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java?rev=921720&r1=921719&r2=921720&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java Thu Mar 11 08:31:12 2010
@@ -19,6 +19,7 @@ package org.apache.myfaces.tobago.compon
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.internal.layout.BankHead;
 import org.apache.myfaces.tobago.internal.layout.Cell;
 import org.apache.myfaces.tobago.internal.layout.FactorList;
 import org.apache.myfaces.tobago.internal.layout.Grid;
@@ -67,51 +68,66 @@ public abstract class AbstractUIGridLayo
 
   public void fixRelativeInsideAuto(Orientation orientation, boolean auto) {
 
-    LayoutTokens tokens = grid.getTokens(orientation);
+    BankHead[] heads = grid.getBankHeads(orientation);
+    BankHead[] heads2 = grid.getBankHeads(orientation.other());
 
     if (auto) {
-      for (int i = 0; i < tokens.getSize(); i++) {
-        if (tokens.get(i) instanceof RelativeLayoutToken) {
+      for (int i = 0; i < heads.length; i++) {
+        if (heads[i].getToken() instanceof RelativeLayoutToken) {
           LOG.warn("Fixing layout token from * to auto, because a * in not allowed inside of a auto. "
               + "For more information please use the debug logging level.");
           if (LOG.isDebugEnabled()) {
             LOG.debug("Token * at index=" + i + ", orientation=" + orientation + ", grid=\n" + grid);
           }
-          tokens.set(i, AutoLayoutToken.INSTANCE);
+          heads[i].setToken(AutoLayoutToken.INSTANCE);
         }
       }
     }
 
-    for (int i = 0; i < tokens.getSize(); i++) {
-      for (int j = 0; j < grid.getTokens(orientation.other()).getSize(); j++) {
+    for (int i = 0; i < heads.length; i++) {
+      boolean neitherRendered = true;
+      for (int j = 0; j < heads2.length; j++) {
         Cell cell = grid.getCell(i, j, orientation);
+        // check rendered = false
+        if (neitherRendered && (cell == null || cell.getComponent().isRendered())) {
+          neitherRendered = false;
+        }
+        // recursion
         if (cell instanceof OriginCell) {
           OriginCell origin = (OriginCell) cell;
           LayoutComponent component = cell.getComponent();
           if (component instanceof LayoutContainer) {
             LayoutManager layoutManager = ((LayoutContainer) component).getLayoutManager();
             // TODO: may be improved
-            boolean childAuto = origin.getSpan(orientation) == 1 && tokens.get(i) instanceof AutoLayoutToken;
+            boolean childAuto = origin.getSpan(orientation) == 1 && heads[i].getToken() instanceof AutoLayoutToken;
             layoutManager.fixRelativeInsideAuto(orientation, childAuto);
           }
         }
       }
+      if (neitherRendered) {
+        heads[i].setRendered(false);
+      }
     }
   }
 
   public void preProcessing(Orientation orientation) {
 
+    final BankHead[] heads = grid.getBankHeads(orientation);
+    final BankHead[] heads2 = grid.getBankHeads(orientation.other());
+    
     // process auto tokens
     int i = 0;
-    for (LayoutToken token : grid.getTokens(orientation)) {
-
+    
+    for (BankHead head : heads) {
+      LayoutToken token = head.getToken();
+      
       if (token instanceof PixelLayoutToken) {
         int pixel = ((PixelLayoutToken) token).getPixel();
-        grid.getSizes(orientation)[i] = Measure.valueOf(pixel); // XXX refactor
+        heads[i].setMeasure(Measure.valueOf(pixel)); // XXX refactor
       }
 
-      IntervalList intervals = new IntervalList();
-      for (int j = 0; j < grid.getTokens(orientation.other()).getSize(); j++) {
+      IntervalList intervalList = new IntervalList();
+      for (int j = 0; j < heads2.length; j++) {
         Cell cell = grid.getCell(i, j, orientation);
         if (cell instanceof OriginCell) {
           OriginCell origin = (OriginCell) cell;
@@ -122,49 +138,57 @@ public abstract class AbstractUIGridLayo
           }
 
           if (token instanceof AutoLayoutToken) {
-            if (origin.getSpan(orientation) == 1) {
-              intervals.add(new Interval(component, orientation));
+            if (origin.getSpan(orientation) == 1 && component.isRendered()) {
+              intervalList.add(new Interval(component, orientation));
             } else {
-              LOG.info("ignored"); // todo
+              if (LOG.isDebugEnabled()) {
+                LOG.debug("Components with span > 1 will be ignored in 'auto' layout rows/columns.");
+                // todo: give this information to the developer
+              }
             }
           }
         }
       }
-      if (intervals.size() >= 1) {
-        Measure auto = intervals.computeAuto();
-        grid.getSizes(orientation)[i] = auto;
-      }
+      if (token instanceof AutoLayoutToken) {
+        if (intervalList.size() >= 1) {
+          heads[i].setMeasure(intervalList.computeAuto());
+        } else {
+          heads[i].setMeasure(Measure.ZERO);
 // todo: what when we cannot find a good value for "auto"?
+        }
+      }
       i++;
     }
 
     // set the size if all sizes of the grid are set
-    Measure size = Measure.ZERO;
-    Measure[] sizes = grid.getSizes(orientation);
-    for (int j = 0; j < sizes.length; j++) {
-      if (sizes[j] == null) {
-        size = null; // set to invalid
+    Measure sum = Measure.ZERO;
+    for (BankHead head : heads) {
+      Measure size = head.getMeasure();
+      if (size == null) {
+        sum = null; // set to invalid
         break;
       }
-      size = size.add(sizes[j]);
-      if (j < sizes.length - 1) {
-        size = size.add(getSpacing(orientation));
-      }
+      sum = sum.add(size);
     }
-    if (size != null) {
-      size = size.add(LayoutUtils.getBeginOffset(orientation, getLayoutContainer()));
-      size = size.add(LayoutUtils.getEndOffset(orientation, getLayoutContainer()));
-      LayoutUtils.setCurrentSize(orientation, getLayoutContainer(), size);
+    if (sum != null) {
+      // adding the space between the cells
+      sum = sum.add(computeSpacing(orientation, 0, heads.length));
+      sum = sum.add(LayoutUtils.getBeginOffset(orientation, getLayoutContainer()));
+      sum = sum.add(LayoutUtils.getEndOffset(orientation, getLayoutContainer()));
+      LayoutUtils.setCurrentSize(orientation, getLayoutContainer(), sum);
     }
   }
 
   public void mainProcessing(Orientation orientation) {
 
+    final BankHead[] heads = grid.getBankHeads(orientation);
+    final BankHead[] heads2 = grid.getBankHeads(orientation.other());
+    
     // find *
     FactorList list = new FactorList();
-    for (LayoutToken token : grid.getTokens(orientation)) {
-      if (token instanceof RelativeLayoutToken) {
-        list.add(((RelativeLayoutToken) token).getFactor());
+    for (BankHead head : heads) {
+      if (head.getToken() instanceof RelativeLayoutToken) {
+        list.add(((RelativeLayoutToken) head.getToken()).getFactor());
       }
     }
     if (!list.isEmpty()) {
@@ -172,13 +196,11 @@ public abstract class AbstractUIGridLayo
       LayoutContainer container = getLayoutContainer();
       Measure available = LayoutUtils.getCurrentSize(orientation, container);
       if (available != null) {
-        for (Measure value : grid.getSizes(orientation)) {
-          available = available.subtractNotNegative(value);
+        for (BankHead head : heads) {
+          available = available.subtractNotNegative(head.getMeasure());
         }
-        Measure spacing = getSpacing(orientation).multiply(grid.getSizes(orientation).length - 1);
-        available = available.subtractNotNegative(spacing);
-
         available = available.subtractNotNegative(LayoutUtils.getBeginOffset(orientation, container));
+        available = available.subtractNotNegative(computeSpacing(orientation, 0, heads.length));
         available = available.subtractNotNegative(LayoutUtils.getEndOffset(orientation, container));
 
         List<Measure> partition = list.partition(available);
@@ -186,9 +208,9 @@ public abstract class AbstractUIGridLayo
         // write values back into the header
         int i = 0;
         int j = 0;
-        for (LayoutToken token : grid.getTokens(orientation)) {
-          if (token instanceof RelativeLayoutToken) {
-            grid.getSizes(orientation)[i] = partition.get(j);
+        for (BankHead head : heads) {
+          if (head.getToken() instanceof RelativeLayoutToken) {
+            heads[i].setMeasure(partition.get(j));
             j++;
           }
           i++;
@@ -199,8 +221,8 @@ public abstract class AbstractUIGridLayo
     }
 
     // call manage sizes for all sub-layout-managers
-    for (int i = 0; i < grid.getTokens(orientation).getSize(); i++) {
-      for (int j = 0; j < grid.getTokens(orientation.other()).getSize(); j++) {
+    for (int i = 0; i < heads.length; i++) {
+      for (int j = 0; j < heads2.length; j++) {
         Cell cell = grid.getCell(i, j, orientation);
         if (cell instanceof OriginCell) {
           LayoutComponent component = cell.getComponent();
@@ -208,19 +230,14 @@ public abstract class AbstractUIGridLayo
           component.setDisplay(Display.BLOCK); // TODO: use CSS via classes and style.css
 
           Integer span = ((OriginCell) cell).getSpan(orientation);
-          Measure[] pixelMeasures = grid.getSizes(orientation);
 
           // compute the size of the cell
-          Measure size = pixelMeasures[i];
-          if (size != null) {
-            for (int k = 1; k < span; k++) {
-              size = size.add(pixelMeasures[i + k]);
-              size = size.add(getSpacing(orientation));
-            }
-            LayoutUtils.setCurrentSize(orientation, component, size);
-          } else {
-            LOG.warn("Size is null, should be debugged... i=" + i + " grid=" + grid, new RuntimeException());
+          Measure size = Measure.ZERO;
+          for (int k = 0; k < span; k++) {
+            size = size.add(heads[i + k].getMeasure());
           }
+          size = size.add(computeSpacing(orientation, i, span));
+          LayoutUtils.setCurrentSize(orientation, component, size);
 
           // call sub layout manager
           if (component instanceof LayoutContainer) {
@@ -233,27 +250,30 @@ public abstract class AbstractUIGridLayo
 
   public void postProcessing(Orientation orientation) {
 
+    final BankHead[] heads = grid.getBankHeads(orientation);
+    final BankHead[] heads2 = grid.getBankHeads(orientation.other());
+    
     // call manage sizes for all sub-layout-managers
-    for (int i = 0; i < grid.getTokens(orientation).getSize(); i++) {
-      for (int j = 0; j < grid.getTokens(orientation.other()).getSize(); j++) {
+    for (int i = 0; i < heads.length; i++) {
+      for (int j = 0; j < heads2.length; j++) {
         Cell cell = grid.getCell(i, j, orientation);
         if (cell instanceof OriginCell) {
           LayoutComponent component = cell.getComponent();
 
-          component.setDisplay(Display.BLOCK); // TODO: use CSS via classes and style.css
-
-          Measure[] pixelMeasures = grid.getSizes(orientation);
+          component.setDisplay(Display.BLOCK);
 
           // compute the position of the cell
           Measure position = LayoutUtils.getBeginOffset(orientation, getLayoutContainer());
           for (int k = 0; k < i; k++) {
-            if (pixelMeasures[k] == null) {
+            if (heads[k] == null) {
               LOG.warn("Measure is null, should be debugged... i=" + i + " k=" + k + " grid=" + grid,
                   new RuntimeException());
             } else {
-              position = position.add(pixelMeasures[k]);
+              if (heads[k].getMeasure().greaterThan(Measure.ZERO)) {
+                position = position.add(heads[k].getMeasure());
+                position = position.add(getSpacing(orientation));
+              }
             }
-            position = position.add(getSpacing(orientation));
           }
           if (orientation == Orientation.HORIZONTAL) {
             component.setLeft(position);
@@ -277,14 +297,33 @@ public abstract class AbstractUIGridLayo
     return ((LayoutContainer) getParent());
   }
 
-  protected Grid getGrid() {
-    return grid;
-  }
-
   public Measure getSpacing(Orientation orientation) {
     return orientation == Orientation.HORIZONTAL ? getColumnSpacing() : getRowSpacing();
   }
 
+
+  /**
+   * Compute the sum of the space between the cells.
+   * There is one "space" less than cells that are not void.
+   */
+  private Measure computeSpacing(Orientation orientation, int startIndex, int length) {
+
+    final BankHead[] heads = grid.getBankHeads(orientation);
+
+    int count = 0;
+    for (int i = startIndex; i < startIndex + length; i++) {
+      if ((heads[i].isRendered())
+          && (heads[i].getMeasure() == null || heads[i].getMeasure().greaterThan(Measure.ZERO))) {
+        count++;
+      }
+    }
+    if (count > 0) {
+      return getSpacing(orientation).multiply(count - 1);
+    } else {
+      return Measure.ZERO;
+    }
+  }
+
   public abstract String getRows();
 
   public abstract String getColumns();
@@ -307,7 +346,8 @@ public abstract class AbstractUIGridLayo
         + "#"
         + getClientId(FacesContext.getCurrentInstance())
         + (grid != null
-        ? "(" + Arrays.toString(grid.getWidths()) + ", " + Arrays.toString(grid.getHeights()) + ")"
+        ? "(" + Arrays.toString(grid.getBankHeads(Orientation.HORIZONTAL)) 
+        + ", " + Arrays.toString(grid.getBankHeads(Orientation.VERTICAL)) + ")"
         : "");
   }
 }

Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/BankHead.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/BankHead.java?rev=921720&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/BankHead.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/BankHead.java Thu Mar 11 08:31:12 2010
@@ -0,0 +1,70 @@
+package org.apache.myfaces.tobago.internal.layout;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.myfaces.tobago.layout.LayoutToken;
+import org.apache.myfaces.tobago.layout.Measure;
+
+/**
+ * BankHead represents the head information of a bank like the token for this bank, the computed measure and if 
+ * it will be rendered. A bank is a generalization for columns and rows. 
+ */
+public class BankHead {
+
+  private LayoutToken token;
+  private Measure measure;
+  private boolean rendered;
+
+  public BankHead(LayoutToken token) {
+    this.token = token;
+    this.rendered = true;
+  }
+
+  public LayoutToken getToken() {
+    return token;
+  }
+
+  public void setToken(LayoutToken token) {
+    this.token = token;
+  }
+
+  public Measure getMeasure() {
+    return measure;
+  }
+
+  public void setMeasure(Measure measure) {
+    this.measure = measure;
+  }
+
+  public boolean isRendered() {
+    return rendered;
+  }
+
+  public void setRendered(boolean rendered) {
+    this.rendered = rendered;
+  }
+
+  @Override
+  public String toString() {
+    return "BankHead{" +
+        "token='" + token +
+        "', measure='" + measure +
+        "', rendered=" + rendered +
+        '}';
+  }
+}

Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/BankHead.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/Grid.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/Grid.java?rev=921720&r1=921719&r2=921720&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/Grid.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/Grid.java Thu Mar 11 08:31:12 2010
@@ -19,10 +19,9 @@ package org.apache.myfaces.tobago.intern
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.layout.AutoLayoutToken;
 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 java.util.ArrayList;
 import java.util.Arrays;
@@ -37,32 +36,38 @@ public class Grid {
    * The rectangular data as a 1-dim list
    */
   private List<Cell> cells;
-  private LayoutTokens columns;
-  private LayoutTokens rows;
-  private Measure[] widths;
-  private Measure[] heights;
 
-  private List<Integer> errorIndexes;
+  private BankHead[] columnHeads;
+  private BankHead[] rowHeads;
+
+  private int columnCount;
+  private int rowCount;
 
   private int columnCursor;
   private int rowCursor;
-  private int[] horizontalIndices;
-  private int[] verticalIndices;
+
+  private List<Integer> errorIndexes;
 
   public Grid(LayoutTokens columns, LayoutTokens rows) {
     assert columns.getSize() > 0;
     assert rows.getSize() > 0;
 
-    this.columns = columns;
-    this.rows = rows;
-    int size = columns.getSize() * rows.getSize();
+    this.columnCount = columns.getSize(); 
+    this.rowCount = rows.getSize(); 
+    
+    this.columnHeads = new BankHead[columnCount];
+    for (int i = 0; i < columnCount; i++) {
+      columnHeads[i] = new BankHead(columns.get(i));
+    }
+    this.rowHeads = new BankHead[rowCount];
+    for (int i = 0; i < rowCount; i++) {
+      rowHeads[i] = new BankHead(rows.get(i));
+    }
+    int size = columnCount * rowCount;
     this.cells = new ArrayList<Cell>(size);
     for (int i = 0; i < size; i++) {
       this.cells.add(null);
     }
-
-    widths = new Measure[columns.getSize()];
-    heights = new Measure[rows.getSize()];
   }
 
   public void add(OriginCell cell, int columnSpan, int rowSpan) {
@@ -72,10 +77,10 @@ public class Grid {
 
     boolean error = false;
 
-    if (columnSpan + columnCursor > columns.getSize()) {
+    if (columnSpan + columnCursor > columnCount) {
       LOG.warn("The columnSpan is to large for the actual position in the grid. Will be fixed. "
-          + "columnSpan=" + columnSpan + " columnCursor=" + columnCursor + " columnCount=" + columns.getSize());
-      columnSpan = columns.getSize() - columnCursor;
+          + "columnSpan=" + columnSpan + " columnCursor=" + columnCursor + " columnCount=" + columnCount);
+      columnSpan = columnCount - columnCursor;
       error = true;
     }
 
@@ -85,7 +90,7 @@ public class Grid {
     for (int i = 1; i < columnSpan; i++) {
       if (getCell(i + columnCursor, rowCursor) != null) {
         LOG.warn("The columnSpan is to large for the actual position in the grid. Will be fixed. "
-            + "columnSpan=" + columnSpan + " columnCursor=" + columnCursor + " columnCount=" + columns.getSize());
+            + "columnSpan=" + columnSpan + " columnCursor=" + columnCursor + " columnCount=" + columnCount);
         columnSpan = i - 1;
         error = true;
       }
@@ -115,26 +120,26 @@ public class Grid {
   }
 
   public Cell getCell(int column, int row) {
-    assert column >= 0 && column < columns.getSize() : "column=" + column + " columnCount=" + columns.getSize();
+    assert column >= 0 && column < columnCount : "column=" + column + " columnCount=" + columnCount;
     assert row >= 0 : "row=" + row;
 
-    if (row >= rows.getSize()) {
+    if (row >= rowCount) {
       return null;
     } else {
-      return cells.get(column + row * columns.getSize());
+      return cells.get(column + row * columnCount);
     }
   }
 
   public void setCell(int column, int row, Cell cell) {
-    if (row >= rows.getSize()) {
-      enlarge(row - rows.getSize() + 1);
+    if (row >= rowCount) {
+      enlarge(row - rowCount + 1);
     }
-    cells.set(column + row * columns.getSize(), cell);
+    cells.set(column + row * columnCount, cell);
   }
 
   private void findNextFreeCell() {
-    for (; rowCursor < rows.getSize(); rowCursor++) {
-      for (; columnCursor < columns.getSize(); columnCursor++) {
+    for (; rowCursor < rowCount; rowCursor++) {
+      for (; columnCursor < columnCount; columnCursor++) {
         if (getCell(columnCursor, rowCursor) == null) {
           return;
         }
@@ -143,43 +148,44 @@ public class Grid {
     }
   }
 
-  public LayoutTokens getTokens(Orientation orientation) {
-    return orientation == Orientation.HORIZONTAL ? getColumns() : getRows();
-  }
-
-  public LayoutTokens getColumns() {
-    return columns;
+  public BankHead[] getBankHeads(Orientation orientation) {
+    return orientation == Orientation.HORIZONTAL ? columnHeads : rowHeads;
   }
-
-  public LayoutTokens getRows() {
-    return rows;
-  }
-
+  
   private void enlarge(int newRows) {
+    
+    // process cells
     for (int i = 0; i < newRows; i++) {
-      for (int j = 0; j < columns.getSize(); j++) {
+      for (int j = 0; j < columnCount; j++) {
         cells.add(null);
       }
-      rows.addToken(AutoLayoutToken.INSTANCE);
     }
 
-    Measure[] oldHeights = heights;
-    heights = new Measure[heights.length + newRows];
-    System.arraycopy(oldHeights, 0, heights, 0, oldHeights.length);
+    // process heads
+    BankHead[] newRowHeads = new BankHead[rowCount + newRows];
+    System.arraycopy(rowHeads, 0, newRowHeads, 0, rowHeads.length);
+    rowHeads = newRowHeads;
+    // todo: shorter in jdk 1.6: rowHeads = Arrays.copyOf(rowHeads, rowHeads.length + newRows);
+    
+    for (int i = rowCount; i <rowCount + newRows; i++ ) {
+      rowHeads[i] = new BankHead(RelativeLayoutToken.DEFAULT_INSTANCE);
+    }
+
+    rowCount += newRows;
   }
 
   public void addError(int i, int j) {
     if (errorIndexes == null) {
       errorIndexes = new ArrayList<Integer>();
     }
-    errorIndexes.add(j * columns.getSize() + i);
+    errorIndexes.add(j * columnCount + i);
   }
 
   public boolean hasError(int i, int j) {
     if (errorIndexes == null) {
       return false;
     }
-    return errorIndexes.contains(j * columns.getSize() + i);
+    return errorIndexes.contains(j * columnCount + i);
   }
 
   /**
@@ -201,7 +207,7 @@ public class Grid {
     StringBuilder builder = new StringBuilder();
 
     // top of grid
-    for (int i = 0; i < columns.getSize(); i++) {
+    for (int i = 0; i < columnCount; i++) {
       if (i == 0) {
         if (getCell(i, 0) != null) {
           builder.append("┏");
@@ -234,18 +240,18 @@ public class Grid {
       }
 
     }
-    if (getCell(columns.getSize() - 1, 0) != null) {
+    if (getCell(columnCount - 1, 0) != null) {
       builder.append("┓");
     } else {
       builder.append("┐");
     }
     builder.append("\n");
 
-    for (int j = 0; j < rows.getSize(); j++) {
+    for (int j = 0; j < rowCount; j++) {
 
       // between the cells
       if (j != 0) {
-        for (int i = 0; i < columns.getSize(); i++) {
+        for (int i = 0; i < columnCount; i++) {
           if (i == 0) {
             Cell b = getCell(0, j - 1);
             Cell d = getCell(0, j);
@@ -316,8 +322,8 @@ public class Grid {
             builder.append("━");
           }
         }
-        Cell a = getCell(columns.getSize() - 1, j - 1);
-        Cell c = getCell(columns.getSize() - 1, j);
+        Cell a = getCell(columnCount - 1, j - 1);
+        Cell c = getCell(columnCount - 1, j);
         if (a == null && c == null) {
           builder.append("┤");
         } else {
@@ -337,7 +343,7 @@ public class Grid {
       }
 
       // cell
-      for (int i = 0; i < columns.getSize(); i++) {
+      for (int i = 0; i < columnCount; i++) {
         if (i == 0) {
           if (getCell(i, j) != null) {
             builder.append("┃");
@@ -375,7 +381,7 @@ public class Grid {
           }
         }
       }
-      if (getCell(columns.getSize() - 1, j) != null) {
+      if (getCell(columnCount - 1, j) != null) {
         builder.append("┃");
       } else {
         builder.append("│");
@@ -384,16 +390,16 @@ public class Grid {
     }
 
     //last bottom
-    for (int i = 0; i < columns.getSize(); i++) {
+    for (int i = 0; i < columnCount; i++) {
       if (i == 0) {
-        if (getCell(0, rows.getSize() - 1) != null) {
+        if (getCell(0, rowCount - 1) != null) {
           builder.append("┗");
         } else {
           builder.append("└");
         }
       } else {
-        Cell a = getCell(i - 1, rows.getSize() - 1);
-        Cell b = getCell(i, rows.getSize() - 1);
+        Cell a = getCell(i - 1, rowCount - 1);
+        Cell b = getCell(i, rowCount - 1);
         if (a == null && b == null) {
           builder.append("┴");
         } else {
@@ -410,13 +416,13 @@ public class Grid {
           }
         }
       }
-      if (getCell(i, rows.getSize() - 1) != null) {
+      if (getCell(i, rowCount - 1) != null) {
         builder.append("━");
       } else {
         builder.append("─");
       }
     }
-    if (getCell(columns.getSize() - 1, rows.getSize() - 1) != null) {
+    if (getCell(columnCount - 1, rowCount - 1) != null) {
       builder.append("┛");
     } else {
       builder.append("┘");
@@ -430,17 +436,11 @@ public class Grid {
   public String toString() {
     StringBuilder builder = new StringBuilder();
     builder.append(gridAsString());
-    builder.append("columns=");
-    builder.append(columns);
-    builder.append("\n");
-    builder.append("rows=");
-    builder.append(rows);
-    builder.append("\n");
-    builder.append("widths=");
-    builder.append(Arrays.toString(widths));
+    builder.append("columnHeads=");
+    builder.append(Arrays.toString(columnHeads));
     builder.append("\n");
-    builder.append("heights=");
-    builder.append(Arrays.toString(heights));
+    builder.append("rowHeads=");
+    builder.append(Arrays.toString(rowHeads));
     builder.append("\n");
     return builder.toString();
   }
@@ -454,32 +454,4 @@ public class Grid {
     }
     return a.getOrigin().equals(b.getOrigin());
   }
-
-  public int[] getHorizontalIndices() {
-    return horizontalIndices;
-  }
-
-  public void setHorizontalIndices(int[] horizontalIndices) {
-    this.horizontalIndices = horizontalIndices;
-  }
-
-  public int[] getVerticalIndices() {
-    return verticalIndices;
-  }
-
-  public void setVerticalIndices(int[] verticalIndices) {
-    this.verticalIndices = verticalIndices;
-  }
-
-  public Measure[] getSizes(Orientation orientation) {
-    return orientation == Orientation.HORIZONTAL ? getWidths() : getHeights();
-  }
-
-  public Measure[] getWidths() {
-    return widths;
-  }
-
-  public Measure[] getHeights() {
-    return heights;
-  }
 }

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/Interval.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/Interval.java?rev=921720&r1=921719&r2=921720&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/Interval.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/Interval.java Thu Mar 11 08:31:12 2010
@@ -23,13 +23,13 @@ import org.apache.myfaces.tobago.layout.
 
 public class Interval {
 
-  private Measure minimum;
+  private final Measure minimum;
 
-  private Measure preferred;
+  private final Measure preferred;
 
-  private Measure maximum;
+  private final Measure maximum;
 
-  private Measure current;
+  private final Measure current;
 
   public Interval(LayoutComponent component, Orientation orientation) {
     this(
@@ -50,34 +50,18 @@ public class Interval {
     return minimum;
   }
 
-  public void setMinimum(Measure minimum) {
-    this.minimum = minimum;
-  }
-
   public Measure getPreferred() {
     return preferred;
   }
 
-  public void setPreferred(Measure preferred) {
-    this.preferred = preferred;
-  }
-
   public Measure getMaximum() {
     return maximum;
   }
 
-  public void setMaximum(Measure maximum) {
-    this.maximum = maximum;
-  }
-
   public Measure getCurrent() {
     return current;
   }
 
-  public void setCurrent(Measure current) {
-    this.current = current;
-  }
-
   @Override
   public String toString() {
     StringBuilder builder = new StringBuilder();

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/LayoutContext.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/LayoutContext.java?rev=921720&r1=921719&r2=921720&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/LayoutContext.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/LayoutContext.java Thu Mar 11 08:31:12 2010
@@ -29,7 +29,7 @@ import javax.faces.component.UIComponent
 import javax.faces.context.FacesContext;
 
 /*
-An algorithm for layouting ...
+An algorithm for laying out ...
 
 - get UIPage
   - call compute-sizes
@@ -47,6 +47,10 @@ An algorithm for layouting ...
   - call set-positions
       - compute and set positions of columns/rows
       - call set-positions for all elements (recursively)
+
+todo: describe what happens, when there is a rendered=false (if all in one bank than collapse)
+todo: describe what happens, when there are too less components (there a free space)
+todo: describe what happens, when there are too much components (there a rows with * added)
  */
 public class LayoutContext {
 

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/LayoutUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/LayoutUtils.java?rev=921720&r1=921719&r2=921720&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/LayoutUtils.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/LayoutUtils.java Thu Mar 11 08:31:12 2010
@@ -39,8 +39,7 @@ public final class LayoutUtils {
 
   private static final Log LOG = LogFactory.getLog(LayoutUtils.class);
 
-  private static final Pattern TOKEN_PATTERN
-      = Pattern.compile("^(\\d*px|\\d*\\*|\\d*%|fixed)$");
+  private static final Pattern TOKEN_PATTERN = Pattern.compile("^(\\d*px|\\d*\\*|\\d*%|fixed)$");
 
   private LayoutUtils() {
     // to prevent instantiation
@@ -94,7 +93,11 @@ public final class LayoutUtils {
     } */
 //  also Forms are transparent for layouting
 
-    return component instanceof Form;
+    if (component instanceof Form) {
+      return true;
+    }
+    
+    return false;
   }
 
   public static boolean checkTokens(String columns) {
@@ -119,6 +122,8 @@ public final class LayoutUtils {
       if (child instanceof LayoutComponent) {
         result.add((LayoutComponent) child);
       } else {
+        // Child seems to be transparent for layout, like UIForm. 
+        // So we try to add the inner components.
         addLayoutChildren(child, result);
       }
     }

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponent.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponent.java?rev=921720&r1=921719&r2=921720&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponent.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponent.java Thu Mar 11 08:31:12 2010
@@ -36,4 +36,6 @@ public interface LayoutComponent extends
 
   Display getDisplay();
   void setDisplay(Display display);
+
+  boolean isRendered();
 }

Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridUnitTest.java?rev=921720&r1=921719&r2=921720&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridUnitTest.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridUnitTest.java Thu Mar 11 08:31:12 2010
@@ -20,6 +20,7 @@ package org.apache.myfaces.tobago.layout
 import org.apache.myfaces.tobago.internal.layout.Grid;
 import org.apache.myfaces.tobago.internal.layout.OriginCell;
 import org.apache.myfaces.tobago.layout.LayoutTokens;
+import org.apache.myfaces.tobago.layout.Orientation;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -29,24 +30,24 @@ public class GridUnitTest {
   public void test1x1() {
 
     Grid grid = new Grid(LayoutTokens.parse("*"), LayoutTokens.parse("*"));
-    Assert.assertEquals(1, grid.getColumns().getSize());
-    Assert.assertEquals(1, grid.getRows().getSize());
+    Assert.assertEquals(1, grid.getBankHeads(Orientation.HORIZONTAL).length);
+    Assert.assertEquals(1, grid.getBankHeads(Orientation.VERTICAL).length);
     Assert.assertEquals(""
         + "┌─┐\n"
         + "│◌│\n"
         + "└─┘\n", grid.gridAsString());
 
     grid.add(new OriginCell(null), 1, 1);
-    Assert.assertEquals(1, grid.getColumns().getSize());
-    Assert.assertEquals(1, grid.getRows().getSize());
+    Assert.assertEquals(1, grid.getBankHeads(Orientation.HORIZONTAL).length);
+    Assert.assertEquals(1, grid.getBankHeads(Orientation.VERTICAL).length);
     Assert.assertEquals(""
         + "┏━┓\n"
         + "┃█┃\n"
         + "┗━┛\n", grid.gridAsString());
 
     grid.add(new OriginCell(null), 1, 1);
-    Assert.assertEquals(1, grid.getColumns().getSize());
-    Assert.assertEquals(2, grid.getRows().getSize());
+    Assert.assertEquals(1, grid.getBankHeads(Orientation.HORIZONTAL).length);
+    Assert.assertEquals(2, grid.getBankHeads(Orientation.VERTICAL).length);
     Assert.assertEquals(""
         + "┏━┓\n"
         + "┃█┃\n"
@@ -55,8 +56,8 @@ public class GridUnitTest {
         + "┗━┛\n", grid.gridAsString());
 
     grid.add(new OriginCell(null), 1, 2);
-    Assert.assertEquals(1, grid.getColumns().getSize());
-    Assert.assertEquals(4, grid.getRows().getSize());
+    Assert.assertEquals(1, grid.getBankHeads(Orientation.HORIZONTAL).length);
+    Assert.assertEquals(4, grid.getBankHeads(Orientation.VERTICAL).length);
     Assert.assertEquals(""
         + "┏━┓\n"
         + "┃█┃\n"
@@ -70,8 +71,8 @@ public class GridUnitTest {
 
     // with warning
     grid.add(new OriginCell(null), 2, 1);
-    Assert.assertEquals(1, grid.getColumns().getSize());
-    Assert.assertEquals(5, grid.getRows().getSize());
+    Assert.assertEquals(1, grid.getBankHeads(Orientation.HORIZONTAL).length);
+    Assert.assertEquals(5, grid.getBankHeads(Orientation.VERTICAL).length);
     Assert.assertEquals(""
         + "┏━┓\n"
         + "┃█┃\n"
@@ -90,32 +91,32 @@ public class GridUnitTest {
   public void test2x1() {
 
     Grid grid = new Grid(LayoutTokens.parse("*;*"), LayoutTokens.parse("*"));
-    Assert.assertEquals(2, grid.getColumns().getSize());
-    Assert.assertEquals(1, grid.getRows().getSize());
+    Assert.assertEquals(2, grid.getBankHeads(Orientation.HORIZONTAL).length);
+    Assert.assertEquals(1, grid.getBankHeads(Orientation.VERTICAL).length);
     Assert.assertEquals(""
         + "┌─┬─┐\n"
         + "│◌│◌│\n"
         + "└─┴─┘\n", grid.gridAsString());
 
     grid.add(new OriginCell(null), 1, 1);
-    Assert.assertEquals(2, grid.getColumns().getSize());
-    Assert.assertEquals(1, grid.getRows().getSize());
+    Assert.assertEquals(2, grid.getBankHeads(Orientation.HORIZONTAL).length);
+    Assert.assertEquals(1, grid.getBankHeads(Orientation.VERTICAL).length);
     Assert.assertEquals(""
         + "┏━┱─┐\n"
         + "┃█┃◌│\n"
         + "┗━┹─┘\n", grid.gridAsString());
 
     grid.add(new OriginCell(null), 1, 1);
-    Assert.assertEquals(2, grid.getColumns().getSize());
-    Assert.assertEquals(1, grid.getRows().getSize());
+    Assert.assertEquals(2, grid.getBankHeads(Orientation.HORIZONTAL).length);
+    Assert.assertEquals(1, grid.getBankHeads(Orientation.VERTICAL).length);
     Assert.assertEquals(""
         + "┏━┳━┓\n"
         + "┃█┃█┃\n"
         + "┗━┻━┛\n", grid.gridAsString());
 
     grid.add(new OriginCell(null), 2, 2);
-    Assert.assertEquals(2, grid.getColumns().getSize());
-    Assert.assertEquals(3, grid.getRows().getSize());
+    Assert.assertEquals(2, grid.getBankHeads(Orientation.HORIZONTAL).length);
+    Assert.assertEquals(3, grid.getBankHeads(Orientation.VERTICAL).length);
     Assert.assertEquals(""
         + "┏━┳━┓\n"
         + "┃█┃█┃\n"
@@ -126,8 +127,8 @@ public class GridUnitTest {
         + "┗━┷━┛\n", grid.gridAsString());
 
     grid.add(new OriginCell(null), 1, 2);
-    Assert.assertEquals(2, grid.getColumns().getSize());
-    Assert.assertEquals(5, grid.getRows().getSize());
+    Assert.assertEquals(2, grid.getBankHeads(Orientation.HORIZONTAL).length);
+    Assert.assertEquals(5, grid.getBankHeads(Orientation.VERTICAL).length);
     Assert.assertEquals(""
         + "┏━┳━┓\n"
         + "┃█┃█┃\n"
@@ -142,8 +143,8 @@ public class GridUnitTest {
         + "┗━┹─┘\n", grid.gridAsString());
 
     grid.add(new OriginCell(null), 1, 1);
-    Assert.assertEquals(2, grid.getColumns().getSize());
-    Assert.assertEquals(5, grid.getRows().getSize());
+    Assert.assertEquals(2, grid.getBankHeads(Orientation.HORIZONTAL).length);
+    Assert.assertEquals(5, grid.getBankHeads(Orientation.VERTICAL).length);
     Assert.assertEquals(""
         + "┏━┳━┓\n"
         + "┃█┃█┃\n"
@@ -158,8 +159,8 @@ public class GridUnitTest {
         + "┗━┹─┘\n", grid.gridAsString());
 
     grid.add(new OriginCell(null), 1, 2);
-    Assert.assertEquals(2, grid.getColumns().getSize());
-    Assert.assertEquals(6, grid.getRows().getSize());
+    Assert.assertEquals(2, grid.getBankHeads(Orientation.HORIZONTAL).length);
+    Assert.assertEquals(6, grid.getBankHeads(Orientation.VERTICAL).length);
     Assert.assertEquals(""
         + "┏━┳━┓\n"
         + "┃█┃█┃\n"
@@ -177,16 +178,16 @@ public class GridUnitTest {
 
     grid.add(new OriginCell(null), 2, 1);
     // fehler
-    Assert.assertEquals(2, grid.getColumns().getSize());
-    Assert.assertEquals(6, grid.getRows().getSize());
+    Assert.assertEquals(2, grid.getBankHeads(Orientation.HORIZONTAL).length);
+    Assert.assertEquals(6, grid.getBankHeads(Orientation.VERTICAL).length);
   }
 
   @Test
   public void test5x5() {
 
     Grid grid = new Grid(LayoutTokens.parse("*;*;*;*;*"), LayoutTokens.parse("*;*;*;*;*"));
-    Assert.assertEquals(5, grid.getColumns().getSize());
-    Assert.assertEquals(5, grid.getRows().getSize());
+    Assert.assertEquals(5, grid.getBankHeads(Orientation.HORIZONTAL).length);
+    Assert.assertEquals(5, grid.getBankHeads(Orientation.VERTICAL).length);
     Assert.assertEquals(""
         + "┌─┬─┬─┬─┬─┐\n"
         + "│◌│◌│◌│◌│◌│\n"
@@ -213,8 +214,8 @@ public class GridUnitTest {
     grid.add(new OriginCell(null), 1, 2);
     grid.add(new OriginCell(null), 2, 1);
     grid.add(new OriginCell(null), 1, 1);
-    Assert.assertEquals(5, grid.getColumns().getSize());
-    Assert.assertEquals(5, grid.getRows().getSize());
+    Assert.assertEquals(5, grid.getBankHeads(Orientation.HORIZONTAL).length);
+    Assert.assertEquals(5, grid.getBankHeads(Orientation.VERTICAL).length);
     Assert.assertEquals(""
         + "┏━┳━┳━┳━┯━┓\n"
         + "┃█┃█┃█┃█│➞┃\n"

Modified: myfaces/tobago/trunk/example/test/src/main/webapp/navigation.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/navigation.xhtml?rev=921720&r1=921719&r2=921720&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/navigation.xhtml (original)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/navigation.xhtml Thu Mar 11 08:31:12 2010
@@ -11,7 +11,7 @@
     <f:facet name="layout">
       <tc:gridLayout columns="300px;*"/>
     </f:facet>
-    <tc:gridLayoutConstraint width="1000px" height="700px"/>
+    <tc:gridLayoutConstraint width="1300px" height="1000px"/>
 
     <tc:panel>
       <f:facet name="layout">

Copied: myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/nested-v.xhtml (from r917992, myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/nested.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/nested-v.xhtml?p2=myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/nested-v.xhtml&p1=myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/nested.xhtml&r1=917992&r2=921720&rev=921720&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/nested.xhtml (original)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/nested-v.xhtml Thu Mar 11 08:31:12 2010
@@ -8,59 +8,26 @@
     xmlns:f="http://java.sun.com/jsf/core">
 
   <tc:page id="page">
-    <f:facet name="layout">
-      <tc:gridLayout columns="100px;205px;*;2*" rows="*;*;*;2*"/>
-    </f:facet>
-    <tc:gridLayoutConstraint width="650px" height="515px"/>
-
-    <tc:image id="x_5" value="pidgeon-point.jpg">
-      <tc:gridLayoutConstraint rowSpan="3"/>
-    </tc:image>
-
-    <tc:image id="x_6" value="pidgeon-point.jpg"/>
-
-    <tc:image id="x_13" value="pidgeon-point.jpg">
-      <tc:gridLayoutConstraint rowSpan="2"/>
-    </tc:image>
+    <tc:gridLayoutConstraint width="500px" height="500px"/>
 
-    <tc:panel id="x_14">
-      <tc:gridLayoutConstraint rowSpan="2"/>
       <f:facet name="layout">
-        <tc:gridLayout columns="130px;*"/>
+        <tc:gridLayout id="page-grid" rows="*;auto"/>
       </f:facet>
-      <tc:image id="x_14_a" value="pidgeon-point.jpg"/>
-      <tc:image id="x_14_b" value="pidgeon-point.jpg"/>
-    </tc:panel>
 
-    <tc:panel id="x_7">
-      <f:facet name="layout">
-        <tc:gridLayout columns="*;2*"/>
-      </f:facet>
-      <tc:image id="x_7_a" value="pidgeon-point.jpg"/>
-      <tc:image id="x_7_b" value="pidgeon-point.jpg"/>
-    </tc:panel>
+      <tc:textarea id="textarea"/>
 
-    <tc:panel id="x_10">
-      <f:facet name="layout">
-        <tc:gridLayout columns="4*;*"/>
-      </f:facet>
-      <tc:image id="x_10_a" value="pidgeon-point.jpg"/>
-      <tc:image id="x_10_b" value="pidgeon-point.jpg"/>
-    </tc:panel>
-
-    <tc:image id="x_17" value="pidgeon-point.jpg">
-      <tc:gridLayoutConstraint columnSpan="2"/>
-    </tc:image>
+      <tc:panel id="panel">
+        <f:facet name="layout">
+          <tc:gridLayout id="panel-grid" columns="*;100px"/>
+        </f:facet>
+        <tc:cell id="cell"/>
+        <tc:button id="button" label="Submit"/>
+      </tc:panel>
 
     <tc:script file="script/test-utils.js"/>
 
-    <tc:script onload="checkLayout('page:x_5', 0, 0, 100, 310);"/>
-    <tc:script onload="checkLayout('page:x_6', 105, 0, 205, 100);"/>
-    <tc:script onload="checkLayout('page:x_13', 315, 0, 110, 205);"/>
-    <tc:script onload="checkLayout('page:x_14', 430, 0, 220, 205);"/>
-    <tc:script onload="checkLayout('page:x_14_a', 430, 0, 130, 205);"/>
-    <tc:script onload="checkLayout('page:x_14_b', 565, 0, 85, 205);"/>
-    <!--todo: test the other controls ...-->
+    <tc:script onload="checkLayout('page:textarea', 0, 0, 500, 475);"/>
+    <tc:script onload="checkLayout('page:button', 400, 480, 100, 20);"/>
 
   </tc:page>
 </f:view>

Modified: myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/nested.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/nested.xhtml?rev=921720&r1=921719&r2=921720&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/nested.xhtml (original)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/nested.xhtml Thu Mar 11 08:31:12 2010
@@ -9,9 +9,9 @@
 
   <tc:page id="page">
     <f:facet name="layout">
-      <tc:gridLayout columns="100px;205px;*;2*" rows="*;*;*;2*"/>
+      <tc:gridLayout columns="100px;205px;*;2*" rows="*;*;*"/>
     </f:facet>
-    <tc:gridLayoutConstraint width="650px" height="515px"/>
+    <tc:gridLayoutConstraint width="650px" height="310px"/>
 
     <tc:image id="x_5" value="pidgeon-point.jpg">
       <tc:gridLayoutConstraint rowSpan="3"/>

Added: myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-empty.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-empty.xhtml?rev=921720&view=auto
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-empty.xhtml (added)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-empty.xhtml Thu Mar 11 08:31:12 2010
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<f:view
+    xmlns:jsp="http://java.sun.com/JSP/Page"
+    xmlns:tc="http://myfaces.apache.org/tobago/component"
+    xmlns:tx="http://myfaces.apache.org/tobago/extension"
+    xmlns:ui="http://java.sun.com/jsf/facelets"
+    xmlns:f="http://java.sun.com/jsf/core">
+
+  <tc:page id="page">
+    <tc:gridLayoutConstraint width="100px" height="205px"/>
+    <f:facet name="layout">
+      <tc:gridLayout columns="*" rows="*;*" />
+    </f:facet>
+
+  </tc:page>
+</f:view>

Propchange: myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-empty.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-horizontal-6.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-horizontal-6.xhtml?rev=921720&view=auto
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-horizontal-6.xhtml (added)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-horizontal-6.xhtml Thu Mar 11 08:31:12 2010
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<f:view
+    xmlns:jsp="http://java.sun.com/JSP/Page"
+    xmlns:tc="http://myfaces.apache.org/tobago/component"
+    xmlns:tx="http://myfaces.apache.org/tobago/extension"
+    xmlns:ui="http://java.sun.com/jsf/facelets"
+    xmlns:f="http://java.sun.com/jsf/core">
+
+  <tc:page id="page">
+    <tc:gridLayoutConstraint width="625px" height="100px"/>
+    <f:facet name="layout">
+      <tc:gridLayout columns="*;*;*;*;*;*" rows="*" />
+    </f:facet>
+
+    <tc:image id="i-0" value="pidgeon-point.jpg"/>
+    <tc:image id="i-1" value="pidgeon-point.jpg"/>
+    <tc:image id="i-2" value="pidgeon-point.jpg"/>
+
+    <tc:script file="script/test-utils.js"/>
+    <tc:script onload="checkLayout('page:i-0', 0, 0, 100, 100);"/>
+    <tc:script onload="checkLayout('page:i-1', 105, 0, 100, 100);"/>
+    <tc:script onload="checkLayout('page:i-2', 210, 0, 100, 100);"/>
+    
+  </tc:page>
+</f:view>

Propchange: myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-horizontal-6.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-horizontal.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-horizontal.xhtml?rev=921720&view=auto
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-horizontal.xhtml (added)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-horizontal.xhtml Thu Mar 11 08:31:12 2010
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<f:view
+    xmlns:jsp="http://java.sun.com/JSP/Page"
+    xmlns:tc="http://myfaces.apache.org/tobago/component"
+    xmlns:tx="http://myfaces.apache.org/tobago/extension"
+    xmlns:ui="http://java.sun.com/jsf/facelets"
+    xmlns:f="http://java.sun.com/jsf/core">
+
+  <tc:page id="page">
+    <tc:gridLayoutConstraint width="205px" height="100px"/>
+    <f:facet name="layout">
+      <tc:gridLayout columns="*;*" rows="*" />
+    </f:facet>
+
+    <tc:image id="i-0" value="pidgeon-point.jpg"/>
+
+    <tc:script file="script/test-utils.js"/>
+    <tc:script onload="checkLayout('page:i-0', 0, 0, 100, 100);"/>
+    
+  </tc:page>
+</f:view>

Propchange: myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-horizontal.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-vertical-6.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-vertical-6.xhtml?rev=921720&view=auto
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-vertical-6.xhtml (added)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-vertical-6.xhtml Thu Mar 11 08:31:12 2010
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<f:view
+    xmlns:jsp="http://java.sun.com/JSP/Page"
+    xmlns:tc="http://myfaces.apache.org/tobago/component"
+    xmlns:tx="http://myfaces.apache.org/tobago/extension"
+    xmlns:ui="http://java.sun.com/jsf/facelets"
+    xmlns:f="http://java.sun.com/jsf/core">
+
+  <tc:page id="page">
+    <tc:gridLayoutConstraint width="100px" height="625px"/>
+    <f:facet name="layout">
+      <tc:gridLayout columns="*" rows="*;*;*;*;*;*" />
+    </f:facet>
+
+    <tc:image id="i-0" value="pidgeon-point.jpg"/>
+    <tc:image id="i-1" value="pidgeon-point.jpg"/>
+    <tc:image id="i-2" value="pidgeon-point.jpg"/>
+
+    <tc:script file="script/test-utils.js"/>
+    <tc:script onload="checkLayout('page:i-0', 0, 0, 100, 100);"/>
+    <tc:script onload="checkLayout('page:i-1', 0, 105, 100, 100);"/>
+    <tc:script onload="checkLayout('page:i-2', 0, 210, 100, 100);"/>
+    
+  </tc:page>
+</f:view>

Propchange: myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-vertical-6.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-vertical.xhtml (from r917992, myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/position-2x2.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-vertical.xhtml?p2=myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-vertical.xhtml&p1=myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/position-2x2.xhtml&r1=917992&r2=921720&rev=921720&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/position-2x2.xhtml (original)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-less-components-vertical.xhtml Thu Mar 11 08:31:12 2010
@@ -8,21 +8,15 @@
     xmlns:f="http://java.sun.com/jsf/core">
 
   <tc:page id="page">
-    <tc:gridLayoutConstraint width="600px" height="600px"/>
+    <tc:gridLayoutConstraint width="100px" height="205px"/>
     <f:facet name="layout">
-      <tc:gridLayout rows="2*;*" columns="2*;*" columnSpacing="0px" rowSpacing="0px"/>
+      <tc:gridLayout columns="*" rows="*;*" />
     </f:facet>
 
     <tc:image id="i-0" value="pidgeon-point.jpg"/>
-    <tc:image id="i-1" value="pidgeon-point.jpg"/>
-    <tc:image id="i-2" value="pidgeon-point.jpg"/>
-    <tc:image id="i-3" value="pidgeon-point.jpg"/>
 
     <tc:script file="script/test-utils.js"/>
-    <tc:script onload="checkLayout('page:i-0', 0, 0, 400, 400);"/>
-    <tc:script onload="checkLayout('page:i-1', 400, 0, 200, 400);"/>
-    <tc:script onload="checkLayout('page:i-2', 0, 400, 400, 200);"/>
-    <tc:script onload="checkLayout('page:i-3', 400, 400, 200, 200);"/>
+    <tc:script onload="checkLayout('page:i-0', 0, 0, 100, 100);"/>
     
   </tc:page>
 </f:view>

Added: myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-much-components.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-much-components.xhtml?rev=921720&view=auto
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-much-components.xhtml (added)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-much-components.xhtml Thu Mar 11 08:31:12 2010
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<f:view
+    xmlns:jsp="http://java.sun.com/JSP/Page"
+    xmlns:tc="http://myfaces.apache.org/tobago/component"
+    xmlns:tx="http://myfaces.apache.org/tobago/extension"
+    xmlns:ui="http://java.sun.com/jsf/facelets"
+    xmlns:f="http://java.sun.com/jsf/core">
+
+  <tc:page id="page">
+    <tc:gridLayoutConstraint width="205px" height="100px"/>
+    <f:facet name="layout">
+      <tc:gridLayout columns="*;*" rows="*" />
+    </f:facet>
+
+    <tc:image id="i-0" value="pidgeon-point.jpg"/>
+    <tc:image id="i-1" value="pidgeon-point.jpg"/>
+    <tc:image id="i-2" value="pidgeon-point.jpg"/>
+    <tc:image id="i-3" value="pidgeon-point.jpg"/>
+
+    <tc:script file="script/test-utils.js"/>
+    <tc:script onload="checkLayout('page:i-0', 0, 0, 100, 100);"/>
+    
+  </tc:page>
+</f:view>

Propchange: myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/too-much-components.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native