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 2013/03/05 13:11:42 UTC
svn commit: r1452759 - in /myfaces/tobago/trunk: tobago-core/
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/
tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/
tobago-extension/tobago-face...
Author: lofwyr
Date: Tue Mar 5 12:11:41 2013
New Revision: 1452759
URL: http://svn.apache.org/r1452759
Log:
TOBAGO-1229: Using Facelets 2.0 from JSF 2.0 instead of Facelets 1.1 from Sun
- the tobago.taglib.xml and tobago-sandbox.taglib.xml will now be generated
TOBAGO-1220: Build with profile generate-tag-reference fails
- generator for Reference was removed
Added:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ValidateFileItemTag.java
- copied, changed from r1452226, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FileItemValidatorTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ValidateSubmittedValueLengthTag.java
- copied, changed from r1452226, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SubmittedValueLengthValidatorTag.java
myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/AnnotationUtils.java
myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/SimpleTag.java
- copied, changed from r1452226, myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/TagGeneration.java
myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/ValidatorTag.java
- copied, changed from r1452226, myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/TagGeneration.java
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java
- copied, changed from r1452232, myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TldGenerator.java
Removed:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FileItemValidatorTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SubmittedValueLengthValidatorTag.java
myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/resources/META-INF/tobago.taglib.xml
myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/resources/META-INF/tobago-sandbox.taglib.xml
myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/TagGeneration.java
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/ReferenceGenerator.java
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TldGenerator.java
Modified:
myfaces/tobago/trunk/tobago-core/pom.xml
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/AttributeTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ConverterTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/DataAttributeTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/GridLayoutConstraintTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/LoadBundleTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PopupReferenceTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ResetInputActionListenerTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ScriptTagDeclaration.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/StyleTagDeclaration.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabChangeListenerTag.java
myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/ConverterHandler.java
myfaces/tobago/trunk/tobago-extension/tobago-sandbox/pom.xml
myfaces/tobago/trunk/tobago-extension/tobago-taglib-extension/pom.xml
myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/Taglib.java
myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/UIComponentTag.java
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/ComponentInfo.java
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/AbstractGenerator.java
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/CheckstyleConfigGenerator.java
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/ClassesGenerator.java
Modified: myfaces/tobago/trunk/tobago-core/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/pom.xml?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/pom.xml (original)
+++ myfaces/tobago/trunk/tobago-core/pom.xml Tue Mar 5 12:11:41 2013
@@ -62,15 +62,13 @@
<outputDirectory>${project.build.directory}/generated</outputDirectory>
<processors>
<processor>org.apache.myfaces.tobago.apt.processor.ClassesGenerator</processor>
- <processor>org.apache.myfaces.tobago.apt.processor.TldGenerator</processor>
+ <processor>org.apache.myfaces.tobago.apt.processor.TaglibGenerator</processor>
<processor>org.apache.myfaces.tobago.apt.processor.FacesConfigGenerator</processor>
- <processor>org.apache.myfaces.tobago.apt.processor.ReferenceGenerator</processor>
</processors>
<optionMap>
<sourceFacesConfig>${basedir}/src/main/faces-config/faces-config.xml</sourceFacesConfig>
<targetFacesConfig>META-INF/faces-config.xml</targetFacesConfig>
- <targetTld>META-INF</targetTld>
- <targetReference>META-INF</targetReference>
+ <targetTaglib>META-INF</targetTaglib>
<jsfVersion>${jsf.target}</jsfVersion>
</optionMap>
</configuration>
@@ -109,9 +107,7 @@
<resource>
<directory>${project.build.directory}/generated</directory>
<includes>
- <include>**/*.tld</include>
- <include>**/tobago.xml</include>
- <include>META-INF/faces-config.xml</include>
+ <include>META-INF/**/*</include>
</includes>
</resource>
</resources>
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/AttributeTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/AttributeTag.java?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/AttributeTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/AttributeTag.java Tue Mar 5 12:11:41 2013
@@ -22,7 +22,7 @@ package org.apache.myfaces.tobago.intern
import org.apache.myfaces.tobago.apt.annotation.BodyContent;
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
-import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
+import org.apache.myfaces.tobago.apt.annotation.SimpleTag;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.SupportsRenderedPartially;
import org.apache.myfaces.tobago.util.ComponentUtils;
@@ -43,7 +43,8 @@ import javax.servlet.jsp.tagext.TagSuppo
* associated with the closest parent UIComponent custom action.
*/
@Tag(name = "attribute", bodyContent = BodyContent.EMPTY)
-@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.AttributeTag")
+@SimpleTag(
+ faceletHandler = "org.apache.myfaces.tobago.facelets.AttributeHandler")
public abstract class AttributeTag extends TagSupport {
private static final long serialVersionUID = 2L;
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ConverterTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ConverterTag.java?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ConverterTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ConverterTag.java Tue Mar 5 12:11:41 2013
@@ -22,7 +22,7 @@ package org.apache.myfaces.tobago.intern
import org.apache.myfaces.tobago.apt.annotation.BodyContent;
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
-import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
+import org.apache.myfaces.tobago.apt.annotation.SimpleTag;
import org.apache.myfaces.tobago.component.Attributes;
import javax.el.ELContext;
@@ -41,7 +41,8 @@ import javax.servlet.jsp.tagext.TagSuppo
* associated with the closest parent UIComponent.
*/
@Tag(name = "converter", bodyContent = BodyContent.EMPTY)
-@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.ConverterTag")
+@SimpleTag(
+ faceletHandler = "org.apache.myfaces.tobago.facelets.ConverterHandler")
public abstract class ConverterTag extends TagSupport {
private static final long serialVersionUID = 2L;
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/DataAttributeTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/DataAttributeTag.java?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/DataAttributeTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/DataAttributeTag.java Tue Mar 5 12:11:41 2013
@@ -20,9 +20,10 @@
package org.apache.myfaces.tobago.internal.taglib.component;
import org.apache.myfaces.tobago.apt.annotation.BodyContent;
+import org.apache.myfaces.tobago.apt.annotation.Preliminary;
+import org.apache.myfaces.tobago.apt.annotation.SimpleTag;
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
-import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
import org.apache.myfaces.tobago.util.ComponentUtils;
import javax.el.ELContext;
@@ -42,8 +43,10 @@ import javax.servlet.jsp.tagext.TagSuppo
* Data attributes will be passed through the renderers into the DOM of the user agent and
* can be used by scripts.
*/
+@Preliminary
@Tag(name = "dataAttribute", bodyContent = BodyContent.EMPTY)
-@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.DataAttributeTag")
+@SimpleTag(
+ faceletHandler = "org.apache.myfaces.tobago.facelets.DataAttributeHandler")
public abstract class DataAttributeTag extends TagSupport {
private static final long serialVersionUID = 2L;
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/GridLayoutConstraintTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/GridLayoutConstraintTag.java?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/GridLayoutConstraintTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/GridLayoutConstraintTag.java Tue Mar 5 12:11:41 2013
@@ -20,9 +20,9 @@
package org.apache.myfaces.tobago.internal.taglib.component;
import org.apache.myfaces.tobago.apt.annotation.BodyContent;
+import org.apache.myfaces.tobago.apt.annotation.SimpleTag;
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
-import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.layout.LayoutBase;
@@ -42,7 +42,8 @@ import javax.servlet.jsp.tagext.TagSuppo
* Add GridLayoutConstraints to the parent UIComponent.
*/
@Tag(name = "gridLayoutConstraint", bodyContent = BodyContent.EMPTY)
-@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.GridLayoutConstraintTag")
+@SimpleTag(
+ faceletHandler = "org.apache.myfaces.tobago.facelets.GridLayoutConstraintHandler")
public abstract class GridLayoutConstraintTag extends TagSupport {
private static final long serialVersionUID = 4L;
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/LoadBundleTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/LoadBundleTag.java?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/LoadBundleTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/LoadBundleTag.java Tue Mar 5 12:11:41 2013
@@ -23,7 +23,7 @@ import org.apache.myfaces.tobago.apt.ann
import org.apache.myfaces.tobago.apt.annotation.DynamicExpression;
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
-import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
+import org.apache.myfaces.tobago.apt.annotation.SimpleTag;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.util.BundleMapWrapper;
@@ -46,7 +46,8 @@ import java.util.Map;
* and configure it in the faces-config.xml.
*/
@Tag(name = "loadBundle", bodyContent = BodyContent.EMPTY)
-@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.LoadBundleTag")
+@SimpleTag(
+ faceletHandler = "org.apache.myfaces.tobago.facelets.LoadBundleHandler")
public abstract class LoadBundleTag extends TagSupport {
private static final long serialVersionUID = 2L;
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PopupReferenceTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PopupReferenceTag.java?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PopupReferenceTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PopupReferenceTag.java Tue Mar 5 12:11:41 2013
@@ -20,9 +20,9 @@
package org.apache.myfaces.tobago.internal.taglib.component;
import org.apache.myfaces.tobago.apt.annotation.BodyContent;
+import org.apache.myfaces.tobago.apt.annotation.SimpleTag;
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
-import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.event.PopupActionListener;
@@ -40,7 +40,8 @@ import javax.servlet.jsp.tagext.TagSuppo
* associated with the closest parent UIComponent.
*/
@Tag(name = "popupReference", bodyContent = BodyContent.EMPTY)
-@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.PopupReferenceTag")
+@SimpleTag(
+ faceletHandler = "org.apache.myfaces.tobago.facelets.PopupReferenceHandler")
public abstract class PopupReferenceTag extends TagSupport {
private static final long serialVersionUID = 2L;
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ResetInputActionListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ResetInputActionListenerTag.java?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ResetInputActionListenerTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ResetInputActionListenerTag.java Tue Mar 5 12:11:41 2013
@@ -22,7 +22,7 @@ package org.apache.myfaces.tobago.intern
import org.apache.myfaces.tobago.apt.annotation.BodyContent;
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
-import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
+import org.apache.myfaces.tobago.apt.annotation.SimpleTag;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.event.ResetFormActionListener;
import org.apache.myfaces.tobago.event.ResetInputActionListener;
@@ -44,7 +44,8 @@ import javax.servlet.jsp.tagext.TagSuppo
* of a page or in a sub-form or part of the component tree.
*/
@Tag(name = "resetInputActionListener", bodyContent = BodyContent.EMPTY)
-@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.ResetInputActionListenerTag")
+@SimpleTag(
+ faceletHandler = "org.apache.myfaces.tobago.facelets.ResetInputActionListenerHandler")
public abstract class ResetInputActionListenerTag extends TagSupport {
private static final long serialVersionUID = 2L;
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ScriptTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ScriptTagDeclaration.java?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ScriptTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ScriptTagDeclaration.java Tue Mar 5 12:11:41 2013
@@ -35,6 +35,7 @@ import org.apache.myfaces.tobago.interna
uiComponent = "org.apache.myfaces.tobago.component.UIScript",
uiComponentFacesClass = "javax.faces.component.UIComponentBase",
componentFamily = "org.apache.myfaces.tobago.Script",
+ faceletHandler = "org.apache.myfaces.tobago.facelets.ScriptHandler",
rendererType = RendererTypes.SCRIPT,
isTransparentForLayout = true,
allowedChildComponenents = "NONE")
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/StyleTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/StyleTagDeclaration.java?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/StyleTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/StyleTagDeclaration.java Tue Mar 5 12:11:41 2013
@@ -38,6 +38,7 @@ import org.apache.myfaces.tobago.interna
uiComponent = "org.apache.myfaces.tobago.component.UIStyle",
componentFamily = "org.apache.myfaces.tobago.Style",
uiComponentFacesClass = "javax.faces.component.UIComponentBase",
+ faceletHandler = "org.apache.myfaces.tobago.facelets.StyleHandler",
rendererType = RendererTypes.STYLE,
isTransparentForLayout = true,
allowedChildComponenents = "NONE")
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabChangeListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabChangeListenerTag.java?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabChangeListenerTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabChangeListenerTag.java Tue Mar 5 12:11:41 2013
@@ -22,7 +22,7 @@ package org.apache.myfaces.tobago.intern
import org.apache.myfaces.tobago.apt.annotation.BodyContent;
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
-import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
+import org.apache.myfaces.tobago.apt.annotation.SimpleTag;
import org.apache.myfaces.tobago.event.TabChangeListener;
import org.apache.myfaces.tobago.event.TabChangeSource;
import org.apache.myfaces.tobago.event.ValueExpressionTabChangeListener;
@@ -41,7 +41,8 @@ import javax.servlet.jsp.tagext.TagSuppo
* associated with the closest parent UIComponent custom action.
*/
@Tag(name = "tabChangeListener", bodyContent = BodyContent.EMPTY)
-@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.TabChangeListenerTag")
+@SimpleTag(
+ faceletHandler = "org.apache.myfaces.tobago.facelets.TabChangeListenerHandler")
public abstract class TabChangeListenerTag extends TagSupport {
private static final long serialVersionUID = 2L;
Copied: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ValidateFileItemTag.java (from r1452226, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FileItemValidatorTag.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ValidateFileItemTag.java?p2=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ValidateFileItemTag.java&p1=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FileItemValidatorTag.java&r1=1452226&r2=1452759&rev=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FileItemValidatorTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ValidateFileItemTag.java Tue Mar 5 12:11:41 2013
@@ -21,7 +21,7 @@ package org.apache.myfaces.tobago.intern
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
-import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
+import org.apache.myfaces.tobago.apt.annotation.ValidatorTag;
import org.apache.myfaces.tobago.util.ComponentUtils;
import org.apache.myfaces.tobago.validator.FileItemValidator;
import org.slf4j.Logger;
@@ -40,13 +40,14 @@ import javax.servlet.jsp.JspException;
* associated with the closest parent UIComponent custom action.
*/
@Tag(name = "validateFileItem")
-@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.FileItemValidatorTag")
-// todo: use ValidatorELTag instead of ValidatorTag
-public abstract class FileItemValidatorTag extends ValidatorELTag {
+@ValidatorTag(
+ validatorId = FileItemValidator.VALIDATOR_ID,
+ faceletHandler = "org.apache.myfaces.tobago.facelets.TobagoValidateHandler")
+public abstract class ValidateFileItemTag extends ValidatorELTag {
private static final long serialVersionUID = 2L;
- private static final Logger LOG = LoggerFactory.getLogger(FileItemValidatorTag.class);
+ private static final Logger LOG = LoggerFactory.getLogger(ValidateFileItemTag.class);
private javax.el.ValueExpression contentType;
private javax.el.ValueExpression maxSize;
Copied: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ValidateSubmittedValueLengthTag.java (from r1452226, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SubmittedValueLengthValidatorTag.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ValidateSubmittedValueLengthTag.java?p2=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ValidateSubmittedValueLengthTag.java&p1=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SubmittedValueLengthValidatorTag.java&r1=1452226&r2=1452759&rev=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SubmittedValueLengthValidatorTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ValidateSubmittedValueLengthTag.java Tue Mar 5 12:11:41 2013
@@ -21,7 +21,7 @@ package org.apache.myfaces.tobago.intern
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
-import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
+import org.apache.myfaces.tobago.apt.annotation.ValidatorTag;
import org.apache.myfaces.tobago.validator.SubmittedValueLengthValidator;
import javax.el.ELContext;
@@ -39,8 +39,9 @@ import javax.servlet.jsp.JspException;
* not on the submitted value. Sometime you need to check the length of the submitted value.
*/
@Tag(name = "validateSubmittedValueLength")
-@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.SubmittedValueLengthValidatorTag")
-public abstract class SubmittedValueLengthValidatorTag extends ValidatorELTag {
+@ValidatorTag(
+ validatorId = SubmittedValueLengthValidator.VALIDATOR_ID)
+public abstract class ValidateSubmittedValueLengthTag extends ValidatorELTag {
private static final long serialVersionUID = 2L;
Modified: myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/ConverterHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/ConverterHandler.java?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/ConverterHandler.java (original)
+++ myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/ConverterHandler.java Tue Mar 5 12:11:41 2013
@@ -35,9 +35,6 @@ import javax.faces.view.facelets.TagExce
import javax.faces.view.facelets.TagHandler;
import java.io.IOException;
-/*
- TBD: Why we don't use a converter directly via the tobago.taglib.xml?
- */
public class ConverterHandler extends TagHandler {
private final TagAttribute converterId;
Modified: myfaces/tobago/trunk/tobago-extension/tobago-sandbox/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-sandbox/pom.xml?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-sandbox/pom.xml (original)
+++ myfaces/tobago/trunk/tobago-extension/tobago-sandbox/pom.xml Tue Mar 5 12:11:41 2013
@@ -89,15 +89,13 @@
<outputDirectory>${project.build.directory}/generated</outputDirectory>
<processors>
<processor>org.apache.myfaces.tobago.apt.processor.ClassesGenerator</processor>
- <processor>org.apache.myfaces.tobago.apt.processor.TldGenerator</processor>
+ <processor>org.apache.myfaces.tobago.apt.processor.TaglibGenerator</processor>
<processor>org.apache.myfaces.tobago.apt.processor.FacesConfigGenerator</processor>
- <processor>org.apache.myfaces.tobago.apt.processor.ReferenceGenerator</processor>
</processors>
<optionMap>
<sourceFacesConfig>${basedir}/src/main/faces-config/faces-config.xml</sourceFacesConfig>
<targetFacesConfig>META-INF/faces-config.xml</targetFacesConfig>
- <targetTld>META-INF</targetTld>
- <targetReference>META-INF</targetReference>
+ <targetTaglib>META-INF</targetTaglib>
<jsfVersion>${jsf.target}</jsfVersion>
</optionMap>
</configuration>
@@ -161,9 +159,7 @@
<resource>
<directory>${project.build.directory}/generated</directory>
<includes>
- <include>**/*.tld</include>
- <include>**/tobago-sandbox.xml</include>
- <include>META-INF/faces-config.xml</include>
+ <include>META-INF/**/*</include>
</includes>
</resource>
</resources>
Modified: myfaces/tobago/trunk/tobago-extension/tobago-taglib-extension/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-taglib-extension/pom.xml?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-taglib-extension/pom.xml (original)
+++ myfaces/tobago/trunk/tobago-extension/tobago-taglib-extension/pom.xml Tue Mar 5 12:11:41 2013
@@ -83,13 +83,11 @@
<!-- source output directory -->
<outputDirectory>${project.build.directory}/generated</outputDirectory>
<processors>
- <processor>org.apache.myfaces.tobago.apt.processor.TldGenerator</processor>
- <processor>org.apache.myfaces.tobago.apt.processor.ReferenceGenerator</processor>
+ <processor>org.apache.myfaces.tobago.apt.processor.TaglibGenerator</processor>
<processor>org.apache.myfaces.tobago.apt.processor.CheckstyleConfigGenerator</processor>
</processors>
<optionMap>
- <targetTld>META-INF</targetTld>
- <targetReference>META-INF</targetReference>
+ <targetTaglib>META-INF</targetTaglib>
<targetCheckstyle>META-INF</targetCheckstyle>
<jsfVersion>${jsf.target}</jsfVersion>
</optionMap>
@@ -121,9 +119,7 @@
<resource>
<directory>${project.build.directory}/generated</directory>
<includes>
- <include>**/*.tld</include>
- <include>**/tobago-extension.xml</include>
- <include>META-INF/tobago-checkstyle.xml</include>
+ <include>META-INF/**/*</include>
</includes>
</resource>
</resources>
Added: myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/AnnotationUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/AnnotationUtils.java?rev=1452759&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/AnnotationUtils.java (added)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/AnnotationUtils.java Tue Mar 5 12:11:41 2013
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.tobago.apt.annotation;
+
+import javax.lang.model.element.TypeElement;
+
+public final class AnnotationUtils {
+
+ private AnnotationUtils() {
+ }
+
+ public static String componentType(UIComponentTag componentTag) {
+ final String s = componentTag.componentType();
+ if (s != null && s.length() > 0) {
+ return s;
+ } else {
+ return componentTag.uiComponent().replace(".component.UI", ".");
+ }
+ }
+
+ public static String generatedTagName(TypeElement typeElement) {
+ final String s = typeElement.getQualifiedName().toString();
+ return s.replace(".component.", ".");
+ }
+
+}
Copied: myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/SimpleTag.java (from r1452226, myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/TagGeneration.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/SimpleTag.java?p2=myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/SimpleTag.java&p1=myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/TagGeneration.java&r1=1452226&r2=1452759&rev=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/TagGeneration.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/SimpleTag.java Tue Mar 5 12:11:41 2013
@@ -23,6 +23,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(value = RetentionPolicy.SOURCE)
-public @interface TagGeneration {
- String className();
+public @interface SimpleTag {
+ String faceletHandler();
}
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/Taglib.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/Taglib.java?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/Taglib.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/Taglib.java Tue Mar 5 12:11:41 2013
@@ -32,6 +32,6 @@ public @interface Taglib {
String shortName();
String uri();
String name();
- String displayName() default "";
+ String displayName();
String [] listener() default {};
}
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/UIComponentTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/UIComponentTag.java?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/UIComponentTag.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/UIComponentTag.java Tue Mar 5 12:11:41 2013
@@ -41,6 +41,8 @@ public @interface UIComponentTag {
String rendererType() default "";
+ String faceletHandler() default "org.apache.myfaces.tobago.facelets.TobagoComponentHandler";
+
String displayName() default "";
boolean isLayout() default false;
Copied: myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/ValidatorTag.java (from r1452226, myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/TagGeneration.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/ValidatorTag.java?p2=myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/ValidatorTag.java&p1=myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/TagGeneration.java&r1=1452226&r2=1452759&rev=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/TagGeneration.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/ValidatorTag.java Tue Mar 5 12:11:41 2013
@@ -23,6 +23,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(value = RetentionPolicy.SOURCE)
-public @interface TagGeneration {
- String className();
+public @interface ValidatorTag {
+ String validatorId();
+ String faceletHandler() default "";
}
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/ComponentInfo.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/ComponentInfo.java?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/ComponentInfo.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/ComponentInfo.java Tue Mar 5 12:11:41 2013
@@ -19,6 +19,7 @@
package org.apache.myfaces.tobago.apt.generate;
+import org.apache.myfaces.tobago.apt.annotation.AnnotationUtils;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
import javax.lang.model.element.TypeElement;
@@ -38,13 +39,8 @@ public class ComponentInfo extends TagIn
public ComponentInfo(TypeElement declaration, UIComponentTag componentTag) {
super(declaration.getQualifiedName().toString(), componentTag.uiComponent(), componentTag.rendererType());
- if (componentTag.componentType().length() > 0) {
- setComponentType(componentTag.componentType());
- } else {
- setComponentType(componentTag.uiComponent().replace(".component.UI", "."));
- }
+ setComponentType(AnnotationUtils.componentType(componentTag));
setComponentFamily(componentTag.componentFamily());
-
setComponentClassName(componentTag.uiComponent());
}
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/AbstractGenerator.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/AbstractGenerator.java?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/AbstractGenerator.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/AbstractGenerator.java Tue Mar 5 12:11:41 2013
@@ -19,8 +19,6 @@
package org.apache.myfaces.tobago.apt.processor;
-import org.w3c.dom.Document;
-
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedSourceVersion;
@@ -114,18 +112,6 @@ public abstract class AbstractGenerator
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "" + e.getMessage() + "\n" + out.toString());
}
- protected void addLeafTextElement(String text, String node, org.w3c.dom.Element parent, Document document) {
- org.w3c.dom.Element element = document.createElement(node);
- element.appendChild(document.createTextNode(text));
- parent.appendChild(element);
- }
-
- protected void addLeafCDATAElement(String text, String node, org.w3c.dom.Element parent, Document document) {
- org.w3c.dom.Element element = document.createElement(node);
- element.appendChild(document.createCDATASection(text));
- parent.appendChild(element);
- }
-
public List<TypeElement> getTypes() {
return types;
}
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/CheckstyleConfigGenerator.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/CheckstyleConfigGenerator.java?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/CheckstyleConfigGenerator.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/CheckstyleConfigGenerator.java Tue Mar 5 12:11:41 2013
@@ -22,13 +22,15 @@ package org.apache.myfaces.tobago.apt.pr
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
+import org.apache.myfaces.tobago.apt.annotation.AnnotationUtils;
import org.apache.myfaces.tobago.apt.annotation.ExtensionTag;
+import org.apache.myfaces.tobago.apt.annotation.SimpleTag;
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
-import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
import org.apache.myfaces.tobago.apt.annotation.Taglib;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+import org.apache.myfaces.tobago.apt.annotation.ValidatorTag;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -145,22 +147,15 @@ public class CheckstyleConfigGenerator e
checkDuplicates(annotationTag.name());
// TODO configure replacement
final String className;
- if (typeElement.getAnnotation(TagGeneration.class) != null) {
- className = typeElement.getAnnotation(TagGeneration.class).className();
-// info("G");
+ if (typeElement.getAnnotation(SimpleTag.class) != null || typeElement.getAnnotation(ValidatorTag.class) != null) {
+ className = AnnotationUtils.generatedTagName(typeElement);
} else if (typeElement.getAnnotation(ExtensionTag.class) != null) {
className = typeElement.getQualifiedName().toString();
-// info("X");
} else if (typeElement.getAnnotation(UIComponentTag.class) != null) {
className = "org.apache.myfaces.tobago.internal.taglib." + StringUtils.capitalize(annotationTag.name())
+ "Tag";
-// info("C");
} else {
-/*
- className = typeElement.getQualifiedName().toString()
- .substring(0, typeElement.getQualifiedName().length() - "Declaration".length());
-*/
- throw new RuntimeException("Not supported");
+ throw new RuntimeException("Not supported: " + typeElement.getQualifiedName());
}
info("Replacing: " + typeElement.getQualifiedName() + " -> " + className);
if (typeElement.getAnnotation(Deprecated.class) != null) {
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/ClassesGenerator.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/ClassesGenerator.java?rev=1452759&r1=1452758&r2=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/ClassesGenerator.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/ClassesGenerator.java Tue Mar 5 12:11:41 2013
@@ -23,12 +23,14 @@ import org.antlr.stringtemplate.StringTe
import org.antlr.stringtemplate.StringTemplateGroup;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
+import org.apache.myfaces.tobago.apt.annotation.AnnotationUtils;
import org.apache.myfaces.tobago.apt.annotation.DynamicExpression;
+import org.apache.myfaces.tobago.apt.annotation.SimpleTag;
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
-import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+import org.apache.myfaces.tobago.apt.annotation.ValidatorTag;
import org.apache.myfaces.tobago.apt.generate.ClassInfo;
import org.apache.myfaces.tobago.apt.generate.ComponentInfo;
import org.apache.myfaces.tobago.apt.generate.ComponentPropertyInfo;
@@ -66,7 +68,7 @@ import java.util.Set;
"org.apache.myfaces.tobago.apt.annotation.UIComponentTag",
"org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute",
"org.apache.myfaces.tobago.apt.annotation.Taglib",
- "org.apache.myfaces.tobago.apt.annotation.TagGeneration"})
+ "org.apache.myfaces.tobago.apt.annotation.SimpleTag"})
@SupportedOptions({
ClassesGenerator.TAG_VERSION,
ClassesGenerator.JSF_VERSION})
@@ -127,7 +129,7 @@ public class ClassesGenerator extends Ab
throw new RuntimeException(
"Error during processing of " + element.getAnnotation(UIComponentTag.class).uiComponent(), e);
}
- } else if (element.getAnnotation(Tag.class) != null && element.getAnnotation(TagGeneration.class) != null) {
+ } else if (element.getAnnotation(SimpleTag.class) != null || element.getAnnotation(ValidatorTag.class) != null) {
createTag(element);
}
}
@@ -136,9 +138,9 @@ public class ClassesGenerator extends Ab
private void createTag(TypeElement declaration) throws IOException {
List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
addPropertiesForTagOnly(declaration, properties);
- TagGeneration tagGeneration = declaration.getAnnotation(TagGeneration.class);
+ String className = AnnotationUtils.generatedTagName(declaration);
- TagInfo tagInfo = new TagInfo(declaration.getQualifiedName().toString(), tagGeneration.className());
+ TagInfo tagInfo = new TagInfo(declaration.getQualifiedName().toString(), className);
tagInfo.setSuperClass(declaration.getQualifiedName().toString());
StringTemplate stringTemplate = tagAbstractStringTemplateGroup.getInstanceOf("tag");
stringTemplate.setAttribute("tagInfo", tagInfo);
Copied: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java (from r1452232, myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TldGenerator.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java?p2=myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java&p1=myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TldGenerator.java&r1=1452232&r2=1452759&rev=1452759&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TldGenerator.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java Tue Mar 5 12:11:41 2013
@@ -21,6 +21,7 @@ package org.apache.myfaces.tobago.apt.pr
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
+import org.apache.myfaces.tobago.apt.annotation.AnnotationUtils;
import org.apache.myfaces.tobago.apt.annotation.BodyContent;
import org.apache.myfaces.tobago.apt.annotation.BodyContentDescription;
import org.apache.myfaces.tobago.apt.annotation.ExtensionTag;
@@ -28,10 +29,11 @@ import org.apache.myfaces.tobago.apt.ann
import org.apache.myfaces.tobago.apt.annotation.Preliminary;
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
-import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
+import org.apache.myfaces.tobago.apt.annotation.SimpleTag;
import org.apache.myfaces.tobago.apt.annotation.Taglib;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+import org.apache.myfaces.tobago.apt.annotation.ValidatorTag;
import org.apache.myfaces.tobago.apt.generate.ClassUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -69,88 +71,74 @@ import java.util.Set;
"org.apache.myfaces.tobago.apt.annotation.TagAttribute",
"org.apache.myfaces.tobago.apt.annotation.Taglib"})
@SupportedOptions({
- TldGenerator.JSF_VERSION,
- TldGenerator.TARGET_TLD})
-public class TldGenerator extends AbstractGenerator {
+ TaglibGenerator.JSF_VERSION,
+ TaglibGenerator.TARGET_TAGLIB})
+public class TaglibGenerator extends AbstractGenerator {
- static final String TARGET_TLD = "targetTld";
+ static final String TARGET_TAGLIB = "targetTaglib";
private Set<String> tagSet = new HashSet<String>();
private Set<String> attributeSet = new HashSet<String>();
private String currentTag;
private String jsfVersion;
- private String targetTld;
+ private String targetTaglib;
public void configure() {
final Map<String, String> options = processingEnv.getOptions();
jsfVersion = options.get(JSF_VERSION);
- targetTld = options.get(TARGET_TLD);
+ targetTaglib = options.get(TARGET_TAGLIB);
- info("Generating the *.tld");
+ info("Generating the *.tld and *.taglib.xml");
info("Options:");
info(JSF_VERSION + ": " + jsfVersion);
- info(TARGET_TLD + ": " + targetTld);
+ info(TARGET_TAGLIB + ": " + targetTaglib);
}
public void generate()
throws IOException, TransformerException, ParserConfigurationException, ClassNotFoundException {
for (PackageElement packageElement : getPackages()) {
Taglib taglibAnnotation = packageElement.getAnnotation(Taglib.class);
- Document document = createTaglib(taglibAnnotation, packageElement);
- writeTaglib(packageElement, taglibAnnotation, document);
+
+ createTaglib(taglibAnnotation, packageElement, Type.JSP);
+ createTaglib(taglibAnnotation, packageElement, Type.FACELETS);
}
}
- protected Document createTaglib(Taglib taglibAnnotation, PackageElement packageElement)
- throws ParserConfigurationException, ClassNotFoundException {
+ protected void createTaglib(Taglib taglibAnnotation, PackageElement packageElement, Type type)
+ throws ParserConfigurationException, ClassNotFoundException, IOException, TransformerException {
resetDuplicateList();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(false);
- DocumentBuilder parser = dbf.newDocumentBuilder();
+ // building the XML document
+
+ DocumentBuilder parser = dbf.newDocumentBuilder();
Document document = parser.newDocument();
- Element taglib = document.createElement("taglib");
- taglib.setAttribute("xmlns", "http://java.sun.com/xml/ns/javaee");
- taglib.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
- taglib.setAttribute("xsi:schemaLocation",
- "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd");
- taglib.setAttribute("version", "2.1");
+ Element taglib = type.createTaglib(document);
String description = processingEnv.getElementUtils().getDocComment(packageElement);
if (description != null) {
addLeafCDATAElement(description, "description", taglib, document);
}
- String displayName = taglibAnnotation.displayName();
- if (displayName == null || displayName.length() == 0) {
- displayName = taglibAnnotation.shortName();
- }
- addLeafTextElement(displayName, "display-name", taglib, document);
- addLeafTextElement("1.2", "tlib-version", taglib, document);
- addLeafTextElement(taglibAnnotation.shortName(), "short-name", taglib, document);
- addLeafTextElement(taglibAnnotation.uri(), "uri", taglib, document);
- for (String listenerClass : taglibAnnotation.listener()) {
- Element listener = document.createElement("listener");
- addLeafTextElement(listenerClass, "listener-class", listener, document);
- taglib.appendChild(listener);
- }
+ addLeafTextElement(taglibAnnotation.displayName(), "display-name", taglib, document);
+ type.addMisc(taglib, document, taglibAnnotation);
+
+ type.addListeners(taglib, document, taglibAnnotation);
for (TypeElement typeElement : getTypes()) {
if (processingEnv.getElementUtils().getPackageOf(typeElement).equals(packageElement)) {
- appendTag(typeElement, taglib, document);
+ appendTag(typeElement, taglib, document, type);
}
}
document.appendChild(taglib);
- return document;
- }
- protected void writeTaglib(PackageElement packageElement, Taglib taglibAnnotation, Document document)
- throws IOException, TransformerException {
+ // writing the XML document
+
Writer writer = null;
try {
- final String name = (StringUtils.isNotBlank(targetTld) ? targetTld + '/' : "")
- + packageElement.getQualifiedName().toString().replace('.', '/') + '/' + taglibAnnotation.name() + ".tld";
- final FileObject resource = processingEnv.getFiler().createResource(StandardLocation.SOURCE_OUTPUT, "", name);
+ String name = type.filename(targetTaglib, packageElement.getQualifiedName().toString(), taglibAnnotation.name());
+ FileObject resource = processingEnv.getFiler().createResource(StandardLocation.SOURCE_OUTPUT, "", name);
info("Writing to file: " + resource.toUri());
writer = resource.openWriter();
@@ -164,69 +152,41 @@ public class TldGenerator extends Abstra
}
}
- protected void appendTag(TypeElement typeElement, Element parent, Document document) throws ClassNotFoundException {
+ protected void appendTag(TypeElement typeElement, Element parent, Document document, Type type)
+ throws ClassNotFoundException {
Tag annotationTag = typeElement.getAnnotation(Tag.class);
if (annotationTag != null) {
checkDuplicates(annotationTag.name());
resetAttributeDuplicateList();
// TODO configure replacement
final String className;
- if (typeElement.getAnnotation(TagGeneration.class) != null) {
- className = typeElement.getAnnotation(TagGeneration.class).className();
-// info("G");
+ if (typeElement.getAnnotation(SimpleTag.class) != null || typeElement.getAnnotation(ValidatorTag.class) != null) {
+ className = AnnotationUtils.generatedTagName(typeElement);
} else if (typeElement.getAnnotation(ExtensionTag.class) != null) {
className = typeElement.getQualifiedName().toString();
-// info("X");
} else if (typeElement.getAnnotation(UIComponentTag.class) != null) {
className = "org.apache.myfaces.tobago.internal.taglib." + StringUtils.capitalize(annotationTag.name())
+ "Tag";
-// info("C");
} else {
-/*
- className = typeElement.getQualifiedName().toString()
- .substring(0, typeElement.getQualifiedName().length() - "Declaration".length());
-*/
- throw new RuntimeException("Not supported");
+ throw new RuntimeException("Not supported: " + typeElement.getQualifiedName());
}
info("Replacing: " + typeElement.getQualifiedName() + " -> " + className);
- Element tag = createTag(typeElement, annotationTag, className, document, false);
- addAttributes(typeElement, tag, document);
+ Element tag = createTag(typeElement, annotationTag, className, document, false, type);
+ addAttributes(typeElement, tag, document, type);
parent.appendChild(tag);
if (annotationTag.deprecatedName() != null && annotationTag.deprecatedName().length() > 0) {
- Element deprecatedTag = createTag(typeElement, annotationTag, className, document, true);
- addAttributes(typeElement, deprecatedTag, document);
+ Element deprecatedTag = createTag(typeElement, annotationTag, className, document, true, type);
+ addAttributes(typeElement, deprecatedTag, document, type);
parent.appendChild(deprecatedTag);
}
}
}
protected Element createTag(
- TypeElement typeElement, Tag annotationTag, String className, Document document, boolean deprecated) {
+ TypeElement typeElement, Tag annotationTag, String className, Document document, boolean deprecated, Type type) {
Element tagElement = document.createElement("tag");
addDescription(typeElement, tagElement, document, deprecated);
- if (deprecated) {
- addLeafTextElement(annotationTag.deprecatedName(), "name", tagElement, document);
- } else {
- addLeafTextElement(annotationTag.name(), "name", tagElement, document);
- }
- addLeafTextElement(className, "tag-class", tagElement, document);
- String tagExtraInfo = annotationTag.tagExtraInfoClassName();
- if (tagExtraInfo != null && tagExtraInfo.length() > 0) {
- // TODO check tagExtraInfo extends TagExtraInfo
- addLeafTextElement(tagExtraInfo, "tei-class", tagElement, document);
- }
- BodyContent bodyContent = annotationTag.bodyContent();
- BodyContentDescription contentDescription = typeElement.getAnnotation(BodyContentDescription.class);
- // TODO more error checking
- if (contentDescription != null) {
- if (bodyContent.equals(BodyContent.JSP) && contentDescription.contentType().length() > 0) {
- throw new IllegalArgumentException(
- "contentType " + contentDescription.contentType() + " for bodyContent JSP not allowed!");
- } else if (bodyContent.equals(BodyContent.TAGDEPENDENT) && contentDescription.contentType().length() == 0) {
- throw new IllegalArgumentException("contentType should set for tagdependent bodyContent");
- }
- }
- addLeafTextElement(bodyContent.toString(), "body-content", tagElement, document);
+ type.addTagContent(typeElement, tagElement, document, deprecated, annotationTag, className);
return tagElement;
}
@@ -387,16 +347,17 @@ public class TldGenerator extends Abstra
return description.toString();
}
- protected void addAttributes(TypeElement type, Element tagElement, Document document) throws ClassNotFoundException {
+ protected void addAttributes(TypeElement typeElement, Element tagElement, Document document, Type type)
+ throws ClassNotFoundException {
- for (javax.lang.model.element.Element element : getAllMembers(type)) {
+ for (javax.lang.model.element.Element element : getAllMembers(typeElement)) {
if (element instanceof ExecutableElement) {
ExecutableElement executableElement = (ExecutableElement) element;
if (executableElement.getAnnotation(TagAttribute.class) == null
&& executableElement.getAnnotation(UIComponentTagAttribute.class) == null) {
continue;
}
- addAttribute(executableElement, tagElement, document);
+ addAttribute(executableElement, tagElement, document, type);
}
}
}
@@ -405,10 +366,10 @@ public class TldGenerator extends Abstra
final List<? extends javax.lang.model.element.Element> members
= new ArrayList<javax.lang.model.element.Element>(processingEnv.getElementUtils().getAllMembers(type));
Collections.sort(members, new Comparator<javax.lang.model.element.Element>() {
- public int compare(javax.lang.model.element.Element d1, javax.lang.model.element.Element d2) {
- return d1.getSimpleName().toString().compareTo(d2.getSimpleName().toString());
- }
- });
+ public int compare(javax.lang.model.element.Element d1, javax.lang.model.element.Element d2) {
+ return d1.getSimpleName().toString().compareTo(d2.getSimpleName().toString());
+ }
+ });
return members;
}
@@ -420,72 +381,273 @@ public class TldGenerator extends Abstra
attributeSet = new HashSet<String>();
}
- protected void addAttribute(ExecutableElement element, Element tagElement, Document document)
+ protected void addAttribute(ExecutableElement element, Element tagElement, Document document, Type type)
throws ClassNotFoundException {
TagAttribute tagAttribute = element.getAnnotation(TagAttribute.class);
if (tagAttribute != null) {
String simpleName = element.getSimpleName().toString();
if (simpleName.startsWith("set") || simpleName.startsWith("get")) {
Element attribute = document.createElement("attribute");
- String attributeStr = simpleName.substring(3, 4).toLowerCase(Locale.ENGLISH) + simpleName.substring(4);
+ String attributeName = simpleName.substring(3, 4).toLowerCase(Locale.ENGLISH) + simpleName.substring(4);
if (tagAttribute.name().length() > 0) {
- attributeStr = tagAttribute.name();
+ attributeName = tagAttribute.name();
}
- checkAttributeDuplicates(attributeStr);
+ checkAttributeDuplicates(attributeName);
addDescription(element, attribute, document, false);
- addLeafTextElement(attributeStr, "name", attribute, document);
+ addLeafTextElement(attributeName, "name", attribute, document);
addLeafTextElement(Boolean.toString(tagAttribute.required()), "required", attribute, document);
UIComponentTagAttribute componentTagAttribute = element.getAnnotation(UIComponentTagAttribute.class);
- if (!tagAttribute.rtexprvalue()) {
- if (componentTagAttribute != null) {
- if (componentTagAttribute.expression().isMethodExpression()) {
- Element deferredMethod = document.createElement("deferred-method");
- StringBuilder signature = new StringBuilder();
- signature.append(componentTagAttribute.methodReturnType());
- signature.append(" ");
- signature.append(attributeStr);
- signature.append("(");
- signature.append(StringUtils.join(componentTagAttribute.methodSignature(), ", "));
- signature.append(")");
- addLeafTextElement(signature.toString(), "method-signature", deferredMethod, document);
- attribute.appendChild(deferredMethod);
- } else if (componentTagAttribute.expression().isValueExpression()) {
- Element deferredValue = document.createElement("deferred-value");
- String type;
- if (componentTagAttribute.type().length == 1) {
- type = componentTagAttribute.type()[0];
- Class wrapper = ClassUtils.getWrapper(type);
- if (wrapper != null) {
- type = wrapper.getName(); // primitive types aren't allowed here
-/* } else {
- XXX what is with inner classes and arrays?
- if (type.endsWith("[]")) {
- Class.forName(type.substring(0, type.length() - 2)); // type check
- } else {
- Class.forName(type); // type check
+ type.addAttributeType(attribute, tagAttribute, componentTagAttribute, document, attributeName);
+ tagElement.appendChild(attribute);
+ } else {
+ throw new IllegalArgumentException("Only setter allowed found: " + simpleName);
+ }
+ }
+ }
+
+ protected static void addLeafTextElement(String text, String node, org.w3c.dom.Element parent, Document document) {
+ org.w3c.dom.Element element = document.createElement(node);
+ element.appendChild(document.createTextNode(text));
+ parent.appendChild(element);
+ }
+
+ protected static void addLeafCDATAElement(String text, String node, org.w3c.dom.Element parent, Document document) {
+ org.w3c.dom.Element element = document.createElement(node);
+ element.appendChild(document.createCDATASection(text));
+ parent.appendChild(element);
+ }
+
+ protected static enum Type {
+ JSP,
+ FACELETS;
+
+ public String filename(String target, String path, String name) {
+ target = StringUtils.isNotBlank(target) ? target + '/' : "";
+ switch (this) {
+ case JSP:
+ return target + path.replace('.', '/') + '/' + name + ".tld";
+ case FACELETS:
+ if (name.equals("tobago-extension")) {
+ return target + name + "-2.taglib.xml"; // XXX The extension lib will not be generated corretly... fix it!
+ } else {
+ return target + name + ".taglib.xml";
+ }
+ default:
+ throw new IllegalArgumentException("Program error");
+ }
+ }
+
+ public Element createTaglib(Document document) {
+ Element taglib;
+ switch (this) {
+ case JSP:
+ taglib = document.createElement("taglib");
+ taglib.setAttribute("xmlns", "http://java.sun.com/xml/ns/javaee");
+ taglib.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
+ taglib.setAttribute("xsi:schemaLocation",
+ "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd");
+ taglib.setAttribute("version", "2.1");
+ break;
+ case FACELETS:
+ taglib = document.createElement("facelet-taglib");
+ taglib.setAttribute("xmlns", "http://java.sun.com/xml/ns/javaee");
+ taglib.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
+ taglib.setAttribute("xsi:schemaLocation",
+ "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd");
+ taglib.setAttribute("version", "2.0");
+ break;
+ default:
+ throw new IllegalArgumentException("Program error");
+ }
+ return taglib;
+ }
+
+ public void addMisc(Element taglib, Document document, Taglib taglibAnnotation) {
+ switch (this) {
+ case JSP:
+ addLeafTextElement("1.2", "tlib-version", taglib, document);
+ addLeafTextElement(taglibAnnotation.shortName(), "short-name", taglib, document);
+ addLeafTextElement(taglibAnnotation.uri(), "uri", taglib, document);
+ break;
+ case FACELETS:
+ addLeafTextElement(taglibAnnotation.uri(), "namespace", taglib, document);
+ break;
+ default:
+ throw new IllegalArgumentException("Program error");
+ }
+ }
+
+ public void addListeners(Element taglib, Document document, Taglib taglibAnnotation) {
+ switch (this) {
+ case JSP:
+ for (String listenerClass : taglibAnnotation.listener()) {
+ Element listener = document.createElement("listener");
+ addLeafTextElement(listenerClass, "listener-class", listener, document);
+ taglib.appendChild(listener);
+ }
+ break;
+ case FACELETS:
+ break;
+ default:
+ throw new IllegalArgumentException("Program error");
+ }
+ }
+
+ public void addTagContent(
+ TypeElement typeElement, Element tagElement, Document document, boolean deprecated,
+ Tag annotationTag, String className) {
+ switch (this) {
+ case JSP:
+ if (deprecated) {
+ addLeafTextElement(annotationTag.deprecatedName(), "name", tagElement, document);
+ } else {
+ addLeafTextElement(annotationTag.name(), "name", tagElement, document);
+ }
+ addLeafTextElement(className, "tag-class", tagElement, document);
+ String tagExtraInfo = annotationTag.tagExtraInfoClassName();
+ if (tagExtraInfo != null && tagExtraInfo.length() > 0) {
+ // TODO check tagExtraInfo extends TagExtraInfo
+ addLeafTextElement(tagExtraInfo, "tei-class", tagElement, document);
+ }
+ BodyContent bodyContent = annotationTag.bodyContent();
+ BodyContentDescription contentDescription = typeElement.getAnnotation(BodyContentDescription.class);
+ // TODO more error checking
+ if (contentDescription != null) {
+ if (bodyContent.equals(BodyContent.JSP) && contentDescription.contentType().length() > 0) {
+ throw new IllegalArgumentException(
+ "contentType " + contentDescription.contentType() + " for bodyContent JSP not allowed!");
+ } else if (bodyContent.equals(BodyContent.TAGDEPENDENT) && contentDescription.contentType().length() == 0) {
+ throw new IllegalArgumentException("contentType should set for tagdependent bodyContent");
+ }
+ }
+ addLeafTextElement(bodyContent.toString(), "body-content", tagElement, document);
+ break;
+ case FACELETS:
+ if (deprecated) {
+ addLeafTextElement(annotationTag.deprecatedName(), "tag-name", tagElement, document);
+ } else {
+ addLeafTextElement(annotationTag.name(), "tag-name", tagElement, document);
+ }
+
+ UIComponentTag componentTag = typeElement.getAnnotation(UIComponentTag.class);
+ if (componentTag != null) {
+ Element componentElement = document.createElement("component");
+ tagElement.appendChild(componentElement);
+ addLeafTextElement(
+ AnnotationUtils.componentType(componentTag), "component-type", componentElement, document);
+ if (StringUtils.isNotBlank(componentTag.rendererType())) {
+ addLeafTextElement(componentTag.rendererType(), "renderer-type", componentElement, document);
+ }
+ addLeafTextElement(componentTag.faceletHandler(), "handler-class", componentElement, document);
+ }
+
+ SimpleTag simpleTag = typeElement.getAnnotation(SimpleTag.class);
+ if (simpleTag != null) {
+ addLeafTextElement(simpleTag.faceletHandler(), "handler-class", tagElement, document);
+ }
+
+ ValidatorTag validatorTag = typeElement.getAnnotation(ValidatorTag.class);
+ if (validatorTag != null) {
+ Element validatorElement = document.createElement("validator");
+ tagElement.appendChild(validatorElement);
+ addLeafTextElement(validatorTag.validatorId(), "validator-id", validatorElement, document);
+ if (StringUtils.isNotBlank(validatorTag.faceletHandler())) {
+ addLeafTextElement(validatorTag.faceletHandler(), "handler-class", validatorElement, document);
+ }
+ }
+ break;
+ default:
+ throw new IllegalArgumentException("Program error");
+ }
+ }
+
+ public void addAttributeType(
+ Element attribute, TagAttribute tagAttribute, UIComponentTagAttribute componentTagAttribute, Document document,
+ String attributeName) {
+ switch (this) {
+ case JSP:
+ if (!tagAttribute.rtexprvalue()) {
+ if (componentTagAttribute != null) {
+ if (componentTagAttribute.expression().isMethodExpression()) {
+ Element deferredMethod = document.createElement("deferred-method");
+ StringBuilder signature = new StringBuilder();
+ signature.append(componentTagAttribute.methodReturnType());
+ signature.append(" ");
+ signature.append(attributeName);
+ signature.append("(");
+ signature.append(StringUtils.join(componentTagAttribute.methodSignature(), ", "));
+ signature.append(")");
+ addLeafTextElement(signature.toString(), "method-signature", deferredMethod, document);
+ attribute.appendChild(deferredMethod);
+ } else if (componentTagAttribute.expression().isValueExpression()) {
+ Element deferredValue = document.createElement("deferred-value");
+ String clazz;
+ if (componentTagAttribute.type().length == 1) {
+ clazz = componentTagAttribute.type()[0];
+ Class wrapper = ClassUtils.getWrapper(clazz);
+ if (wrapper != null) {
+ clazz = wrapper.getName(); // primitive types aren't allowed here
+ /* } else {
+ XXX what is with inner classes and arrays?
+ if (clazz.endsWith("[]")) {
+ Class.forName(clazz.substring(0, clazz.length() - 2)); // type check
+ } else {
+ Class.forName(clazz); // type check
+ }
+ */
}
-*/
+ } else {
+ clazz = "java.lang.Object";
}
- } else {
- type = "java.lang.Object";
+ addLeafTextElement(clazz, "type", deferredValue, document);
+ attribute.appendChild(deferredValue);
}
- addLeafTextElement(type, "type", deferredValue, document);
+ } else {
+ Element deferredValue = document.createElement("deferred-value");
+ addLeafTextElement(tagAttribute.type(), "type", deferredValue, document);
attribute.appendChild(deferredValue);
}
- } else {
- Element deferredValue = document.createElement("deferred-value");
- addLeafTextElement(tagAttribute.type(), "type", deferredValue, document);
- attribute.appendChild(deferredValue);
}
- }
- if (tagAttribute.rtexprvalue()) {
- addLeafTextElement(Boolean.toString(tagAttribute.rtexprvalue()), "rtexprvalue", attribute, document);
- }
- tagElement.appendChild(attribute);
- } else {
- throw new IllegalArgumentException("Only setter allowed found: " + simpleName);
+ if (tagAttribute.rtexprvalue()) {
+ addLeafTextElement(Boolean.toString(tagAttribute.rtexprvalue()), "rtexprvalue", attribute, document);
+ }
+ break;
+ case FACELETS:
+ if (!tagAttribute.rtexprvalue()) {
+ if (componentTagAttribute != null) {
+ if (componentTagAttribute.expression().isMethodExpression()) {
+ // todo
+ } else if (componentTagAttribute.expression().isValueExpression()) {
+ String clazz;
+ if (componentTagAttribute.type().length == 1) {
+ clazz = componentTagAttribute.type()[0];
+ Class wrapper = ClassUtils.getWrapper(clazz);
+ if (wrapper != null) {
+ clazz = wrapper.getName(); // primitive types aren't allowed here
+ /* } else {
+ XXX what is with inner classes and arrays?
+ if (clazz.endsWith("[]")) {
+ Class.forName(clazz.substring(0, clazz.length() - 2)); // type check
+ } else {
+ Class.forName(clazz); // type check
+ }
+ */
+ }
+ } else {
+ clazz = "java.lang.Object";
+ }
+ addLeafTextElement(clazz, "type", attribute, document);
+ }
+ } else {
+ addLeafTextElement(tagAttribute.type(), "type", attribute, document);
+ }
+ }
+ break;
+ default:
+ throw new IllegalArgumentException("Program error");
}
+
}
}
}