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 2009/09/11 16:31:17 UTC

svn commit: r813855 - /myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/DeprecatedDimensionRule.java

Author: bommel
Date: Fri Sep 11 14:31:16 2009
New Revision: 813855

URL: http://svn.apache.org/viewvc?rev=813855&view=rev
Log:
TOBAGO-606: Layout-Manager
 - put the deprecated height/width attributes of tc:popup and tc:page into one interface

Modified:
    myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/DeprecatedDimensionRule.java

Modified: myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/DeprecatedDimensionRule.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/DeprecatedDimensionRule.java?rev=813855&r1=813854&r2=813855&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/DeprecatedDimensionRule.java (original)
+++ myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/DeprecatedDimensionRule.java Fri Sep 11 14:31:16 2009
@@ -24,6 +24,7 @@
 import com.sun.facelets.tag.TagAttribute;
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.component.UIPage;
+import org.apache.myfaces.tobago.component.DeprecatedDimension;
 import org.apache.myfaces.tobago.layout.Measure;
 
 public class DeprecatedDimensionRule extends MetaRule {
@@ -32,14 +33,12 @@
 
   public Metadata applyRule(String name, TagAttribute attribute,
       MetadataTarget metadataTarget) {
-    if (metadataTarget.isTargetInstanceOf(UIPage.class)) {
-      if (attribute.isLiteral()) {
-        if (Attributes.WIDTH.equals(name)) {
-          return new WidthMapper(attribute);
-        }
-        if (Attributes.HEIGHT.equals(name)) {
-          return new HeightMapper(attribute);
-        }
+    if (attribute.isLiteral()) {
+      if (Attributes.WIDTH.equals(name)) {
+        return new WidthMapper(attribute);
+      }
+      if (Attributes.HEIGHT.equals(name)) {
+        return new HeightMapper(attribute);
       }
     }
     return null;
@@ -71,8 +70,7 @@
     }
 
   public void applyMetadata(FaceletContext ctx, Object instance) {
-      UIPage page = (UIPage) instance;
-      page.setWidth(Measure.parse(attribute.getValue()));
+      ((DeprecatedDimension) instance).setWidth(Measure.parse(attribute.getValue()));
     }
   }
 
@@ -84,8 +82,7 @@
     }
 
     public void applyMetadata(FaceletContext ctx, Object instance) {
-      UIPage page = (UIPage) instance;
-      page.setHeight(Measure.parse(attribute.getValue()));
+      ((DeprecatedDimension) instance).setHeight(Measure.parse(attribute.getValue()));
     }
   }
 }