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 2009/11/11 12:39:09 UTC
svn commit: r834843 - 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/main/java/org/apache/myf...
Author: lofwyr
Date: Wed Nov 11 11:39:07 2009
New Revision: 834843
URL: http://svn.apache.org/viewvc?rev=834843&view=rev
Log:
TOBAGO-606: Layout Manager - cleanup
- move mathematical aproach to separate math project, it is not in uses in the moment.
Added:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/MathUtils.java
- copied, changed from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/MathUtils.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext.java
- copied, changed from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext2.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/internal/
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/internal/layout/
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/internal/layout/MathUtilsUnitTest.java
- copied, changed from r834383, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/MathUtilsUnitTest.java
myfaces/tobago/trunk/extension/math/
myfaces/tobago/trunk/extension/math/pom.xml (contents, props changed)
- copied, changed from r834383, myfaces/tobago/trunk/extension/deprecation/pom.xml
myfaces/tobago/trunk/extension/math/src/
myfaces/tobago/trunk/extension/math/src/main/
myfaces/tobago/trunk/extension/math/src/main/java/
myfaces/tobago/trunk/extension/math/src/main/java/org/
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/AbstractUIEquationGridLayout.java (contents, props changed)
- copied, changed from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/UIEquationGridLayout.java
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/EquationLayoutContext.java
- copied, changed from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext.java
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/EquationLayoutManager.java
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/math/
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/math/AbstractEquation.java
- copied unchanged from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/AbstractEquation.java
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/math/CombinationEquation.java
- copied unchanged from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/CombinationEquation.java
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/math/Equation.java
- copied unchanged from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/Equation.java
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/math/EquationComparator.java
- copied unchanged from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/EquationComparator.java
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/math/EquationManager.java
- copied unchanged from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/EquationManager.java
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java
- copied unchanged from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/math/PartitionEquation.java
- copied unchanged from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/PartitionEquation.java
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/math/ProportionEquation.java
- copied unchanged from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ProportionEquation.java
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/math/ReferenceToVariable.java
- copied unchanged from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ReferenceToVariable.java
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/math/RemainderEquation.java
- copied unchanged from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/RemainderEquation.java
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/math/SubsetOfReferencesToVariables.java
- copied unchanged from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SubsetOfReferencesToVariables.java
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/math/SystemOfEquations.java
- copied, changed from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SystemOfEquations.java
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/math/ZeroEquation.java
- copied unchanged from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ZeroEquation.java
myfaces/tobago/trunk/extension/math/src/test/
myfaces/tobago/trunk/extension/math/src/test/java/
myfaces/tobago/trunk/extension/math/src/test/java/org/
myfaces/tobago/trunk/extension/math/src/test/java/org/apache/
myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/
myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/
myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/component/
myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java (contents, props changed)
- copied, changed from r834383, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java
myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/
myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java (contents, props changed)
- copied, changed from r834383, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java
myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/MockContainer.java (contents, props changed)
- copied, changed from r834383, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MockContainer.java
myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/math/
myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/math/CombinationEquationUnitTest.java
- copied, changed from r834383, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/CombinationEquationUnitTest.java
myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/math/EquationManagerUnitTest.java
- copied unchanged from r834383, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/EquationManagerUnitTest.java
myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/math/PartitionEquationUnitTest.java
- copied, changed from r834383, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/PartitionEquationUnitTest.java
myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/math/SystemOfEquationsUnitTest.java
- copied unchanged from r834383, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/SystemOfEquationsUnitTest.java
Removed:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext2.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MockContainer.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/CombinationEquationUnitTest.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/EquationManagerUnitTest.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/MathUtilsUnitTest.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/PartitionEquationUnitTest.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/SystemOfEquationsUnitTest.java
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/component/AbstractUISheetLayout.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroupLayout.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/FactorList.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutManager.java
myfaces/tobago/trunk/extension/pom.xml
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
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=834843&r1=834842&r2=834843&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 Wed Nov 11 11:39:07 2009
@@ -26,7 +26,6 @@
import org.apache.myfaces.tobago.layout.IntervalList;
import org.apache.myfaces.tobago.layout.LayoutComponent;
import org.apache.myfaces.tobago.layout.LayoutContainer;
-import org.apache.myfaces.tobago.layout.LayoutContext;
import org.apache.myfaces.tobago.layout.LayoutManager;
import org.apache.myfaces.tobago.layout.LayoutToken;
import org.apache.myfaces.tobago.layout.LayoutTokens;
@@ -38,7 +37,6 @@
import org.apache.myfaces.tobago.layout.grid.Cell;
import org.apache.myfaces.tobago.layout.grid.Grid;
import org.apache.myfaces.tobago.layout.grid.OriginCell;
-import org.apache.myfaces.tobago.layout.math.EquationManager;
import java.util.Arrays;
import java.util.List;
@@ -219,7 +217,7 @@
}
LayoutUtils.setSize(orientation, component, size);
} else {
- LOG.warn("Size is null, should be debugged... i=" + i + " grid="+grid, new RuntimeException());
+ LOG.warn("Size is null, should be debugged... i=" + i + " grid=" + grid, new RuntimeException());
}
// call sub layout manager
@@ -248,7 +246,7 @@
Measure position = LayoutUtils.getBeginOffset(orientation, getLayoutContainer());
for (int k = 0; k < i; k++) {
if (pixelMeasures[k] == null) {
- LOG.warn("Measure is null, should be debugged... i=" + i + " k=" + k + " grid="+grid, new RuntimeException());
+ LOG.warn("Measure is null, should be debugged... i=" + i + " k=" + k + " grid=" + grid, new RuntimeException());
} else {
position = position.add(pixelMeasures[k]);
}
@@ -271,215 +269,6 @@
}
}
- // /////////////////////////////////////////////////////////////////////////////////////////
- // layout mechanism with equations
- // /////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Phase 1: Collects the layout information from the components recursively.
- */
- public void collect(LayoutContext layoutContext, LayoutContainer container, int horizontalIndex, int verticalIndex) {
-
- init();
-
- // horizontal
- EquationManager horizontal = layoutContext.getHorizontal();
- int[] horizontalIndices = horizontal.partition(
- horizontalIndex, grid.getColumns().getSize(), getColumnSpacing(),
- container.getLeftOffset(), container.getRightOffset(), grid.getColumns(), container);
- grid.setHorizontalIndices(horizontalIndices);
-
- // vertical
- EquationManager vertical = layoutContext.getVertical();
- int[] verticalIndices = vertical.partition(
- verticalIndex, grid.getRows().getSize(), getRowSpacing(),
- container.getTopOffset(), container.getBottomOffset(), grid.getRows(), container);
- grid.setVerticalIndices(verticalIndices);
-
- addPixelConstraints(layoutContext, horizontalIndex + 1, verticalIndex + 1);
- addRelativeConstraints(layoutContext, horizontalIndex + 1, verticalIndex + 1);
-
- for (int j = 0; j < grid.getRows().getSize(); j++) {
- for (int i = 0; i < grid.getColumns().getSize(); i++) {
- Cell temp = grid.getCell(i, j);
- if (temp instanceof OriginCell) {
- OriginCell cell = (OriginCell) temp;
- LayoutComponent component = temp.getComponent();
-
- // horizontal
- int hIndex = horizontal.combine(
- horizontalIndices[i], cell.getColumnSpan(), getColumnSpacing(), grid.getColumns().get(i), component);
- cell.getComponent().setHorizontalIndex(hIndex);
-
- // vertical
- int vIndex = vertical.combine(
- verticalIndices[j], cell.getRowSpan(), getRowSpacing(), grid.getRows().get(j), component);
- cell.getComponent().setVerticalIndex(vIndex);
-
- if (component instanceof LayoutContainer) {
- LayoutContainer subContainer = (LayoutContainer) component;
- LayoutManager layoutManager = subContainer.getLayoutManager();
- layoutManager.collect(layoutContext, subContainer, hIndex, vIndex);
- } else {
- // XXX is this a good idea?
-
- Measure preferredWidth = component.getPreferredWidth();
- if (preferredWidth != null) {
- horizontal.setFixedLength(hIndex, preferredWidth, component);
- }
- Measure preferredHeight = component.getPreferredHeight();
- if (preferredHeight != null) {
- vertical.setFixedLength(vIndex, preferredHeight, component);
- }
- }
- }
- }
- }
- }
-
- /**
- * Phase 2: Distribute the computed values into the components recursively.
- */
- public void distribute(LayoutContext layoutContext, LayoutContainer container) {
-
- distributeSizes(layoutContext);
- distributePositions(layoutContext, container);
- }
-
- private void distributeSizes(LayoutContext layoutContext) {
-
- for (int j = 0; j < grid.getRows().getSize(); j++) {
- for (int i = 0; i < grid.getColumns().getSize(); i++) {
- Cell temp = grid.getCell(i, j);
- if (temp instanceof OriginCell) {
- OriginCell cell = (OriginCell) temp;
- LayoutComponent component = temp.getComponent();
-
- component.setDisplay(Display.BLOCK);
-
- EquationManager horizontal = layoutContext.getHorizontal();
- EquationManager vertical = layoutContext.getVertical();
-
- int horizontalIndex = cell.getComponent().getHorizontalIndex();
- int verticalIndex = cell.getComponent().getVerticalIndex();
-
- Measure width = horizontal.getResult()[horizontalIndex];
- Measure height = vertical.getResult()[verticalIndex];
-
- component.setWidth(width);
- component.setHeight(height);
-
- if (component instanceof LayoutContainer) {
-
- LayoutContainer subContainer = (LayoutContainer) component;
- LayoutManager layoutManager = subContainer.getLayoutManager();
- if (layoutManager != null) {
- layoutManager.distribute(layoutContext, subContainer);
- }
- }
- }
- }
- }
- }
-
- private void distributePositions(LayoutContext layoutContext, LayoutContainer container) {
-
- // find the "left" positions
- for (int j = 0; j < grid.getRows().getSize(); j++) {
- Measure left = container.getLeftOffset();
- for (int i = 0; i < grid.getColumns().getSize(); i++) {
- Cell cell = grid.getCell(i, j);
- if (cell == null) {
- continue; // XXX why this can happen? Can it still happen?
- }
- LayoutComponent component = cell.getComponent();
- if (cell instanceof OriginCell) {
- component.setLeft(left);
- }
- EquationManager horizontal = layoutContext.getHorizontal();
- left = left.add(horizontal.getResult()[grid.getHorizontalIndices()[i]]);
- left = left.add(getColumnSpacing());
- }
- }
-
- // find the "top" positions
- for (int i = 0; i < grid.getColumns().getSize(); i++) {
- Measure top = container.getTopOffset();
- for (int j = 0; j < grid.getRows().getSize(); j++) {
- Cell cell = grid.getCell(i, j);
- if (cell == null) {
- continue; // XXX why this can happen? Can it still happen?
- }
- LayoutComponent component = cell.getComponent();
- if (cell instanceof OriginCell) {
- component.setTop(top);
- }
- EquationManager vertical = layoutContext.getVertical();
- top = top.add(vertical.getResult()[grid.getVerticalIndices()[j]]);
- top = top.add(getRowSpacing());
- }
- }
- }
-
- private void addPixelConstraints(LayoutContext layoutContext, int horizontalIndexOffset, int verticalIndexOffset) {
- // horizontal
- LayoutTokens columnTokens = grid.getColumns();
- for (int i = 0; i < columnTokens.getSize(); i++) {
- LayoutToken layoutToken = columnTokens.get(i);
- if (layoutToken instanceof PixelLayoutToken) {
- Measure pixel = new PixelMeasure(((PixelLayoutToken) layoutToken).getPixel());
- layoutContext.getHorizontal().setFixedLength(i + horizontalIndexOffset, pixel, this);
- }
- }
- // vertical
- LayoutTokens rowTokens = grid.getRows();
- for (int i = 0; i < rowTokens.getSize(); i++) {
- LayoutToken layoutToken = rowTokens.get(i);
- if (layoutToken instanceof PixelLayoutToken) {
- // XXX PixelLayoutToken might be removed/changed
- Measure pixel = new PixelMeasure(((PixelLayoutToken) layoutToken).getPixel());
- layoutContext.getVertical().setFixedLength(i + verticalIndexOffset, pixel, this);
- }
- }
- }
-
- private void addRelativeConstraints(LayoutContext layoutContext, int horizontalIndexOffset, int verticalIndexOffset) {
- // horizontal
- Integer first = null;
- Integer firstIndex = null;
- LayoutTokens columnTokens = grid.getColumns();
- for (int i = 0; i < columnTokens.getTokens().size(); i++) {
- LayoutToken token = columnTokens.getTokens().get(i);
- if (token instanceof RelativeLayoutToken) {
- int factor = ((RelativeLayoutToken) token).getFactor();
- if (first == null) {
- first = factor;
- firstIndex = i + horizontalIndexOffset;
- } else {
- layoutContext.getHorizontal().proportionate(
- firstIndex, i + horizontalIndexOffset, first, factor, getLayoutContainer());
- }
- }
- }
- // vertical
- first = null;
- firstIndex = null;
- LayoutTokens rowTokens = grid.getRows();
- for (int i = 0; i < rowTokens.getTokens().size(); i++) {
- LayoutToken token = rowTokens.getTokens().get(i);
- if (token instanceof RelativeLayoutToken) {
- int factor = ((RelativeLayoutToken) token).getFactor();
- if (first == null) {
- first = factor;
- firstIndex = i + verticalIndexOffset;
- } else {
- layoutContext.getVertical().proportionate(
- firstIndex, i + verticalIndexOffset, first, factor, getLayoutContainer());
- }
- }
- }
- }
-
private LayoutContainer getLayoutContainer() {
// todo: check with instanceof and do something in the error case
return ((LayoutContainer) getParent());
@@ -513,7 +302,7 @@
public String toString() {
return getClass().getSimpleName()
+ (grid != null
- ? "(" + Arrays.toString(grid.getWidths()) + ", " + Arrays.toString(grid.getHeights()) + ")"
+ ? "(" + Arrays.toString(grid.getWidths()) + ", " + Arrays.toString(grid.getHeights()) + ")"
: "");
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheetLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheetLayout.java?rev=834843&r1=834842&r2=834843&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheetLayout.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheetLayout.java Wed Nov 11 11:39:07 2009
@@ -24,7 +24,6 @@
import org.apache.myfaces.tobago.layout.IntervalList;
import org.apache.myfaces.tobago.layout.LayoutComponent;
import org.apache.myfaces.tobago.layout.LayoutContainer;
-import org.apache.myfaces.tobago.layout.LayoutContext;
import org.apache.myfaces.tobago.layout.LayoutManager;
import org.apache.myfaces.tobago.layout.LayoutUtils;
import org.apache.myfaces.tobago.layout.Measure;
@@ -136,12 +135,6 @@
}
}
- public void collect(LayoutContext layoutContext, LayoutContainer container, int horizontalIndex, int verticalIndex) {
- }
-
- public void distribute(LayoutContext layoutContext, LayoutContainer container) {
- }
-
private LayoutContainer getLayoutContainer() {
// todo: check with instanceof and do something in the error case
return ((LayoutContainer) getParent());
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroupLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroupLayout.java?rev=834843&r1=834842&r2=834843&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroupLayout.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroupLayout.java Wed Nov 11 11:39:07 2009
@@ -24,7 +24,6 @@
import org.apache.myfaces.tobago.layout.IntervalList;
import org.apache.myfaces.tobago.layout.LayoutComponent;
import org.apache.myfaces.tobago.layout.LayoutContainer;
-import org.apache.myfaces.tobago.layout.LayoutContext;
import org.apache.myfaces.tobago.layout.LayoutManager;
import org.apache.myfaces.tobago.layout.LayoutUtils;
import org.apache.myfaces.tobago.layout.Measure;
@@ -136,12 +135,6 @@
}
}
- public void collect(LayoutContext layoutContext, LayoutContainer container, int horizontalIndex, int verticalIndex) {
- }
-
- public void distribute(LayoutContext layoutContext, LayoutContainer container) {
- }
-
private LayoutContainer getLayoutContainer() {
// todo: check with instanceof and do something in the error case
return ((LayoutContainer) getParent());
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/MathUtils.java (from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/MathUtils.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/MathUtils.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/MathUtils.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/MathUtils.java&r1=834383&r2=834843&rev=834843&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/MathUtils.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/layout/MathUtils.java Wed Nov 11 11:39:07 2009
@@ -1,4 +1,4 @@
-package org.apache.myfaces.tobago.layout.math;
+package org.apache.myfaces.tobago.internal.layout;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -47,7 +47,7 @@
assert isZero(bias);
}
- static double findAndAdjustMaxRemainder(double[] list) {
+ public static double findAndAdjustMaxRemainder(double[] list) {
double max = 0.0;
Integer indexOfMax = null;
for (int i = 0; i < list.length; i++) {
@@ -64,7 +64,7 @@
return 0.0;
}
- static double findAndAdjustMinRemainder(double[] list) {
+ public static double findAndAdjustMinRemainder(double[] list) {
double min = 1.0;
Integer indexOfMin = null;
for (int i = 0; i < list.length; i++) {
@@ -84,23 +84,23 @@
return 0.0;
}
- static double remainder(double v) {
+ public static double remainder(double v) {
return v - Math.floor(v);
}
- static boolean isZero(double factor) {
+ public static boolean isZero(double factor) {
return Math.abs(factor) < EPSILON;
}
- static boolean isNotZero(double factor) {
+ public static boolean isNotZero(double factor) {
return Math.abs(factor) >= EPSILON;
}
- static boolean isInteger(double value) {
+ public static boolean isInteger(double value) {
return isZero(value - Math.round(value));
}
- static boolean isNotInteger(double value) {
+ public static boolean isNotInteger(double value) {
return isNotZero(value - Math.round(value));
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/FactorList.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/FactorList.java?rev=834843&r1=834842&r2=834843&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/FactorList.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/FactorList.java Wed Nov 11 11:39:07 2009
@@ -19,7 +19,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.layout.math.MathUtils;
+import org.apache.myfaces.tobago.internal.layout.MathUtils;
import java.util.ArrayList;
import java.util.List;
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext.java (from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext2.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext2.java&r1=834383&r2=834843&rev=834843&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext2.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext.java Wed Nov 11 11:39:07 2009
@@ -24,7 +24,7 @@
import javax.faces.component.UIComponent;
/*
-An alternative algorithm to the SystemOfEquations ...
+An algorithm for layouting ...
- get UIPage
- call compute-sizes
@@ -43,13 +43,13 @@
- compute and set positions of columns/rows
- call set-positions for all elements (recursively)
*/
-public class LayoutContext2 {
+public class LayoutContext {
- private static final Log LOG = LogFactory.getLog(LayoutContext2.class);
+ private static final Log LOG = LogFactory.getLog(LayoutContext.class);
private LayoutContainer container;
- public LayoutContext2(LayoutContainer container) {
+ public LayoutContext(LayoutContainer container) {
this.container = container;
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutManager.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutManager.java?rev=834843&r1=834842&r2=834843&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutManager.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutManager.java Wed Nov 11 11:39:07 2009
@@ -19,10 +19,6 @@
public interface LayoutManager {
- void collect(LayoutContext layoutContext, LayoutContainer container, int horizontalIndex, int verticalIndex);
-
- void distribute(LayoutContext layoutContext, LayoutContainer container);
-
void init();
void fixRelativeInsideAuto(boolean orientation, boolean auto);
Copied: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/internal/layout/MathUtilsUnitTest.java (from r834383, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/MathUtilsUnitTest.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/internal/layout/MathUtilsUnitTest.java?p2=myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/internal/layout/MathUtilsUnitTest.java&p1=myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/MathUtilsUnitTest.java&r1=834383&r2=834843&rev=834843&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/MathUtilsUnitTest.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/internal/layout/MathUtilsUnitTest.java Wed Nov 11 11:39:07 2009
@@ -1,4 +1,4 @@
-package org.apache.myfaces.tobago.layout.math;
+package org.apache.myfaces.tobago.internal.layout;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
Copied: myfaces/tobago/trunk/extension/math/pom.xml (from r834383, myfaces/tobago/trunk/extension/deprecation/pom.xml)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/math/pom.xml?p2=myfaces/tobago/trunk/extension/math/pom.xml&p1=myfaces/tobago/trunk/extension/deprecation/pom.xml&r1=834383&r2=834843&rev=834843&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/deprecation/pom.xml (original)
+++ myfaces/tobago/trunk/extension/math/pom.xml Wed Nov 11 11:39:07 2009
@@ -23,12 +23,12 @@
<version>1.5.0-alpha-2-SNAPSHOT</version>
</parent>
<packaging>jar</packaging>
- <name>Tobago Deprecation</name>
- <artifactId>tobago-deprecation</artifactId>
+ <name>Tobago Mathematical Abroach for Layout Managing</name>
+ <artifactId>tobago-math</artifactId>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/tobago/trunk/extension/deprecation</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/tobago/trunk/extension/deprecation</developerConnection>
- <url>http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/deprecation</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/tobago/trunk/extension/math</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/tobago/trunk/extension/math</developerConnection>
+ <url>http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/math</url>
</scm>
<dependencies>
<dependency>
@@ -43,45 +43,5 @@
</exclusion>
</exclusions>
</dependency>
- <dependency>
- <groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago-theme-standard</artifactId>
- <version>${project.version}</version>
- </dependency>
</dependencies>
- <profiles>
- <profile>
- <id>jdk14retro</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>retrotranslator-maven-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>translate-project</goal>
- </goals>
- <configuration>
- <classifier>jdk14retro</classifier>
- <attach>true</attach>
- <verify>true</verify>
- <verifyClasspath>
- <element>${java14.home}/${java.classes.jar}</element>
- </verifyClasspath>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>net.sf.retrotranslator</groupId>
- <artifactId>retrotranslator-runtime</artifactId>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
-
</project>
Propchange: myfaces/tobago/trunk/extension/math/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/extension/math/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/tobago/trunk/extension/math/pom.xml
------------------------------------------------------------------------------
svn:mergeinfo =
Copied: myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/AbstractUIEquationGridLayout.java (from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/AbstractUIEquationGridLayout.java?p2=myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/AbstractUIEquationGridLayout.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java&r1=834383&r2=834843&rev=834843&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java (original)
+++ myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/AbstractUIEquationGridLayout.java Wed Nov 11 11:39:07 2009
@@ -19,18 +19,13 @@
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.Display;
-import org.apache.myfaces.tobago.layout.FactorList;
-import org.apache.myfaces.tobago.layout.Interval;
-import org.apache.myfaces.tobago.layout.IntervalList;
+import org.apache.myfaces.tobago.layout.EquationLayoutContext;
+import org.apache.myfaces.tobago.layout.EquationLayoutManager;
import org.apache.myfaces.tobago.layout.LayoutComponent;
import org.apache.myfaces.tobago.layout.LayoutContainer;
-import org.apache.myfaces.tobago.layout.LayoutContext;
-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.LayoutUtils;
import org.apache.myfaces.tobago.layout.Measure;
import org.apache.myfaces.tobago.layout.PixelLayoutToken;
import org.apache.myfaces.tobago.layout.PixelMeasure;
@@ -43,16 +38,12 @@
import java.util.Arrays;
import java.util.List;
-public abstract class AbstractUIGridLayout extends UILayout implements LayoutManager {
+public abstract class AbstractUIEquationGridLayout extends UILayout implements EquationLayoutManager {
- private static final Log LOG = LogFactory.getLog(AbstractUIGridLayout.class);
+ private static final Log LOG = LogFactory.getLog(AbstractUIEquationGridLayout.class);
private Grid grid;
- // /////////////////////////////////////////////////////////////////////////////////////////
- // new layout mechanism
- // /////////////////////////////////////////////////////////////////////////////////////////
-
public void init() {
grid = new Grid(LayoutTokens.parse(getColumns()), LayoutTokens.parse(getRows()));
@@ -67,218 +58,11 @@
}
}
}
-
- public void fixRelativeInsideAuto(boolean orientation, boolean auto) {
-
- LayoutTokens tokens = grid.getTokens(orientation);
-
- if (auto) {
- for (int i = 0; i < tokens.getSize(); i++) {
- if (tokens.get(i) instanceof RelativeLayoutToken) {
- LOG.warn("Fixing layout token from * to auto, because a * in not allowed inside of a auto.");
- tokens.set(i, AutoLayoutToken.INSTANCE);
- }
- }
- }
-
- for (int i = 0; i < tokens.getSize(); i++) {
- for (int j = 0; j < grid.getTokens(!orientation).getSize(); j++) {
- Cell cell = grid.getCell(i, j, orientation);
- 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;
- layoutManager.fixRelativeInsideAuto(orientation, childAuto);
- }
- }
- }
- }
- }
-
- public void preProcessing(boolean orientation) {
-
- // process auto tokens
- int i = 0;
- for (LayoutToken token : grid.getTokens(orientation)) {
-
- if (token instanceof PixelLayoutToken) {
- int pixel = ((PixelLayoutToken) token).getPixel();
- grid.getSizes(orientation)[i] = new PixelMeasure(pixel); // XXX refactor
- }
-
- IntervalList intervals = new IntervalList();
- for (int j = 0; j < grid.getTokens(!orientation).getSize(); j++) {
- Cell cell = grid.getCell(i, j, orientation);
- if (cell instanceof OriginCell) {
- OriginCell origin = (OriginCell) cell;
- LayoutComponent component = cell.getComponent();
-
- if (component instanceof LayoutContainer) {
- ((LayoutContainer) component).getLayoutManager().preProcessing(orientation);
- }
-
- if (token instanceof AutoLayoutToken) {
- if (origin.getSpan(orientation) == 1) {
- intervals.add(new Interval(component, orientation));
- } else {
- LOG.info("ignored"); // todo
- }
- }
- }
- }
- if (intervals.size() >= 1) {
- Measure auto = intervals.computeAuto();
- grid.getSizes(orientation)[i] = (PixelMeasure) auto;
- }
-// todo: what when we cannot find a good value for "auto"?
- i++;
- }
-
- // set the size if all sizes are set
- Measure size = PixelMeasure.ZERO;
- PixelMeasure[] sizes = grid.getSizes(orientation);
- for (int j = 0; j < sizes.length; j++) {
- if (sizes[j] == null) {
- size = null; // set to invalid
- break;
- }
- size = size.add(sizes[j]);
- if (j < sizes.length - 1) {
- size = size.add(getSpacing(orientation));
- }
- }
- if (size != null) {
- size = size.add(LayoutUtils.getBeginOffset(orientation, getLayoutContainer()));
- size = size.add(LayoutUtils.getEndOffset(orientation, getLayoutContainer()));
- LayoutUtils.setSize(orientation, getLayoutContainer(), size);
- }
- }
-
- public void mainProcessing(boolean orientation) {
-
- // find *
- FactorList list = new FactorList();
- for (LayoutToken token : grid.getTokens(orientation)) {
- if (token instanceof RelativeLayoutToken) {
- list.add(((RelativeLayoutToken) token).getFactor());
- }
- }
- if (!list.isEmpty()) {
- // find rest
- LayoutContainer container = getLayoutContainer();
- Measure available = LayoutUtils.getSize(orientation, container);
- if (available != null) {
- for (PixelMeasure value : grid.getSizes(orientation)) {
- available = available.subtractNotNegative(value);
- }
- PixelMeasure spacing = new PixelMeasure(
- getSpacing(orientation).getPixel() * (grid.getSizes(orientation).length - 1));
- available = available.subtractNotNegative(spacing);
-
- available = available.subtractNotNegative(LayoutUtils.getBeginOffset(orientation, container));
- available = available.subtractNotNegative(LayoutUtils.getEndOffset(orientation, container));
-
- List<Measure> partition = list.partition(available);
-
- // 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] = (PixelMeasure) partition.get(j);
- j++;
- }
- i++;
- }
- } else {
- LOG.warn("No width/height set but needed for *!"); // todo: more information
- }
- }
-
- // 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).getSize(); 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
-
- Integer span = ((OriginCell) cell).getSpan(orientation);
- PixelMeasure[] 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.setSize(orientation, component, size);
- } else {
- LOG.warn("Size is null, should be debugged... i=" + i + " grid="+grid, new RuntimeException());
- }
-
- // call sub layout manager
- if (component instanceof LayoutContainer) {
- ((LayoutContainer) component).getLayoutManager().mainProcessing(orientation);
- }
- }
- }
- }
- }
-
- public void postProcessing(boolean orientation) {
-
- // 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).getSize(); 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
-
- PixelMeasure[] pixelMeasures = grid.getSizes(orientation);
-
- // compute the position of the cell
- Measure position = LayoutUtils.getBeginOffset(orientation, getLayoutContainer());
- for (int k = 0; k < i; k++) {
- if (pixelMeasures[k] == null) {
- LOG.warn("Measure is null, should be debugged... i=" + i + " k=" + k + " grid="+grid, new RuntimeException());
- } else {
- position = position.add(pixelMeasures[k]);
- }
- position = position.add(getSpacing(orientation));
- }
- if (orientation) {
- component.setLeft(position);
- } else {
- component.setTop(position);
- }
-
- // call sub layout manager
- if (component instanceof LayoutContainer) {
- ((LayoutContainer) component).getLayoutManager().postProcessing(orientation);
- }
-
- // todo: optimize: the AutoLayoutTokens with columnSpan=1 are already called
- }
- }
- }
- }
-
- // /////////////////////////////////////////////////////////////////////////////////////////
- // layout mechanism with equations
- // /////////////////////////////////////////////////////////////////////////////////////////
-
+
/**
* Phase 1: Collects the layout information from the components recursively.
*/
- public void collect(LayoutContext layoutContext, LayoutContainer container, int horizontalIndex, int verticalIndex) {
+ public void collect(EquationLayoutContext layoutContext, LayoutContainer container, int horizontalIndex, int verticalIndex) {
init();
@@ -318,7 +102,7 @@
if (component instanceof LayoutContainer) {
LayoutContainer subContainer = (LayoutContainer) component;
- LayoutManager layoutManager = subContainer.getLayoutManager();
+ EquationLayoutManager layoutManager = (EquationLayoutManager) subContainer.getLayoutManager();
layoutManager.collect(layoutContext, subContainer, hIndex, vIndex);
} else {
// XXX is this a good idea?
@@ -340,13 +124,13 @@
/**
* Phase 2: Distribute the computed values into the components recursively.
*/
- public void distribute(LayoutContext layoutContext, LayoutContainer container) {
+ public void distribute(EquationLayoutContext layoutContext, LayoutContainer container) {
distributeSizes(layoutContext);
distributePositions(layoutContext, container);
}
- private void distributeSizes(LayoutContext layoutContext) {
+ private void distributeSizes(EquationLayoutContext layoutContext) {
for (int j = 0; j < grid.getRows().getSize(); j++) {
for (int i = 0; i < grid.getColumns().getSize(); i++) {
@@ -372,7 +156,7 @@
if (component instanceof LayoutContainer) {
LayoutContainer subContainer = (LayoutContainer) component;
- LayoutManager layoutManager = subContainer.getLayoutManager();
+ EquationLayoutManager layoutManager = (EquationLayoutManager) subContainer.getLayoutManager();
if (layoutManager != null) {
layoutManager.distribute(layoutContext, subContainer);
}
@@ -382,7 +166,7 @@
}
}
- private void distributePositions(LayoutContext layoutContext, LayoutContainer container) {
+ private void distributePositions(EquationLayoutContext layoutContext, LayoutContainer container) {
// find the "left" positions
for (int j = 0; j < grid.getRows().getSize(); j++) {
@@ -421,7 +205,7 @@
}
}
- private void addPixelConstraints(LayoutContext layoutContext, int horizontalIndexOffset, int verticalIndexOffset) {
+ private void addPixelConstraints(EquationLayoutContext layoutContext, int horizontalIndexOffset, int verticalIndexOffset) {
// horizontal
LayoutTokens columnTokens = grid.getColumns();
for (int i = 0; i < columnTokens.getSize(); i++) {
@@ -443,7 +227,7 @@
}
}
- private void addRelativeConstraints(LayoutContext layoutContext, int horizontalIndexOffset, int verticalIndexOffset) {
+ private void addRelativeConstraints(EquationLayoutContext layoutContext, int horizontalIndexOffset, int verticalIndexOffset) {
// horizontal
Integer first = null;
Integer firstIndex = null;
@@ -480,6 +264,22 @@
}
}
+ public void fixRelativeInsideAuto(boolean orientation, boolean auto) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void preProcessing(boolean orientation) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void mainProcessing(boolean orientation) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void postProcessing(boolean orientation) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
private LayoutContainer getLayoutContainer() {
// todo: check with instanceof and do something in the error case
return ((LayoutContainer) getParent());
@@ -516,4 +316,4 @@
? "(" + Arrays.toString(grid.getWidths()) + ", " + Arrays.toString(grid.getHeights()) + ")"
: "");
}
-}
+}
\ No newline at end of file
Propchange: myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/AbstractUIEquationGridLayout.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/AbstractUIEquationGridLayout.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/UIEquationGridLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/UIEquationGridLayout.java?rev=834843&view=auto
==============================================================================
--- myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/UIEquationGridLayout.java (added)
+++ myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/UIEquationGridLayout.java Wed Nov 11 11:39:07 2009
@@ -0,0 +1,347 @@
+// ---------- Attention: Generated code, please do not modify! -----------
+
+/*
+ * 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.
+ */
+
+package org.apache.myfaces.tobago.component;
+
+import org.apache.myfaces.tobago.layout.Measure;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * UIComponent class, generated from template {@code component1.2.stg} with class
+ * {@link org.apache.myfaces.tobago.taglib.component.GridLayoutTagDeclaration}.
+ */
+public class UIEquationGridLayout
+ extends AbstractUIEquationGridLayout {
+
+
+
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.GridLayout";
+
+ public static final String COMPONENT_FAMILY = "org.apache.myfaces.tobago.GridLayout";
+
+ private String border;
+ private Measure cellspacing;
+ private Measure columnSpacing;
+ private Measure rowSpacing;
+ private String margin;
+ private String marginBottom;
+ private String marginLeft;
+ private String marginRight;
+ private String marginTop;
+ private String columns;
+ private String rows;
+
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+
+ public String getBorder() {
+ if (border != null) {
+ return border;
+ }
+ javax.el.ValueExpression ve = getValueExpression("border");
+ if (ve != null) {
+ try {
+ return (String) ve.getValue(getFacesContext().getELContext());
+ } catch (javax.el.ELException e) {
+ throw new javax.faces.FacesException(e);
+ }
+ }
+ return null;
+ }
+
+ public void setBorder(String border) {
+ this.border = border;
+ }
+
+ public Measure getCellspacing() {
+ if (cellspacing != null) {
+ return cellspacing;
+ }
+ javax.el.ValueExpression ve = getValueExpression("cellspacing");
+ if (ve != null) {
+ try {
+ Object object = ve.getValue(getFacesContext().getELContext());
+ if (object instanceof Measure) {
+ Measure cellspacing = (Measure) object;
+ return cellspacing;
+ } else if (object instanceof Number) {
+ return new org.apache.myfaces.tobago.layout.PixelMeasure(((Number)object).intValue());
+ } else if (object instanceof String) {
+ return Measure.parse((String)object);
+ } else if (object != null) {
+ return Measure.parse(object.toString());
+ }
+ } catch (javax.el.ELException e) {
+ throw new javax.faces.FacesException(e);
+ }
+ }
+ return null;
+ }
+
+ public void setCellspacing(Measure cellspacing) {
+ this.cellspacing = cellspacing;
+ }
+
+ public Measure getColumnSpacing() {
+ if (columnSpacing != null) {
+ return columnSpacing;
+ }
+ javax.el.ValueExpression ve = getValueExpression("columnSpacing");
+ if (ve != null) {
+ try {
+ Object object = ve.getValue(getFacesContext().getELContext());
+ if (object instanceof Measure) {
+ Measure columnSpacing = (Measure) object;
+ return columnSpacing;
+ } else if (object instanceof Number) {
+ return new org.apache.myfaces.tobago.layout.PixelMeasure(((Number)object).intValue());
+ } else if (object instanceof String) {
+ return Measure.parse((String)object);
+ } else if (object != null) {
+ return Measure.parse(object.toString());
+ }
+ } catch (javax.el.ELException e) {
+ throw new javax.faces.FacesException(e);
+ }
+ }
+ return getCellspacing() != null ? getCellspacing() : org.apache.myfaces.tobago.config.ThemeConfig.getMeasure(getFacesContext(), this, "columnSpacing");
+ }
+
+ public void setColumnSpacing(Measure columnSpacing) {
+ this.columnSpacing = columnSpacing;
+ }
+
+ public Measure getRowSpacing() {
+ if (rowSpacing != null) {
+ return rowSpacing;
+ }
+ javax.el.ValueExpression ve = getValueExpression("rowSpacing");
+ if (ve != null) {
+ try {
+ Object object = ve.getValue(getFacesContext().getELContext());
+ if (object instanceof Measure) {
+ Measure rowSpacing = (Measure) object;
+ return rowSpacing;
+ } else if (object instanceof Number) {
+ return new org.apache.myfaces.tobago.layout.PixelMeasure(((Number)object).intValue());
+ } else if (object instanceof String) {
+ return Measure.parse((String)object);
+ } else if (object != null) {
+ return Measure.parse(object.toString());
+ }
+ } catch (javax.el.ELException e) {
+ throw new javax.faces.FacesException(e);
+ }
+ }
+ return getCellspacing() != null ? getCellspacing() : org.apache.myfaces.tobago.config.ThemeConfig.getMeasure(getFacesContext(), this, "rowSpacing");
+ }
+
+ public void setRowSpacing(Measure rowSpacing) {
+ this.rowSpacing = rowSpacing;
+ }
+
+ public String getMargin() {
+ if (margin != null) {
+ return margin;
+ }
+ javax.el.ValueExpression ve = getValueExpression("margin");
+ if (ve != null) {
+ try {
+ return (String) ve.getValue(getFacesContext().getELContext());
+ } catch (javax.el.ELException e) {
+ throw new javax.faces.FacesException(e);
+ }
+ }
+ return null;
+ }
+
+ public void setMargin(String margin) {
+ this.margin = margin;
+ }
+
+ public String getMarginBottom() {
+ if (marginBottom != null) {
+ return marginBottom;
+ }
+ javax.el.ValueExpression ve = getValueExpression("marginBottom");
+ if (ve != null) {
+ try {
+ String marginBottom = (String) ve.getValue(getFacesContext().getELContext());
+ if (marginBottom != null) {
+ return marginBottom;
+ }
+ } catch (javax.el.ELException e) {
+ throw new javax.faces.FacesException(e);
+ }
+ }
+ return getMargin();
+ }
+
+ public void setMarginBottom(String marginBottom) {
+ this.marginBottom = marginBottom;
+ }
+
+ public String getMarginLeft() {
+ if (marginLeft != null) {
+ return marginLeft;
+ }
+ javax.el.ValueExpression ve = getValueExpression("marginLeft");
+ if (ve != null) {
+ try {
+ String marginLeft = (String) ve.getValue(getFacesContext().getELContext());
+ if (marginLeft != null) {
+ return marginLeft;
+ }
+ } catch (javax.el.ELException e) {
+ throw new javax.faces.FacesException(e);
+ }
+ }
+ return getMargin();
+ }
+
+ public void setMarginLeft(String marginLeft) {
+ this.marginLeft = marginLeft;
+ }
+
+ public String getMarginRight() {
+ if (marginRight != null) {
+ return marginRight;
+ }
+ javax.el.ValueExpression ve = getValueExpression("marginRight");
+ if (ve != null) {
+ try {
+ String marginRight = (String) ve.getValue(getFacesContext().getELContext());
+ if (marginRight != null) {
+ return marginRight;
+ }
+ } catch (javax.el.ELException e) {
+ throw new javax.faces.FacesException(e);
+ }
+ }
+ return getMargin();
+ }
+
+ public void setMarginRight(String marginRight) {
+ this.marginRight = marginRight;
+ }
+
+ public String getMarginTop() {
+ if (marginTop != null) {
+ return marginTop;
+ }
+ javax.el.ValueExpression ve = getValueExpression("marginTop");
+ if (ve != null) {
+ try {
+ String marginTop = (String) ve.getValue(getFacesContext().getELContext());
+ if (marginTop != null) {
+ return marginTop;
+ }
+ } catch (javax.el.ELException e) {
+ throw new javax.faces.FacesException(e);
+ }
+ }
+ return getMargin();
+ }
+
+ public void setMarginTop(String marginTop) {
+ this.marginTop = marginTop;
+ }
+
+ public String getColumns() {
+ if (columns != null) {
+ return columns;
+ }
+ javax.el.ValueExpression ve = getValueExpression("columns");
+ if (ve != null) {
+ try {
+ String columns = (String) ve.getValue(getFacesContext().getELContext());
+ if (columns != null) {
+ return columns;
+ }
+ } catch (javax.el.ELException e) {
+ throw new javax.faces.FacesException(e);
+ }
+ }
+ return "1*";
+ }
+
+ public void setColumns(String columns) {
+ this.columns = columns;
+ }
+
+ public String getRows() {
+ if (rows != null) {
+ return rows;
+ }
+ javax.el.ValueExpression ve = getValueExpression("rows");
+ if (ve != null) {
+ try {
+ String rows = (String) ve.getValue(getFacesContext().getELContext());
+ if (rows != null) {
+ return rows;
+ }
+ } catch (javax.el.ELException e) {
+ throw new javax.faces.FacesException(e);
+ }
+ }
+ return "1*";
+ }
+
+ public void setRows(String rows) {
+ this.rows = rows;
+ }
+
+ public void restoreState(FacesContext context, Object componentState) {
+ Object[] values = (Object[]) componentState;
+ super.restoreState(context, values[0]);
+ border = (String) values[1];
+ cellspacing = (Measure) values[2];
+ columnSpacing = (Measure) values[3];
+ rowSpacing = (Measure) values[4];
+ margin = (String) values[5];
+ marginBottom = (String) values[6];
+ marginLeft = (String) values[7];
+ marginRight = (String) values[8];
+ marginTop = (String) values[9];
+ columns = (String) values[10];
+ rows = (String) values[11];
+ }
+
+ public Object saveState(FacesContext context) {
+ Object[] values = new Object[12];
+ values[0] = super.saveState(context);
+ values[1] = border;
+ values[2] = cellspacing;
+ values[3] = columnSpacing;
+ values[4] = rowSpacing;
+ values[5] = margin;
+ values[6] = marginBottom;
+ values[7] = marginLeft;
+ values[8] = marginRight;
+ values[9] = marginTop;
+ values[10] = columns;
+ values[11] = rows;
+ return values;
+ }
+
+
+}
\ No newline at end of file
Copied: myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/EquationLayoutContext.java (from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/EquationLayoutContext.java?p2=myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/EquationLayoutContext.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext.java&r1=834383&r2=834843&rev=834843&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext.java (original)
+++ myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/EquationLayoutContext.java Wed Nov 11 11:39:07 2009
@@ -19,13 +19,13 @@
import org.apache.myfaces.tobago.layout.math.EquationManager;
-public class LayoutContext {
+public class EquationLayoutContext {
private EquationManager horizontal;
private EquationManager vertical;
private LayoutContainer container;
- public LayoutContext(LayoutContainer container) {
+ public EquationLayoutContext(LayoutContainer container) {
this.horizontal = new EquationManager();
this.vertical = new EquationManager();
this.container = container;
@@ -51,11 +51,12 @@
vertical.setFixedLength(0, container.getHeight(), container);
}
- container.getLayoutManager().collect(this, container, 0, 0);
+ ((EquationLayoutManager)container.getLayoutManager()).collect(this, container, 0, 0);
horizontal.solve();
vertical.solve();
- container.getLayoutManager().distribute(this, container);
+ ((EquationLayoutManager)container.getLayoutManager()).distribute(this, container);
}
+
}
Added: myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/EquationLayoutManager.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/EquationLayoutManager.java?rev=834843&view=auto
==============================================================================
--- myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/EquationLayoutManager.java (added)
+++ myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/EquationLayoutManager.java Wed Nov 11 11:39:07 2009
@@ -0,0 +1,25 @@
+package org.apache.myfaces.tobago.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.
+ */
+
+public interface EquationLayoutManager extends LayoutManager {
+
+ void init();
+ void collect(EquationLayoutContext layoutContext, LayoutContainer container, int horizontalIndex, int verticalIndex);
+ void distribute(EquationLayoutContext layoutContext, LayoutContainer container);
+}
\ No newline at end of file
Copied: myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/math/SystemOfEquations.java (from r834383, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SystemOfEquations.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/math/SystemOfEquations.java?p2=myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/math/SystemOfEquations.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SystemOfEquations.java&r1=834383&r2=834843&rev=834843&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SystemOfEquations.java (original)
+++ myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/layout/math/SystemOfEquations.java Wed Nov 11 11:39:07 2009
@@ -19,6 +19,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.internal.layout.MathUtils;
import org.apache.myfaces.tobago.layout.Measure;
import org.apache.myfaces.tobago.layout.PixelMeasure;
Copied: myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java (from r834383, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java?p2=myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java&p1=myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java&r1=834383&r2=834843&rev=834843&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java (original)
+++ myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java Wed Nov 11 11:39:07 2009
@@ -19,7 +19,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.layout.LayoutContext;
+import org.apache.myfaces.tobago.layout.EquationLayoutContext;
import org.apache.myfaces.tobago.layout.Measure;
import org.apache.myfaces.tobago.layout.MockComponent;
import org.apache.myfaces.tobago.layout.MockContainer;
@@ -51,7 +51,7 @@
MockComponent c2 = new MockComponent();
container.getComponents().add(c2);
- UIGridLayout manager = new UIGridLayout();
+ UIEquationGridLayout manager = new UIEquationGridLayout();
manager.setColumns("*;2*");
manager.setRows("*");
manager.setColumnSpacing(PixelMeasure.ZERO);
@@ -65,7 +65,7 @@
container.setTopOffset(PixelMeasure.ZERO);
container.setRightOffset(PixelMeasure.ZERO);
container.setBottomOffset(PixelMeasure.ZERO);
- LayoutContext layoutContext = new LayoutContext(container);
+ EquationLayoutContext layoutContext = new EquationLayoutContext(container);
layoutContext.layout();
Measure[] result = layoutContext.getHorizontal().getResult();
@@ -108,7 +108,7 @@
container.setBottomOffset(PixelMeasure.ZERO);
span.setColumnSpan(2);
- UIGridLayout manager = new UIGridLayout();
+ UIEquationGridLayout manager = new UIEquationGridLayout();
manager.setColumns("*;*;*");
manager.setRows("*");
manager.setColumnSpacing(PixelMeasure.ZERO);
@@ -118,7 +118,7 @@
container.setWidth(new PixelMeasure(300));
container.setHeight(new PixelMeasure(20));
- LayoutContext layoutContext = new LayoutContext(container);
+ EquationLayoutContext layoutContext = new EquationLayoutContext(container);
layoutContext.layout();
Measure[] result = layoutContext.getHorizontal().getResult();
@@ -169,7 +169,7 @@
MockContainer subContainer = new MockContainer();
container.getComponents().add(subContainer);
- UIGridLayout manager = new UIGridLayout();
+ UIEquationGridLayout manager = new UIEquationGridLayout();
manager.setColumns("*;2*;500px");
manager.setRows("*;600px");
manager.setColumnSpacing(PixelMeasure.ZERO);
@@ -177,7 +177,7 @@
manager.setParent(container);
container.setLayoutManager(manager);
- UIGridLayout subManager = new UIGridLayout();
+ UIEquationGridLayout subManager = new UIEquationGridLayout();
subManager.setColumns("7*;3*");
subManager.setRows("*;*");
subManager.setColumnSpacing(PixelMeasure.ZERO);
@@ -199,7 +199,7 @@
container.setTopOffset(PixelMeasure.ZERO);
container.setRightOffset(PixelMeasure.ZERO);
container.setBottomOffset(PixelMeasure.ZERO);
- LayoutContext layoutContext = new LayoutContext(container);
+ EquationLayoutContext layoutContext = new EquationLayoutContext(container);
layoutContext.layout();
Measure[] result = layoutContext.getHorizontal().getResult();
@@ -250,7 +250,7 @@
container.getComponents().add(span2);
container.getComponents().add(new MockComponent());
- UIGridLayout manager1 = new UIGridLayout();
+ UIEquationGridLayout manager1 = new UIEquationGridLayout();
manager1.setColumns("*;*;*");
manager1.setRows("*;*");
manager1.setColumnSpacing(PixelMeasure.ZERO);
@@ -258,7 +258,7 @@
manager1.setParent(container);
container.setLayoutManager(manager1);
- UIGridLayout manager2 = new UIGridLayout();
+ UIEquationGridLayout manager2 = new UIEquationGridLayout();
manager2.setColumns("*;*;*");
manager2.setRows("*");
manager2.setColumnSpacing(PixelMeasure.ZERO);
@@ -266,7 +266,7 @@
manager2.setParent(span1);
span1.setLayoutManager(manager2);
- UIGridLayout manager3 = new UIGridLayout();
+ UIEquationGridLayout manager3 = new UIEquationGridLayout();
manager3.setColumns("*;*;*");
manager3.setRows("*");
manager3.setColumnSpacing(PixelMeasure.ZERO);
@@ -280,10 +280,10 @@
container.setTopOffset(PixelMeasure.ZERO);
container.setRightOffset(PixelMeasure.ZERO);
container.setBottomOffset(PixelMeasure.ZERO);
- LayoutContext layoutContext = new LayoutContext(container);
+ EquationLayoutContext layoutContext = new EquationLayoutContext(container);
layoutContext.layout();
- LOG.info(((UIGridLayout) container.getLayoutManager()).getGrid());
+ LOG.info(((UIEquationGridLayout) container.getLayoutManager()).getGrid());
Measure[] result = layoutContext.getHorizontal().getResult();
LOG.info("result: " + Arrays.toString(result));
@@ -298,8 +298,8 @@
LOG.info("result: " + Arrays.toString(result));
Assert.assertArrayEquals(new Measure[]{
new PixelMeasure(200), new PixelMeasure(100), new PixelMeasure(100), PixelMeasure.ZERO,
- new PixelMeasure(100), new PixelMeasure(100), new PixelMeasure(100),PixelMeasure.ZERO,
- new PixelMeasure(100), new PixelMeasure(100), PixelMeasure.ZERO,new PixelMeasure(100)},
+ new PixelMeasure(100), new PixelMeasure(100), new PixelMeasure(100), PixelMeasure.ZERO,
+ new PixelMeasure(100), new PixelMeasure(100), PixelMeasure.ZERO, new PixelMeasure(100)},
result);
Assert.assertEquals("width of container", 900, container.getWidth().getPixel());
@@ -334,7 +334,7 @@
container.getComponents().add(new MockComponent());
container.getComponents().add(new MockComponent());
- UIGridLayout manager = new UIGridLayout();
+ UIEquationGridLayout manager = new UIEquationGridLayout();
manager.setColumns("*;*");
manager.setRows("*;*");
manager.setColumnSpacing(PixelMeasure.ZERO);
@@ -348,7 +348,7 @@
container.setTopOffset(PixelMeasure.ZERO);
container.setRightOffset(PixelMeasure.ZERO);
container.setBottomOffset(PixelMeasure.ZERO);
- LayoutContext layoutContext = new LayoutContext(container);
+ EquationLayoutContext layoutContext = new EquationLayoutContext(container);
layoutContext.layout();
Measure[] result = layoutContext.getHorizontal().getResult();
Propchange: myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java (from r834383, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java?p2=myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java&p1=myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java&r1=834383&r2=834843&rev=834843&view=diff
==============================================================================
(empty)
Propchange: myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/MockContainer.java (from r834383, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MockContainer.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/MockContainer.java?p2=myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/MockContainer.java&p1=myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MockContainer.java&r1=834383&r2=834843&rev=834843&view=diff
==============================================================================
(empty)
Propchange: myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/MockContainer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/MockContainer.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/math/CombinationEquationUnitTest.java (from r834383, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/CombinationEquationUnitTest.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/math/CombinationEquationUnitTest.java?p2=myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/math/CombinationEquationUnitTest.java&p1=myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/CombinationEquationUnitTest.java&r1=834383&r2=834843&rev=834843&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/CombinationEquationUnitTest.java (original)
+++ myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/math/CombinationEquationUnitTest.java Wed Nov 11 11:39:07 2009
@@ -17,6 +17,7 @@
* limitations under the License.
*/
+import org.apache.myfaces.tobago.internal.layout.MathUtils;
import org.apache.myfaces.tobago.layout.PixelMeasure;
import org.junit.Assert;
import org.junit.Test;
Copied: myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/math/PartitionEquationUnitTest.java (from r834383, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/PartitionEquationUnitTest.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/math/PartitionEquationUnitTest.java?p2=myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/math/PartitionEquationUnitTest.java&p1=myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/PartitionEquationUnitTest.java&r1=834383&r2=834843&rev=834843&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/PartitionEquationUnitTest.java (original)
+++ myfaces/tobago/trunk/extension/math/src/test/java/org/apache/myfaces/tobago/layout/math/PartitionEquationUnitTest.java Wed Nov 11 11:39:07 2009
@@ -17,6 +17,7 @@
* limitations under the License.
*/
+import org.apache.myfaces.tobago.internal.layout.MathUtils;
import org.apache.myfaces.tobago.layout.Measure;
import org.apache.myfaces.tobago.layout.PixelMeasure;
import org.junit.Assert;
Modified: myfaces/tobago/trunk/extension/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/pom.xml?rev=834843&r1=834842&r2=834843&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/pom.xml (original)
+++ myfaces/tobago/trunk/extension/pom.xml Wed Nov 11 11:39:07 2009
@@ -34,8 +34,9 @@
<module>deprecation</module>
<module>facelets</module>
<module>fileupload</module>
- <module>security</module>
+ <module>math</module>
<module>message-fix</module>
+ <module>security</module>
<module>tobago-taglib-extension</module>
</modules>
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java?rev=834843&r1=834842&r2=834843&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java Wed Nov 11 11:39:07 2009
@@ -19,7 +19,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
import org.apache.myfaces.tobago.component.AbstractUIPage;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.Facets;
@@ -29,7 +28,7 @@
import org.apache.myfaces.tobago.context.ClientProperties;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
import org.apache.myfaces.tobago.context.TobagoFacesContext;
-import org.apache.myfaces.tobago.layout.LayoutContext2;
+import org.apache.myfaces.tobago.layout.LayoutContext;
import org.apache.myfaces.tobago.renderkit.PageRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
@@ -61,6 +60,8 @@
import java.util.Map;
import java.util.Set;
+import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
+
public class PageRenderer extends PageRendererBase {
private static final Log LOG = LogFactory.getLog(PageRenderer.class);
@@ -111,7 +112,7 @@
// LAYOUT Begin
long begin = System.nanoTime();
- LayoutContext2 layoutContext = new LayoutContext2(page);
+ LayoutContext layoutContext = new LayoutContext(page);
layoutContext.layout();
long end = System.nanoTime();
NumberFormat format = new DecimalFormat("#,##0");