myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bom...@apache.org
Subject svn commit: r451741 - /myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/FacesConfigAnnotationVisitor.java
Date Sun, 01 Oct 2006 12:02:22 GMT
Author: bommel
Date: Sun Oct  1 05:02:22 2006
New Revision: 451741

URL: http://svn.apache.org/viewvc?view=rev&rev=451741
Log:
[TOBAGO-140] generate faces-config from annotations

Modified:
    myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/FacesConfigAnnotationVisitor.java

Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/FacesConfigAnnotationVisitor.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/FacesConfigAnnotationVisitor.java?view=diff&rev=451741&r1=451740&r2=451741
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/FacesConfigAnnotationVisitor.java
(original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/FacesConfigAnnotationVisitor.java
Sun Oct  1 05:02:22 2006
@@ -137,11 +137,11 @@
             elementsToAdd.add(newElement);
           }
         }
-        if (elementsToAdd.size() > 0 && components.size() > 0) {
+        if (!elementsToAdd.isEmpty() && !components.isEmpty()) {
           int lastIndex = rootElement.indexOf(components.get(components.size()-1));
           rootElement.addContent(lastIndex+1, elementsToAdd);
 
-        } else if (elementsToAdd.size() > 0) {
+        } else if (!elementsToAdd.isEmpty()) {
           rootElement.addContent(0, elementsToAdd);
         }
         document.setDocType(new DocType("faces-config",
@@ -185,8 +185,6 @@
       elementClass.setText(componentTag.uiComponent());
       element.addContent(elementClass);
       addFacets(componentTag, namespace, element);
-
-
       return element;
   }
 
@@ -198,7 +196,7 @@
       if (simpleName.startsWith("set")) {
         String attributeStr = simpleName.substring(3, 4).toLowerCase() + simpleName.substring(4);
         String methodStr;
-        if (componentAttribute.type().length > 0 &&
+        if (componentAttribute.type().length == 1 &&
             (componentAttribute.type()[0].equals(Boolean.class.getName()) || componentAttribute.type()[0].equals("boolean")))
{
           methodStr = "is" + simpleName.substring(3);
         } else {
@@ -214,7 +212,7 @@
           attributeClass = new Element(PROPERTY_CLASS, namespace);
 
         } catch (NoSuchMethodException e) {
-          e.printStackTrace();
+          // if property not found should be attribute
           attribute = new Element(ATTRIBUTE, namespace);
           attributeName = new Element(ATTRIBUTE_NAME, namespace);
           attributeClass = new Element(ATTRIBUTE_CLASS, namespace);
@@ -319,6 +317,7 @@
         Class<?> uiComponentClass = Class.forName(componentTag.uiComponent());
         Element element = createElement(decl, componentTag, uiComponentClass, namespace);
         if (element != null) {
+          addAttributes(decl, uiComponentClass, element, namespace);
           components.add(element);
         }
       } catch (Exception e) {



Mime
View raw message