You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2006/12/22 21:09:23 UTC

svn commit: r489745 - in /myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago: component/ComponentUtil.java taglib/component/PageTag.java

Author: bommel
Date: Fri Dec 22 12:09:23 2006
New Revision: 489745

URL: http://svn.apache.org/viewvc?view=rev&rev=489745
Log:
(TOBAGO-107) tc:page should use a reasonable default width+height and state

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PageTag.java

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java?view=diff&rev=489745&r1=489744&r2=489745
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java Fri Dec 22 12:09:23 2006
@@ -621,6 +621,25 @@
     return output;
   }
 
+  public static void setIntegerSizeProperty(UIComponent component,
+      String name, String value) {
+    if (value != null) {
+      if (UIComponentTag.isValueReference(value)) {
+        component.setValueBinding(name, createValueBinding(value));
+      } else {
+        value = removePx(value);
+        component.getAttributes().put(name, new Integer(value));
+      }
+    }
+  }
+
+  private static String removePx(String value) {
+    if (value!=null&&value.endsWith("px")) {
+      value = value.substring(0, value.length() - 2);
+    }
+    return value;
+  }
+
   public static void setIntegerProperty(UIComponent component,
       String name, String value) {
     if (value != null) {

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PageTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PageTag.java?view=diff&rev=489745&r1=489744&r2=489745
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PageTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PageTag.java Fri Dec 22 12:09:23 2006
@@ -87,8 +87,8 @@
     ComponentUtil.setStringProperty(component, ATTR_FOCUS_ID, focusId);
     ComponentUtil.setStringProperty(component, ATTR_LABEL, label);
     ComponentUtil.setValueBinding(component, ATTR_STATE, state);
-    ComponentUtil.setStringProperty(component, ATTR_WIDTH, width);
-    ComponentUtil.setStringProperty(component, ATTR_HEIGHT, height);
+    ComponentUtil.setIntegerSizeProperty(component, ATTR_WIDTH, width);
+    ComponentUtil.setIntegerSizeProperty(component, ATTR_HEIGHT, height);
   }
 
   public void setDoctype(String doctype) {