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 2007/08/12 12:17:27 UTC

svn commit: r565034 - in /myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets: PageRule.java TobagoComponentHandler.java UIPageRule.java

Author: bommel
Date: Sun Aug 12 03:17:25 2007
New Revision: 565034

URL: http://svn.apache.org/viewvc?view=rev&rev=565034
Log:
minor cleanup

Added:
    myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/PageRule.java
      - copied, changed from r561101, myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/UIPageRule.java
Removed:
    myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/UIPageRule.java
Modified:
    myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java

Copied: myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/PageRule.java (from r561101, myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/UIPageRule.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/PageRule.java?view=diff&rev=565034&p1=myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/UIPageRule.java&r1=561101&p2=myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/PageRule.java&r2=565034
==============================================================================
--- myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/UIPageRule.java (original)
+++ myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/PageRule.java Sun Aug 12 03:17:25 2007
@@ -25,6 +25,7 @@
 import com.sun.facelets.el.LegacyValueBinding;
 import org.apache.myfaces.tobago.component.UIPage;
 import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.TobagoConstants;
 
 import javax.faces.component.UIComponent;
 
@@ -33,36 +34,31 @@
  * Date: Jan 2, 2007
  * Time: 3:35:58 PM
  */
-public class UIPageRule extends MetaRule {
-  public static final UIPageRule INSTANCE = new UIPageRule();
+public class PageRule extends MetaRule {
+  public static final PageRule INSTANCE = new PageRule();
 
   public Metadata applyRule(String name, TagAttribute attribute,
       MetadataTarget metadataTarget) {
     if (metadataTarget.isTargetInstanceOf(UIPage.class)) {
-      if (!attribute.isLiteral()) {
-        Class type = metadataTarget.getPropertyType(name);
-        if (type == null) {
-          type = Object.class;
+      if (attribute.isLiteral()) {
+        if (TobagoConstants.ATTR_WIDTH.equals(name)) {
+          return new PageWidthMapper(attribute);
         }
-        return new UIPageDimensionExpression(name, type, attribute);
-      } else {
-        if ("width".equals(name)) {
-          return new UIPageWidthMapper(attribute);
-        }
-        if ("height".equals(name)) {
-          return new UIPageHeightMapper(attribute);
+        if (TobagoConstants.ATTR_HEIGHT.equals(name)) {
+          return new PageHeightMapper(attribute);
         }
       }
     }
     return null;
   }
 
-  static final class UIPageDimensionExpression extends Metadata {
+  // TODO remove this
+  static final class PageDimensionExpression extends Metadata {
     private final String name;
     private final TagAttribute attr;
     private final Class type;
 
-    public UIPageDimensionExpression(String name, Class type, TagAttribute attr) {
+    PageDimensionExpression(String name, Class type, TagAttribute attr) {
       this.name = name;
       this.attr = attr;
       this.type = type;
@@ -73,10 +69,10 @@
     }
   }
 
-  static final class UIPageWidthMapper extends Metadata {
+  static final class PageWidthMapper extends Metadata {
     private final TagAttribute attribute;
 
-    public UIPageWidthMapper(TagAttribute attribute) {
+    PageWidthMapper(TagAttribute attribute) {
       this.attribute = attribute;
     }
 
@@ -86,10 +82,10 @@
     }
   }
 
-  static final class UIPageHeightMapper extends Metadata {
+  static final class PageHeightMapper extends Metadata {
     private final TagAttribute attribute;
 
-    public UIPageHeightMapper(TagAttribute attribute) {
+    PageHeightMapper(TagAttribute attribute) {
       this.attribute = attribute;
     }
 

Modified: myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java?view=diff&rev=565034&r1=565033&r2=565034
==============================================================================
--- myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java (original)
+++ myfaces/tobago/trunk/contrib/facelets/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java Sun Aug 12 03:17:25 2007
@@ -48,7 +48,7 @@
       metaRuleset.addRule(SortActionSourceRule.INSTANCE);
     }
     if (UIPage.class.isAssignableFrom(aClass)) {
-      metaRuleset.addRule(UIPageRule.INSTANCE);
+      metaRuleset.addRule(PageRule.INSTANCE);
     }
     if (TabChangeSource.class.isAssignableFrom(aClass)) {
       metaRuleset.addRule(TabChangeSourceRule.INSTANCE);