Author: dbiatenia
Date: 2007-04-27 11:39:53 -0400 (Fri, 27 Apr 2007)
New Revision: 135
Modified:
trunk/cdk/generator/src/main/resources/META-INF/templates12/converter.vm
trunk/cdk/generator/src/main/resources/META-INF/templates12/converterTag.vm
trunk/cdk/generator/src/main/resources/META-INF/templates12/faces-config.vm
trunk/cdk/generator/src/main/resources/META-INF/templates12/taglib.vm
trunk/cdk/generator/src/main/resources/META-INF/templates12/validator.vm
trunk/cdk/generator/src/main/resources/META-INF/templates12/validatorTag.vm
Log:
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates12/converter.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates12/converter.vm 2007-04-27
15:39:14 UTC (rev 134)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates12/converter.vm 2007-04-27
15:39:53 UTC (rev 135)
@@ -1,186 +1,204 @@
-package $package;
-
-#foreach($import in $imports)
-import $import ;
-#end
-
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-import java.io.IOException;
-import javax.faces.FacesException;
-
-/**
- * Converter-Id ${converter.id}
- * ${converter.xmlEncodedDescription}
- */
-public class $converter.simpleClassName extends $converter.superclass
-{
-
- public static final String CONVERTER_ID = "${converter.id}";
-
- /**
- * Default no-args contstructor
- */
- public $converter.simpleClassName ()
- {
- }
-
-// Conveter properties fields
-#set( $fiedCounter = 1 )
-#foreach( $prop in $converter.properties )
- #if( !$prop.exist )
- /**
- * $prop.name
- * ${prop.xmlEncodedDescription}
- */
- #if($prop.simpleType)
- private $prop.simpleClassName _$prop.name = ${prop.defaultvalue};
- /**
- * Flag indicated that $prop.name is set.
- */
- private boolean _${prop.name}Set = false;
- #set( $fiedCounter = $fiedCounter+2)
- #else
- private $prop.simpleClassName _$prop.name = null; /* Default is
${prop.defaultvalue}*/
- #set( $fiedCounter = $fiedCounter+1)
- #end
- #end
-#end
-
-// Getters and setters
-#foreach( $prop in $converter.properties )
- #if( !$prop.exist )
- /**
- * ${prop.xmlEncodedDescription}
- * Setter for $prop.name
- * @param $prop.name - new value
- */
- public void ${prop.setterName}( $prop.simpleClassName __$prop.name )
- {
- this._${prop.name} = __$prop.name;
- #if($prop.simpleType)
- this._${prop.name}Set = true;
- #end
- }
-
- /**
- * ${prop.xmlEncodedDescription}
- * Getter for $prop.name
- * @return $prop.name value from local variable or value binding
- */
- public $prop.simpleClassName ${prop.getterName}()
- {
- ValueBinding vb = getValueBinding("${prop.name}");
- #if($prop.simpleType)
- if(this._${prop.name}Set)
- {
- return this._${prop.name};
- }
- if (vb != null)
- {
- ${prop.boxingClass} value = (${prop.boxingClass}) vb.getValue(getFacesContext());
- if (null == value)
- {
- return this._${prop.name};
- }
- //return (value.${prop.classname}Value());
- } else
- {
- return (this._${prop.name});
- }
- }
- #else
- if (null != this._${prop.name})
- {
- return this._${prop.name};
- }
- #if( !$prop.isInstanceof("javax.faces.el.MethodBinding") &&
!$prop.isInstanceof("javax.faces.el.ValueBinding"))
- else if (null != vb)
- {
- return (${prop.simpleClassName})vb.getValue(getFacesContext());
- }
- #end
- else
- {
- return ${prop.defaultvalue};
- }
- #end
- #if($prop.raw)
- /**
- * ${prop.xmlEncodedDescription}
- * Raw Setter for $prop.name
- * @param $prop.name - new value
- */
- public void ${prop.setterName}Raw( $prop.simpleClassName __$prop.name )
- {
- this._${prop.name} = __$prop.name;
- }
- /*
- * ${prop.xmlEncodedDescription}
- * Raw ( bypadd bindings ) Getter for $prop.name
- * @return $prop.name value from local variable
- */
- public $prop.simpleClassName ${prop.getterName}Raw()
- {
- return this._${prop.name};
- }
- #end
- #end
-#end
-
-// Save state
-// ----------------------------------------------------- StateHolder Methods
-
-
- public Object saveState(FacesContext context) {
- Object values[] = new Object[${fiedCounter}];
- values[0] = super.saveState(context);
-#set($currentField = 1)
-#foreach( $prop in $component.properties )
- #if( !$prop.exist )
- #if($prop.simpleType)
- values[${currentField}] = new ${prop.boxingClass}(_$prop.name);
- #set( $currentField = $currentField+1)
- values[${currentField}] = Boolean.valueOf(_${prop.name}Set);
- #set( $currentField = $currentField+1)
- #else
- #if(!${prop.attachedstate} )
- values[${currentField}] = _$prop.name;
- #else
- values[${currentField}] = saveAttachedState(context, _$prop.name );
- #end
- #set( $currentField = $currentField+1)
- #end
- #end
-#end
- return values;
- }
-
-
- public void restoreState(FacesContext context, Object state) {
- Object values[] = (Object[]) state;
- super.restoreState(context, values[0]);
-#set($currentField = 1)
-#foreach( $prop in $component.properties )
- #if( !$prop.exist )
- #if($prop.simpleType)
- _$prop.name =
((${prop.boxingClass})values[${currentField}]).${prop.classname}Value();
- #set( $currentField = $currentField+1)
- _${prop.name}Set = ((Boolean)values[${currentField}]).booleanValue();
- #set( $currentField = $currentField+1)
- #else
- #if( !${prop.attachedstate} )
- _$prop.name = (${prop.simpleClassName})values[${currentField}] ;
- #else
- _$prop.name =
(${prop.simpleClassName})restoreAttachedState(context,values[${currentField}] );
- #end
- #end
- #set( $currentField = $currentField+1)
- #end
-#end
-
-
- }
-// Utilites
-
-}
+package $package;
+
+#foreach($import in $imports)
+import $import ;
+#end
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import java.io.IOException;
+import javax.faces.FacesException;
+import javax.faces.component.StateHolder;
+
+/**
+ * Converter-Id ${converter.id}
+ * ${converter.xmlEncodedDescription}
+ */
+public class $converter.simpleClassName extends $converter.superclass implements
StateHolder
+{
+
+ public static final String CONVERTER_ID = "${converter.id}";
+
+ /**
+ * Default no-args contstructor
+ */
+ public $converter.simpleClassName ()
+ {
+ }
+
+// Conveter properties fields
+#set( $fiedCounter = 0 )
+#foreach( $prop in $converter.properties )
+ #if( !$prop.exist )
+ /**
+ * $prop.name
+ * ${prop.xmlEncodedDescription}
+ */
+ #if($prop.simpleType)
+ private $prop.simpleClassName _$prop.name = ${prop.defaultvalue};
+ /**
+ * Flag indicated that $prop.name is set.
+ */
+ private boolean _${prop.name}Set = false;
+ #set( $fiedCounter = $fiedCounter+2)
+ #else
+ private $prop.simpleClassName _$prop.name = null; /* Default is
${prop.defaultvalue}*/
+ #set( $fiedCounter = $fiedCounter+1)
+ #end
+ #end
+#end
+
+// Getters and setters
+#foreach( $prop in $converter.properties )
+ #if( !$prop.exist )
+ /**
+ * ${prop.xmlEncodedDescription}
+ * Setter for $prop.name
+ * @param $prop.name - new value
+ */
+ public void ${prop.setterName}( $prop.simpleClassName __$prop.name )
+ {
+ this._${prop.name} = __$prop.name;
+ #if($prop.simpleType)
+ this._${prop.name}Set = true;
+ #end
+ }
+
+ /**
+ * ${prop.xmlEncodedDescription}
+ * Getter for $prop.name
+ * @return $prop.name value from local variable or value binding
+ */
+ public $prop.simpleClassName ${prop.getterName}()
+ {
+ ValueBinding vb = getValueBinding("${prop.name}");
+ #if($prop.simpleType)
+ if(this._${prop.name}Set)
+ {
+ return this._${prop.name};
+ }
+ if (vb != null)
+ {
+ ${prop.boxingClass} value = (${prop.boxingClass}) vb.getValue(getFacesContext());
+ if (null == value)
+ {
+ return this._${prop.name};
+ }
+ //return (value.${prop.classname}Value());
+ } else
+ {
+ return (this._${prop.name});
+ }
+ }
+ #else
+ if (null != this._${prop.name})
+ {
+ return this._${prop.name};
+ }
+ #if( !$prop.isInstanceof("javax.faces.el.MethodBinding") &&
!$prop.isInstanceof("javax.faces.el.ValueBinding"))
+ else if (null != vb)
+ {
+ return (${prop.simpleClassName})vb.getValue(getFacesContext());
+ }
+ #end
+ else
+ {
+ return ${prop.defaultvalue};
+ }
+ #end
+ }
+ #if($prop.raw)
+ /**
+ * ${prop.xmlEncodedDescription}
+ * Raw Setter for $prop.name
+ * @param $prop.name - new value
+ */
+ public void ${prop.setterName}Raw( $prop.simpleClassName __$prop.name )
+ {
+ this._${prop.name} = __$prop.name;
+ }
+ /*
+ * ${prop.xmlEncodedDescription}
+ * Raw ( bypadd bindings ) Getter for $prop.name
+ * @return $prop.name value from local variable
+ */
+ public $prop.simpleClassName ${prop.getterName}Raw()
+ {
+ return this._${prop.name};
+ }
+ #end
+ #end
+#end
+
+// Save state
+// ----------------------------------------------------- StateHolder Methods
+
+
+ public Object saveState(FacesContext context) {
+ Object values[] = new Object[${fiedCounter}];
+ //values[0] = super.saveState(context);
+#set($currentField = 0)
+#foreach( $prop in $converter.properties )
+ #if( !$prop.exist )
+ #if($prop.simpleType)
+ values[${currentField}] = new ${prop.boxingClass}(_$prop.name);
+ #set( $currentField = $currentField+1)
+ values[${currentField}] = Boolean.valueOf(_${prop.name}Set);
+ #set( $currentField = $currentField+1)
+ #else
+ #if(!${prop.attachedstate} )
+ values[${currentField}] = _$prop.name;
+ #else
+ values[${currentField}] = saveAttachedState(context, _$prop.name );
+ #end
+ #set( $currentField = $currentField+1)
+ #end
+ #end
+#end
+ return values;
+ }
+
+
+ public void restoreState(FacesContext context, Object state) {
+ Object values[] = (Object[]) state;
+ //super.restoreState(context, values[0]);
+#set($currentField = 0)
+#foreach( $prop in $converter.properties )
+ #if( !$prop.exist )
+ #if($prop.simpleType)
+ _$prop.name =
((${prop.boxingClass})values[${currentField}]).${prop.classname}Value();
+ #set( $currentField = $currentField+1)
+ _${prop.name}Set = ((Boolean)values[${currentField}]).booleanValue();
+ #set( $currentField = $currentField+1)
+ #else
+ #if( !${prop.attachedstate} )
+ _$prop.name = (${prop.simpleClassName})values[${currentField}] ;
+ #else
+ _$prop.name =
(${prop.simpleClassName})restoreAttachedState(context,values[${currentField}] );
+ #end
+ #end
+ #set( $currentField = $currentField+1)
+ #end
+#end
+
+
+ }
+// Utilites
+
+ public boolean isTransient() {
+ return false;
+ }
+
+ public void setTransient(boolean newTransientValue){
+ }
+
+
+ private FacesContext getFacesContext() {
+ return FacesContext.getCurrentInstance();
+ }
+
+ private ValueBinding getValueBinding(String name) {
+ return getFacesContext().getApplication().createValueBinding(name);
+ }
+
+}
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates12/converterTag.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates12/converterTag.vm 2007-04-27
15:39:14 UTC (rev 134)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates12/converterTag.vm 2007-04-27
15:39:53 UTC (rev 135)
@@ -1,95 +1,95 @@
-/**
- * GENERATED FILE - DO NOT EDIT
- *
- */
-package ${tag.packageName};
-
-#foreach($import in $imports)
-import $import ;
-#end
-import javax.faces.component.UIComponent;
-import javax.faces.convert.Converter;
-import javax.faces.webapp.UIComponentTag;
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-import org.apache.commons.beanutils.ConvertUtils;
-import javax.servlet.jsp.JspException;
-import ${converter.classname};
-
-public class $tag.simpleClassName extends $tag.superclass
-{
-
-// Fields
-#foreach( $prop in $converter.properties )
-#if( !$prop.existintag )
- /*
- * $prop.name
- * ${prop.xmlEncodedDescription}
- */
- private String _$prop.name = null;
-
-#end
-#end
-// Setters
-#foreach( $prop in $converter.properties )
-#if( !$prop.existintag )
- /*
- * $prop.description
- * Setter for $prop.name
- * @param $prop.name - new value
- */
- public void ${prop.setterName}(String __${prop.name})
- {
- this._${prop.name} = __${prop.name};
- }
-
-#end
-#if( $prop.alias)
- /*
- * ${prop.xmlEncodedDescription}
- * Setter for alias of $prop.name as $prop.alias
- * @param $prop.name - new value
- */
- public void set${prop.upperFirstChar($prop.alias)}(String __${prop.alias})
- {
- this.${prop.setterName}(__${prop.alias});
- }
-#end
-#end
-
- protected Converter createConverter() throws JspException
- {
- ${converter.simpleClassName} converter = new ${converter.simpleClassName}();
- _setProperties(converter);
- return converter;
- }
-
- // Support method to wire in attributes
- private void _setProperties(${converter.simpleClassName} converter) throws JspException
- {
- FacesContext facesContext = FacesContext.getCurrentInstance();
-#foreach( $prop in $converter.properties )
-#if( !$prop.existintag )
- if (_${prop.name} != null)
- {
-#if( ${prop.el} )
- if (UIComponentTag.isValueReference(_${prop.name}))
- {
- ValueBinding vb =
facesContext.getApplication().createValueBinding(_${prop.name});
- converter.${prop.setterName}((${prop.simpleClassName})
vb.getValue(facesContext));
- }
-#if (!${prop.elonly})
- else
- {
- converter.${prop.setterName}((${prop.simpleClassName})
ConvertUtils.convert(_${prop.name}, ${prop.simpleClassName}.class));
- }
-#end
- }
-#else
- converter.${prop.setterName}((${prop.simpleClassName})
ConvertUtils.convert(_${prop.name}, ${prop.simpleClassName}.class));
-#end
-#end
-#end
- }
-
-}
+/**
+ * GENERATED FILE - DO NOT EDIT
+ *
+ */
+package ${tag.packageName};
+
+#foreach($import in $imports)
+import $import ;
+#end
+import javax.faces.component.UIComponent;
+import javax.faces.convert.Converter;
+import javax.faces.webapp.UIComponentTag;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import org.apache.commons.beanutils.ConvertUtils;
+import javax.servlet.jsp.JspException;
+import ${converter.classname};
+
+public class $tag.simpleClassName extends $tag.superclass
+{
+
+// Fields
+#foreach( $prop in $converter.properties )
+#if( !$prop.existintag )
+ /*
+ * $prop.name
+ * ${prop.xmlEncodedDescription}
+ */
+ private String _$prop.name = null;
+
+#end
+#end
+// Setters
+#foreach( $prop in $converter.properties )
+#if( !$prop.existintag )
+ /*
+ * $prop.description
+ * Setter for $prop.name
+ * @param $prop.name - new value
+ */
+ public void ${prop.setterName}(String __${prop.name})
+ {
+ this._${prop.name} = __${prop.name};
+ }
+
+#end
+#if( $prop.alias)
+ /*
+ * ${prop.xmlEncodedDescription}
+ * Setter for alias of $prop.name as $prop.alias
+ * @param $prop.name - new value
+ */
+ public void set${prop.upperFirstChar($prop.alias)}(String __${prop.alias})
+ {
+ this.${prop.setterName}(__${prop.alias});
+ }
+#end
+#end
+
+ protected Converter createConverter() throws JspException
+ {
+ ${converter.simpleClassName} converter = new ${converter.simpleClassName}();
+ _setProperties(converter);
+ return converter;
+ }
+
+ // Support method to wire in attributes
+ private void _setProperties(${converter.simpleClassName} converter) throws JspException
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+#foreach( $prop in $converter.properties )
+#if( !$prop.existintag )
+ if (_${prop.name} != null)
+ {
+#if( ${prop.el} )
+ if (UIComponentTag.isValueReference(_${prop.name}))
+ {
+ ValueBinding vb =
facesContext.getApplication().createValueBinding(_${prop.name});
+ converter.${prop.setterName}((${prop.simpleClassName})
vb.getValue(facesContext));
+ }
+#if (!${prop.elonly})
+ else
+ {
+ converter.${prop.setterName}((${prop.simpleClassName})
ConvertUtils.convert(_${prop.name}, ${prop.simpleClassName}.class));
+ }
+#end
+ }
+#else
+ converter.${prop.setterName}((${prop.simpleClassName})
ConvertUtils.convert(_${prop.name}, ${prop.simpleClassName}.class));
+#end
+#end
+#end
+ }
+
+}
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates12/faces-config.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates12/faces-config.vm 2007-04-27
15:39:14 UTC (rev 134)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates12/faces-config.vm 2007-04-27
15:39:53 UTC (rev 135)
@@ -1,103 +1,103 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces
Config 1.1//EN"
-
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
-<faces-config>
-
-${facesConfig.includeContent}
-
-#foreach( $component in ${components})
-#if( $component.generate )
- <component>
- #if(${component.description})
- <description>${component.xmlEncodedDescription}</description>
- #end
- #if(${component.displayname})
- <display-name>${component.xmlEncodedDisplayname}</display-name>
- #end
- <component-type>${component.name}</component-type>
- <component-class>${component.classname}</component-class>
-
-#foreach( $facet in $component.facets)
- <facet>
- #if(${facet.description})
- <description>${facet.xmlEncodedDescription}</description>
- #end
- #if(${facet.displayname})
- <display-name>${facet.xmlEncodedDisplayname}</display-name>
- #end
- <facet-name>${facet.name}</facet-name>
- </facet>
-#end
- #if(${component.renderer})
- <component-extension>
- <component-family>${component.family}</component-family>
- <renderer-type>${component.renderer.name}</renderer-type>
- </component-extension>
- #end
- </component>
-#end
-#end
-
-#foreach( $validator in ${validators})
- #if( $validator.generate )
- <validator>
- #if(${validator.description})
- <description>${validator.xmlEncodedDescription}</description>
- #end
- #if(${validator.displayname})
- <display-name>${validator.xmlEncodedDisplayname}</display-name>
- #end
- <validator-id>${validator.id}</validator-id>
- <validator-class>${validator.classname}</validator-class>
- </validator>
- #end
-#end
-
-#foreach( $converter in ${converters})
- #if( $converter.generate )
- <converter>
- #if(${converter.description})
- <description>${converter.xmlEncodedDescription}</description>
- #end
- #if(${converter.displayname})
- <display-name>${converter.xmlEncodedDisplayname}</display-name>
- #end
- #if(${converter.forClass})
- <converter-for-class>${converter.forClass}</converter-for-class>
- #elseif(${converter.id})
- <converter-id>${converter.id}</converter-id>
- #end
- <converter-class>${converter.classname}</converter-class>
- </converter>
- #end
-#end
-
-#foreach( $renderkit in $facesConfig.renderKits)
- <render-kit>
- #if(${renderkit.renderkitid})
- <render-kit-id>${renderkit.renderkitid}</render-kit-id>
- #if(${renderkit.renderkitclass})
- <render-kit-class>${renderkit.renderkitclass}</render-kit-class>
- #end
- #end
-#foreach( $component in $components)
- #if($component.renderer)
- #set($rendererClass = $renderkit.rendererClass($component.renderer.classname) )
- #if( $component.renderer.generate ||
$facesConfig.rendererExists("${rendererClass}"))
- <renderer>
- <component-family>${component.family}</component-family>
- <renderer-type>
- ${component.renderer.name}
- </renderer-type>
- <renderer-class>
- ${rendererClass}
- </renderer-class>
- </renderer>
- #end
- #end
-#end
- </render-kit>
-#end
-
-
-</faces-config>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces
Config 1.1//EN"
+
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
+<faces-config>
+
+${facesConfig.includeContent}
+
+#foreach( $validator in ${validators})
+ <validator>
+ <validator-id>${validator.id}</validator-id>
+ <validator-class>${validator.classname}</validator-class>
+ #if(${validator.description})
+ <description>${validator.description}</description>
+ #end
+ #if(${validator.displayname})
+ <display-name>${validator.displayname}</display-name>
+ #end
+ #if(${validator.icon})
+ <icon>${validator.icon}</icon>
+ #end
+ </validator>
+#end
+
+#foreach( $converter in ${converters})
+ <converter>
+ <converter-id>${converter.id}</converter-id>
+ <converter-class>${converter.classname}</converter-class>
+ #if(${converter.description})
+ <description>${converter.description}</description>
+ #end
+ #if(${converter.displayname})
+ <display-name>${converter.displayname}</display-name>
+ #end
+ #if(${converter.icon})
+ <icon>${converter.icon}</icon>
+ #end
+ </converter>
+#end
+
+
+
+#foreach( $component in ${components})
+#if( $component.generate )
+ <component>
+ #if(${component.description})
+ <description>${component.xmlEncodedDescription}</description>
+ #end
+ #if(${component.displayname})
+ <display-name>${component.xmlEncodedDisplayname}</display-name>
+ #end
+ <component-type>${component.name}</component-type>
+ <component-class>${component.classname}</component-class>
+
+#foreach( $facet in $component.facets)
+ <facet>
+ #if(${facet.description})
+ <description>${facet.xmlEncodedDescription}</description>
+ #end
+ #if(${facet.displayname})
+ <display-name>${facet.xmlEncodedDisplayname}</display-name>
+ #end
+ <facet-name>${facet.name}</facet-name>
+ </facet>
+#end
+ #if(${component.renderer})
+ <component-extension>
+ <component-family>${component.family}</component-family>
+ <renderer-type>${component.renderer.name}</renderer-type>
+ </component-extension>
+ #end
+ </component>
+#end
+#end
+
+#foreach( $renderkit in $facesConfig.renderKits)
+ <render-kit>
+ #if(${renderkit.renderkitid})
+ <render-kit-id>${renderkit.renderkitid}</render-kit-id>
+ #if(${renderkit.renderkitclass})
+ <render-kit-class>${renderkit.renderkitclass}</render-kit-class>
+ #end
+ #end
+#foreach( $component in $components)
+ #if($component.renderer)
+ #set($rendererClass = $renderkit.rendererClass($component.renderer.classname) )
+ #if( $component.renderer.generate ||
$facesConfig.rendererExists("${rendererClass}"))
+ <renderer>
+ <component-family>${component.family}</component-family>
+ <renderer-type>
+ ${component.renderer.name}
+ </renderer-type>
+ <renderer-class>
+ ${rendererClass}
+ </renderer-class>
+ </renderer>
+ #end
+ #end
+#end
+ </render-kit>
+#end
+
+
+</faces-config>
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates12/taglib.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates12/taglib.vm 2007-04-27
15:39:14 UTC (rev 134)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates12/taglib.vm 2007-04-27
15:39:53 UTC (rev 135)
@@ -1,132 +1,135 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library
1.2//EN"
-
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
-<taglib>
- <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>
- <name>${component.tag.name}</name>
- <tag-class>${component.tag.classname}</tag-class>
- <body-content>${component.tag.bodyContent}</body-content>
- #if(${component.tag.displayname})
- <display-name>${component.tag.xmlEncodedDisplayname}</display-name>
- #elseif(${component.displayname})
- <display-name>${component.xmlEncodedDisplayname}</display-name>
- #end
- #if(${component.tag.description})
- <description>${component.tag.xmlEncodedDescription}</description>
- #else
- <description>${component.xmlEncodedDescription}</description>
- #end
- #foreach( $prop in ${component.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>
- #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>
- #else
- <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 )
- <attribute>
- <name>${prop.alias}</name>
- <rtexprvalue>false</rtexprvalue>
- <description>Alias for ${prop.name} :
${prop.xmlEncodedDescription}</description>
- </attribute>
- #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>${coonverter.xmlEncodedDisplayname}</display-name>
- #end
- #if(${converter.tag.description})
- <description>${converter.tag.xmlEncodedDescription}</description>
- #else
- <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>
- #end
- #end
- #end
-</tag>
-#end
-#end
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library
1.2//EN"
+
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
+<taglib>
+ <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>
+ <name>${component.tag.name}</name>
+ <tag-class>${component.tag.classname}</tag-class>
+ <body-content>${component.tag.bodyContent}</body-content>
+ #if(${component.tag.displayname})
+ <display-name>${component.tag.xmlEncodedDisplayname}</display-name>
+ #elseif(${component.displayname})
+ <display-name>${component.xmlEncodedDisplayname}</display-name>
+ #end
+ #if(${component.tag.description})
+ <description>${component.tag.xmlEncodedDescription}</description>
+ #else
+ <description>${component.xmlEncodedDescription}</description>
+ #end
+ #foreach( $prop in ${component.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>
+ #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 )
+ <attribute>
+ <name>${prop.alias}</name>
+ <rtexprvalue>false</rtexprvalue>
+ <description>Alias for ${prop.name} :
${prop.xmlEncodedDescription}</description>
+ </attribute>
+ #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>
+ #end
+ #end
+ #end
+</tag>
+#end
+#end
+
+
+
</taglib>
\ No newline at end of file
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates12/validator.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates12/validator.vm 2007-04-27
15:39:14 UTC (rev 134)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates12/validator.vm 2007-04-27
15:39:53 UTC (rev 135)
@@ -0,0 +1,202 @@
+package $package;
+
+#foreach($import in $imports)
+import $import ;
+#end
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import java.io.IOException;
+import javax.faces.FacesException;
+import javax.faces.component.StateHolder;
+
+/**
+ * Validator-Id ${validator.id}
+ * ${validator.xmlEncodedDescription}
+ */
+public class $validator.simpleClassName extends $validator.superclass implements
StateHolder {
+
+ public static final String VALIDATOR_ID = "${validator.id}";
+
+ /**
+ * Default no-args contstructor
+ */
+ public $validator.simpleClassName () {
+ }
+
+// Validator properties fields
+#set( $fiedCounter = 0 )
+#foreach( $prop in $validator.properties )
+ #if( !$prop.exist )
+ /**
+ * $prop.name
+ * ${prop.xmlEncodedDescription}
+ */
+ #if($prop.simpleType)
+ private $prop.simpleClassName _$prop.name = ${prop.defaultvalue};
+ /**
+ * Flag indicated that $prop.name is set.
+ */
+ private boolean _${prop.name}Set = false;
+ #set( $fiedCounter = $fiedCounter+2)
+ #else
+ private $prop.simpleClassName _$prop.name = null; /* Default is
${prop.defaultvalue}*/
+ #set( $fiedCounter = $fiedCounter+1)
+ #end
+ #end
+#end
+
+// Getters and setters
+#foreach( $prop in $validator.properties )
+ #if( !$prop.exist )
+ /**
+ * ${prop.xmlEncodedDescription}
+ * Setter for $prop.name
+ * @param $prop.name - new value
+ */
+ public void ${prop.setterName}( $prop.simpleClassName __$prop.name )
+ {
+ this._${prop.name} = __$prop.name;
+ #if($prop.simpleType)
+ this._${prop.name}Set = true;
+ #end
+ }
+
+ /**
+ * ${prop.xmlEncodedDescription}
+ * Getter for $prop.name
+ * @return $prop.name value from local variable or value binding
+ */
+ public $prop.simpleClassName ${prop.getterName}()
+ {
+ ValueBinding vb = getValueBinding("${prop.name}");
+ #if($prop.simpleType)
+ if(this._${prop.name}Set)
+ {
+ return this._${prop.name};
+ }
+ if (vb != null)
+ {
+ ${prop.boxingClass} value = (${prop.boxingClass}) vb.getValue(getFacesContext());
+ if (null == value)
+ {
+ return this._${prop.name};
+ }
+ //return (value.${prop.classname}Value());
+ } else
+ {
+ return (this._${prop.name});
+ }
+ }
+ #else
+ if (null != this._${prop.name})
+ {
+ return this._${prop.name};
+ }
+ #if( !$prop.isInstanceof("javax.faces.el.MethodBinding") &&
!$prop.isInstanceof("javax.faces.el.ValueBinding"))
+ else if (null != vb)
+ {
+ return (${prop.simpleClassName})vb.getValue(getFacesContext());
+ }
+ #end
+ else
+ {
+ return ${prop.defaultvalue};
+ }
+ #end
+ }
+ #if($prop.raw)
+
+ /**
+ * ${prop.xmlEncodedDescription}
+ * Raw Setter for $prop.name
+ * @param $prop.name - new value
+ */
+ public void ${prop.setterName}Raw( $prop.simpleClassName __$prop.name )
+ {
+ this._${prop.name} = __$prop.name;
+ }
+ /*
+ * ${prop.xmlEncodedDescription}
+ * Raw ( bypadd bindings ) Getter for $prop.name
+ * @return $prop.name value from local variable
+ */
+ public $prop.simpleClassName ${prop.getterName}Raw()
+ {
+ return this._${prop.name};
+ }
+ #end
+ #end
+#end
+
+// Save state
+// ----------------------------------------------------- StateHolder Methods
+
+
+ public Object saveState(FacesContext context) {
+ Object values[] = new Object[${fiedCounter}];
+// values[0] = super.saveState(context);
+#set($currentField = 0)
+#foreach( $prop in $validator.properties )
+ #if( !$prop.exist )
+ #if($prop.simpleType)
+ values[${currentField}] = new ${prop.boxingClass}(_$prop.name);
+ #set( $currentField = $currentField+1)
+ values[${currentField}] = Boolean.valueOf(_${prop.name}Set);
+ #set( $currentField = $currentField+1)
+ #else
+ #if(!${prop.attachedstate} )
+ values[${currentField}] = _$prop.name;
+ #else
+ values[${currentField}] = saveAttachedState(context, _$prop.name );
+ #end
+ #set( $currentField = $currentField+1)
+ #end
+ #end
+#end
+ return values;
+ }
+
+
+ public void restoreState(FacesContext context, Object state) {
+ Object values[] = (Object[]) state;
+// super.restoreState(context, values[0]);
+#set($currentField = 0)
+#foreach( $prop in $validator.properties )
+ #if( !$prop.exist )
+ #if($prop.simpleType)
+ _$prop.name =
((${prop.boxingClass})values[${currentField}]).${prop.classname}Value();
+ #set( $currentField = $currentField+1)
+ _${prop.name}Set = ((Boolean)values[${currentField}]).booleanValue();
+ #set( $currentField = $currentField+1)
+ #else
+ #if( !${prop.attachedstate} )
+ _$prop.name = (${prop.simpleClassName})values[${currentField}] ;
+ #else
+ _$prop.name =
(${prop.simpleClassName})restoreAttachedState(context,values[${currentField}] );
+ #end
+ #end
+ #set( $currentField = $currentField+1)
+ #end
+#end
+
+ }
+
+ public boolean isTransient() {
+ return false;
+ }
+
+ public void setTransient(boolean newTransientValue){
+ }
+
+ // Utilites
+
+ private FacesContext getFacesContext() {
+ return FacesContext.getCurrentInstance();
+ }
+
+ private ValueBinding getValueBinding(String name) {
+ return getFacesContext().getApplication().createValueBinding(name);
+ }
+
+}
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates12/validatorTag.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates12/validatorTag.vm 2007-04-27
15:39:14 UTC (rev 134)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates12/validatorTag.vm 2007-04-27
15:39:53 UTC (rev 135)
@@ -63,7 +63,7 @@
return validator;
}
- // Support method to wire in attributes
+ // Support method to wire in properties
private void _setProperties(${validator.simpleClassName} validator) throws JspException
{
FacesContext facesContext = FacesContext.getCurrentInstance();
Show replies by date