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 2014/01/06 15:35:05 UTC
svn commit: r1555812 - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/
tobago-example/tobago-example-test/src/main/webapp/test/type/
Author: lofwyr
Date: Mon Jan 6 14:35:04 2014
New Revision: 1555812
URL: http://svn.apache.org/r1555812
Log:
TOBAGO-1354: Conversion of different types to Measure should be done automatically
Added:
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/type/measure-image-with-constraints.xhtml
- copied, changed from r1555711, myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/type/measure.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/type/measure-image-without-constraints.xhtml
Removed:
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/type/measure.xhtml
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutConstraintHandler.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/GridLayoutConstraintTag.java
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutConstraintHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutConstraintHandler.java?rev=1555812&r1=1555811&r2=1555812&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutConstraintHandler.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutConstraintHandler.java Mon Jan 6 14:35:04 2014
@@ -128,7 +128,7 @@ public class GridLayoutConstraintHandler
component.setWidth(Measure.valueOf(width.getValue()));
} else {
parent.setValueExpression(Attributes.WIDTH,
- width.getValueExpression(faceletContext, Measure.class));
+ width.getValueExpression(faceletContext, Object.class));
}
}
@@ -137,7 +137,7 @@ public class GridLayoutConstraintHandler
component.setHeight(Measure.valueOf(height.getValue()));
} else {
parent.setValueExpression(Attributes.HEIGHT,
- height.getValueExpression(faceletContext, Measure.class));
+ height.getValueExpression(faceletContext, Object.class));
}
}
@@ -146,7 +146,7 @@ public class GridLayoutConstraintHandler
component.setMinimumWidth(Measure.valueOf(minimumWidth.getValue()));
} else {
parent.setValueExpression(Attributes.MINIMUM_WIDTH,
- minimumWidth.getValueExpression(faceletContext, Measure.class));
+ minimumWidth.getValueExpression(faceletContext, Object.class));
}
}
@@ -155,7 +155,7 @@ public class GridLayoutConstraintHandler
component.setMinimumHeight(Measure.valueOf(minimumHeight.getValue()));
} else {
parent.setValueExpression(Attributes.MINIMUM_HEIGHT,
- minimumHeight.getValueExpression(faceletContext, Measure.class));
+ minimumHeight.getValueExpression(faceletContext, Object.class));
}
}
@@ -164,7 +164,7 @@ public class GridLayoutConstraintHandler
component.setPreferredWidth(Measure.valueOf(preferredWidth.getValue()));
} else {
parent.setValueExpression(Attributes.PREFERRED_WIDTH,
- preferredWidth.getValueExpression(faceletContext, Measure.class));
+ preferredWidth.getValueExpression(faceletContext, Object.class));
}
}
@@ -173,7 +173,7 @@ public class GridLayoutConstraintHandler
component.setPreferredHeight(Measure.valueOf(preferredHeight.getValue()));
} else {
parent.setValueExpression(Attributes.PREFERRED_HEIGHT,
- preferredHeight.getValueExpression(faceletContext, Measure.class));
+ preferredHeight.getValueExpression(faceletContext, Object.class));
}
}
@@ -182,7 +182,7 @@ public class GridLayoutConstraintHandler
component.setMaximumWidth(Measure.valueOf(maximumWidth.getValue()));
} else {
parent.setValueExpression(Attributes.MAXIMUM_WIDTH,
- maximumWidth.getValueExpression(faceletContext, Measure.class));
+ maximumWidth.getValueExpression(faceletContext, Object.class));
}
}
@@ -191,7 +191,7 @@ public class GridLayoutConstraintHandler
component.setMaximumHeight(Measure.valueOf(maximumHeight.getValue()));
} else {
parent.setValueExpression(Attributes.MAXIMUM_HEIGHT,
- maximumHeight.getValueExpression(faceletContext, Measure.class));
+ maximumHeight.getValueExpression(faceletContext, Object.class));
}
}
@@ -200,7 +200,7 @@ public class GridLayoutConstraintHandler
component.setMarginLeft(Measure.valueOf(marginLeft.getValue()));
} else {
parent.setValueExpression(Attributes.MARGIN_LEFT,
- marginLeft.getValueExpression(faceletContext, Measure.class));
+ marginLeft.getValueExpression(faceletContext, Object.class));
}
}
@@ -209,7 +209,7 @@ public class GridLayoutConstraintHandler
component.setMarginRight(Measure.valueOf(marginRight.getValue()));
} else {
parent.setValueExpression(Attributes.MARGIN_RIGHT,
- marginRight.getValueExpression(faceletContext, Measure.class));
+ marginRight.getValueExpression(faceletContext, Object.class));
}
}
@@ -218,7 +218,7 @@ public class GridLayoutConstraintHandler
component.setMarginTop(Measure.valueOf(marginTop.getValue()));
} else {
parent.setValueExpression(Attributes.MARGIN_TOP,
- marginTop.getValueExpression(faceletContext, Measure.class));
+ marginTop.getValueExpression(faceletContext, Object.class));
}
}
@@ -227,7 +227,7 @@ public class GridLayoutConstraintHandler
component.setMarginBottom(Measure.valueOf(marginBottom.getValue()));
} else {
parent.setValueExpression(Attributes.MARGIN_BOTTOM,
- marginBottom.getValueExpression(faceletContext, Measure.class));
+ marginBottom.getValueExpression(faceletContext, Object.class));
}
}
@@ -243,7 +243,7 @@ public class GridLayoutConstraintHandler
container.setBorderLeft(Measure.valueOf(borderLeft.getValue()));
} else {
parent.setValueExpression(Attributes.BORDER_LEFT,
- borderLeft.getValueExpression(faceletContext, Measure.class));
+ borderLeft.getValueExpression(faceletContext, Object.class));
}
}
@@ -252,7 +252,7 @@ public class GridLayoutConstraintHandler
container.setBorderRight(Measure.valueOf(borderRight.getValue()));
} else {
parent.setValueExpression(Attributes.BORDER_RIGHT,
- borderRight.getValueExpression(faceletContext, Measure.class));
+ borderRight.getValueExpression(faceletContext, Object.class));
}
}
@@ -261,7 +261,7 @@ public class GridLayoutConstraintHandler
container.setBorderTop(Measure.valueOf(borderTop.getValue()));
} else {
parent.setValueExpression(Attributes.BORDER_TOP,
- borderTop.getValueExpression(faceletContext, Measure.class));
+ borderTop.getValueExpression(faceletContext, Object.class));
}
}
@@ -270,7 +270,7 @@ public class GridLayoutConstraintHandler
container.setBorderBottom(Measure.valueOf(borderBottom.getValue()));
} else {
parent.setValueExpression(Attributes.BORDER_BOTTOM,
- borderBottom.getValueExpression(faceletContext, Measure.class));
+ borderBottom.getValueExpression(faceletContext, Object.class));
}
}
@@ -279,7 +279,7 @@ public class GridLayoutConstraintHandler
container.setPaddingLeft(Measure.valueOf(paddingLeft.getValue()));
} else {
parent.setValueExpression(Attributes.PADDING_LEFT,
- paddingLeft.getValueExpression(faceletContext, Measure.class));
+ paddingLeft.getValueExpression(faceletContext, Object.class));
}
}
@@ -288,7 +288,7 @@ public class GridLayoutConstraintHandler
container.setPaddingRight(Measure.valueOf(paddingRight.getValue()));
} else {
parent.setValueExpression(Attributes.PADDING_RIGHT,
- paddingRight.getValueExpression(faceletContext, Measure.class));
+ paddingRight.getValueExpression(faceletContext, Object.class));
}
}
@@ -297,7 +297,7 @@ public class GridLayoutConstraintHandler
container.setPaddingTop(Measure.valueOf(paddingTop.getValue()));
} else {
parent.setValueExpression(Attributes.PADDING_TOP,
- paddingTop.getValueExpression(faceletContext, Measure.class));
+ paddingTop.getValueExpression(faceletContext, Object.class));
}
}
@@ -306,7 +306,7 @@ public class GridLayoutConstraintHandler
container.setPaddingBottom(Measure.valueOf(paddingBottom.getValue()));
} else {
parent.setValueExpression(Attributes.PADDING_BOTTOM,
- paddingBottom.getValueExpression(faceletContext, Measure.class));
+ paddingBottom.getValueExpression(faceletContext, Object.class));
}
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/GridLayoutConstraintTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/GridLayoutConstraintTag.java?rev=1555812&r1=1555811&r2=1555812&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/GridLayoutConstraintTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/GridLayoutConstraintTag.java Mon Jan 6 14:35:04 2014
@@ -28,11 +28,14 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.layout.LayoutBase;
import org.apache.myfaces.tobago.layout.LayoutComponent;
import org.apache.myfaces.tobago.layout.LayoutContainer;
+import org.apache.myfaces.tobago.layout.Measure;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.el.ELContext;
import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
import javax.faces.webapp.UIComponentClassicTagBase;
import javax.faces.webapp.UIComponentELTag;
import javax.servlet.jsp.JspException;
@@ -99,13 +102,11 @@ public abstract class GridLayoutConstrai
component = component.getParent();
}
- if (!(component instanceof LayoutBase)) {
- // TODO Message resource i18n
- throw new JspException("Component Instance is not a LayoutBase");
- }
-
+ final LayoutBase layoutBase = (LayoutBase) component;
final boolean isLayoutContainer = component instanceof LayoutContainer;
final boolean isLayoutComponent = component instanceof LayoutComponent;
+ final LayoutContainer layoutContainer = isLayoutContainer ? (LayoutContainer) component : null;
+ final ELContext elContext = FacesContext.getCurrentInstance().getELContext();
if (columnSpan != null) {
if (isLayoutComponent) {
@@ -124,56 +125,108 @@ public abstract class GridLayoutConstrai
}
if (width != null) {
- component.setValueExpression(Attributes.WIDTH, width);
+ if (width.isLiteralText()) {
+ layoutBase.setWidth(Measure.valueOf(width.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.WIDTH, width);
+ }
}
if (height != null) {
- component.setValueExpression(Attributes.HEIGHT, height);
+ if (height.isLiteralText()) {
+ layoutBase.setHeight(Measure.valueOf(height.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.HEIGHT, height);
+ }
}
if (minimumWidth != null) {
- component.setValueExpression(Attributes.MINIMUM_WIDTH, minimumWidth);
+ if (minimumWidth.isLiteralText()) {
+ layoutBase.setMinimumWidth(Measure.valueOf(minimumWidth.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.MINIMUM_WIDTH, minimumWidth);
+ }
}
if (minimumHeight != null) {
- component.setValueExpression(Attributes.MINIMUM_HEIGHT, minimumHeight);
+ if (minimumHeight.isLiteralText()) {
+ layoutBase.setMinimumHeight(Measure.valueOf(minimumHeight.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.MINIMUM_HEIGHT, minimumHeight);
+ }
}
if (preferredWidth != null) {
- component.setValueExpression(Attributes.PREFERRED_WIDTH, preferredWidth);
+ if (preferredWidth.isLiteralText()) {
+ layoutBase.setPreferredWidth(Measure.valueOf(preferredWidth.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.PREFERRED_WIDTH, preferredWidth);
+ }
}
if (preferredHeight != null) {
- component.setValueExpression(Attributes.PREFERRED_HEIGHT, preferredHeight);
+ if (preferredHeight.isLiteralText()) {
+ layoutBase.setPreferredHeight(Measure.valueOf(preferredHeight.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.PREFERRED_HEIGHT, preferredHeight);
+ }
}
if (maximumWidth != null) {
- component.setValueExpression(Attributes.MAXIMUM_WIDTH, maximumWidth);
+ if (maximumWidth.isLiteralText()) {
+ layoutBase.setMaximumWidth(Measure.valueOf(maximumWidth.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.MAXIMUM_WIDTH, maximumWidth);
+ }
}
if (maximumHeight != null) {
- component.setValueExpression(Attributes.MAXIMUM_HEIGHT, maximumHeight);
+ if (maximumHeight.isLiteralText()) {
+ layoutBase.setMaximumHeight(Measure.valueOf(maximumHeight.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.MAXIMUM_HEIGHT, maximumHeight);
+ }
}
if (marginLeft != null) {
- component.setValueExpression(Attributes.MARGIN_LEFT, marginLeft);
+ if (marginLeft.isLiteralText()) {
+ layoutBase.setMarginLeft(Measure.valueOf(marginLeft.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.MARGIN_LEFT, marginLeft);
+ }
}
if (marginRight != null) {
- component.setValueExpression(Attributes.MARGIN_RIGHT, marginRight);
+ if (marginRight.isLiteralText()) {
+ layoutBase.setMarginRight(Measure.valueOf(marginRight.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.MARGIN_RIGHT, marginRight);
+ }
}
if (marginTop != null) {
- component.setValueExpression(Attributes.MARGIN_TOP, marginTop);
+ if (marginTop.isLiteralText()) {
+ layoutBase.setMarginTop(Measure.valueOf(marginTop.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.MARGIN_TOP, marginTop);
+ }
}
if (marginBottom != null) {
- component.setValueExpression(Attributes.MARGIN_BOTTOM, marginBottom);
+ if (marginBottom.isLiteralText()) {
+ layoutBase.setMarginBottom(Measure.valueOf(marginBottom.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.MARGIN_BOTTOM, marginBottom);
+ }
}
if (borderLeft != null) {
if (isLayoutContainer) {
- component.setValueExpression(Attributes.BORDER_LEFT, borderLeft);
+ if (borderLeft.isLiteralText()) {
+ layoutContainer.setBorderLeft(Measure.valueOf(borderLeft.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.BORDER_LEFT, borderLeft);
+ }
} else {
LOG.warn("Ignoring '" + Attributes.BORDER_LEFT + "', because the parent is not a LayoutContainer!");
}
@@ -181,14 +234,23 @@ public abstract class GridLayoutConstrai
if (borderRight != null) {
if (isLayoutContainer) {
- component.setValueExpression(Attributes.BORDER_RIGHT, borderRight);
+ if (borderRight.isLiteralText()) {
+ layoutContainer.setBorderRight(Measure.valueOf(borderRight.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.BORDER_RIGHT, borderRight);
+ }
} else {
LOG.warn("Ignoring '" + Attributes.BORDER_RIGHT + "', because the parent is not a LayoutContainer!");
}
}
+
if (borderTop != null) {
if (isLayoutContainer) {
- component.setValueExpression(Attributes.BORDER_TOP, borderTop);
+ if (borderTop.isLiteralText()) {
+ layoutContainer.setBorderTop(Measure.valueOf(borderTop.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.BORDER_TOP, borderTop);
+ }
} else {
LOG.warn("Ignoring '" + Attributes.BORDER_TOP + "', because the parent is not a LayoutContainer!");
}
@@ -196,7 +258,11 @@ public abstract class GridLayoutConstrai
if (borderBottom != null) {
if (isLayoutContainer) {
- component.setValueExpression(Attributes.BORDER_BOTTOM, borderBottom);
+ if (borderBottom.isLiteralText()) {
+ layoutContainer.setBorderBottom(Measure.valueOf(borderBottom.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.BORDER_BOTTOM, borderBottom);
+ }
} else {
LOG.warn("Ignoring '" + Attributes.BORDER_BOTTOM + "', because the parent is not a LayoutContainer!");
}
@@ -204,7 +270,11 @@ public abstract class GridLayoutConstrai
if (paddingLeft != null) {
if (isLayoutContainer) {
- component.setValueExpression(Attributes.PADDING_LEFT, paddingLeft);
+ if (paddingLeft.isLiteralText()) {
+ layoutContainer.setPaddingLeft(Measure.valueOf(paddingLeft.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.PADDING_LEFT, paddingLeft);
+ }
} else {
LOG.warn("Ignoring '" + Attributes.PADDING_LEFT + "', because the parent is not a LayoutContainer!");
}
@@ -212,14 +282,22 @@ public abstract class GridLayoutConstrai
if (paddingRight != null) {
if (isLayoutContainer) {
- component.setValueExpression(Attributes.PADDING_RIGHT, paddingRight);
+ if (paddingRight.isLiteralText()) {
+ layoutContainer.setPaddingRight(Measure.valueOf(paddingRight.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.PADDING_RIGHT, paddingRight);
+ }
} else {
LOG.warn("Ignoring '" + Attributes.PADDING_RIGHT + "', because the parent is not a LayoutContainer!");
}
}
if (paddingTop != null) {
if (isLayoutContainer) {
- component.setValueExpression(Attributes.PADDING_TOP, paddingTop);
+ if (paddingTop.isLiteralText()) {
+ layoutContainer.setPaddingTop(Measure.valueOf(paddingTop.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.PADDING_TOP, paddingTop);
+ }
} else {
LOG.warn("Ignoring '" + Attributes.PADDING_TOP + "', because the parent is not a LayoutContainer!");
}
@@ -227,7 +305,11 @@ public abstract class GridLayoutConstrai
if (paddingBottom != null) {
if (isLayoutContainer) {
- component.setValueExpression(Attributes.PADDING_BOTTOM, paddingBottom);
+ if (paddingBottom.isLiteralText()) {
+ layoutContainer.setPaddingBottom(Measure.valueOf(paddingBottom.getValue(elContext)));
+ } else {
+ component.setValueExpression(Attributes.PADDING_BOTTOM, paddingBottom);
+ }
} else {
LOG.warn("Ignoring '" + Attributes.PADDING_BOTTOM + "', because the parent is not a LayoutContainer!");
}
@@ -282,8 +364,8 @@ public abstract class GridLayoutConstrai
/**
* The width for this component.
*/
- @TagAttribute(name = "width", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "width", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setWidth(final ValueExpression width) {
this.width = width;
}
@@ -291,8 +373,8 @@ public abstract class GridLayoutConstrai
/**
* The height for this component.
*/
- @TagAttribute(name = "height", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "height", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setHeight(final ValueExpression height) {
this.height = height;
}
@@ -300,8 +382,8 @@ public abstract class GridLayoutConstrai
/**
* The minimum width for this component.
*/
- @TagAttribute(name = "minimumWidth", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "minimumWidth", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setMinimumWidth(final ValueExpression minimumWidth) {
this.minimumWidth = minimumWidth;
}
@@ -309,8 +391,8 @@ public abstract class GridLayoutConstrai
/**
* The minimum height for this component.
*/
- @TagAttribute(name = "minimumHeight", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "minimumHeight", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setMinimumHeight(final ValueExpression minimumHeight) {
this.minimumHeight = minimumHeight;
}
@@ -318,8 +400,8 @@ public abstract class GridLayoutConstrai
/**
* The preferred width for this component.
*/
- @TagAttribute(name = "preferredWidth", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "preferredWidth", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setPreferredWidth(final ValueExpression preferredWidth) {
this.preferredWidth = preferredWidth;
}
@@ -327,8 +409,8 @@ public abstract class GridLayoutConstrai
/**
* The preferred height for this component.
*/
- @TagAttribute(name = "preferredHeight", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "preferredHeight", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setPreferredHeight(final ValueExpression preferredHeight) {
this.preferredHeight = preferredHeight;
}
@@ -336,8 +418,8 @@ public abstract class GridLayoutConstrai
/**
* The maximum width for this component.
*/
- @TagAttribute(name = "maximumWidth", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "maximumWidth", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setMaximumWidth(final ValueExpression maximumWidth) {
this.maximumWidth = maximumWidth;
}
@@ -345,8 +427,8 @@ public abstract class GridLayoutConstrai
/**
* The maximum height for this component.
*/
- @TagAttribute(name = "maximumHeight", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "maximumHeight", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setMaximumHeight(final ValueExpression maximumHeight) {
this.maximumHeight = maximumHeight;
}
@@ -354,8 +436,8 @@ public abstract class GridLayoutConstrai
/**
* The left margin for this component.
*/
- @TagAttribute(name = "marginLeft", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "marginLeft", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setMarginLeft(final ValueExpression marginLeft) {
this.marginLeft = marginLeft;
}
@@ -363,8 +445,8 @@ public abstract class GridLayoutConstrai
/**
* The right margin for this component.
*/
- @TagAttribute(name = "marginRight", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "marginRight", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setMarginRight(final ValueExpression marginRight) {
this.marginRight = marginRight;
}
@@ -372,8 +454,8 @@ public abstract class GridLayoutConstrai
/**
* The top margin for this component.
*/
- @TagAttribute(name = "marginTop", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "marginTop", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setMarginTop(final ValueExpression marginTop) {
this.marginTop = marginTop;
}
@@ -381,8 +463,8 @@ public abstract class GridLayoutConstrai
/**
* The bottom margin for this component.
*/
- @TagAttribute(name = "marginBottom", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "marginBottom", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setMarginBottom(final ValueExpression marginBottom) {
this.marginBottom = marginBottom;
}
@@ -390,8 +472,8 @@ public abstract class GridLayoutConstrai
/**
* The left border area for this component. Its only applicably for containers.
*/
- @TagAttribute(name = "borderLeft", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "borderLeft", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setBorderLeft(final ValueExpression borderLeft) {
this.borderLeft = borderLeft;
}
@@ -399,8 +481,8 @@ public abstract class GridLayoutConstrai
/**
* The right border area for this component. Its only applicably for containers.
*/
- @TagAttribute(name = "borderRight", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "borderRight", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setBorderRight(final ValueExpression borderRight) {
this.borderRight = borderRight;
}
@@ -408,8 +490,8 @@ public abstract class GridLayoutConstrai
/**
* The top border area for this component. Its only applicably for containers.
*/
- @TagAttribute(name = "borderTop", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "borderTop", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setBorderTop(final ValueExpression borderTop) {
this.borderTop = borderTop;
}
@@ -417,8 +499,8 @@ public abstract class GridLayoutConstrai
/**
* The bottom border area for this component. Its only applicably for containers.
*/
- @TagAttribute(name = "borderBottom", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "borderBottom", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setBorderBottom(final ValueExpression borderBottom) {
this.borderBottom = borderBottom;
}
@@ -426,8 +508,8 @@ public abstract class GridLayoutConstrai
/**
* The left padding for this component. Its only applicably for containers.
*/
- @TagAttribute(name = "paddingLeft", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "paddingLeft", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setPaddingLeft(final ValueExpression paddingLeft) {
this.paddingLeft = paddingLeft;
}
@@ -435,8 +517,8 @@ public abstract class GridLayoutConstrai
/**
* The right padding for this component. Its only applicably for containers.
*/
- @TagAttribute(name = "paddingRight", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "paddingRight", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setPaddingRight(final ValueExpression paddingRight) {
this.paddingRight = paddingRight;
}
@@ -444,8 +526,8 @@ public abstract class GridLayoutConstrai
/**
* The top padding for this component. Its only applicably for containers.
*/
- @TagAttribute(name = "paddingTop", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "paddingTop", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setPaddingTop(final ValueExpression paddingTop) {
this.paddingTop = paddingTop;
}
@@ -453,8 +535,8 @@ public abstract class GridLayoutConstrai
/**
* The bottom padding for this component. Its only applicably for containers.
*/
- @TagAttribute(name = "paddingBottom", type = "org.apache.myfaces.tobago.layout.Measure")
- @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ @TagAttribute(name = "paddingBottom", type = "java.lang.Object")
+ @UIComponentTagAttribute(type = "java.lang.Object")
public void setPaddingBottom(final ValueExpression paddingBottom) {
this.paddingBottom = paddingBottom;
}
Copied: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/type/measure-image-with-constraints.xhtml (from r1555711, myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/type/measure.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/type/measure-image-with-constraints.xhtml?p2=myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/type/measure-image-with-constraints.xhtml&p1=myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/type/measure.xhtml&r1=1555711&r2=1555812&rev=1555812&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/type/measure.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/type/measure-image-with-constraints.xhtml Mon Jan 6 14:35:04 2014
@@ -132,76 +132,6 @@
maximumWidth="#{measureBean.anyWidth}" maximumHeight="#{measureBean.anyHeight}"/>
</tc:image>
- <tc:image id="j-0" value="pidgeon-point.jpg" width="100px" height="95px">
- <tc:dataAttribute name="assert-left" value="0"/>
- <tc:dataAttribute name="assert-top" value="900"/>
- <tc:dataAttribute name="assert-width" value="100"/>
- <tc:dataAttribute name="assert-height" value="95"/>
- </tc:image>
-
- <tc:image id="j-1" value="pidgeon-point.jpg" width="150" height="95">
- <tc:dataAttribute name="assert-left" value="0"/>
- <tc:dataAttribute name="assert-top" value="1000"/>
- <tc:dataAttribute name="assert-width" value="150"/>
- <tc:dataAttribute name="assert-height" value="95"/>
- </tc:image>
-
- <tc:image id="j-2" value="pidgeon-point.jpg"
- width="#{measureBean.intWidth}" height="#{measureBean.intHeight}">
- <tc:dataAttribute name="assert-left" value="0"/>
- <tc:dataAttribute name="assert-top" value="1100"/>
- <tc:dataAttribute name="assert-width" value="200"/>
- <tc:dataAttribute name="assert-height" value="95"/>
- </tc:image>
-
- <tc:image id="j-3" value="pidgeon-point.jpg"
- width="#{measureBean.integerWidth}" height="#{measureBean.integerHeight}">
- <tc:dataAttribute name="assert-left" value="0"/>
- <tc:dataAttribute name="assert-top" value="1200"/>
- <tc:dataAttribute name="assert-width" value="250"/>
- <tc:dataAttribute name="assert-height" value="95"/>
- </tc:image>
-
- <tc:image id="j-4" value="pidgeon-point.jpg"
- width="#{measureBean.measureWidth}" height="#{measureBean.measureHeight}">
- <tc:dataAttribute name="assert-left" value="0"/>
- <tc:dataAttribute name="assert-top" value="1300"/>
- <tc:dataAttribute name="assert-width" value="300"/>
- <tc:dataAttribute name="assert-height" value="95"/>
- </tc:image>
-
- <tc:image id="j-5" value="pidgeon-point.jpg"
- width="#{measureBean.stringWidth}" height="#{measureBean.stringHeight}">
- <tc:dataAttribute name="assert-left" value="0"/>
- <tc:dataAttribute name="assert-top" value="1400"/>
- <tc:dataAttribute name="assert-width" value="350"/>
- <tc:dataAttribute name="assert-height" value="95"/>
- </tc:image>
-
- <tc:image id="j-6" value="pidgeon-point.jpg"
- width="#{measureBean.stringPxWidth}" height="#{measureBean.stringPxHeight}">
- <tc:dataAttribute name="assert-left" value="0"/>
- <tc:dataAttribute name="assert-top" value="1500"/>
- <tc:dataAttribute name="assert-width" value="400"/>
- <tc:dataAttribute name="assert-height" value="95"/>
- </tc:image>
-
- <tc:image id="j-7" value="pidgeon-point.jpg"
- width="#{measureBean.longWidth}" height="#{measureBean.longHeight}">
- <tc:dataAttribute name="assert-left" value="0"/>
- <tc:dataAttribute name="assert-top" value="1600"/>
- <tc:dataAttribute name="assert-width" value="450"/>
- <tc:dataAttribute name="assert-height" value="95"/>
- </tc:image>
-
- <tc:image id="j-8" value="pidgeon-point.jpg"
- width="#{measureBean.anyWidth}" height="#{measureBean.anyHeight}">
- <tc:dataAttribute name="assert-left" value="0"/>
- <tc:dataAttribute name="assert-top" value="1700"/>
- <tc:dataAttribute name="assert-width" value="500"/>
- <tc:dataAttribute name="assert-height" value="95"/>
- </tc:image>
-
<!-- fixme: this filler is not nice, should work automatically -->
<tc:cell>
<tc:gridLayoutConstraint width="100px" height="200px"/>
Added: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/type/measure-image-without-constraints.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/type/measure-image-without-constraints.xhtml?rev=1555812&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/type/measure-image-without-constraints.xhtml (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/type/measure-image-without-constraints.xhtml Mon Jan 6 14:35:04 2014
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<f:view
+ xmlns:tc="http://myfaces.apache.org/tobago/component"
+ xmlns:tx="http://myfaces.apache.org/tobago/extension"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+ <tc:page id="page">
+ <tc:gridLayoutConstraint width="600px" height="2000px"/>
+ <f:facet name="layout">
+ <tc:gridLayout rows="auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto"/>
+ </f:facet>
+ <!--
+ Test of different ways to set the size of tc:gridLayoutConstraint and tc:image.
+ There are literals like "100" or "100px" and
+ different types like: Measure, Integer, int, String (?)
+ -->
+
+ <tc:image id="j-0" value="pidgeon-point.jpg" width="100px" height="95px">
+ <tc:dataAttribute name="assert-left" value="0"/>
+ <tc:dataAttribute name="assert-top" value="0"/>
+ <tc:dataAttribute name="assert-width" value="100"/>
+ <tc:dataAttribute name="assert-height" value="95"/>
+ </tc:image>
+
+ <tc:image id="j-1" value="pidgeon-point.jpg" width="150" height="95">
+ <tc:dataAttribute name="assert-left" value="0"/>
+ <tc:dataAttribute name="assert-top" value="100"/>
+ <tc:dataAttribute name="assert-width" value="150"/>
+ <tc:dataAttribute name="assert-height" value="95"/>
+ </tc:image>
+
+ <tc:image id="j-2" value="pidgeon-point.jpg"
+ width="#{measureBean.intWidth}" height="#{measureBean.intHeight}">
+ <tc:dataAttribute name="assert-left" value="0"/>
+ <tc:dataAttribute name="assert-top" value="200"/>
+ <tc:dataAttribute name="assert-width" value="200"/>
+ <tc:dataAttribute name="assert-height" value="95"/>
+ </tc:image>
+
+ <tc:image id="j-3" value="pidgeon-point.jpg"
+ width="#{measureBean.integerWidth}" height="#{measureBean.integerHeight}">
+ <tc:dataAttribute name="assert-left" value="0"/>
+ <tc:dataAttribute name="assert-top" value="300"/>
+ <tc:dataAttribute name="assert-width" value="250"/>
+ <tc:dataAttribute name="assert-height" value="95"/>
+ </tc:image>
+
+ <tc:image id="j-4" value="pidgeon-point.jpg"
+ width="#{measureBean.measureWidth}" height="#{measureBean.measureHeight}">
+ <tc:dataAttribute name="assert-left" value="0"/>
+ <tc:dataAttribute name="assert-top" value="400"/>
+ <tc:dataAttribute name="assert-width" value="300"/>
+ <tc:dataAttribute name="assert-height" value="95"/>
+ </tc:image>
+
+ <tc:image id="j-5" value="pidgeon-point.jpg"
+ width="#{measureBean.stringWidth}" height="#{measureBean.stringHeight}">
+ <tc:dataAttribute name="assert-left" value="0"/>
+ <tc:dataAttribute name="assert-top" value="500"/>
+ <tc:dataAttribute name="assert-width" value="350"/>
+ <tc:dataAttribute name="assert-height" value="95"/>
+ </tc:image>
+
+ <tc:image id="j-6" value="pidgeon-point.jpg"
+ width="#{measureBean.stringPxWidth}" height="#{measureBean.stringPxHeight}">
+ <tc:dataAttribute name="assert-left" value="0"/>
+ <tc:dataAttribute name="assert-top" value="600"/>
+ <tc:dataAttribute name="assert-width" value="400"/>
+ <tc:dataAttribute name="assert-height" value="95"/>
+ </tc:image>
+
+ <tc:image id="j-7" value="pidgeon-point.jpg"
+ width="#{measureBean.longWidth}" height="#{measureBean.longHeight}">
+ <tc:dataAttribute name="assert-left" value="0"/>
+ <tc:dataAttribute name="assert-top" value="700"/>
+ <tc:dataAttribute name="assert-width" value="450"/>
+ <tc:dataAttribute name="assert-height" value="95"/>
+ </tc:image>
+
+ <tc:image id="j-8" value="pidgeon-point.jpg"
+ width="#{measureBean.anyWidth}" height="#{measureBean.anyHeight}">
+ <tc:dataAttribute name="assert-left" value="0"/>
+ <tc:dataAttribute name="assert-top" value="800"/>
+ <tc:dataAttribute name="assert-width" value="500"/>
+ <tc:dataAttribute name="assert-height" value="95"/>
+ </tc:image>
+
+ <!-- fixme: this filler is not nice, should work automatically -->
+ <tc:cell>
+ <tc:gridLayoutConstraint width="100px" height="200px"/>
+ </tc:cell>
+
+ <tc:script file="script/tobago-assert.js"/>
+
+ </tc:page>
+</f:view>