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/07/24 09:43:06 UTC
svn commit: r797354 - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/component/
core/src/main/java/org/apache/myfaces/tobago/layout/
core/src/main/java/org/apache/myfaces/tobago/layout/math/
core/src/main/java/org/apache/myfaces...
Author: lofwyr
Date: Fri Jul 24 07:43:05 2009
New Revision: 797354
URL: http://svn.apache.org/viewvc?rev=797354&view=rev
Log:
TOBAGO-606: Layout-Manager
- add new attributes: leftOffset, rightOffset, topOffset, bottomOffset
- change class hierarchy (because UIPage and UIPopup are not LayoutComponents):
- LayoutComponent has new superclass LayoutObject
- LayoutContainer is no longer subclass of LayoutComponent, but of LayoutObject
Added:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutObject.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/AbstractUIPanel.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroup.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponent.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainer.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/EquationManager.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/PartitionEquation.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutConstraintTag.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponent.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponentWithDeprecatedDimension.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MockContainer.java
myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutConstraintHandler.java
myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties
myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties
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=797354&r1=797353&r2=797354&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 Fri Jul 24 07:43:05 2009
@@ -66,15 +66,21 @@
grid = new Grid(columnTokens.getSize(), rowTokens.getSize());
}
+ /**
+ * Phase 1: Collects the layout information from the components recursively.
+ */
public void collect(LayoutContext layoutContext, LayoutContainer container, int horizontalIndex, int verticalIndex) {
// horizontal
EquationManager horizontal = layoutContext.getHorizontal();
- int[] horizontalIndices = horizontal.partition(horizontalIndex, columnTokens.getSize(), getColumnSpacing());
+ int[] horizontalIndices = horizontal.partition(
+ horizontalIndex, columnTokens.getSize(),
+ getColumnSpacing(), container.getLeftOffset(), container.getRightOffset());
// vertical
EquationManager vertical = layoutContext.getVertical();
- int[] verticalIndices = vertical.partition(verticalIndex, rowTokens.getSize(), getRowSpacing());
+ int[] verticalIndices = vertical.partition(
+ verticalIndex, rowTokens.getSize(), getRowSpacing(), container.getTopOffset(), container.getBottomOffset());
List<LayoutComponent> components = container.getComponents();
for (LayoutComponent c : components) {
@@ -110,10 +116,13 @@
}
}
+ /**
+ * Phase 2: Distribute the computed values into the components recursively.
+ */
public void distribute(LayoutContext layoutContext, LayoutContainer container) {
distributeSizes(layoutContext);
- distributePositions();
+ distributePositions(container);
}
private void distributeSizes(LayoutContext layoutContext) {
@@ -133,8 +142,8 @@
int horizontalIndex = cell.getComponent().getHorizontalIndex();
int verticalIndex = cell.getComponent().getVerticalIndex();
- PixelMeasure width = (PixelMeasure) horizontal.getResult()[horizontalIndex];
- PixelMeasure height = (PixelMeasure) vertical.getResult()[verticalIndex];
+ Measure width = horizontal.getResult()[horizontalIndex];
+ Measure height = vertical.getResult()[verticalIndex];
component.setWidth(width);
component.setHeight(height);
@@ -152,11 +161,11 @@
}
}
- private void distributePositions() {
+ private void distributePositions(LayoutContainer container) {
// find the "left" positions
for (int j = 0; j < grid.getRowCount(); j++) {
- PixelMeasure left = new PixelMeasure(0);
+ PixelMeasure left = (PixelMeasure) container.getLeftOffset();
for (int i = 0; i < grid.getColumnCount(); i++) {
Cell cell = grid.get(i, j);
if (cell == null) {
@@ -177,7 +186,7 @@
// find the "top" positions
for (int i = 0; i < grid.getColumnCount(); i++) {
- PixelMeasure top = new PixelMeasure(0);
+ PixelMeasure top = (PixelMeasure) container.getTopOffset();
for (int j = 0; j < grid.getRowCount(); j++) {
Cell cell = grid.get(i, j);
if (cell == null) {
@@ -206,7 +215,7 @@
layoutContext.getHorizontal().setFixedLength(i + horizontalIndexOffset, pixel);
}
if (layoutToken instanceof FixedLayoutToken) {
- Measure pixel = new PixelMeasure(100);
+ Measure pixel = new PixelMeasure(100); // TODO
LOG.warn("auto/fixed is not implemented yet and was set to 100px");
layoutContext.getHorizontal().setFixedLength(i + horizontalIndexOffset, pixel);
}
@@ -220,7 +229,7 @@
layoutContext.getVertical().setFixedLength(i + verticalIndexOffset, pixel);
}
if (layoutToken instanceof FixedLayoutToken) {
- Measure pixel = new PixelMeasure(25);
+ Measure pixel = new PixelMeasure(25); // TODO
LOG.warn("auto/fixed is not implemented yet and was set to 25px");
layoutContext.getVertical().setFixedLength(i + verticalIndexOffset, pixel);
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPanel.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPanel.java?rev=797354&r1=797353&r2=797354&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPanel.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPanel.java Fri Jul 24 07:43:05 2009
@@ -30,7 +30,7 @@
import java.util.ArrayList;
import java.util.List;
-public abstract class AbstractUIPanel extends UIPanelBase implements LayoutContainer {
+public abstract class AbstractUIPanel extends UIPanelBase implements LayoutContainer, LayoutComponent {
private static final Log LOG = LogFactory.getLog(AbstractUIPanel.class);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroup.java?rev=797354&r1=797353&r2=797354&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroup.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroup.java Fri Jul 24 07:43:05 2009
@@ -46,7 +46,7 @@
import java.util.List;
public abstract class AbstractUITabGroup extends UIPanelBase
- implements TabChangeSource, ActionSource, AjaxComponent, LayoutContainer, OnComponentCreated {
+ implements TabChangeSource, ActionSource, AjaxComponent, LayoutContainer, LayoutComponent, OnComponentCreated {
private static final Log LOG = LogFactory.getLog(AbstractUITabGroup.class);
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=797354&r1=797353&r2=797354&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 Fri Jul 24 07:43:05 2009
@@ -17,7 +17,10 @@
* limitations under the License.
*/
-public interface LayoutComponent {
+/**
+ * A LayoutComponent is a piece which can be positioned in a LayoutContainer.
+ */
+public interface LayoutComponent extends LayoutObject {
Integer getColumnSpan();
void setColumnSpan(Integer columnSpan);
@@ -25,27 +28,6 @@
Integer getRowSpan();
void setRowSpan(Integer rowSpan);
- Measure getWidth();
- void setWidth(Measure width);
-
- Measure getHeight();
- void setHeight(Measure height);
-
- void setMinimumWidth(Measure minimumWidth);
-
- void setMinimumHeight(Measure minimumHeight);
-
- void setPreferredWidth(Measure preferredWidth);
-
- void setPreferredHeight(Measure preferredHeight);
-
- void setMaximumWidth(Measure maximumWidth);
-
- void setMaximumHeight(Measure maximumHeight);
-
- Measure getLeft();
- void setLeft(Measure left);
-
Measure getTop();
void setTop(Measure top);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainer.java?rev=797354&r1=797353&r2=797354&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainer.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainer.java Fri Jul 24 07:43:05 2009
@@ -19,9 +19,17 @@
import java.util.List;
-public interface LayoutContainer extends LayoutComponent {
+public interface LayoutContainer extends LayoutObject {
List<LayoutComponent> getComponents();
LayoutManager getLayoutManager();
+
+ Measure getLeftOffset();
+
+ Measure getRightOffset();
+
+ Measure getTopOffset();
+
+ Measure getBottomOffset();
}
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutObject.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutObject.java?rev=797354&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutObject.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutObject.java Fri Jul 24 07:43:05 2009
@@ -0,0 +1,46 @@
+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.
+ */
+
+/**
+ * A LayoutObject is the technical base for LayoutComponent and LayoutContainer.
+ */
+public interface LayoutObject {
+
+ Measure getWidth();
+ void setWidth(Measure width);
+
+ Measure getHeight();
+ void setHeight(Measure height);
+
+ void setMinimumWidth(Measure minimumWidth);
+
+ void setMinimumHeight(Measure minimumHeight);
+
+ void setPreferredWidth(Measure preferredWidth);
+
+ void setPreferredHeight(Measure preferredHeight);
+
+ void setMaximumWidth(Measure maximumWidth);
+
+ void setMaximumHeight(Measure maximumHeight);
+
+ Measure getLeft();
+ void setLeft(Measure left);
+
+}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/EquationManager.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/EquationManager.java?rev=797354&r1=797353&r2=797354&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/EquationManager.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/EquationManager.java Fri Jul 24 07:43:05 2009
@@ -20,6 +20,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.layout.Measure;
+import org.apache.myfaces.tobago.layout.PixelMeasure;
/**
* Manages the relation between the Tree of LayoutManagers and the Linear System of Equations
@@ -42,11 +43,16 @@
}
public int[] partition(int index, int number, Measure spacing) {
+ // TODO
+ return partition(index, number, spacing, PixelMeasure.ZERO, PixelMeasure.ZERO);
+ }
+
+ public int[] partition(int index, int number, Measure spacing, Measure beginOffset, Measure endOffset) {
assert number > 0;
int[] newIndices = equations.addVariables(number);
- equations.addEqualsEquation(new PartitionEquation(newIndices[0], number, index, spacing));
+ equations.addEqualsEquation(new PartitionEquation(newIndices[0], number, index, spacing, beginOffset, endOffset));
LOG.info(equations);
return newIndices;
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/PartitionEquation.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/PartitionEquation.java?rev=797354&r1=797353&r2=797354&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/PartitionEquation.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/PartitionEquation.java Fri Jul 24 07:43:05 2009
@@ -18,6 +18,7 @@
*/
import org.apache.myfaces.tobago.layout.Measure;
+import org.apache.myfaces.tobago.layout.PixelMeasure;
/**
* This equation describes the partition of one column (or row) into some other columns (or rows).
@@ -31,18 +32,29 @@
private int count;
private int parent;
private Measure spacing;
+ private Measure beginOffset;
+ private Measure endOffset;
+
+ @Deprecated
+ public PartitionEquation(int begin, int count, int parent, Measure spacing) {
+ this(begin, count, parent, spacing, PixelMeasure.ZERO, PixelMeasure.ZERO);
+ }
/**
- * @param begin lowest index
- * @param count number of cells of the partition
- * @param parent parent index
- * @param spacing space between two cells of the partition
+ * @param begin lowest index
+ * @param count number of cells of the partition
+ * @param parent parent index
+ * @param spacing space between two cells of the partition
+ * @param beginOffset offset before the first cell
+ * @param endOffset offset after the last cell
*/
- public PartitionEquation(int begin, int count, int parent, Measure spacing) {
+ public PartitionEquation(int begin, int count, int parent, Measure spacing, Measure beginOffset, Measure endOffset) {
this.begin = begin;
this.count = count;
this.parent = parent;
this.spacing = spacing;
+ this.beginOffset = beginOffset;
+ this.endOffset = endOffset;
assert begin >= 0 && count > 0 && parent >= 0;
assert parent <= begin;
@@ -60,7 +72,7 @@
row[i] = 0.0;
}
// the last variable contains a constant, this is here the sum of spaces between cells.
- row[row.length - 1] = -(count - 1) * spacing.getPixel();
+ row[row.length - 1] = -((count - 1) * spacing.getPixel() + beginOffset.getPixel() + endOffset.getPixel());
for (i = parent; i < parent + 1; i++) {
row[i] = -1.0;
@@ -104,6 +116,16 @@
}
}
+ // plus offsets
+ if (beginOffset.getPixel() > 0) {
+ builder.append(" + ");
+ builder.append(beginOffset);
+ }
+ if (endOffset.getPixel() > 0) {
+ builder.append(" + ");
+ builder.append(endOffset);
+ }
+
return builder.toString();
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutConstraintTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutConstraintTag.java?rev=797354&r1=797353&r2=797354&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutConstraintTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutConstraintTag.java Fri Jul 24 07:43:05 2009
@@ -24,6 +24,7 @@
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.layout.LayoutComponent;
+import org.apache.myfaces.tobago.layout.LayoutObject;
import org.apache.myfaces.tobago.layout.Measure;
import javax.faces.component.UIComponent;
@@ -131,12 +132,12 @@
throw new JspException("Component Instance is null");
}
- if (!(component instanceof LayoutComponent)) {
+ if (!(component instanceof LayoutObject)) {
// TODO Message resource i18n
- throw new JspException("Component Instance is not a LayoutComponent");
+ throw new JspException("Component Instance is not a LayoutObject");
}
- if (isColumnSpanSet()) {
+ if (component instanceof LayoutComponent && isColumnSpanSet()) {
if (isColumnSpanLiteral()) {
((LayoutComponent) component).setColumnSpan(Integer.valueOf(getColumnSpanExpression()));
} else {
@@ -144,7 +145,7 @@
}
}
- if (isRowSpanSet()) {
+ if (component instanceof LayoutComponent && isRowSpanSet()) {
if (isRowSpanLiteral()) {
((LayoutComponent) component).setRowSpan(Integer.valueOf(getRowSpanExpression()));
} else {
@@ -154,7 +155,7 @@
if (isWidthSet()) {
if (isWidthLiteral()) {
- ((LayoutComponent) component).setWidth(Measure.parse(getWidthExpression()));
+ ((LayoutObject) component).setWidth(Measure.parse(getWidthExpression()));
} else {
component.setValueBinding(Attributes.WIDTH, (ValueBinding) getWidthAsBindingOrExpression());
}
@@ -162,7 +163,7 @@
if (isHeightSet()) {
if (isHeightLiteral()) {
- ((LayoutComponent) component).setHeight(Measure.parse(getHeightExpression()));
+ ((LayoutObject) component).setHeight(Measure.parse(getHeightExpression()));
} else {
component.setValueBinding(Attributes.HEIGHT, (ValueBinding) getHeightAsBindingOrExpression());
}
@@ -170,7 +171,7 @@
if (isMinimumWidthSet()) {
if (isMinimumWidthLiteral()) {
- ((LayoutComponent) component).setMinimumWidth(Measure.parse(getMinimumWidthExpression()));
+ ((LayoutObject) component).setMinimumWidth(Measure.parse(getMinimumWidthExpression()));
} else {
component.setValueBinding(Attributes.MINIMUM_WIDTH, (ValueBinding) getMinimumWidthAsBindingOrExpression());
}
@@ -178,7 +179,7 @@
if (isMinimumHeightSet()) {
if (isMinimumHeightLiteral()) {
- ((LayoutComponent) component).setMinimumHeight(Measure.parse(getMinimumHeightExpression()));
+ ((LayoutObject) component).setMinimumHeight(Measure.parse(getMinimumHeightExpression()));
} else {
component.setValueBinding(Attributes.MINIMUM_WIDTH, (ValueBinding) getMinimumHeightAsBindingOrExpression());
}
@@ -186,7 +187,7 @@
if (isPreferredWidthSet()) {
if (isPreferredWidthLiteral()) {
- ((LayoutComponent) component).setPreferredWidth(Measure.parse(getPreferredWidthExpression()));
+ ((LayoutObject) component).setPreferredWidth(Measure.parse(getPreferredWidthExpression()));
} else {
component.setValueBinding(Attributes.PREFERRED_WIDTH, (ValueBinding) getPreferredWidthAsBindingOrExpression());
}
@@ -194,7 +195,7 @@
if (isPreferredHeightSet()) {
if (isPreferredHeightLiteral()) {
- ((LayoutComponent) component).setPreferredHeight(Measure.parse(getPreferredHeightExpression()));
+ ((LayoutObject) component).setPreferredHeight(Measure.parse(getPreferredHeightExpression()));
} else {
component.setValueBinding(Attributes.PREFERRED_WIDTH, (ValueBinding) getPreferredHeightAsBindingOrExpression());
}
@@ -202,7 +203,7 @@
if (isMaximumWidthSet()) {
if (isMaximumWidthLiteral()) {
- ((LayoutComponent) component).setMaximumWidth(Measure.parse(getMaximumWidthExpression()));
+ ((LayoutObject) component).setMaximumWidth(Measure.parse(getMaximumWidthExpression()));
} else {
component.setValueBinding(Attributes.MAXIMUM_WIDTH, (ValueBinding) getMaximumWidthAsBindingOrExpression());
}
@@ -210,7 +211,7 @@
if (isMaximumHeightSet()) {
if (isMaximumHeightLiteral()) {
- ((LayoutComponent) component).setMaximumHeight(Measure.parse(getMaximumHeightExpression()));
+ ((LayoutObject) component).setMaximumHeight(Measure.parse(getMaximumHeightExpression()));
} else {
component.setValueBinding(Attributes.MAXIMUM_WIDTH, (ValueBinding) getMaximumHeightAsBindingOrExpression());
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponent.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponent.java?rev=797354&r1=797353&r2=797354&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponent.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponent.java Fri Jul 24 07:43:05 2009
@@ -22,19 +22,20 @@
public interface IsGridLayoutComponent {
/**
- * @param columnSpan The number of horizontal cells this component should use.
+ * @param columnSpan The number of horizontal cells this component should use.
*/
@UIComponentTagAttribute(type = "java.lang.Integer", defaultValue = "1")
void setColumnSpan(String columnSpan);
/**
- * @param rowSpan The number of vertical cells this component should use.
+ * @param rowSpan The number of vertical cells this component should use.
*/
@UIComponentTagAttribute(type = "java.lang.Integer", defaultValue = "1")
void setRowSpan(String rowSpan);
/**
* This value will usually be set by the layout manager.
+ *
* @param width The width for this component.
*/
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
@@ -42,6 +43,7 @@
/**
* This value will usually be set by the layout manager.
+ *
* @param height The height for this component.
*/
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
@@ -85,6 +87,7 @@
/**
* This value will usually be set by the layout manager.
+ *
* @param left The left position value for this component.
*/
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
@@ -92,6 +95,7 @@
/**
* This value will usually be set by the layout manager.
+ *
* @param top The top position value for this component.
*/
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
@@ -99,6 +103,7 @@
/**
* This attribute is for internal use only.
+ *
* @param horizontalIndex The index of the component inside its container grid in horizontal direction.
*/
@UIComponentTagAttribute(type = "java.lang.Integer")
@@ -106,6 +111,7 @@
/**
* This attribute is for internal use only.
+ *
* @param verticalIndex The index of the component inside its container grid in vertical direction.
*/
@UIComponentTagAttribute(type = "java.lang.Integer")
@@ -113,8 +119,55 @@
/**
* This attribute is for internal use only.
+ *
* @param display Indicates the renderer to render the element as block or inline.
*/
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Display")
void setDisplay(String display);
+
+ /**
+ * This attribute is for internal use only.
+ * TODO: this attribute es for containers only
+ *
+ * @param leftOffset The left offset which is needed by some containers (e. g. a box).
+ */
+ @UIComponentTagAttribute(
+ type = "org.apache.myfaces.tobago.layout.Measure",
+ defaultCode = "org.apache.myfaces.tobago.config.ThemeConfig.getMeasure("
+ + "getFacesContext(), this, \"leftOffset\")")
+ void setLeftOffset(String leftOffset);
+
+ /**
+ * This attribute is for internal use only.
+ * TODO: this attribute es for containers only
+ *
+ * @param rightOffset The right offset which is needed by some containers (e. g. a box).
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure",
+ defaultCode = "org.apache.myfaces.tobago.config.ThemeConfig.getMeasure("
+ + "getFacesContext(), this, \"rightOffset\")")
+ void setRightOffset(String rightOffset);
+
+ /**
+ * This attribute is for internal use only.
+ * TODO: this attribute es for containers only
+ *
+ * @param topOffset The top offset which is needed by some containers (e. g. a box).
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure",
+ defaultCode = "org.apache.myfaces.tobago.config.ThemeConfig.getMeasure("
+ + "getFacesContext(), this, \"topOffset\")")
+ void setTopOffset(String topOffset);
+
+ /**
+ * This attribute is for internal use only.
+ * TODO: this attribute es for containers only
+ *
+ * @param bottomOffset The bottom offset which is needed by some containers (e. g. a box).
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure",
+ defaultCode = "org.apache.myfaces.tobago.config.ThemeConfig.getMeasure("
+ + "getFacesContext(), this, \"bottomOffset\")")
+ void setBottomOffset(String bottomOffset);
+
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponentWithDeprecatedDimension.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponentWithDeprecatedDimension.java?rev=797354&r1=797353&r2=797354&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponentWithDeprecatedDimension.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponentWithDeprecatedDimension.java Fri Jul 24 07:43:05 2009
@@ -20,6 +20,8 @@
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+// XXX optimize: smarter code generator
+
/**
* This interface is useful for migration. The width and height attributes can be set
* in Tobago 1.0. With this interface it can be set for compatibility.
@@ -127,4 +129,45 @@
*/
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Display")
void setDisplay(String display);
+
+ /**
+ * This attribute is for internal use only.
+ * TODO: this attribute es for containers only
+ * @param leftOffset The left offset which is needed by some containers (e. g. a box).
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure",
+ defaultCode = "org.apache.myfaces.tobago.config.ThemeConfig.getMeasure("
+ + "getFacesContext(), this, \"leftOffset\")")
+ void setLeftOffset(String leftOffset);
+
+ /**
+ * This attribute is for internal use only.
+ * TODO: this attribute es for containers only
+ * @param rightOffset The right offset which is needed by some containers (e. g. a box).
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure",
+ defaultCode = "org.apache.myfaces.tobago.config.ThemeConfig.getMeasure("
+ + "getFacesContext(), this, \"rightOffset\")")
+ void setRightOffset(String rightOffset);
+
+ /**
+ * This attribute is for internal use only.
+ * TODO: this attribute es for containers only
+ * @param topOffset The top offset which is needed by some containers (e. g. a box).
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure",
+ defaultCode = "org.apache.myfaces.tobago.config.ThemeConfig.getMeasure("
+ + "getFacesContext(), this, \"topOffset\")")
+ void setTopOffset(String topOffset);
+
+ /**
+ * This attribute is for internal use only.
+ * TODO: this attribute es for containers only
+ * @param bottomOffset The bottom offset which is needed by some containers (e. g. a box).
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure",
+ defaultCode = "org.apache.myfaces.tobago.config.ThemeConfig.getMeasure("
+ + "getFacesContext(), this, \"bottomOffset\")")
+ void setBottomOffset(String bottomOffset);
+
}
Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MockContainer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MockContainer.java?rev=797354&r1=797353&r2=797354&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MockContainer.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MockContainer.java Fri Jul 24 07:43:05 2009
@@ -26,6 +26,12 @@
private List<LayoutComponent> components;
+ private Measure leftOffset = PixelMeasure.ZERO;
+ private Measure topOffset = PixelMeasure.ZERO;
+
+ private Measure rightOffset = PixelMeasure.ZERO;
+ private Measure bottomOffset = PixelMeasure.ZERO;
+
public MockContainer() {
components = new ArrayList<LayoutComponent>();
}
@@ -41,4 +47,36 @@
public LayoutManager getLayoutManager() {
return layoutManager;
}
+
+ public Measure getLeftOffset() {
+ return leftOffset;
+ }
+
+ public void setLeftOffset(Measure leftOffset) {
+ this.leftOffset = leftOffset;
+ }
+
+ public Measure getTopOffset() {
+ return topOffset;
+ }
+
+ public void setTopOffset(Measure topOffset) {
+ this.topOffset = topOffset;
+ }
+
+ public Measure getRightOffset() {
+ return rightOffset;
+ }
+
+ public void setRightOffset(Measure rightOffset) {
+ this.rightOffset = rightOffset;
+ }
+
+ public Measure getBottomOffset() {
+ return bottomOffset;
+ }
+
+ public void setBottomOffset(Measure bottomOffset) {
+ this.bottomOffset = bottomOffset;
+ }
}
Modified: myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutConstraintHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutConstraintHandler.java?rev=797354&r1=797353&r2=797354&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutConstraintHandler.java (original)
+++ myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutConstraintHandler.java Fri Jul 24 07:43:05 2009
@@ -25,6 +25,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.layout.LayoutComponent;
+import org.apache.myfaces.tobago.layout.LayoutObject;
import org.apache.myfaces.tobago.layout.Measure;
import javax.el.ELException;
@@ -68,108 +69,108 @@
public void apply(FaceletContext faceletContext, UIComponent parent)
throws IOException, FacesException, ELException {
- if (parent instanceof LayoutComponent) {
- LayoutComponent component = (LayoutComponent) parent;
+ if (parent instanceof LayoutObject) {
+ LayoutObject component = (LayoutObject) parent;
- if (columnSpan != null) {
- LOG.error(columnSpan.getValue());
- if (columnSpan.isLiteral()) {
- component.setColumnSpan(Integer.valueOf(columnSpan.getValue()));
- } else {
- parent.setValueBinding(Attributes.COLUMN_SPAN,
- faceletContext.getFacesContext().getApplication().createValueBinding(columnSpan.getValue()));
- }
- }
-
- if (rowSpan != null) {
- LOG.error(rowSpan.getValue());
- if (rowSpan.isLiteral()) {
- component.setRowSpan(Integer.valueOf(rowSpan.getValue()));
- } else {
- parent.setValueBinding(Attributes.ROW_SPAN,
- faceletContext.getFacesContext().getApplication().createValueBinding(rowSpan.getValue()));
- }
- }
-
- if (width != null) {
- LOG.error(width.getValue());
- if (width.isLiteral()) {
- component.setWidth(Measure.parse(width.getValue()));
- } else {
- parent.setValueBinding(Attributes.WIDTH,
- faceletContext.getFacesContext().getApplication().createValueBinding(width.getValue()));
- }
- }
-
- if (height != null) {
- LOG.error(height.getValue());
- if (height.isLiteral()) {
- component.setHeight(Measure.parse(height.getValue()));
- } else {
- parent.setValueBinding(Attributes.HEIGHT,
- faceletContext.getFacesContext().getApplication().createValueBinding(height.getValue()));
- }
- }
-
- if (minimumWidth != null) {
- LOG.error(minimumWidth.getValue());
- if (minimumWidth.isLiteral()) {
- component.setMinimumWidth(Measure.parse(minimumWidth.getValue()));
- } else {
- parent.setValueBinding(Attributes.MINIMUM_WIDTH,
- faceletContext.getFacesContext().getApplication().createValueBinding(minimumWidth.getValue()));
- }
- }
-
- if (minimumHeight != null) {
- LOG.error(minimumHeight.getValue());
- if (minimumHeight.isLiteral()) {
- component.setMinimumHeight(Measure.parse(minimumHeight.getValue()));
- } else {
- parent.setValueBinding(Attributes.MINIMUM_HEIGHT,
- faceletContext.getFacesContext().getApplication().createValueBinding(minimumHeight.getValue()));
- }
- }
-
- if (preferredWidth != null) {
- LOG.error(preferredWidth.getValue());
- if (preferredWidth.isLiteral()) {
- component.setPreferredWidth(Measure.parse(preferredWidth.getValue()));
- } else {
- parent.setValueBinding(Attributes.PREFERRED_WIDTH,
- faceletContext.getFacesContext().getApplication().createValueBinding(preferredWidth.getValue()));
- }
- }
-
- if (preferredHeight != null) {
- LOG.error(preferredHeight.getValue());
- if (preferredHeight.isLiteral()) {
- component.setPreferredHeight(Measure.parse(preferredHeight.getValue()));
- } else {
- parent.setValueBinding(Attributes.PREFERRED_HEIGHT,
- faceletContext.getFacesContext().getApplication().createValueBinding(preferredHeight.getValue()));
- }
- }
-
- if (maximumWidth != null) {
- LOG.error(maximumWidth.getValue());
- if (maximumWidth.isLiteral()) {
- component.setMaximumWidth(Measure.parse(maximumWidth.getValue()));
- } else {
- parent.setValueBinding(Attributes.MAXIMUM_WIDTH,
- faceletContext.getFacesContext().getApplication().createValueBinding(maximumWidth.getValue()));
- }
- }
-
- if (maximumHeight != null) {
- LOG.error(maximumHeight.getValue());
- if (maximumHeight.isLiteral()) {
- component.setMaximumHeight(Measure.parse(maximumHeight.getValue()));
- } else {
- parent.setValueBinding(Attributes.MAXIMUM_HEIGHT,
- faceletContext.getFacesContext().getApplication().createValueBinding(maximumHeight.getValue()));
- }
+ if (parent instanceof LayoutComponent && columnSpan != null) {
+ LOG.error(columnSpan.getValue());
+ if (columnSpan.isLiteral()) {
+ ((LayoutComponent) component).setColumnSpan(Integer.valueOf(columnSpan.getValue()));
+ } else {
+ parent.setValueBinding(Attributes.COLUMN_SPAN,
+ faceletContext.getFacesContext().getApplication().createValueBinding(columnSpan.getValue()));
+ }
+ }
+
+ if (parent instanceof LayoutComponent && rowSpan != null) {
+ LOG.error(rowSpan.getValue());
+ if (rowSpan.isLiteral()) {
+ ((LayoutComponent) component).setRowSpan(Integer.valueOf(rowSpan.getValue()));
+ } else {
+ parent.setValueBinding(Attributes.ROW_SPAN,
+ faceletContext.getFacesContext().getApplication().createValueBinding(rowSpan.getValue()));
+ }
+ }
+
+ if (width != null) {
+ LOG.error(width.getValue());
+ if (width.isLiteral()) {
+ component.setWidth(Measure.parse(width.getValue()));
+ } else {
+ parent.setValueBinding(Attributes.WIDTH,
+ faceletContext.getFacesContext().getApplication().createValueBinding(width.getValue()));
+ }
+ }
+
+ if (height != null) {
+ LOG.error(height.getValue());
+ if (height.isLiteral()) {
+ component.setHeight(Measure.parse(height.getValue()));
+ } else {
+ parent.setValueBinding(Attributes.HEIGHT,
+ faceletContext.getFacesContext().getApplication().createValueBinding(height.getValue()));
+ }
+ }
+
+ if (minimumWidth != null) {
+ LOG.error(minimumWidth.getValue());
+ if (minimumWidth.isLiteral()) {
+ component.setMinimumWidth(Measure.parse(minimumWidth.getValue()));
+ } else {
+ parent.setValueBinding(Attributes.MINIMUM_WIDTH,
+ faceletContext.getFacesContext().getApplication().createValueBinding(minimumWidth.getValue()));
+ }
+ }
+
+ if (minimumHeight != null) {
+ LOG.error(minimumHeight.getValue());
+ if (minimumHeight.isLiteral()) {
+ component.setMinimumHeight(Measure.parse(minimumHeight.getValue()));
+ } else {
+ parent.setValueBinding(Attributes.MINIMUM_HEIGHT,
+ faceletContext.getFacesContext().getApplication().createValueBinding(minimumHeight.getValue()));
+ }
+ }
+
+ if (preferredWidth != null) {
+ LOG.error(preferredWidth.getValue());
+ if (preferredWidth.isLiteral()) {
+ component.setPreferredWidth(Measure.parse(preferredWidth.getValue()));
+ } else {
+ parent.setValueBinding(Attributes.PREFERRED_WIDTH,
+ faceletContext.getFacesContext().getApplication().createValueBinding(preferredWidth.getValue()));
+ }
+ }
+
+ if (preferredHeight != null) {
+ LOG.error(preferredHeight.getValue());
+ if (preferredHeight.isLiteral()) {
+ component.setPreferredHeight(Measure.parse(preferredHeight.getValue()));
+ } else {
+ parent.setValueBinding(Attributes.PREFERRED_HEIGHT,
+ faceletContext.getFacesContext().getApplication().createValueBinding(preferredHeight.getValue()));
+ }
+ }
+
+ if (maximumWidth != null) {
+ LOG.error(maximumWidth.getValue());
+ if (maximumWidth.isLiteral()) {
+ component.setMaximumWidth(Measure.parse(maximumWidth.getValue()));
+ } else {
+ parent.setValueBinding(Attributes.MAXIMUM_WIDTH,
+ faceletContext.getFacesContext().getApplication().createValueBinding(maximumWidth.getValue()));
+ }
+ }
+
+ if (maximumHeight != null) {
+ LOG.error(maximumHeight.getValue());
+ if (maximumHeight.isLiteral()) {
+ component.setMaximumHeight(Measure.parse(maximumHeight.getValue()));
+ } else {
+ parent.setValueBinding(Attributes.MAXIMUM_HEIGHT,
+ faceletContext.getFacesContext().getApplication().createValueBinding(maximumHeight.getValue()));
}
+ }
} else {
LOG.warn("");
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties?rev=797354&r1=797353&r2=797354&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties Fri Jul 24 07:43:05 2009
@@ -49,6 +49,12 @@
Box.paddingTopWhenToolbar=22
Box.extraPaddingHeightWhenToolbar=10
+#new layout manager // todo
+Box.leftOffset=6
+Box.topOffset=25
+Box.rightOffset=7
+Box.bottomOffset=7
+
Button.imageWidth=18
Button.paddingWidth=10
Button.fontWidth=8
Modified: myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties?rev=797354&r1=797353&r2=797354&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties Fri Jul 24 07:43:05 2009
@@ -22,6 +22,12 @@
Box.componentExtraWidth=0
Box.componentExtraHeight=0
+#new layout manager
+Box.leftOffset=6
+Box.topOffset=25
+Box.rightOffset=7
+Box.bottomOffset=7
+
DatePicker.fixedWidth=20
MenuBar.fixedHeight=17