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/06/26 14:13:47 UTC
svn commit: r788668 [3/6] - in /myfaces/tobago/trunk: core/
core/src/main/java/org/apache/myfaces/tobago/component/
core/src/main/java/org/apache/myfaces/tobago/context/
core/src/main/java/org/apache/myfaces/tobago/layout/
core/src/main/java/org/apache...
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutConstraintTag.java (from r766599, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupReferenceTag.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutConstraintTag.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutConstraintTag.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupReferenceTag.java&r1=766599&r2=788668&rev=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupReferenceTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutConstraintTag.java Fri Jun 26 12:13:41 2009
@@ -21,35 +21,96 @@
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
-import org.apache.myfaces.tobago.event.PopupActionListener;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+import org.apache.myfaces.tobago.component.Attributes;
+import org.apache.myfaces.tobago.layout.Component;
+import org.apache.myfaces.tobago.layout.Measure;
-import javax.faces.component.ActionSource;
import javax.faces.component.UIComponent;
+import javax.faces.el.ValueBinding;
import javax.faces.webapp.UIComponentTag;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
-/*
- * Date: Jan 3, 2007
- * Time: 10:42:11 PM
- */
-
/**
* Register an PopupActionListener instance on the UIComponent
* associated with the closest parent UIComponent.
*/
-@Tag(name = "popupReference", bodyContent = BodyContent.EMPTY)
-@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.PopupReferenceTag")
-public abstract class PopupReferenceTag extends TagSupport {
+@Tag(name = "gridLayoutConstraint", bodyContent = BodyContent.EMPTY)
+@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.GridLayoutConstraintTag")
+public abstract class GridLayoutConstraintTag extends TagSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * @param columnSpan The number of horizontal cells this component should use.
+ */
+ @TagAttribute
+ public abstract void setColumnSpan(String columnSpan);
+
+ /**
+ * @param rowSpan The number of vertical cells this component should use.
+ */
+ @TagAttribute
+ public abstract void setRowSpan(String rowSpan);
+
+ /**
+ * @param width The width for this component.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ public abstract void setWidth(String width);
+
+ /**
+ * @param height The height for this component.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ public abstract void setHeight(String height);
- private static final long serialVersionUID = -8444689365088370011L;
+ /**
+ * @param minimumWidth The minimum width for this component.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ public abstract void setMinimumWidth(String minimumWidth);
+
+ /**
+ * @param minimumHeight The minimum height for this component.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ public abstract void setMinimumHeight(String minimumHeight);
+
+ /**
+ * @param preferredWidth The preferred width for this component.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ public abstract void setPreferredWidth(String preferredWidth);
+
+ /**
+ * @param preferredHeight The preferred height for this component.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ public abstract void setPreferredHeight(String preferredHeight);
/**
- * The id of a Popup.
+ * @param maximumWidth The maximum width for this component.
*/
- @TagAttribute(required = true, name ="for")
- public abstract String getForValue();
+ @TagAttribute
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ public abstract void setMaximumWidth(String maximumWidth);
+ /**
+ * @param maximumHeight The maximum height for this component.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ public abstract void setMaximumHeight(String maximumHeight);
+
+ @Override
public int doStartTag() throws JspException {
// Locate our parent UIComponentTag
@@ -69,13 +130,193 @@
// TODO Message resource i18n
throw new JspException("Component Instance is null");
}
- if (!(component instanceof ActionSource)) {
+
+ if (!(component instanceof Component)) {
// TODO Message resource i18n
- throw new JspException("Component " + component.getClass().getName() + " is not instanceof ActionSource");
+ throw new JspException("Component Instance is not a LayoutComponent");
}
- ActionSource actionSource = (ActionSource) component;
- actionSource.addActionListener(new PopupActionListener(getForValue()));
+
+ if (isColumnSpanSet()) {
+ if (isColumnSpanLiteral()) {
+ ((Component) component).setColumnSpan(Integer.valueOf(getColumnSpanExpression()));
+ } else {
+ component.setValueBinding(Attributes.COLUMN_SPAN, (ValueBinding) getColumnSpanAsBindingOrExpression());
+ }
+ }
+
+ if (isRowSpanSet()) {
+ if (isRowSpanLiteral()) {
+ ((Component) component).setRowSpan(Integer.valueOf(getRowSpanExpression()));
+ } else {
+ component.setValueBinding(Attributes.ROW_SPAN, (ValueBinding) getRowSpanAsBindingOrExpression());
+ }
+ }
+
+ if (isWidthSet()) {
+ if (isWidthLiteral()) {
+ ((Component) component).setWidth(Measure.parse(getWidthExpression()));
+ } else {
+ component.setValueBinding(Attributes.WIDTH, (ValueBinding) getWidthAsBindingOrExpression());
+ }
+ }
+
+ if (isHeightSet()) {
+ if (isHeightLiteral()) {
+ ((Component) component).setHeight(Measure.parse(getHeightExpression()));
+ } else {
+ component.setValueBinding(Attributes.HEIGHT, (ValueBinding) getHeightAsBindingOrExpression());
+ }
+ }
+
+ if (isMinimumWidthSet()) {
+ if (isMinimumWidthLiteral()) {
+ ((Component) component).setMinimumWidth(Measure.parse(getMinimumWidthExpression()));
+ } else {
+ component.setValueBinding(Attributes.MINIMUM_WIDTH, (ValueBinding) getMinimumWidthAsBindingOrExpression());
+ }
+ }
+
+ if (isMinimumHeightSet()) {
+ if (isMinimumHeightLiteral()) {
+ ((Component) component).setMinimumHeight(Measure.parse(getMinimumHeightExpression()));
+ } else {
+ component.setValueBinding(Attributes.MINIMUM_WIDTH, (ValueBinding) getMinimumHeightAsBindingOrExpression());
+ }
+ }
+
+ if (isPreferredWidthSet()) {
+ if (isPreferredWidthLiteral()) {
+ ((Component) component).setPreferredWidth(Measure.parse(getPreferredWidthExpression()));
+ } else {
+ component.setValueBinding(Attributes.PREFERRED_WIDTH, (ValueBinding) getPreferredWidthAsBindingOrExpression());
+ }
+ }
+
+ if (isPreferredHeightSet()) {
+ if (isPreferredHeightLiteral()) {
+ ((Component) component).setPreferredHeight(Measure.parse(getPreferredHeightExpression()));
+ } else {
+ component.setValueBinding(Attributes.PREFERRED_WIDTH, (ValueBinding) getPreferredHeightAsBindingOrExpression());
+ }
+ }
+
+ if (isMaximumWidthSet()) {
+ if (isMaximumWidthLiteral()) {
+ ((Component) component).setMaximumWidth(Measure.parse(getMaximumWidthExpression()));
+ } else {
+ component.setValueBinding(Attributes.MAXIMUM_WIDTH, (ValueBinding) getMaximumWidthAsBindingOrExpression());
+ }
+ }
+
+ if (isMaximumHeightSet()) {
+ if (isMaximumHeightLiteral()) {
+ ((Component) component).setMaximumHeight(Measure.parse(getMaximumHeightExpression()));
+ } else {
+ component.setValueBinding(Attributes.MAXIMUM_WIDTH, (ValueBinding) getMaximumHeightAsBindingOrExpression());
+ }
+ }
+
return (SKIP_BODY);
}
+ // column span
+
+ public abstract boolean isColumnSpanSet();
+
+ public abstract boolean isColumnSpanLiteral();
+
+ public abstract Object getColumnSpanAsBindingOrExpression();
+
+ public abstract String getColumnSpanExpression();
+
+ // row span
+
+ public abstract boolean isRowSpanSet();
+
+ public abstract boolean isRowSpanLiteral();
+
+ public abstract Object getRowSpanAsBindingOrExpression();
+
+ public abstract String getRowSpanExpression();
+
+ // width
+
+ public abstract boolean isWidthSet();
+
+ public abstract boolean isWidthLiteral();
+
+ public abstract Object getWidthAsBindingOrExpression();
+
+ public abstract String getWidthExpression();
+
+ // height
+
+ public abstract boolean isHeightSet();
+
+ public abstract boolean isHeightLiteral();
+
+ public abstract Object getHeightAsBindingOrExpression();
+
+ public abstract String getHeightExpression();
+
+ // minimum width
+
+ public abstract boolean isMinimumWidthSet();
+
+ public abstract boolean isMinimumWidthLiteral();
+
+ public abstract Object getMinimumWidthAsBindingOrExpression();
+
+ public abstract String getMinimumWidthExpression();
+
+ // minimum height
+
+ public abstract boolean isMinimumHeightSet();
+
+ public abstract boolean isMinimumHeightLiteral();
+
+ public abstract Object getMinimumHeightAsBindingOrExpression();
+
+ public abstract String getMinimumHeightExpression();
+
+ // preferred width
+
+ public abstract boolean isPreferredWidthSet();
+
+ public abstract boolean isPreferredWidthLiteral();
+
+ public abstract Object getPreferredWidthAsBindingOrExpression();
+
+ public abstract String getPreferredWidthExpression();
+
+ // preferred height
+
+ public abstract boolean isPreferredHeightSet();
+
+ public abstract boolean isPreferredHeightLiteral();
+
+ public abstract Object getPreferredHeightAsBindingOrExpression();
+
+ public abstract String getPreferredHeightExpression();
+
+ // maximum width
+
+ public abstract boolean isMaximumWidthSet();
+
+ public abstract boolean isMaximumWidthLiteral();
+
+ public abstract Object getMaximumWidthAsBindingOrExpression();
+
+ public abstract String getMaximumWidthExpression();
+
+ // maximum height
+
+ public abstract boolean isMaximumHeightSet();
+
+ public abstract boolean isMaximumHeightLiteral();
+
+ public abstract Object getMaximumHeightAsBindingOrExpression();
+
+ public abstract String getMaximumHeightExpression();
+
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ImageTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ImageTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ImageTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ImageTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -24,15 +24,10 @@
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.taglib.decl.HasBorder;
-import org.apache.myfaces.tobago.taglib.decl.HasDimension;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
import org.apache.myfaces.tobago.taglib.decl.HasTip;
+import org.apache.myfaces.tobago.taglib.decl.IsGridLayoutComponentWithDeprecatedDimension;
-/*
- * Created: Aug 6, 2005 3:19:55 PM
- * User: bommel
- * $Id$
- */
/**
* Renders a Image.
*/
@@ -42,7 +37,8 @@
uiComponentBaseClass = "javax.faces.component.UIGraphic",
rendererType = RendererTypes.IMAGE,
allowedChildComponenents = "NONE")
-public interface ImageTagDeclaration extends HasIdBindingAndRendered, HasBorder, HasDimension, HasTip {
+public interface ImageTagDeclaration
+ extends HasIdBindingAndRendered, HasBorder, HasTip, IsGridLayoutComponentWithDeprecatedDimension {
/**
* Absolute url to an image or image name to lookup in tobago resource path
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -26,9 +26,7 @@
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.taglib.decl.HasConverter;
-import org.apache.myfaces.tobago.taglib.decl.HasDeprecatedWidth;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
-import org.apache.myfaces.tobago.taglib.decl.HasLabelAndAccessKey;
import org.apache.myfaces.tobago.taglib.decl.HasSuggestMethod;
import org.apache.myfaces.tobago.taglib.decl.HasTip;
import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
@@ -37,11 +35,6 @@
import org.apache.myfaces.tobago.taglib.decl.IsReadonly;
import org.apache.myfaces.tobago.taglib.decl.IsRequired;
-/*
- * Created: Aug 5, 2005 4:53:25 PM
- * User: bommel
- * $Id$
- */
/**
* Renders a text input field.
*/
@@ -61,9 +54,7 @@
})
public interface InTagDeclaration
extends TextInputTagDeclaration, HasIdBindingAndRendered,
- HasConverter, IsReadonly, IsDisabled, HasDeprecatedWidth,
- IsInline, IsRequired, HasTip, HasLabelAndAccessKey,
- IsPassword, HasSuggestMethod {
+ HasConverter, IsReadonly, IsDisabled, IsInline, IsRequired, HasTip, IsPassword, HasSuggestMethod {
/**
* Indicate markup of this component.
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/LabelTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/LabelTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/LabelTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/LabelTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -22,20 +22,14 @@
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.component.RendererTypes;
-import org.apache.myfaces.tobago.taglib.decl.HasDeprecatedWidth;
import org.apache.myfaces.tobago.taglib.decl.HasFor;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
import org.apache.myfaces.tobago.taglib.decl.HasLabelWithAccessKey;
import org.apache.myfaces.tobago.taglib.decl.HasMarkup;
import org.apache.myfaces.tobago.taglib.decl.HasTip;
+import org.apache.myfaces.tobago.taglib.decl.IsGridLayoutComponent;
import org.apache.myfaces.tobago.taglib.decl.IsInline;
-/*
- * Created: Aug 5, 2005 3:48:09 PM
- * User: bommel
- * $Id$
- */
-
/**
* Renders a label component.
*/
@@ -46,7 +40,7 @@
rendererType = RendererTypes.LABEL,
allowedChildComponenents = "NONE")
public interface LabelTagDeclaration extends HasIdBindingAndRendered,
- HasLabelWithAccessKey, HasFor, IsInline, HasDeprecatedWidth, HasTip, HasMarkup {
+ HasLabelWithAccessKey, HasFor, IsInline, HasTip, HasMarkup, IsGridLayoutComponent {
/**
* Text value to display as label. Overwritten by 'labelWithAccessKey'
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/LinkTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/LinkTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/LinkTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/LinkTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -21,6 +21,7 @@
import org.apache.myfaces.tobago.apt.annotation.Facet;
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
+import org.apache.myfaces.tobago.component.ComponentTypes;
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.taglib.decl.AbstractCommandTagDeclaration;
@@ -35,11 +36,6 @@
import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
import org.apache.myfaces.tobago.taglib.decl.IsInline;
-/*
- * Date: 11.02.2006
- * Time: 13:16:47
- */
-
/**
* Renders a link element.
*/
@@ -54,7 +50,7 @@
@Facet(
name = Facets.CONFIRMATION,
description = "Contains a UIOutput instance with the confirmation message.",
- allowedChildComponenents = "org.apache.myfaces.tobago.Output"),
+ allowedChildComponenents = ComponentTypes.OUT),
@Facet(
name = Facets.POPUP,
description = "Contains a UIPopup instance.",
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuBarTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuBarTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuBarTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuBarTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -21,14 +21,8 @@
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
import org.apache.myfaces.tobago.component.RendererTypes;
-import org.apache.myfaces.tobago.taglib.decl.HasDeprecatedWidth;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
-/*
- * Date: 14.03.2006
- * Time: 17:14:12
- */
-
/**
* Renders a menu bar.<br />
* Add menu bar as facet name="menuBar" to page tag or use it anywhere
@@ -52,5 +46,5 @@
"org.apache.myfaces.tobago.MenuSelectOne",
"org.apache.myfaces.tobago.MenuSeparator"
})
-public interface MenuBarTagDeclaration extends HasIdBindingAndRendered, HasDeprecatedWidth {
+public interface MenuBarTagDeclaration extends HasIdBindingAndRendered {
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -24,11 +24,7 @@
import org.apache.myfaces.tobago.taglib.decl.HasImage;
import org.apache.myfaces.tobago.taglib.decl.HasLabelAndAccessKey;
import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
-
-/*
-* Date: 31.03.2006
-* Time: 21:49:41
-*/
+import org.apache.myfaces.tobago.taglib.decl.IsGridLayoutComponent;
/**
* Container component to hold submenus and items.
@@ -50,5 +46,5 @@
"org.apache.myfaces.tobago.MenuSelectOne",
"org.apache.myfaces.tobago.MenuSeparator"})
public interface MenuTagDeclaration extends HasIdBindingAndRendered, HasLabelAndAccessKey,
- IsDisabled, HasImage {
+ IsDisabled, HasImage, IsGridLayoutComponent {
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/OutTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/OutTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/OutTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/OutTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -22,31 +22,29 @@
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+import org.apache.myfaces.tobago.component.ComponentTypes;
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.taglib.decl.HasConverter;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
import org.apache.myfaces.tobago.taglib.decl.HasTip;
import org.apache.myfaces.tobago.taglib.decl.HasValue;
+import org.apache.myfaces.tobago.taglib.decl.IsGridLayoutComponent;
import org.apache.myfaces.tobago.taglib.decl.IsInline;
-/*
- * Created: Aug 5, 2005 3:32:40 PM
- * User: bommel
- * $Id$
- */
-
/**
* Renders a text
*/
@Tag(name = "out")
@BodyContentDescription(anyTagOf = "f:converter|f:convertNumber|f:convertDateTime|...")
@UIComponentTag(
- uiComponent = "org.apache.myfaces.tobago.component.UIOutput",
- uiComponentBaseClass = "javax.faces.component.UIOutput",
+ uiComponent = "org.apache.myfaces.tobago.component.UIOut",
+ uiComponentBaseClass = "org.apache.myfaces.tobago.component.AbstractUIOut",
+ componentType = ComponentTypes.OUT,
rendererType = RendererTypes.OUT,
allowedChildComponenents = "NONE")
-public interface OutTagDeclaration extends HasIdBindingAndRendered, HasConverter, IsInline, HasTip, HasValue {
+public interface OutTagDeclaration
+ extends HasIdBindingAndRendered, HasConverter, IsInline, HasTip, HasValue, IsGridLayoutComponent {
/**
* Flag indicating that characters that are
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PageTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PageTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PageTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PageTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -28,6 +28,7 @@
import org.apache.myfaces.tobago.taglib.decl.HasId;
import org.apache.myfaces.tobago.taglib.decl.HasLabel;
import org.apache.myfaces.tobago.taglib.decl.HasState;
+import org.apache.myfaces.tobago.taglib.decl.IsGridLayoutComponentWithDeprecatedDimension;
/**
* Renders a page element.
@@ -45,7 +46,8 @@
@Facet(name=Facets.LAYOUT, description = "Contains an instance of UILayout",
allowedChildComponenents = "org.apache.myfaces.tobago.GridLayout")})
-public interface PageTagDeclaration extends HasLabel, HasId, HasBinding, HasState {
+public interface PageTagDeclaration
+ extends HasLabel, HasId, HasBinding, HasState, IsGridLayoutComponentWithDeprecatedDimension {
/**
* Possible values for doctype are:
* <dl>
@@ -78,12 +80,14 @@
@UIComponentTagAttribute()
void setApplicationIcon(String icon);
- @TagAttribute
- @UIComponentTagAttribute(type="java.lang.Integer", defaultCode = "getHeightInternal()")
- void setHeight(String height);
-
- @TagAttribute
- @UIComponentTagAttribute(type="java.lang.Integer", defaultCode = "getWidthInternal()")
- void setWidth(String width);
+ // XXX LAYOUT_GENERATE
+// @TagAttribute
+// @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+// void setHeight(String height);
+
+ // XXX LAYOUT_GENERATE
+// @TagAttribute
+// @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+// void setWidth(String width);
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PanelTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PanelTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PanelTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PanelTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -24,13 +24,9 @@
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.RendererTypes;
-import org.apache.myfaces.tobago.taglib.decl.HasDeprecatedDimension;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
+import org.apache.myfaces.tobago.taglib.decl.IsGridLayoutComponent;
-/*
- * Date: 11.02.2006
- * Time: 13:54:04
- */
/**
* Intended for use in situations when only one UIComponent child can be
* nested, such as in the case of facets.
@@ -38,7 +34,7 @@
@Tag(name = "panel")
@UIComponentTag(
uiComponent = "org.apache.myfaces.tobago.component.UIPanel",
- uiComponentBaseClass = "org.apache.myfaces.tobago.component.UIPanelBase",
+ uiComponentBaseClass = "org.apache.myfaces.tobago.component.AbstractUIPanel",
rendererType = RendererTypes.PANEL,
interfaces = {"org.apache.myfaces.tobago.ajax.api.AjaxComponent",
"org.apache.myfaces.tobago.component.SupportsMarkup"},
@@ -47,7 +43,7 @@
allowedChildComponenents = "org.apache.myfaces.tobago.Reload"),
@Facet(name=Facets.LAYOUT, description = "Contains an instance of UILayout",
allowedChildComponenents = "org.apache.myfaces.tobago.GridLayout")})
-public interface PanelTagDeclaration extends HasIdBindingAndRendered, HasDeprecatedDimension {
+public interface PanelTagDeclaration extends HasIdBindingAndRendered, IsGridLayoutComponent {
/**
* Indicate markup of this component.
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -22,14 +22,10 @@
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.component.RendererTypes;
-import org.apache.myfaces.tobago.taglib.decl.HasDimension;
import org.apache.myfaces.tobago.taglib.decl.HasId;
+import org.apache.myfaces.tobago.taglib.decl.IsGridLayoutComponentWithDeprecatedDimension;
import org.apache.myfaces.tobago.taglib.decl.IsRendered;
-/*
- * Date: 02.04.2006
- * Time: 16:11:02
- */
/**
* Renders a popup panel.
*/
@@ -39,15 +35,7 @@
uiComponentBaseClass = "org.apache.myfaces.tobago.component.AbstractUIPopup",
interfaces = "org.apache.myfaces.tobago.ajax.api.AjaxComponent",
rendererType = RendererTypes.POPUP)
-public interface PopupTagDeclaration extends HasId, IsRendered, HasDimension {
-
- @TagAttribute
- @UIComponentTagAttribute(type = "java.lang.Integer")
- void setLeft(String left);
-
- @TagAttribute
- @UIComponentTagAttribute(type = "java.lang.Integer")
- void setTop(String top);
+public interface PopupTagDeclaration extends HasId, IsRendered, IsGridLayoutComponentWithDeprecatedDimension {
@TagAttribute
@UIComponentTagAttribute(type = {"java.lang.Boolean"}, defaultValue = "true")
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectManyListboxTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectManyListboxTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectManyListboxTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectManyListboxTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -22,7 +22,6 @@
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.taglib.decl.HasBinding;
import org.apache.myfaces.tobago.taglib.decl.HasConverter;
-import org.apache.myfaces.tobago.taglib.decl.HasDeprecatedHeight;
import org.apache.myfaces.tobago.taglib.decl.HasId;
import org.apache.myfaces.tobago.taglib.decl.HasLabelAndAccessKey;
import org.apache.myfaces.tobago.taglib.decl.HasTip;
@@ -32,11 +31,6 @@
import org.apache.myfaces.tobago.taglib.decl.IsRendered;
import org.apache.myfaces.tobago.taglib.decl.IsRequired;
-/*
- * Created: Aug 5, 2005 5:58:55 PM
- * User: bommel
- * $Id$
- */
/**
* Render a multi selection option listbox.
*/
@@ -48,7 +42,7 @@
allowedChildComponenents = {"javax.faces.SelectItem", "javax.faces.SelectItems"})
public interface SelectManyListboxTagDeclaration extends SelectManyTagDeclaration, HasId, IsDisabled,
- HasDeprecatedHeight, IsInline, HasLabelAndAccessKey,
+ IsInline, HasLabelAndAccessKey,
IsRendered, HasBinding, HasTip, IsReadonly, HasConverter, IsRequired {
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectOneListboxTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectOneListboxTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectOneListboxTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectOneListboxTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -27,7 +27,6 @@
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.taglib.decl.HasBinding;
import org.apache.myfaces.tobago.taglib.decl.HasConverter;
-import org.apache.myfaces.tobago.taglib.decl.HasDeprecatedHeight;
import org.apache.myfaces.tobago.taglib.decl.HasId;
import org.apache.myfaces.tobago.taglib.decl.HasLabelAndAccessKey;
import org.apache.myfaces.tobago.taglib.decl.HasTip;
@@ -35,11 +34,6 @@
import org.apache.myfaces.tobago.taglib.decl.IsReadonly;
import org.apache.myfaces.tobago.taglib.decl.IsRendered;
-/*
- * Created: Aug 5, 2005 6:08:24 PM
- * User: bommel
- * $Id$
- */
/**
* Render a single selection option listbox.
*/
@@ -64,7 +58,7 @@
allowedChildComponenents = "org.apache.myfaces.tobago.Command")
})
public interface SelectOneListboxTagDeclaration extends SelectOneTagDeclaration, HasId, IsDisabled,
- IsReadonly, HasLabelAndAccessKey, IsRendered, HasBinding, HasDeprecatedHeight, HasTip, HasConverter {
+ IsReadonly, HasLabelAndAccessKey, IsRendered, HasBinding, HasTip, HasConverter {
/**
* Flag indicating that selecting an Item representing a Value is Required.
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupLayoutTagDeclaration.java (from r786116, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutTagDeclaration.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupLayoutTagDeclaration.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupLayoutTagDeclaration.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutTagDeclaration.java&r1=786116&r2=788668&rev=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupLayoutTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -21,84 +21,18 @@
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
import org.apache.myfaces.tobago.component.RendererTypes;
-import org.apache.myfaces.tobago.taglib.decl.HasBinding;
-import org.apache.myfaces.tobago.taglib.decl.HasBorder;
-import org.apache.myfaces.tobago.taglib.decl.HasCellspacing;
-import org.apache.myfaces.tobago.taglib.decl.HasColumnLayout;
import org.apache.myfaces.tobago.taglib.decl.HasId;
-import org.apache.myfaces.tobago.taglib.decl.HasMargin;
-import org.apache.myfaces.tobago.taglib.decl.HasMargins;
-import org.apache.myfaces.tobago.taglib.decl.HasRowLayout;
-
-/*
- * Date: 14.03.2006
- * Time: 16:58:13
- */
/**
- * Renders a GridLayout.
- * <pre>
- * columns/rows ::= LAYOUT
- * LAYOUT ::= TOKEN [";" TOKEN]+
- * TOKEN ::= FIXED | PIXEL | PROPORTIONAL
- * FIXED ::= "fixed"
- * PIXEL ::= NUMBER "px"
- * PROPORTIONAL ::= [NUMBER] "*"
- * </pre>
- * <p/>
- * <table border="1">
- * <tr>
- * <th>Parent</th>
- * <th>Child</th>
- * <th>Okay?</th>
- * <th>Remarks</th>
- * </tr>
- * <tr>
- * <td>FIXED</td>
- * <td>any combination of FIXED or PIXEL but no PROPORTIONAL</td>
- * <td>okay</td>
- * <td>-</td>
- * </tr>
- * <tr>
- * <td>FIXED</td>
- * <td>any combination with at least one PROPORTIONAL</td>
- * <td>wrong</td>
- * <td>LayoutManager cannot compute the fixed value.</td>
- * </tr>
- * <tr>
- * <td>PIXEL</td>
- * <td>any combination of FIXED or PIXEL but no PROPORTIONAL</td>
- * <td>potentially wrong</td>
- * <td>The values depend on each other, the programmer has to keep consistency manually.</td>
- * </tr>
- * <tr>
- * <td>PIXEL</td>
- * <td>any combination with at least one PROPORTIONAL</td>
- * <td>okay</td>
- * <td>-</td>
- * </tr>
- * <tr>
- * <td>PROPORTIONAL</td>
- * <td>any combination of FIXED or PIXEL but no PROPORTIONAL</td>
- * <td>potentially wrong</td>
- * <td>No automatical matching:<ul><li>too little space: scrollbar</li>
- * <li>too much space: elements will be spreaded.</li></ul></td>
- * </tr>
- * <tr>
- * <td>PROPORTIONAL</td>
- * <td>any combination with at least one PROPORTIONAL</td>
- * <td>okay</td>
- * <td>-</td>
- * </tr>
- * </table>
+ * Creates a TabGroupLayout, which is a internal layout manager of a tabGroup.
*/
-@Tag(name = "gridLayout", bodyContent = BodyContent.EMPTY)
+@Tag(name = "tabGroupLayout", bodyContent = BodyContent.EMPTY)
@UIComponentTag(
- uiComponent = "org.apache.myfaces.tobago.component.UIGridLayout",
- uiComponentBaseClass = "org.apache.myfaces.tobago.component.AbstractUIGridLayout",
- rendererType = RendererTypes.GRID_LAYOUT,
- componentFamily = "org.apache.myfaces.tobago.GridLayout",
- allowedChildComponenents = "NONE", isLayout = true)
-public interface GridLayoutTagDeclaration extends HasId, HasBorder, HasCellspacing, HasMargin,
- HasMargins, HasColumnLayout, HasRowLayout, HasBinding {
+ uiComponent = "org.apache.myfaces.tobago.component.UITabGroupLayout",
+ uiComponentBaseClass = "org.apache.myfaces.tobago.component.AbstractUITabGroupLayout",
+ rendererType = RendererTypes.TAB_GROUP_LAYOUT,
+ componentFamily = "org.apache.myfaces.tobago.TabGroupLayout",
+ allowedChildComponenents = "NONE",
+ isLayout = true)
+public interface TabGroupLayoutTagDeclaration extends HasId {
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -27,17 +27,10 @@
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.taglib.decl.HasAction;
import org.apache.myfaces.tobago.taglib.decl.HasActionListener;
-import org.apache.myfaces.tobago.taglib.decl.HasDeprecatedDimension;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
+import org.apache.myfaces.tobago.taglib.decl.IsGridLayoutComponent;
import org.apache.myfaces.tobago.taglib.decl.IsImmediateCommand;
-/*
- * Created by IntelliJ IDEA.
- * User: bommel
- * Date: 08.04.2006
- * Time: 14:53:06
- */
-
/**
* Renders a tabpanel.
*/
@@ -48,10 +41,11 @@
uiComponentBaseClass = "org.apache.myfaces.tobago.component.AbstractUITabGroup",
rendererType = RendererTypes.TAB_GROUP,
interfaces = { "org.apache.myfaces.tobago.ajax.api.AjaxComponent", "javax.faces.component.ActionSource"},
+// componentFamily = "org.apache.myfaces.tobago.TabGroup",
allowedChildComponenents = "org.apache.myfaces.tobago.Tab")
-public interface TabGroupTagDeclaration extends HasIdBindingAndRendered, HasDeprecatedDimension,
- IsImmediateCommand, HasAction, HasActionListener {
+public interface TabGroupTagDeclaration
+ extends HasIdBindingAndRendered, IsImmediateCommand, HasAction, HasActionListener, IsGridLayoutComponent {
/**
* Deprecated! Use 'switchType' instead.
* Flag indicating that tab switching is done by server request.
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TextAreaTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TextAreaTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TextAreaTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TextAreaTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -23,7 +23,6 @@
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.taglib.decl.HasConverter;
-import org.apache.myfaces.tobago.taglib.decl.HasDeprecatedDimension;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
import org.apache.myfaces.tobago.taglib.decl.HasLabelAndAccessKey;
import org.apache.myfaces.tobago.taglib.decl.HasTip;
@@ -31,12 +30,6 @@
import org.apache.myfaces.tobago.taglib.decl.IsReadonly;
import org.apache.myfaces.tobago.taglib.decl.IsRequired;
-/*
- * Created: Aug 5, 2005 5:00:41 PM
- * User: bommel
- * $Id$
- */
-
/**
* Renders a multiline text input control.
*/
@@ -47,8 +40,7 @@
rendererType = RendererTypes.TEXT_AREA,
allowedChildComponenents = "NONE")
public interface TextAreaTagDeclaration extends TextInputTagDeclaration, HasIdBindingAndRendered,
- HasConverter, IsReadonly, IsDisabled, HasDeprecatedDimension,
- IsRequired, HasLabelAndAccessKey, HasTip {
+ HasConverter, IsReadonly, IsDisabled, IsRequired, HasLabelAndAccessKey, HasTip {
/**
* The row count for this component.
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -26,6 +26,7 @@
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
import org.apache.myfaces.tobago.taglib.decl.HasTreeNodeValue;
+import org.apache.myfaces.tobago.taglib.decl.IsGridLayoutComponent;
import org.apache.myfaces.tobago.taglib.decl.IsRequired;
/**
@@ -44,7 +45,7 @@
"org.apache.myfaces.tobago.TreeData"
})
public interface TreeTagDeclaration
- extends HasIdBindingAndRendered, HasTreeNodeValue, IsRequired {
+ extends HasIdBindingAndRendered, HasTreeNodeValue, IsRequired, IsGridLayoutComponent {
/**
* Flag indicating whether or not this component should be render selectable items.
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/InputTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/InputTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/InputTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/InputTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -17,11 +17,6 @@
* limitations under the License.
*/
-
-/*
- * Created: Aug 5, 2005 4:18:38 PM
- * $Id$
- */
public interface InputTagDeclaration extends HasValidator, HasOnchange, HasValue, HasValueChangeListener,
- HasValidatorMessage, HasConverterMessage, HasRequiredMessage, HasTabIndex, IsFocus {
+ HasValidatorMessage, HasConverterMessage, HasRequiredMessage, HasTabIndex, IsFocus, IsGridLayoutComponent {
}
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponent.java (from r766599, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasTip.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponent.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponent.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasTip.java&r1=766599&r2=788668&rev=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasTip.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponent.java Fri Jun 26 12:13:41 2009
@@ -17,17 +17,104 @@
* limitations under the License.
*/
-import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
-/**
- * $Id$
- */
-public interface HasTip {
+public interface IsGridLayoutComponent {
+
+ /**
+ * @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.
+ */
+ @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")
+ void setWidth(String width);
+
+ /**
+ * 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")
+ void setHeight(String height);
+
+ /**
+ * @param minimumWidth The minimum width for this component.
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ void setMinimumWidth(String minimumWidth);
+
+ /**
+ * @param minimumHeight The minimum height for this component.
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ void setMinimumHeight(String minimumHeight);
+
+ /**
+ * @param preferredWidth The preferred width for this component.
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ void setPreferredWidth(String preferredWidth);
+
+ /**
+ * @param preferredHeight The preferred height for this component.
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ void setPreferredHeight(String preferredHeight);
+
+ /**
+ * @param maximumWidth The maximum width for this component.
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ void setMaximumWidth(String maximumWidth);
+
+ /**
+ * @param maximumHeight The maximum height for this component.
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ void setMaximumHeight(String maximumHeight);
+
+ /**
+ * 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")
+ void setLeft(String left);
+
+ /**
+ * 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")
+ void setTop(String top);
+
+ /**
+ * 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")
+ void setHorizontalIndex(String horizontalIndex);
+
+ /**
+ * 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")
+ void setVerticalIndex(String verticalIndex);
+
/**
- * Text value to display as tooltip.
+ * This attribute is for internal use only.
+ * @param display Indicates the renderer to render the element as block or inline.
*/
- @TagAttribute
- @UIComponentTagAttribute()
- void setTip(String tip);
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Display")
+ void setDisplay(String display);
}
Added: 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=788668&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponentWithDeprecatedDimension.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponentWithDeprecatedDimension.java Fri Jun 26 12:13:41 2009
@@ -0,0 +1,130 @@
+package org.apache.myfaces.tobago.taglib.decl;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+
+/**
+ * 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.
+ *
+ * @see IsGridLayoutComponent
+ */
+@Deprecated
+public interface IsGridLayoutComponentWithDeprecatedDimension {
+
+ /**
+ * @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.
+ */
+ @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.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ void setWidth(String width);
+
+ /**
+ * This value will usually be set by the layout manager.
+ * @param height The height for this component.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ void setHeight(String height);
+
+ /**
+ * @param minimumWidth The minimum width for this component.
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ void setMinimumWidth(String minimumWidth);
+
+ /**
+ * @param minimumHeight The minimum height for this component.
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ void setMinimumHeight(String minimumHeight);
+
+ /**
+ * @param preferredWidth The preferred width for this component.
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ void setPreferredWidth(String preferredWidth);
+
+ /**
+ * @param preferredHeight The preferred height for this component.
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ void setPreferredHeight(String preferredHeight);
+
+ /**
+ * @param maximumWidth The maximum width for this component.
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ void setMaximumWidth(String maximumWidth);
+
+ /**
+ * @param maximumHeight The maximum height for this component.
+ */
+ @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
+ void setMaximumHeight(String maximumHeight);
+
+ /**
+ * 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")
+ void setLeft(String left);
+
+ /**
+ * 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")
+ void setTop(String top);
+
+ /**
+ * 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")
+ void setHorizontalIndex(String horizontalIndex);
+
+ /**
+ * 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")
+ void setVerticalIndex(String verticalIndex);
+
+ /**
+ * 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);
+}
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtils.java (from r788441, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtil.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtils.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtils.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtil.java&r1=788441&r2=788668&rev=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtil.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtils.java Fri Jun 26 12:13:41 2009
@@ -24,6 +24,7 @@
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.Form;
import org.apache.myfaces.tobago.component.RendererTypes;
+import org.apache.myfaces.tobago.layout.Measure;
import org.apache.myfaces.tobago.renderkit.LayoutInformationProvider;
import javax.faces.component.UIComponent;
@@ -35,14 +36,14 @@
import java.util.StringTokenizer;
import java.util.regex.Pattern;
-public final class LayoutUtil {
+public final class LayoutUtils {
- private static final Log LOG = LogFactory.getLog(LayoutUtil.class);
+ private static final Log LOG = LogFactory.getLog(LayoutUtils.class);
private static final Pattern TOKEN_PATTERN
= Pattern.compile("^(\\d*px|\\d*\\*|\\d*%|fixed)$");
- private LayoutUtil() {
+ private LayoutUtils() {
// to prevent instantiation
}
@@ -149,6 +150,8 @@
if (value != null) {
if (value instanceof String) {
return new Integer(((String) value).replaceAll("\\D", ""));
+ } else if (value instanceof Measure) {
+ return ((Measure) value).getPixel();
} else {
return (Integer) value;
}
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtils.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java Fri Jun 26 12:13:41 2009
@@ -21,8 +21,13 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.component.Attributes;
+import org.apache.myfaces.tobago.layout.Component;
+import org.apache.myfaces.tobago.layout.Display;
+import org.apache.myfaces.tobago.layout.Measure;
+import org.apache.myfaces.tobago.renderkit.css.CssProperties;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
+import org.apache.myfaces.tobago.renderkit.html.HtmlStyleMap;
import org.apache.myfaces.tobago.util.HtmlWriterUtil;
import org.apache.myfaces.tobago.util.XmlUtils;
@@ -33,6 +38,7 @@
import java.util.Arrays;
import java.util.EmptyStackException;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
import java.util.Stack;
@@ -394,9 +400,60 @@
}
public void writeStyleAttribute() throws IOException {
- Object style = component.getAttributes().get(Attributes.STYLE);
- if (style != null) {
- writeAttribute(HtmlAttributes.STYLE, style.toString(), false);
+
+ HtmlStyleMap styles = (HtmlStyleMap) component.getAttributes().get(Attributes.STYLE);
+
+ styles = addLayout(styles);
+
+ if (styles != null) {
+ writeAttribute(HtmlAttributes.STYLE, styles.toString(), false);
+ }
+ }
+
+ private HtmlStyleMap addLayout(HtmlStyleMap styles) {
+ if (component instanceof Component) {
+ Component layoutComponent = (Component) component;
+ Measure width = layoutComponent.getWidth();
+ if (width != null) {
+ styles = ensureHtmlStyleMap(component, styles);
+ styles.put(Attributes.WIDTH, width);
+ }
+ Measure height = layoutComponent.getHeight();
+ if (height != null) {
+ styles = ensureHtmlStyleMap(component, styles);
+ styles.put(Attributes.HEIGHT, height);
+ }
+ Measure left = layoutComponent.getLeft();
+ if (left != null) {
+ styles = ensureHtmlStyleMap(component, styles);
+ styles.put(Attributes.LEFT, left);
+ }
+ Measure top = layoutComponent.getTop();
+ if (top != null) {
+ styles = ensureHtmlStyleMap(component, styles);
+ styles.put(Attributes.TOP, top);
+ }
+ // if there are a position coordinates, activate absolute positioning
+ // XXX String "Page" is not nice here
+ if ((left != null || top != null) && !component.getRendererType().contains("Page")) {
+ styles = ensureHtmlStyleMap(component, styles);
+ styles.put(CssProperties.POSITION, CssProperties.Position.ABSOLUTE);
+ }
+ Display display = layoutComponent.getDisplay();
+ if (display != null) {
+ styles = ensureHtmlStyleMap(component, styles);
+ styles.put(CssProperties.DISPLAY, display.getValue());
+ }
}
+ return styles;
}
+
+ public static HtmlStyleMap ensureHtmlStyleMap(UIComponent component, HtmlStyleMap styles) {
+ if (styles == null) {
+ styles = new HtmlStyleMap();
+ ((Map<String, Object>) component.getAttributes()).put(Attributes.STYLE, styles);
+ }
+ return styles;
+ }
+
}
Copied: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java (from r766599, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridLayoutManagerUnitTest.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java?p2=myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java&p1=myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridLayoutManagerUnitTest.java&r1=766599&r2=788668&rev=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridLayoutManagerUnitTest.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java Fri Jun 26 12:13:41 2009
@@ -1,4 +1,4 @@
-package org.apache.myfaces.tobago.layout.grid;
+package org.apache.myfaces.tobago.component;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -20,13 +20,12 @@
import junit.framework.TestCase;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.component.AbstractUIGridConstraints;
-import org.apache.myfaces.tobago.layout.Component;
import org.apache.myfaces.tobago.layout.LayoutContext;
import org.apache.myfaces.tobago.layout.MockComponent;
import org.apache.myfaces.tobago.layout.MockContainer;
import org.apache.myfaces.tobago.layout.PixelMeasure;
import org.apache.myfaces.tobago.layout.math.AssertUtils;
+import org.apache.myfaces.tobago.layout.math.SystemOfEquations;
import java.util.Arrays;
@@ -45,31 +44,34 @@
* </pre>
*/
public void testSimple() {
- MockContainer container = newContainer();
- MockComponent c1 = newComponent();
+ MockContainer container = new MockContainer();
+ MockComponent c1 = new MockComponent();
container.getComponents().add(c1);
- MockComponent c2 = newComponent();
+ MockComponent c2 = new MockComponent();
container.getComponents().add(c2);
- GridLayoutManager manager = new GridLayoutManager("*;2*", "*");
+ UIGridLayout manager = new UIGridLayout();
+ manager.setColumns("*;2*");
+ manager.setRows("*");
+ manager.onComponentCreated(null, manager);
container.setLayoutManager(manager);
- ((AbstractUIGridConstraints) container.getConstraints()).setWidth(new PixelMeasure(300));
- ((AbstractUIGridConstraints) container.getConstraints()).setHeight(new PixelMeasure(20));
+ container.setWidth(new PixelMeasure(300));
+ container.setHeight(new PixelMeasure(20));
LayoutContext layoutContext = new LayoutContext(container);
layoutContext.layout();
double[] result = layoutContext.getHorizontal().getResult();
LOG.info("result: " + Arrays.toString(result));
- AssertUtils.assertEquals(new double[]{300, 100, 200}, result, 0.000001);
+ AssertUtils.assertEquals(new double[]{300, 100, 200, 100, 200}, result, 0.000001);
result = layoutContext.getVertical().getResult();
LOG.info("result: " + Arrays.toString(result));
- AssertUtils.assertEquals(new double[]{20, 20}, result, 0.000001);
+ AssertUtils.assertEquals(new double[]{20, 20, 20, 20}, result, 0.000001);
- assertEquals("width of container", 300, ((AbstractUIGridConstraints) container.getConstraints()).getWidth().getPixel());
- assertEquals("width of component 1", 100, ((AbstractUIGridConstraints) c1.getConstraints()).getWidth().getPixel());
- assertEquals("width of component 2", 200, ((AbstractUIGridConstraints) c2.getConstraints()).getWidth().getPixel());
+ assertEquals("width of container", 300, container.getWidth().getPixel());
+ assertEquals("width of component 1", 100, c1.getWidth().getPixel());
+ assertEquals("width of component 2", 200, c2.getWidth().getPixel());
}
/**
@@ -83,32 +85,35 @@
* </pre>
*/
public void testSpan() {
- MockContainer container = newContainer();
- MockComponent c = newComponent();
+ MockContainer container = new MockContainer();
+ MockComponent c = new MockComponent();
container.getComponents().add(c);
- MockComponent span = newComponent();
+ MockComponent span = new MockComponent();
container.getComponents().add(span);
- ((AbstractUIGridConstraints) span.getConstraints()).setColumnSpan(2);
+ span.setColumnSpan(2);
- GridLayoutManager manager = new GridLayoutManager("*;*;*", "*");
+ UIGridLayout manager = new UIGridLayout();
+ manager.setColumns("*;*;*");
+ manager.setRows("*");
+ manager.onComponentCreated(null, manager);
container.setLayoutManager(manager);
- ((AbstractUIGridConstraints) container.getConstraints()).setWidth(new PixelMeasure(300));
- ((AbstractUIGridConstraints) container.getConstraints()).setHeight(new PixelMeasure(20));
+ container.setWidth(new PixelMeasure(300));
+ container.setHeight(new PixelMeasure(20));
LayoutContext layoutContext = new LayoutContext(container);
layoutContext.layout();
double[] result = layoutContext.getHorizontal().getResult();
LOG.info("result: " + Arrays.toString(result));
- AssertUtils.assertEquals(new double[]{300, 100, 100, 100}, result, 0.000001);
+ AssertUtils.assertEquals(new double[]{300, 100, 100, 100, 100, 200}, result, 0.000001);
result = layoutContext.getVertical().getResult();
LOG.info("result: " + Arrays.toString(result));
- AssertUtils.assertEquals(new double[]{20, 20}, result, 0.000001);
+ AssertUtils.assertEquals(new double[]{20, 20, 20, 20}, result, 0.000001);
- assertEquals("width of container", 300, ((AbstractUIGridConstraints) container.getConstraints()).getWidth().getPixel());
- assertEquals("width of component", 100, ((AbstractUIGridConstraints) c.getConstraints()).getWidth().getPixel());
- assertEquals("width of span", 200, ((AbstractUIGridConstraints) span.getConstraints()).getWidth().getPixel());
+ assertEquals("width of container", 300, container.getWidth().getPixel());
+ assertEquals("width of component", 100, c.getWidth().getPixel());
+ assertEquals("width of span", 200, span.getWidth().getPixel());
}
/**
@@ -129,101 +134,169 @@
* </pre>
*/
public void testSpanAndSubLayout() {
- MockContainer container = newContainer();
- Component span = newComponent();
- AbstractUIGridConstraints bConstraint = (AbstractUIGridConstraints) span.getConstraints();
- bConstraint.setColumnSpan(2);
+ MockContainer container = new MockContainer();
+ MockComponent span = new MockComponent();
+ span.setColumnSpan(2);
- container.getComponents().add(newComponent());
+ container.getComponents().add(new MockComponent());
container.getComponents().add(span);
- container.getComponents().add(newComponent());
- container.getComponents().add(newComponent());
+ container.getComponents().add(new MockComponent());
+ container.getComponents().add(new MockComponent());
- MockContainer subContainer = newContainer();
+ MockContainer subContainer = new MockContainer();
container.getComponents().add(subContainer);
- GridLayoutManager manager = new GridLayoutManager("*;2*;500px", "*;600px");
+ UIGridLayout manager = new UIGridLayout();
+ manager.setColumns("*;2*;500px");
+ manager.setRows("*;600px");
+ manager.onComponentCreated(null, manager);
container.setLayoutManager(manager);
- GridLayoutManager subManager = new GridLayoutManager("7*;3*", "*;*");
+ UIGridLayout subManager = new UIGridLayout();
+ subManager.setColumns("7*;3*");
+ subManager.setRows("*;*");
+ subManager.onComponentCreated(null, manager);
subContainer.setLayoutManager(subManager);
- subContainer.getComponents().add(newComponent());
- subContainer.getComponents().add(newComponent());
- subContainer.getComponents().add(newComponent());
- subContainer.getComponents().add(newComponent());
+ subContainer.getComponents().add(new MockComponent());
+ subContainer.getComponents().add(new MockComponent());
+ subContainer.getComponents().add(new MockComponent());
+ subContainer.getComponents().add(new MockComponent());
- ((AbstractUIGridConstraints) container.getConstraints()).setWidth(new PixelMeasure(800));
- ((AbstractUIGridConstraints) container.getConstraints()).setHeight(new PixelMeasure(800));
+ container.setWidth(new PixelMeasure(800));
+ container.setHeight(new PixelMeasure(800));
LayoutContext layoutContext = new LayoutContext(container);
layoutContext.layout();
double[] result = layoutContext.getHorizontal().getResult();
LOG.info("result: " + Arrays.toString(result));
- AssertUtils.assertEquals(new double[]{800, 100, 200, 500, 350, 150}, result, 0.000001);
+ AssertUtils.assertEquals(new double[]{
+ 800, 100, 200, 500, 100, 700, 100, 200, 500, 350, 150, 350, 150, 350, 150
+ }, result, 0.000001);
result = layoutContext.getVertical().getResult();
LOG.info("result: " + Arrays.toString(result));
- AssertUtils.assertEquals(new double[]{800, 200, 600, 300, 300}, result, 0.000001);
+ AssertUtils.assertEquals(new double[]{
+ 800, 200, 600, 200, 200, 600, 600, 600, 300, 300, 300, 300, 300, 300
+ }, result, 0.000001);
- assertEquals("width of container", 800, ((AbstractUIGridConstraints) container.getConstraints()).getWidth().getPixel());
- assertEquals("width of span", 700, ((AbstractUIGridConstraints) span.getConstraints()).getWidth().getPixel());
+ assertEquals("width of container", 800, container.getWidth().getPixel());
+ assertEquals("width of span", 700, span.getWidth().getPixel());
}
/**
* <pre>
- * | 1000px |
+ * | 900px |
* | * | * | * |
* | | * | * | * |
* | * | * | * | |
* </pre>
*/
public void testSpanOverlapsSpan() {
- MockContainer container = newContainer();
+ MockContainer container = new MockContainer();
- MockContainer span1 = newContainer();
- AbstractUIGridConstraints constraint1 = (AbstractUIGridConstraints) span1.getConstraints();
- constraint1.setColumnSpan(2);
+ MockContainer span1 = new MockContainer();
+ span1.setColumnSpan(2);
- MockContainer span2 = newContainer();
- AbstractUIGridConstraints constraint2 = (AbstractUIGridConstraints) span2.getConstraints();
- constraint2.setColumnSpan(2);
+ MockContainer span2 = new MockContainer();
+ span2.setColumnSpan(2);
- container.getComponents().add(newComponent());
+ container.getComponents().add(new MockComponent());
container.getComponents().add(span1);
container.getComponents().add(span2);
- container.getComponents().add(newComponent());
+ container.getComponents().add(new MockComponent());
- container.setLayoutManager(new GridLayoutManager("*;*;*", "*;*"));
- span1.setLayoutManager(new GridLayoutManager("*;*;*", "*"));
- span2.setLayoutManager(new GridLayoutManager("*;*;*", "*"));
+ UIGridLayout manager1 = new UIGridLayout();
+ manager1.setColumns("*;*;*");
+ manager1.setRows("*;*");
+ manager1.onComponentCreated(null, manager1);
+ container.setLayoutManager(manager1);
+
+ UIGridLayout manager2 = new UIGridLayout();
+ manager2.setColumns("*;*;*");
+ manager2.setRows("*");
+ manager2.onComponentCreated(null, manager2);
+ span1.setLayoutManager(manager2);
+
+ UIGridLayout manager3 = new UIGridLayout();
+ manager3.setColumns("*;*;*");
+ manager3.setRows("*");
+ manager3.onComponentCreated(null, manager3);
+ span2.setLayoutManager(manager3);
- ((AbstractUIGridConstraints) container.getConstraints()).setWidth(new PixelMeasure(900));
- ((AbstractUIGridConstraints) container.getConstraints()).setHeight(new PixelMeasure(200));
+ container.setWidth(new PixelMeasure(900));
+ container.setHeight(new PixelMeasure(200));
LayoutContext layoutContext = new LayoutContext(container);
layoutContext.layout();
- LOG.info(((GridLayoutManager) container.getLayoutManager()).getGrid());
+ LOG.info(((UIGridLayout) container.getLayoutManager()).getGrid());
double[] result = layoutContext.getHorizontal().getResult();
LOG.info("result: " + Arrays.toString(result));
- AssertUtils.assertEquals(new double[]{900, 300, 300, 300, 200, 200, 200, 200, 200, 200}, result, 0.000001);
+ AssertUtils.assertEquals(new double[]{
+ 900, 300, 300, 300, 300, 600, 200, 200, 200, 600, 200, 200, 200, 300
+ }, result, 0.000001);
result = layoutContext.getVertical().getResult();
LOG.info("result: " + Arrays.toString(result));
- AssertUtils.assertEquals(new double[]{200, 100, 100, 100, 100}, result, 0.000001);
+ AssertUtils.assertEquals(new double[]{200, 100, 100, 100, 100, 100, 100, 100, 100}, result, 0.000001);
- assertEquals("width of container", 900, ((AbstractUIGridConstraints) container.getConstraints()).getWidth().getPixel());
- assertEquals("width of span 1", 600, ((AbstractUIGridConstraints) span1.getConstraints()).getWidth().getPixel());
- assertEquals("width of span 2", 600, ((AbstractUIGridConstraints) span2.getConstraints()).getWidth().getPixel());
+ assertEquals("width of container", 900, container.getWidth().getPixel());
+ assertEquals("width of span 1", 600, span1.getWidth().getPixel());
+ assertEquals("width of span 2", 600, span2.getWidth().getPixel());
}
- private MockContainer newContainer() {
- return new MockContainer(new AbstractUIGridConstraints(){});
- }
+ /**
+ * <pre>
+ * | 800px |
+ * | * | * |
+ * | | |
+ * <p/>
+ * +---------+----------+ ----- -----
+ * | | |
+ * | | | *
+ * | | |
+ * + +----------+ 800px -----
+ * | | |
+ * | | | *
+ * | | |
+ * +---------+----------+ ----- -----
+ * </pre>
+ */
+ public void testRowSpan() {
+ MockContainer container = new MockContainer();
+ MockComponent span = new MockComponent();
+ span.setRowSpan(2);
- private MockComponent newComponent() {
- return new MockComponent(new AbstractUIGridConstraints(){});
+ container.getComponents().add(span);
+ container.getComponents().add(new MockComponent());
+ container.getComponents().add(new MockComponent());
+
+ UIGridLayout manager = new UIGridLayout();
+ manager.setColumns("*;*");
+ manager.setRows("*;*");
+ manager.onComponentCreated(null, manager);
+ container.setLayoutManager(manager);
+
+ container.setWidth(new PixelMeasure(800));
+ container.setHeight(new PixelMeasure(800));
+ LayoutContext layoutContext = new LayoutContext(container);
+ layoutContext.layout();
+
+ double[] result = layoutContext.getHorizontal().getResult();
+ LOG.info("result: " + Arrays.toString(result));
+ AssertUtils.assertEquals(new double[]{800.0, 400.0, 400.0, 400.0, 400.0, 400.0}, result, SystemOfEquations.EPSILON);
+
+
+ result = layoutContext.getVertical().getResult();
+ LOG.info("result: " + Arrays.toString(result));
+ AssertUtils.assertEquals(new double[]{800.0, 400.0, 400.0, 800.0, 400.0, 400.0}, result, SystemOfEquations.EPSILON);
+
+ assertEquals("width of container", 800, container.getWidth().getPixel());
+ assertEquals("height of container", 800, container.getHeight().getPixel());
+ assertEquals("width of span", 400, span.getWidth().getPixel());
+ assertEquals("height of span", 800, span.getHeight().getPixel());
}
+
}
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java Fri Jun 26 12:13:41 2009
@@ -17,19 +17,154 @@
* limitations under the License.
*/
-/*
- * Date: 14.02.2008 12:08:52
- */
public class MockComponent implements Component {
- private Constraints constraints;
+ private Integer columnSpan = 1;
+
+ private Integer rowSpan = 1;
+
+ private Measure width;
+ private Measure height;
+
+ private Measure minimumWidth;
+ private Measure minimumHeight;
+
+ private Measure preferredWidth;
+ private Measure preferredHeight;
+
+ private Measure maximumWidth;
+ private Measure maximumHeight;
+
+ private Measure left;
+ private Measure top;
+
+ private Integer horizontalIndex;
+ private Integer verticalIndex;
+
+ private Display display;
+
+ public String getFamily() {
+ return null;
+ }
+
+ public Integer getColumnSpan() {
+ return columnSpan;
+ }
+
+ public void setColumnSpan(Integer columnSpan) {
+ this.columnSpan = columnSpan;
+ }
+
+ public Integer getRowSpan() {
+ return rowSpan;
+ }
+
+ public void setRowSpan(Integer rowSpan) {
+ this.rowSpan = rowSpan;
+ }
- public MockComponent(Constraints constraints) {
- this.constraints = constraints;
+ public Measure getWidth() {
+ return width;
}
- public Constraints getConstraints() {
- return constraints;
+ public void setWidth(Measure width) {
+ this.width = width;
}
+ public Measure getHeight() {
+ return height;
+ }
+
+ public void setHeight(Measure height) {
+ this.height = height;
+ }
+
+ public Measure getMinimumWidth() {
+ return minimumWidth;
+ }
+
+ public void setMinimumWidth(Measure minimumWidth) {
+ this.minimumWidth = minimumWidth;
+ }
+
+ public Measure getMinimumHeight() {
+ return minimumHeight;
+ }
+
+ public void setMinimumHeight(Measure minimumHeight) {
+ this.minimumHeight = minimumHeight;
+ }
+
+ public Measure getPreferredWidth() {
+ return preferredWidth;
+ }
+
+ public void setPreferredWidth(Measure preferredWidth) {
+ this.preferredWidth = preferredWidth;
+ }
+
+ public Measure getPreferredHeight() {
+ return preferredHeight;
+ }
+
+ public void setPreferredHeight(Measure preferredHeight) {
+ this.preferredHeight = preferredHeight;
+ }
+
+ public Measure getMaximumWidth() {
+ return maximumWidth;
+ }
+
+ public void setMaximumWidth(Measure maximumWidth) {
+ this.maximumWidth = maximumWidth;
+ }
+
+ public Measure getMaximumHeight() {
+ return maximumHeight;
+ }
+
+ public void setMaximumHeight(Measure maximumHeight) {
+ this.maximumHeight = maximumHeight;
+ }
+
+ public Measure getLeft() {
+ return left;
+ }
+
+ public void setLeft(Measure left) {
+ this.left = left;
+ }
+
+ public Measure getTop() {
+ return top;
+ }
+
+ public void setTop(Measure top) {
+
+ this.top = top;
+ }
+
+ public Integer getHorizontalIndex() {
+ return horizontalIndex;
+ }
+
+ public void setHorizontalIndex(Integer horizontalIndex) {
+ this.horizontalIndex = horizontalIndex;
+ }
+
+ public Integer getVerticalIndex() {
+ return verticalIndex;
+ }
+
+ public void setVerticalIndex(Integer verticalIndex) {
+ this.verticalIndex = verticalIndex;
+ }
+
+ public Display getDisplay() {
+ return display;
+ }
+
+ public void setDisplay(Display display) {
+ this.display = display;
+ }
}
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=788668&r1=788667&r2=788668&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 Jun 26 12:13:41 2009
@@ -20,17 +20,13 @@
import java.util.ArrayList;
import java.util.List;
-/*
- * Date: 14.02.2008 12:03:31
- */
public class MockContainer extends MockComponent implements Container {
private LayoutManager layoutManager;
private List<Component> components;
- public MockContainer(Constraints constraints) {
- super(constraints);
+ public MockContainer() {
components = new ArrayList<Component>();
}
Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/AssertUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/AssertUtils.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/AssertUtils.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/AssertUtils.java Fri Jun 26 12:13:41 2009
@@ -31,4 +31,11 @@
Assert.assertEquals(expected[i], result[i], delta);
}
}
+
+ public static void assertEquals(int[] expected, int[] result) {
+ Assert.assertEquals(expected.length, result.length);
+ for (int i = 0; i < expected.length; i++) {
+ Assert.assertEquals(expected[i], result[i]);
+ }
+ }
}