You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2009/11/02 18:02:34 UTC

svn commit: r831970 - in /myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt: component1.1.stg component1.2.stg

Author: lofwyr
Date: Mon Nov  2 17:02:33 2009
New Revision: 831970

URL: http://svn.apache.org/viewvc?rev=831970&view=rev
Log:
TOBAGO-637: better compatibility support for Measure

Modified:
    myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.1.stg
    myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.2.stg

Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.1.stg
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.1.stg?rev=831970&r1=831969&r2=831970&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.1.stg (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.1.stg Mon Nov  2 17:02:33 2009
@@ -338,10 +338,6 @@
 <NormalProperty(property)>
 >>
 
-MeasureProperty(property) ::= <<
-<NormalProperty(property)>
->>
-
 DisplayProperty(property) ::= <<
 <NormalProperty(property)>
 >>
@@ -402,6 +398,36 @@
 }
 >>
 
+MeasureProperty(property) ::= <<
+
+public <property.type> get<property.upperCamelCaseName>() {
+  if (<property.propertyName> != null) {
+    return <property.propertyName>;
+  }
+  <getValueExpression(property)>
+  if (vb != null) {
+    Object object = <getValue(property)>
+    if (object instanceof Number) {
+      return new org.apache.myfaces.tobago.layout.PixelMeasure(((Number)object).intValue());
+    } else if (object instanceof Measure) {
+      <property.type> <property.propertyName> = (<property.type>) object;
+      return <property.propertyName>;
+    } else if (object != null) {
+      throw new ClassCastException(object.getClass().getName());
+    }
+  }
+  <if(property.defaultCode)>
+  return <property.defaultCode>;
+  <else>
+  return null;
+  <endif>
+}
+
+public void set<property.upperCamelCaseName>(<property.type> <property.propertyName>) {
+  this.<property.propertyName> = <property.propertyName>;
+}
+>>
+
 
 field() ::= <<
 private <it.internalType> <it.propertyName>;

Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.2.stg
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.2.stg?rev=831970&r1=831969&r2=831970&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.2.stg (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.2.stg Mon Nov  2 17:02:33 2009
@@ -249,10 +249,6 @@
 <NormalProperty(property)>
 >>
 
-MeasureProperty(property) ::= <<
-<NormalProperty(property)>
->>
-
 DisplayProperty(property) ::= <<
 <NormalProperty(property)>
 >>
@@ -349,6 +345,40 @@
 }
 >>
 
+MeasureProperty(property) ::= <<
+
+public <property.type> get<property.upperCamelCaseName>() {
+  if (<property.propertyName> != null) {
+    return <property.propertyName>;
+  }
+  <getValueExpression(property)>
+  if (ve != null) {
+    try {
+      Object object = <getValue(property)>
+      if (object instanceof Number) {
+        return new org.apache.myfaces.tobago.layout.PixelMeasure(((Number)object).intValue());
+      } else if (object instanceof Measure) {
+        <property.type> <property.propertyName> = (<property.type>) object;
+        return <property.propertyName>;
+      } else if (object != null) {
+        throw new ClassCastException(object.getClass().getName());
+      }
+    } catch (javax.el.ELException e) {
+		  throw new javax.faces.FacesException(e);
+	  }
+  }
+  <if(property.defaultCode)>
+  return <property.defaultCode>;
+  <else>
+  return null;
+  <endif>
+}
+
+public void set<property.upperCamelCaseName>(<property.type> <property.propertyName>) {
+  this.<property.propertyName> = <property.propertyName>;
+}
+>>
+
 
 field() ::= <<
 <if(it.elAlternativeAvailable)>