Author: maksimkaszynski
Date: 2007-10-23 11:18:41 -0400 (Tue, 23 Oct 2007)
New Revision: 3489
Modified:
trunk/cdk/generator/src/main/resources/META-INF/templates12/taglib.vm
Log:
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates12/taglib.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates12/taglib.vm 2007-10-23
14:44:37 UTC (rev 3488)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates12/taglib.vm 2007-10-23
15:18:41 UTC (rev 3489)
@@ -1,96 +1,14 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<taglib
xmlns="http://java.sun.com/xml/ns/javaee"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_${taglib.jspversion.r...;,
'_')}.xsd"
- version="${taglib.jspversion}">
- <tlib-version>${taglib.tlibversion}</tlib-version>
-## <jsp-version>${taglib.jspversion}</jsp-version>
-#if(${taglib.shortname})
- <short-name>${taglib.shortname}</short-name>
-#end
- <uri>${taglib.uri}</uri>
-#if(${taglib.description})
- <description>${taglib.description}</description>
-#end
-${taglib.includeContent}
-
-#foreach( $component in ${components})
- #if($component.tag)
- <tag>
- #if(${component.tag.description})
- <description>${component.tag.xmlEncodedDescription}</description>
- #else
- <description>${component.xmlEncodedDescription}</description>
- #end
- #if(${component.tag.displayname})
- <display-name>${component.tag.xmlEncodedDisplayname}</display-name>
- #elseif(${component.displayname})
- <display-name>${component.xmlEncodedDisplayname}</display-name>
- #end
- <name>${component.tag.name}</name>
- <tag-class>${component.tag.classname}</tag-class>
- <body-content>${component.tag.bodyContent}</body-content>
- #foreach( $prop in ${component.properties} )
+##Create tag attributes for object's properties
+#macro(tagAttributes $source)
+ #foreach( $prop in ${source.properties} )
#if( !${prop.hidden} && !${prop.disabled} )
<attribute>
- <description>${prop.xmlEncodedDescription}</description>
<name>${prop.name}</name>
#if(${prop.required})
<required>true</required>
#end
- #if(${prop.el})
- #if( !$prop.isInstanceof("javax.faces.el.MethodBinding") &&
!$prop.isInstanceof("javax.el.MethodExpression") )
- <deferred-value>
- <type>${prop.classname}</type>
- </deferred-value>
- #else
- <deferred-method>
- <method-signature>${prop.returntype}
${prop.name}(${prop.methodargs})</method-signature>
- </deferred-method>
- #end
- #else
- <rtexprvalue>false</rtexprvalue>
- #end
- </attribute>
- #if( $prop.alias )
- <attribute>
- <name>${prop.alias}</name>
<rtexprvalue>false</rtexprvalue>
- <description>Alias for ${prop.name} :
${prop.xmlEncodedDescription}</description>
- </attribute>
- #end
- #end
- #end
-</tag>
-#end
-#end
-
-#*
-#foreach( $validator in ${validators})
- #if($validator.tag)
- <tag>
- <name>${validator.tag.name}</name>
- <tag-class>${validator.tag.classname}</tag-class>
- <body-content>${validator.tag.bodyContent}</body-content>
- #if(${validator.tag.displayname})
- <display-name>${validator.tag.xmlEncodedDisplayname}</display-name>
- #elseif(${validator.displayname})
- <display-name>${validator.xmlEncodedDisplayname}</display-name>
- #end
- #if(${validator.tag.description})
- <description>${validator.tag.xmlEncodedDescription}</description>
- #elseif(${validator.xmlEncodedDescription})
- <description>${validator.xmlEncodedDescription}</description>
- #end
- #foreach( $prop in ${validator.properties} )
- #if( !${prop.hidden} && !${prop.disabled} )
- <attribute>
- <name>${prop.name}</name>
- #if(${prop.required})
- <required>true</required>
- #end
- <rtexprvalue>false</rtexprvalue>
<description>${prop.xmlEncodedDescription}</description>
</attribute>
#if( $prop.alias )
@@ -102,87 +20,59 @@
#end
#end
#end
-</tag>
#end
-#end
-#foreach( $converter in ${converters})
- #if($converter.tag)
- <tag>
- <name>${converter.tag.name}</name>
- <tag-class>${converter.tag.classname}</tag-class>
- <body-content>${converter.tag.bodyContent}</body-content>
- #if(${converter.tag.displayname})
- <display-name>${converter.tag.xmlEncodedDisplayname}</display-name>
- #elseif(${converter.displayname})
- <display-name>${converter.xmlEncodedDisplayname}</display-name>
- #end
- #if(${converter.tag.description})
- <description>${converter.tag.xmlEncodedDescription}</description>
- #elseif(${converter.xmlEncodedDescription})
- <description>${converter.xmlEncodedDescription}</description>
- #end
- #foreach( $prop in ${converter.properties} )
- #if( !${prop.hidden} && !${prop.disabled} )
- <attribute>
- <name>${prop.name}</name>
- #if(${prop.required})
- <required>true</required>
- #end
- <rtexprvalue>false</rtexprvalue>
- <description>${prop.xmlEncodedDescription}</description>
- </attribute>
- #if( $prop.alias )
- <attribute>
- <name>${prop.alias}</name>
- <rtexprvalue>false</rtexprvalue>
- <description>Alias for ${prop.name} :
${prop.xmlEncodedDescription}</description>
- </attribute>
+##Create tag for dedicated object in config
+#macro(tag $source)
+ #if($source.tag)
+ <tag>
+ #if(${source.tag.description})
+ <description>${source.tag.xmlEncodedDescription}</description>
+ #else
+ <description>${source.xmlEncodedDescription}</description>
+ #end
+ #if(${source.tag.displayname})
+ <display-name>${source.tag.xmlEncodedDisplayname}</display-name>
+ #elseif(${source.displayname})
+ <display-name>${source.xmlEncodedDisplayname}</display-name>
+ #end
+ <name>${source.tag.name}</name>
+ <tag-class>${source.tag.classname}</tag-class>
+ <body-content>${source.tag.bodyContent}</body-content>
+
+ #tagAttributes($source)
+
+ </tag>
#end
- #end
- #end
-</tag>
+
#end
-#end
-#foreach( $listener in ${listeners})
- #if($listener.tag)
- <tag>
- <name>${listener.tag.name}</name>
- <tag-class>${listener.tag.classname}</tag-class>
- <body-content>${listener.tag.bodyContent}</body-content>
- #if(${listener.tag.displayname})
- <display-name>${listener.tag.xmlEncodedDisplayname}</display-name>
- #elseif(${listener.displayname})
- <display-name>${listener.xmlEncodedDisplayname}</display-name>
- #end
- #if(${listener.tag.description})
- <description>${listener.tag.xmlEncodedDescription}</description>
- #elseif(${listener.xmlEncodedDescription})
- <description>${listener.xmlEncodedDescription}</description>
- #end
- #foreach( $prop in ${listener.properties} )
- #if( !${prop.hidden} && !${prop.disabled} )
- <attribute>
- <name>${prop.name}</name>
- #if(${prop.required})
- <required>true</required>
- #end
- <rtexprvalue>false</rtexprvalue>
- <description>${prop.xmlEncodedDescription}</description>
- </attribute>
- #if( $prop.alias )
- <attribute>
- <name>${prop.alias}</name>
- <rtexprvalue>false</rtexprvalue>
- <description>Alias for ${prop.name} :
${prop.xmlEncodedDescription}</description>
- </attribute>
+##Generate tags for each category of config beans
+#macro(generateBunchOfTags $category)
+ #foreach($item in $category)
+ #tag($item)
#end
- #end
- #end
-</tag>
#end
+
+<taglib
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_${taglib.jspversion.r...;,
'_')}.xsd"
+ version="${taglib.jspversion}">
+ <tlib-version>${taglib.tlibversion}</tlib-version>
+## <jsp-version>${taglib.jspversion}</jsp-version>
+#if(${taglib.shortname})
+ <short-name>${taglib.shortname}</short-name>
#end
-*#
+ <uri>${taglib.uri}</uri>
+#if(${taglib.description})
+ <description>${taglib.description}</description>
+#end
+${taglib.includeContent}
+
+#generateBunchOfTags(${components})
+#generateBunchOfTags(${validators})
+#generateBunchOfTags(${converters})
+#generateBunchOfTags(${listeners})
+
</taglib>