You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by aw...@apache.org on 2007/08/26 23:54:00 UTC

svn commit: r569891 - /myfaces/trinidad/branches/1.2.2-branch/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java

Author: awiner
Date: Sun Aug 26 14:53:59 2007
New Revision: 569891

URL: http://svn.apache.org/viewvc?rev=569891&view=rev
Log:
TRINIDAD-649: Stop branching plugins - use one version for both JSF 1.1 and 1.2
- Add JSP taglib generation fixes for JSF 1.1 generation from the 1.2
  version - the description element was getting generated in the wrong place

Modified:
    myfaces/trinidad/branches/1.2.2-branch/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java

Modified: myfaces/trinidad/branches/1.2.2-branch/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.2-branch/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java?rev=569891&r1=569890&r2=569891&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.2-branch/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java (original)
+++ myfaces/trinidad/branches/1.2.2-branch/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java Sun Aug 26 14:53:59 2007
@@ -354,7 +354,9 @@
     stream.writeCharacters("\n  ");
     stream.writeStartElement("tag");
     stream.writeCharacters("\n    ");
-    if (component.getDescription() != null)
+
+    // In JSP 2.1, description goes up top
+    if (_is12() && component.getDescription() != null)
     {
       stream.writeCharacters("\n    ");
       stream.writeStartElement("description");
@@ -381,6 +383,15 @@
 
     GenerateJspTaglibsMojo.this.writeCustomComponentTagDescriptorContent(stream, component);
 
+    // In JSP 2.0, description goes just before the attributes
+    if (!_is12() && component.getDescription() != null)
+    {
+      stream.writeCharacters("\n    ");
+      stream.writeStartElement("description");
+      stream.writeCData(component.getDescription());
+      stream.writeEndElement();
+    }
+
     Iterator properties = component.properties(true);
     properties = new FilteredIterator(properties, new TagAttributeFilter());
     while (properties.hasNext())
@@ -407,7 +418,7 @@
     stream.writeCharacters("\n  ");
     stream.writeStartElement("tag");
     stream.writeCharacters("\n    ");
-    if (converter.getDescription() != null)
+    if (_is12() && converter.getDescription() != null)
     {
       stream.writeCharacters("\n    ");
       stream.writeStartElement("description");
@@ -432,6 +443,14 @@
       stream.writeEndElement();
     }
 
+    if (!_is12() && converter.getDescription() != null)
+    {
+      stream.writeCharacters("\n    ");
+      stream.writeStartElement("description");
+      stream.writeCData(converter.getDescription());
+      stream.writeEndElement();
+    }
+
     // converters need an id attribute
     writeTagAttribute(stream, "id", "the identifier for the converter", null, null);
 
@@ -451,15 +470,11 @@
     stream.writeEndElement();
   }
 
-  protected void writeTagAttribute(
+  private void _writeTagAttributeDescription(
     XMLStreamWriter stream,
-    String          propertyName,
     String          description,
-    String[]        unsupportedAgents,
-    PropertyBean    property) throws XMLStreamException
+    String[]        unsupportedAgents) throws XMLStreamException
   {
-    stream.writeCharacters("\n    ");
-    stream.writeStartElement("attribute");
 
     if (description != null ||
         unsupportedAgents.length > 0)
@@ -485,6 +500,21 @@
       stream.writeCData(description);
       stream.writeEndElement();
     }
+  }
+
+  protected void writeTagAttribute(
+    XMLStreamWriter stream,
+    String          propertyName,
+    String          description,
+    String[]        unsupportedAgents,
+    PropertyBean    property) throws XMLStreamException
+  {
+    stream.writeCharacters("\n    ");
+    stream.writeStartElement("attribute");
+
+    // In JSP 2.1, the description goes at the beginning
+    if (_is12())
+      _writeTagAttributeDescription(stream, description, unsupportedAgents);
 
     stream.writeCharacters("\n      ");
     stream.writeStartElement("name");
@@ -502,6 +532,9 @@
       stream.writeStartElement("rtexprvalue");
       stream.writeCharacters("false");
       stream.writeEndElement();
+
+      // In JSP 2.0, the tag description goes at the end
+      _writeTagAttributeDescription(stream, description, unsupportedAgents);
     }
     else
     {
@@ -596,7 +629,7 @@
     stream.writeCharacters("\n  ");
     stream.writeStartElement("tag");
 
-    if (validator.getDescription() != null)
+    if (_is12() && validator.getDescription() != null)
     {
       stream.writeCharacters("\n    ");
       stream.writeStartElement("description");
@@ -619,6 +652,14 @@
       stream.writeCharacters("\n    ");
       stream.writeStartElement("body-content");
       stream.writeCharacters("empty");
+      stream.writeEndElement();
+    }
+
+    if (!_is12() && validator.getDescription() != null)
+    {
+      stream.writeCharacters("\n    ");
+      stream.writeStartElement("description");
+      stream.writeCData(validator.getDescription());
       stream.writeEndElement();
     }