Author: dbiatenia
Date: 2007-04-27 11:39:14 -0400 (Fri, 27 Apr 2007)
New Revision: 134
Modified:
trunk/cdk/generator/src/main/resources/META-INF/templates/converter.vm
trunk/cdk/generator/src/main/resources/META-INF/templates/faces-config.vm
trunk/cdk/generator/src/main/resources/META-INF/templates/taglib.vm
trunk/cdk/generator/src/main/resources/META-INF/templates/validator.vm
trunk/cdk/generator/src/main/resources/META-INF/templates/validatorTag.vm
Log:
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates/converter.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates/converter.vm 2007-04-27
15:25:52 UTC (rev 133)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/converter.vm 2007-04-27
15:39:14 UTC (rev 134)
@@ -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/templates/faces-config.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates/faces-config.vm 2007-04-27
15:25:52 UTC (rev 133)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/faces-config.vm 2007-04-27
15:39:14 UTC (rev 134)
@@ -5,6 +5,40 @@
${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>
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates/taglib.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates/taglib.vm 2007-04-27
15:25:52 UTC (rev 133)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/taglib.vm 2007-04-27
15:39:14 UTC (rev 134)
@@ -51,4 +51,85 @@
</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/templates/validator.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates/validator.vm 2007-04-27
15:25:52 UTC (rev 133)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/validator.vm 2007-04-27
15:39:14 UTC (rev 134)
@@ -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/templates/validatorTag.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates/validatorTag.vm 2007-04-27
15:25:52 UTC (rev 133)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/validatorTag.vm 2007-04-27
15:39:14 UTC (rev 134)
@@ -18,6 +18,9 @@
public class $tag.simpleClassName extends $tag.superclass {
+ //private String validatorId = "${validator.id}";
+
+
// Fields
#foreach( $prop in $validator.properties )
#if( !$prop.existintag )
@@ -63,7 +66,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