JBoss Ajax4JSF SVN: r143 - trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo.
by ajax4jsf-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-30 17:09:07 -0400 (Mon, 30 Apr 2007)
New Revision: 143
Modified:
trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AbstractCDKMojo.java
Log:
JSF Version detection failed due to wrong classloading. Fixed
Modified: trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AbstractCDKMojo.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AbstractCDKMojo.java 2007-04-30 20:58:02 UTC (rev 142)
+++ trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AbstractCDKMojo.java 2007-04-30 21:09:07 UTC (rev 143)
@@ -28,7 +28,6 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
-import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -92,12 +91,12 @@
* @parameter expression="${project.build.directory}/generated-component/java"
*/
protected File outputJavaDirectory;
-
+
/**
* @parameter expression="${project.build.directory}/generated-component/test"
*/
protected File outputTestsDirectory;
-
+
/**
* Directory where the output Java Files will be located.
*
@@ -149,7 +148,7 @@
}
if (null == library.getPrefix()) {
library.setPrefix(project.getGroupId());
-
+
}
if (null == library.getDescription()) {
library.setDescription(project.getDescription());
@@ -157,9 +156,8 @@
if( null == library.getJsfVersion()){
String version = Library.JSF11;
// Check version-specific methods in UIComponent class
- ClassLoader loader = createProjectClassLoader(project);
try {
- Class componentClass = loader.loadClass("javax.faces.component.UIComponent");
+ Class componentClass = createProjectClassLoader(project, false).loadClass("javax.faces.component.UIComponent");
Method[] methods = componentClass.getDeclaredMethods();
for (int i = 0; i < methods.length; i++) {
if("encodeAll".equals(methods[i].getName())){
@@ -200,7 +198,7 @@
}
if (null == taglib.getDisplayName()) {
taglib.setDisplayName(project.getDescription());
-
+
}
if( null == taglib.getJspVersion()){
// Jsf 1.2 can use JSP 2.1 only, other - 2.0
@@ -220,15 +218,15 @@
url = url + "/" + project.getArtifactId();
}
taglib.setUri(url);
-
+
}
if (null == taglib.getShortName()) {
taglib.setShortName(project.getArtifactId());
-
+
}
return taglib;
}
-
+
protected void writeParsedTemplate(String templateName, VelocityContext context, File configFile) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException, Exception {
File dir = configFile.getParentFile();
if(!dir.exists()){
@@ -241,30 +239,39 @@
fileWriter.flush();
fileWriter.close();
}
-
-
- protected ClassLoader createProjectClassLoader(MavenProject project) {
+
+ protected ClassLoader createProjectClassLoader(MavenProject project, boolean useCCL) {
ClassLoader classLoader = Thread.currentThread()
- .getContextClassLoader();
+ .getContextClassLoader();
try {
List compileClasspathElements = project
- .getCompileClasspathElements();
+ .getCompileClasspathElements();
String outputDirectory = project.getBuild().getOutputDirectory();
URL[] urls = new URL[compileClasspathElements.size() + 1];
int i = 0;
urls[i++] = new File(outputDirectory).toURL();
for (Iterator iter = compileClasspathElements.iterator(); iter
- .hasNext();) {
+ .hasNext();) {
String element = (String) iter.next();
urls[i++] = new File(element).toURL();
}
- classLoader = new URLClassLoader(urls, classLoader);
+
+ if (useCCL) {
+ classLoader = new URLClassLoader(urls, classLoader);
+ } else {
+ classLoader = new URLClassLoader(urls);
+ }
} catch (MalformedURLException e) {
getLog().error("Bad URL in classpath", e);
} catch (DependencyResolutionRequiredException e) {
getLog().error("Dependencies not resolved ", e);
}
+
return classLoader;
}
-}
+ protected ClassLoader createProjectClassLoader(MavenProject project) {
+ return createProjectClassLoader(project, true);
+ }
+
+}
\ No newline at end of file
17 years, 8 months
JBoss Ajax4JSF SVN: r142 - trunk/cdk/generator/src/main/resources/META-INF/templates12.
by ajax4jsf-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-30 16:58:02 -0400 (Mon, 30 Apr 2007)
New Revision: 142
Modified:
trunk/cdk/generator/src/main/resources/META-INF/templates12/componenttest.vm
Log:
componenttest.vm template updated for JSF 1.2
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates12/componenttest.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates12/componenttest.vm 2007-04-30 20:08:17 UTC (rev 141)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates12/componenttest.vm 2007-04-30 20:58:02 UTC (rev 142)
@@ -17,6 +17,9 @@
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
import javax.faces.component.UIViewRoot;
+
+import org.ajax4jsf.tests.MockValueBinding;
+
//import ${component.classname};
#if(${generator.key})
@@ -88,13 +91,16 @@
}
public void testComponent() throws Exception {
-
+ #if(${component.renderer})
+ assertEquals("${component.renderer.name}", component.getRendererType());
+ #end
+/*
HtmlPage renderedView = renderView();
assertNotNull(renderedView);
System.out.println(renderedView.getWebResponse().getContentAsString());
HtmlElement element = renderedView.getHtmlElementById(form.getId() + ":" + component.getId());
assertNotNull(element);
-
+*/
// values[0] = component.saveState(facesContext);
}
@@ -106,16 +112,31 @@
public void testContext(){
Object state = component.saveState(facesContext);
-
+/*
UIViewRoot root = facesContext.getViewRoot();
root.processDecodes(facesContext);
root.processValidators(facesContext);
root.processUpdates(facesContext);
root.processApplication(facesContext);
-
+*/
testRestoreState(state);
}
+ public void testGetters() {
+ ${component.simpleClassName} component = new ${component.simpleClassName}();
+
+#foreach( $prop in $component.properties )
+ #if(!$prop.exist && !$prop.elonly && !$prop.classname.startsWith("javax.faces."))
+ component.setValueBinding("${prop.name}", new MockValueBinding($testDataGenerator.getTestVeData(${prop}), ${testDataGenerator.getTestVeClass(${prop})}.class));
+ assertEquals($testDataGenerator.getTestData(${prop}), component.${prop.getterName}());
+ component.${prop.setterName}($testDataGenerator.getTestData1(${prop}) );
+ assertEquals($testDataGenerator.getTestData1(${prop}), component.${prop.getterName}());
+ #end
+#end
+
+
+ }
+
private void testRestoreState(Object state){
${component.simpleClassName} restoredComponent = new ${component.simpleClassName}();
restoredComponent.restoreState(facesContext, state);
@@ -128,4 +149,11 @@
}
+ private void assertEquals(double d1, double d2) {
+ assertEquals(d1, d2, 0);
+ }
+
+ private void assertEquals(float d1, float d2) {
+ assertEquals(d1, d2, 0);
+ }
}
\ No newline at end of file
17 years, 8 months
JBoss Ajax4JSF SVN: r140 - in trunk: cdk and 39 other directories.
by ajax4jsf-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-04-30 13:31:18 -0400 (Mon, 30 Apr 2007)
New Revision: 140
Added:
trunk/samples/createProject.bat
trunk/samples/createProject.sh
trunk/samples/tomahawkCompability/
trunk/samples/tomahawkCompability/.exadelproject
trunk/samples/tomahawkCompability/pom.xml
trunk/samples/tomahawkCompability/src/
trunk/samples/tomahawkCompability/src/main/
trunk/samples/tomahawkCompability/src/main/java/
trunk/samples/tomahawkCompability/src/main/java/org/
trunk/samples/tomahawkCompability/src/main/java/org/ajax4jsf/
trunk/samples/tomahawkCompability/src/main/java/org/ajax4jsf/Bean.java
trunk/samples/tomahawkCompability/src/main/resources/
trunk/samples/tomahawkCompability/src/main/webapp/
trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/
trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/faces-config.xml
trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/faces-config.xml.l4t
trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/jboss-web.xml
trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/web.xml
trunk/samples/tomahawkCompability/src/main/webapp/index.jsp
trunk/samples/tomahawkCompability/src/main/webapp/pages/
trunk/samples/tomahawkCompability/src/main/webapp/pages/index.jsp
trunk/samples/tomahawkCompability/src/main/webapp/pages/index.xhtml
trunk/samples/tomahawkCompability/src/main/webapp/pages/response.jsp
trunk/samples/tomahawkCompability/src/test/
trunk/samples/tomahawkCompability/src/test/java/
trunk/samples/tomahawkCompability/src/test/java/org/
trunk/samples/tomahawkCompability/src/test/java/org/ajax4jsf/
trunk/samples/tomahawkCompability/src/test/java/org/ajax4jsf/BeanTest.java
trunk/samples/useCases/
trunk/samples/useCases/.exadelproject
trunk/samples/useCases/pom.xml
trunk/samples/useCases/src/
trunk/samples/useCases/src/main/
trunk/samples/useCases/src/main/java/
trunk/samples/useCases/src/main/java/logging.properties
trunk/samples/useCases/src/main/java/org/
trunk/samples/useCases/src/main/java/org/ajax4jsf/
trunk/samples/useCases/src/main/java/org/ajax4jsf/Bean.java
trunk/samples/useCases/src/main/resources/
trunk/samples/useCases/src/main/webapp/
trunk/samples/useCases/src/main/webapp/WEB-INF/
trunk/samples/useCases/src/main/webapp/WEB-INF/faces-config.xml
trunk/samples/useCases/src/main/webapp/WEB-INF/faces-config.xml.l4t
trunk/samples/useCases/src/main/webapp/WEB-INF/web.xml
trunk/samples/useCases/src/main/webapp/index.jsp
trunk/samples/useCases/src/main/webapp/pages/
trunk/samples/useCases/src/main/webapp/pages/index.jsp
trunk/samples/useCases/src/main/webapp/pages/index.xhtml
trunk/samples/useCases/src/main/webapp/pages/prependId.xhtml
trunk/samples/useCases/src/test/
trunk/samples/useCases/src/test/java/
trunk/samples/useCases/src/test/java/org/
trunk/samples/useCases/src/test/java/org/ajax4jsf/
trunk/samples/useCases/src/test/java/org/ajax4jsf/BeanTest.java
Modified:
trunk/a4j-portlet/src/main/resources/META-INF/faces-config.xml
trunk/cdk/generator/pom.xml
trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/config/ComponentBaseBean.java
trunk/cdk/generator/src/main/resources/META-INF/templates/converter.vm
trunk/cdk/generator/src/main/resources/META-INF/templates/validator.vm
trunk/cdk/generator/src/main/resources/META-INF/templates12/converter.vm
trunk/cdk/generator/src/main/resources/META-INF/templates12/validator.vm
trunk/cdk/pom.xml
trunk/framework/pom.xml
trunk/framework/src/main/config/faces/original-faces-config.xml
trunk/framework/src/main/config/faces/original-faces-config.xml.l4t
trunk/framework/src/main/java/org/ajax4jsf/ajax/UIAjaxForm.java
trunk/framework/src/main/java/org/ajax4jsf/framework/ajax/AjaxContext.java
trunk/framework/src/main/java/org/ajax4jsf/framework/ajax/EventValueBinding.java
trunk/framework/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java
trunk/framework/src/main/javascript/ajaxjsf/JSFAJAX.js
trunk/samples/ajaxPortlet/pom.xml
trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/ajaxportlet-object.xml
trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/faces-config.xml
trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/portlet.xml
trunk/samples/pom.xml
Log:
applied patces from AJSF-12.
create sample projects for a framework use-cases
AjaxContext instance for a a4j-portlet library moved to jar from a application faces-config.xml
fixed AJSF-53
Modified: trunk/a4j-portlet/src/main/resources/META-INF/faces-config.xml
===================================================================
--- trunk/a4j-portlet/src/main/resources/META-INF/faces-config.xml 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/a4j-portlet/src/main/resources/META-INF/faces-config.xml 2007-04-30 17:31:18 UTC (rev 140)
@@ -9,6 +9,13 @@
<factory>
<faces-context-factory>org.ajax4jsf.portlet.context.FacesContextFactoryImpl</faces-context-factory>
</factory>
+
+ <managed-bean>
+ <managed-bean-name>ajaxContext</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.portlet.PortletAjaxContext</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+
<render-kit>
<renderer>
Modified: trunk/cdk/generator/pom.xml
===================================================================
--- trunk/cdk/generator/pom.xml 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/cdk/generator/pom.xml 2007-04-30 17:31:18 UTC (rev 140)
@@ -52,9 +52,13 @@
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>1.2_03</version>
- <scope>test</scope>
</dependency>
<dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
<groupId>qdox</groupId>
<artifactId>qdox</artifactId>
<version>1.6</version>
Modified: trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/config/ComponentBaseBean.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/config/ComponentBaseBean.java 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/config/ComponentBaseBean.java 2007-04-30 17:31:18 UTC (rev 140)
@@ -8,6 +8,8 @@
import java.util.HashMap;
import java.util.Map;
+import javax.faces.component.StateHolder;
+import javax.faces.context.FacesContext;
import javax.naming.ConfigurationException;
import org.apache.commons.beanutils.PropertyUtils;
@@ -275,4 +277,95 @@
return false;
}
+ public boolean isStateHolderRequired() {
+ getLog().info("isStateHolderRequired");
+ for (PropertyBean propertyBean : getProperties())
+ {
+ getLog().info("Property " + propertyBean.getName() + "/" + propertyBean.isTransient());
+ if (!propertyBean.isTransient())
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean isSuperclassImplementsStateHolder()
+ {
+ try {
+ Class superClass = getLoader().loadClass(getSuperclass());
+ return (StateHolder.class.isAssignableFrom(superClass));
+ } catch (ClassNotFoundException e) {
+ getLog().error("superclass not found for tag "+getTag().getName(), e);
+ return false;
+ }
+ }
+
+ public boolean isSuperSaveStateMethodExists()
+ {
+ try {
+ Class superClass = getLoader().loadClass(getSuperclass());
+ Class[] signature = {FacesContext.class};
+ try {
+ Method m = superClass.getMethod("saveState", signature);
+ return !Modifier.isAbstract(m.getModifiers());
+ } catch (NoSuchMethodException e) {
+ return false;
+ }
+ } catch (ClassNotFoundException e) {
+ getLog().error("superclass not found for tag "+getTag().getName(), e);
+ return false;
+ }
+ }
+
+ public boolean isSuperRestoreStateMethodExists()
+ {
+ try {
+ Class superClass = getLoader().loadClass(getSuperclass());
+ Class[] signature = {FacesContext.class, Object.class};
+ try {
+ Method m = superClass.getMethod("restoreState", signature);
+ return !Modifier.isAbstract(m.getModifiers());
+ } catch (NoSuchMethodException e) {
+ return false;
+ }
+ } catch (ClassNotFoundException e) {
+ getLog().error("superclass not found for tag "+getTag().getName(), e);
+ return false;
+ }
+ }
+
+ public boolean isSuperIsTransientMethodExists()
+ {
+ try {
+ Class superClass = getLoader().loadClass(getSuperclass());
+ Class[] signature = new Class[0];
+ try {
+ Method m = superClass.getMethod("isTransient", signature);
+ return !Modifier.isAbstract(m.getModifiers());
+ } catch (NoSuchMethodException e) {
+ return false;
+ }
+ } catch (ClassNotFoundException e) {
+ getLog().error("superclass not found for tag "+getTag().getName(), e);
+ return false;
+ }
+ }
+
+ public boolean isSuperSetTransientMethodExists()
+ {
+ try {
+ Class superClass = getLoader().loadClass(getSuperclass());
+ Class[] signature = {boolean.class};
+ try {
+ Method m = superClass.getMethod("setTransient", signature);
+ return !Modifier.isAbstract(m.getModifiers());
+ } catch (NoSuchMethodException e) {
+ return false;
+ }
+ } catch (ClassNotFoundException e) {
+ getLog().error("superclass not found for tag "+getTag().getName(), e);
+ return false;
+ }
+ }
}
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 17:56:16 UTC (rev 139)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/converter.vm 2007-04-30 17:31:18 UTC (rev 140)
@@ -1,204 +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;
-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);
- }
-
-}
+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/validator.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates/validator.vm 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/validator.vm 2007-04-30 17:31:18 UTC (rev 140)
@@ -1,202 +1,434 @@
-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);
- }
-
-}
+package $package;
+package $package;
+
+#foreach($import in $imports)
+import $import ;
+#end
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import javax.faces.component.StateHolder;
+
+/**
+ * Validator-Id ${validator.id}
+ * ${validator.xmlEncodedDescription}
+ */
+public class $validator.simpleClassName extends $validator.superclass #if(${validator.stateHolderRequired} && !${validator.superclassImplementsStateHolder})implements StateHolder#end
+{
+
+ public static final String VALIDATOR_ID = "${validator.id}";
+
+ /**
+ * Default no-args contstructor
+ */
+ public $validator.simpleClassName ()
+ {
+ }
+
+// Validator properties fields
+#set( $fieldCounter = 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( $fieldCounter = $fieldCounter+2)
+#else
+ private $prop.simpleClassName _$prop.name = null; /* Default is ${prop.defaultvalue}*/
+#set( $fieldCounter = $fieldCounter+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
+
+
+#if($validator.stateHolderRequired)
+
+ // Save state
+ // ----------------------------------------------------- StateHolder Methods
+
+ private boolean _transient;
+#if(${validator.superclassImplementsStateHolder})
+#set($currentField=1)
+#set( $fieldCounter = $fieldCounter+1)
+#else
+#set($currentField=0)
+#end
+ public Object saveState(FacesContext context) {
+#if(${validator.superSaveStateMethodExists})
+ Object values[] = new Object[${fieldCounter}];
+ values[0] = super.saveState(context);
+#else
+ Object values[] = new Object[${fieldCounter}];
+#end
+#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;
+ }
+
+#if(${validator.superclassImplementsStateHolder})
+#set($currentField=1)
+#else
+#set($currentField=0)
+#end
+ public void restoreState(FacesContext context, Object state) {
+#if(${validator.superRestoreStateMethodExists})
+ Object values[] = (Object[]) state;
+ super.restoreState(context, values[0]);
+#else
+ Object values[] = (Object[]) state;
+#end
+#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
+#set( $currentField = $currentField+1)
+#end
+
+#end
+#end
+ }
+
+#if(!$validator.superIsTransientMethodExists)
+ public boolean isTransient()
+ {
+ return _transient;
+ }
+#end
+
+#if(!$validator.superSetTransientMethodExists)
+ public void setTransient(boolean newTransientValue)
+ {
+ this._transient = newTransientValue;
+ }
+#end
+
+#end
+
+
+// Utilites
+
+ private FacesContext getFacesContext()
+ {
+ return FacesContext.getCurrentInstance();
+ }
+
+ private ValueBinding getValueBinding(String name)
+ {
+ return getFacesContext().getApplication().createValueBinding(name);
+ }
+
+}
+
+#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/converter.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates12/converter.vm 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates12/converter.vm 2007-04-30 17:31:18 UTC (rev 140)
@@ -1,204 +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;
-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);
- }
-
-}
+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/validator.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates12/validator.vm 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates12/validator.vm 2007-04-30 17:31:18 UTC (rev 140)
@@ -1,202 +1,434 @@
-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);
- }
-
-}
+package $package;
+package $package;
+
+#foreach($import in $imports)
+import $import ;
+#end
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import javax.faces.component.StateHolder;
+
+/**
+ * Validator-Id ${validator.id}
+ * ${validator.xmlEncodedDescription}
+ */
+public class $validator.simpleClassName extends $validator.superclass #if(${validator.stateHolderRequired} && !${validator.superclassImplementsStateHolder})implements StateHolder#end
+{
+
+ public static final String VALIDATOR_ID = "${validator.id}";
+
+ /**
+ * Default no-args contstructor
+ */
+ public $validator.simpleClassName ()
+ {
+ }
+
+// Validator properties fields
+#set( $fieldCounter = 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( $fieldCounter = $fieldCounter+2)
+#else
+ private $prop.simpleClassName _$prop.name = null; /* Default is ${prop.defaultvalue}*/
+#set( $fieldCounter = $fieldCounter+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
+
+
+#if($validator.stateHolderRequired)
+
+ // Save state
+ // ----------------------------------------------------- StateHolder Methods
+
+ private boolean _transient;
+#if(${validator.superclassImplementsStateHolder})
+#set($currentField=1)
+#set( $fieldCounter = $fieldCounter+1)
+#else
+#set($currentField=0)
+#end
+ public Object saveState(FacesContext context) {
+#if(${validator.superSaveStateMethodExists})
+ Object values[] = new Object[${fieldCounter}];
+ values[0] = super.saveState(context);
+#else
+ Object values[] = new Object[${fieldCounter}];
+#end
+#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;
+ }
+
+#if(${validator.superclassImplementsStateHolder})
+#set($currentField=1)
+#else
+#set($currentField=0)
+#end
+ public void restoreState(FacesContext context, Object state) {
+#if(${validator.superRestoreStateMethodExists})
+ Object values[] = (Object[]) state;
+ super.restoreState(context, values[0]);
+#else
+ Object values[] = (Object[]) state;
+#end
+#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
+#set( $currentField = $currentField+1)
+#end
+
+#end
+#end
+ }
+
+#if(!$validator.superIsTransientMethodExists)
+ public boolean isTransient()
+ {
+ return _transient;
+ }
+#end
+
+#if(!$validator.superSetTransientMethodExists)
+ public void setTransient(boolean newTransientValue)
+ {
+ this._transient = newTransientValue;
+ }
+#end
+
+#end
+
+
+// Utilites
+
+ private FacesContext getFacesContext()
+ {
+ return FacesContext.getCurrentInstance();
+ }
+
+ private ValueBinding getValueBinding(String name)
+ {
+ return getFacesContext().getApplication().createValueBinding(name);
+ }
+
+}
+
+#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/pom.xml
===================================================================
--- trunk/cdk/pom.xml 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/cdk/pom.xml 2007-04-30 17:31:18 UTC (rev 140)
@@ -1,37 +1,38 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>master</artifactId>
- <groupId>org.ajax4jsf</groupId>
- <version>1.1.1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.ajax4jsf</groupId>
- <artifactId>cdk</artifactId>
- <packaging>pom</packaging>
- <name>JSF Components Development kit</name>
- <version>1.1.1-SNAPSHOT</version>
- <url>http://labs.jboss.com/wiki/Ajax4jsf/cdk</url>
- <dependencies />
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.0</version>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
- <modules>
- <module>maven-cdk-plugin</module>
- <module>compiler</module>
- <module>generator</module>
- <module>maven-archetype-jsf-component</module>
- <module>maven-archetype-jsfwebapp</module>
- </modules>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>master</artifactId>
+ <groupId>org.ajax4jsf</groupId>
+ <version>1.1.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.ajax4jsf</groupId>
+ <artifactId>cdk</artifactId>
+ <packaging>pom</packaging>
+ <name>JSF Components Development kit</name>
+ <version>1.1.1-SNAPSHOT</version>
+ <url>http://labs.jboss.com/wiki/Ajax4jsf/cdk</url>
+ <dependencies/>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <modules>
+ <module>maven-cdk-plugin</module>
+ <module>compiler</module>
+ <module>generator</module>
+ <module>maven-archetype-jsf-component</module>
+ <module>maven-archetype-jsfwebapp</module>
+ </modules>
</project>
\ No newline at end of file
Modified: trunk/framework/pom.xml
===================================================================
--- trunk/framework/pom.xml 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/framework/pom.xml 2007-04-30 17:31:18 UTC (rev 140)
@@ -140,17 +140,17 @@
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
- <version>1.6</version>
+ <version>1.7.0</version>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
- <version>1.5</version>
+ <version>1.8</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
- <version>2.1</version>
+ <version>3.2</version>
</dependency>
</dependencies>
<profiles>
Modified: trunk/framework/src/main/config/faces/original-faces-config.xml
===================================================================
--- trunk/framework/src/main/config/faces/original-faces-config.xml 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/framework/src/main/config/faces/original-faces-config.xml 2007-04-30 17:31:18 UTC (rev 140)
@@ -30,12 +30,14 @@
<managed-bean-name>a4jSkin</managed-bean-name>
<managed-bean-class>org.ajax4jsf.framework.skin.SkinBean</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
- </managed-bean>
+ </managed-bean>
+ <!--
<managed-bean>
<managed-bean-name>ajaxContext</managed-bean-name>
<managed-bean-class>org.ajax4jsf.framework.ajax.AjaxContext</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
- </managed-bean>
+ </managed-bean>
+ -->
<component>
<component-type>javax.faces.ViewRoot</component-type>
Modified: trunk/framework/src/main/config/faces/original-faces-config.xml.l4t
===================================================================
--- trunk/framework/src/main/config/faces/original-faces-config.xml.l4t 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/framework/src/main/config/faces/original-faces-config.xml.l4t 2007-04-30 17:31:18 UTC (rev 140)
@@ -1,2 +1,2 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<PROCESS ENTITY="JSFProcess"/>
+<?xml version="1.0" encoding="UTF-8"?>
+<PROCESS ENTITY="JSFProcess"/>
Modified: trunk/framework/src/main/java/org/ajax4jsf/ajax/UIAjaxForm.java
===================================================================
--- trunk/framework/src/main/java/org/ajax4jsf/ajax/UIAjaxForm.java 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/framework/src/main/java/org/ajax4jsf/ajax/UIAjaxForm.java 2007-04-30 17:31:18 UTC (rev 140)
@@ -109,11 +109,11 @@
*/
private boolean mustProcessed(FacesContext context)
{
- if ( !AjaxContext.getCurrentInstance(context).isAjaxRequest(context)) {
+// if ( !AjaxContext.getCurrentInstance(context).isAjaxRequest(context)) {
if (!isSubmitted() ) {
return false;
}
- }
+// }
return true;
}
Modified: trunk/framework/src/main/java/org/ajax4jsf/framework/ajax/AjaxContext.java
===================================================================
--- trunk/framework/src/main/java/org/ajax4jsf/framework/ajax/AjaxContext.java 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/framework/src/main/java/org/ajax4jsf/framework/ajax/AjaxContext.java 2007-04-30 17:31:18 UTC (rev 140)
@@ -29,6 +29,7 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
+import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
@@ -114,7 +115,7 @@
ViewIdHolder viewIdHolder = null;
Map responseDataMap = new HashMap();
-
+
Map commonAjaxParameters = new HashMap();
static {
@@ -154,6 +155,12 @@
AjaxContext ajaxContext = (AjaxContext) context.getApplication()
.getVariableResolver().resolveVariable(context,
AJAX_CONTEXT_KEY);
+ if (null == ajaxContext) {
+ // Create default implementation.
+ ajaxContext = new AjaxContext();
+ context.getExternalContext().getRequestMap().put(AJAX_CONTEXT_KEY,
+ ajaxContext);
+ }
return ajaxContext;
}
@@ -404,10 +411,10 @@
.getViewHandler().getResourceURL(context,
styleSheetUri);
// TODO - some resources can be non-session aware, we
- // must
+ // must
// skip encoding for this case ?
// But, in common case - static links not need session
- // info,
+ // info,
// and dynamic resources perform encodings if nessesary
// resourceURL =
// context.getExternalContext().encodeResourceURL(resourceURL);
@@ -554,6 +561,30 @@
return this.ajaxAreasToRender;
}
+ /**
+ * Add affected regions's ID to ajaxView component.
+ *
+ * @param component
+ */
+ public void addRegionsFromComponent(UIComponent component) {
+ // First step - find parent ajax view
+ Set ajaxRegions = AjaxRendererUtils.getAjaxAreas(component);
+ // if (ajaxRegions == null){
+ // FacesContext context = FacesContext.getCurrentInstance();
+ // ajaxRegions = AjaxRendererUtils.getAbsoluteId(context,component);
+ // }
+ if (log.isDebugEnabled()) {
+ log.debug(Messages.getMessage(Messages.INVOKE_AJAX_REGION_LISTENER,
+ component.getId()));
+ }
+ if (ajaxRegions != null) {
+ for (Iterator iter = ajaxRegions.iterator(); iter.hasNext();) {
+ String id = iter.next().toString();
+ ajaxAreasToRender.add(convertId(component, id));
+ }
+ }
+ }
+
public void addComponentToAjaxRender(UIComponent component) {
this.ajaxAreasToRender.add(AjaxRendererUtils.getAbsoluteId(component));
}
@@ -563,6 +594,68 @@
}
/**
+ * Test for relative id of target components. Attempt convert to
+ * absolute. For use as argument for
+ * {@link UIComponent#findComponent(java.lang.String)}
+ *
+ * @param component
+ * @param id
+ * @return
+ */
+ private String convertId(UIComponent component, String id) {
+ if (id.charAt(0) == NamingContainer.SEPARATOR_CHAR) {
+ return id;
+ }
+ if (null == component) {
+ throw new NullPointerException(
+ "Base component for search re-rendered compnnent is null");
+ }
+ UIComponent target = null;
+ UIComponent parent = component;
+ UIComponent root = component;
+ while (null == target && null != parent) {
+ target = parent.findComponent(id);
+ root = parent;
+ parent = parent.getParent();
+ }
+ if (null == target) {
+ target = findUIComponentBelow(root, id);
+ }
+ if (null != target) {
+ return AjaxRendererUtils.getAbsoluteId(target);
+ }
+ log.warn("Target component for id "+id+" not found");
+ return id;
+ }
+
+ private UIComponent findUIComponentBelow(UIComponent root,
+ String id) {
+
+ UIComponent target = null;
+ for (Iterator iter = root.getFacetsAndChildren(); iter.hasNext();) {
+ UIComponent child = (UIComponent) iter.next();
+ if (child instanceof NamingContainer) {
+ try {
+ target = child.findComponent(id);
+ } catch (IllegalArgumentException iae) {
+ continue;
+ }
+ }
+ if (target == null) {
+ if (child.getChildCount() > 0) {
+ target = findUIComponentBelow(child, id);
+ }
+ }
+
+ if (target != null) {
+ break;
+ }
+
+ }
+ return target;
+ }
+
+ /**
* @return Returns the ajaxRenderedAreas.
*/
public Set getAjaxRenderedAreas() {
@@ -677,81 +770,40 @@
return writer;
}
- /**
- * Add affected regions's ID to ajaxView component.
- *
- * @param component
- */
- public void addRegionsFromComponent(UIComponent component) {
- // First step - find parent ajax view
- Set ajaxRegions = AjaxRendererUtils.getAjaxAreas(component);
- // if (ajaxRegions == null){
- // FacesContext context = FacesContext.getCurrentInstance();
- // ajaxRegions = AjaxRendererUtils.getAbsoluteId(context,component);
- // }
- if (log.isDebugEnabled()) {
- log.debug(Messages.getMessage(Messages.INVOKE_AJAX_REGION_LISTENER,
- component.getId()));
- }
- if (ajaxRegions != null) {
- for (Iterator iter = ajaxRegions.iterator(); iter.hasNext();) {
- String id = iter.next().toString();
- ajaxAreasToRender.add(convertId(component, id));
- }
- }
- }
-
- /**
- * Test for relative id of target components. Attempt convert to
- * absolute. For use as argument for
- * {@link UIComponent#findComponent(java.lang.String)}
- *
- * @param component
- * @param id
- * @return
- */
- private String convertId(UIComponent component, String id) {
- if (id.charAt(0) == NamingContainer.SEPARATOR_CHAR) {
- return id;
- }
- if (null != component) {
- UIComponent target = component.findComponent(id);
- if (null != target) {
- return AjaxRendererUtils.getAbsoluteId(target);
- }
- }
- return id;
- }
-
public String getAjaxActionURL() {
return getAjaxActionURL(FacesContext.getCurrentInstance());
}
public String getAjaxActionURL(FacesContext context) {
// Check arguments
- if(null == context){
- throw new NullPointerException("Faces context for build AJAX Action URL is null");
+ if (null == context) {
+ throw new NullPointerException(
+ "Faces context for build AJAX Action URL is null");
}
UIViewRoot viewRoot = context.getViewRoot();
- if(null == viewRoot){
- throw new NullPointerException("Faces view tree for build AJAX Action URL is null");
+ if (null == viewRoot) {
+ throw new NullPointerException(
+ "Faces view tree for build AJAX Action URL is null");
}
String viewId = viewRoot.getViewId();
- if(null == viewId){
- throw new NullPointerException("View id for build AJAX Action URL is null");
+ if (null == viewId) {
+ throw new NullPointerException(
+ "View id for build AJAX Action URL is null");
}
- if(!viewId.startsWith("/")){
- throw new IllegalArgumentException("Illegal view Id for build AJAX Action URL: "+viewId);
- }
+ if (!viewId.startsWith("/")) {
+ throw new IllegalArgumentException(
+ "Illegal view Id for build AJAX Action URL: " + viewId);
+ }
ViewHandler viewHandler = context.getApplication().getViewHandler();
- return context.getExternalContext().encodeActionURL(viewHandler.getActionURL(context, viewId));
+ return context.getExternalContext().encodeActionURL(
+ viewHandler.getActionURL(context, viewId));
}
/**
- * @return the commonAjaxParameters
- */
+ * @return the commonAjaxParameters
+ */
public Map getCommonAjaxParameters() {
- return commonAjaxParameters;
+ return commonAjaxParameters;
}
}
\ No newline at end of file
Modified: trunk/framework/src/main/java/org/ajax4jsf/framework/ajax/EventValueBinding.java
===================================================================
--- trunk/framework/src/main/java/org/ajax4jsf/framework/ajax/EventValueBinding.java 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/framework/src/main/java/org/ajax4jsf/framework/ajax/EventValueBinding.java 2007-04-30 17:31:18 UTC (rev 140)
@@ -31,151 +31,176 @@
import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
import org.ajax4jsf.framework.util.message.Messages;
-
/**
* Inner class for build event string for parent component.
+ *
* @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:57:38 $
- * Disadvantages - not rebuild event string setted as EL expression.
- * TODO - save expressions for build event string at render phase.
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:57:38 $ Disadvantages -
+ * not rebuild event string setted as EL expression. TODO - save
+ * expressions for build event string at render phase.
*/
public class EventValueBinding extends ValueBinding implements StateHolder {
-
+
/**
- *
- */
+ *
+ */
private static final long serialVersionUID = -6583167387542332290L;
+
private String _componentId;
-
-
+
/**
- * current update component. transient since saved state as component.
- */
+ * current update component. transient since saved state as component.
+ */
transient private AjaxSupport _component = null;
-
+
/**
- * Default constructor for restoreState.
- */
+ * Default constructor for restoreState.
+ */
public EventValueBinding() {
-
+
}
/**
- * Constructor for build from AjaxComponent.
- * @param update
- */
- public EventValueBinding(AjaxSupport update)
- {
- _component = update;
-// _componentId = string;
+ * Constructor for build from AjaxComponent.
+ *
+ * @param update
+ */
+ public EventValueBinding(AjaxSupport update) {
+ _component = update;
+ // _componentId = string;
}
- /* (non-Javadoc)
- * @see javax.faces.el.ValueBinding#getType(javax.faces.context.FacesContext)
- */
- public Class getType(FacesContext facesContext) throws EvaluationException, PropertyNotFoundException
- {
-
- return String.class;
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.el.ValueBinding#getType(javax.faces.context.FacesContext)
+ */
+ public Class getType(FacesContext facesContext) throws EvaluationException,
+ PropertyNotFoundException {
+
+ return String.class;
}
- /* (non-Javadoc)
- * @see javax.faces.el.ValueBinding#getValue(javax.faces.context.FacesContext)
- */
- public Object getValue(FacesContext facesContext) throws EvaluationException, PropertyNotFoundException
- {
- return getComponent(facesContext).getEventString();
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.el.ValueBinding#getValue(javax.faces.context.FacesContext)
+ */
+ public Object getValue(FacesContext facesContext)
+ throws EvaluationException, PropertyNotFoundException {
+ if (((UIComponent) getComponent(facesContext)).isRendered()) {
+ return getComponent(facesContext).getEventString();
+
+ } else {
+ return null;
+ }
}
-
- private AjaxSupport getComponent(FacesContext facesContext) throws EvaluationException {
- if (_component == null)
- {
- UIComponent uiComponent = facesContext.getViewRoot().findComponent(_componentId);
- if (null != uiComponent && uiComponent instanceof AjaxComponent)
- {
- _component = (AjaxSupport) uiComponent;
- } else {
- throw new EvaluationException(Messages.getMessage(Messages.COMPONENT_NOT_FOUND, _componentId));
- }
-
- }
+ private AjaxSupport getComponent(FacesContext facesContext)
+ throws EvaluationException {
- return _component;
+ if (_component == null) {
+ UIComponent uiComponent = facesContext.getViewRoot().findComponent(
+ _componentId);
+ if (null != uiComponent && uiComponent instanceof AjaxComponent) {
+ _component = (AjaxSupport) uiComponent;
+ } else {
+ throw new EvaluationException(Messages.getMessage(
+ Messages.COMPONENT_NOT_FOUND, _componentId));
+ }
+
+ }
+
+ return _component;
}
/**
- * @param component the component to set
- */
- public void setComponent(AjaxSupport component) {
- _component = component;
- }
+ * @param component
+ * the component to set
+ */
+ public void setComponent(AjaxSupport component) {
+ _component = component;
+ }
- /* (non-Javadoc)
- * @see javax.faces.el.ValueBinding#isReadOnly(javax.faces.context.FacesContext)
- */
- public boolean isReadOnly(FacesContext facesContext) throws EvaluationException, PropertyNotFoundException
- {
- // TODO Auto-generated method stub
- return true;
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.el.ValueBinding#isReadOnly(javax.faces.context.FacesContext)
+ */
+ public boolean isReadOnly(FacesContext facesContext)
+ throws EvaluationException, PropertyNotFoundException {
+ // TODO Auto-generated method stub
+ return true;
}
- /* (non-Javadoc)
- * @see javax.faces.el.ValueBinding#setValue(javax.faces.context.FacesContext, java.lang.Object)
- */
- public void setValue(FacesContext facesContext, Object value) throws EvaluationException, PropertyNotFoundException
- {
- throw new EvaluationException(Messages.getMessage(Messages.EVENT_IS_READ_ONLY));
-
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.el.ValueBinding#setValue(javax.faces.context.FacesContext,
+ * java.lang.Object)
+ */
+ public void setValue(FacesContext facesContext, Object value)
+ throws EvaluationException, PropertyNotFoundException {
+ throw new EvaluationException(Messages
+ .getMessage(Messages.EVENT_IS_READ_ONLY));
+
}
- /* (non-Javadoc)
- * @see javax.faces.component.StateHolder#saveState(javax.faces.context.FacesContext)
- */
- public Object saveState(FacesContext context)
- {
- if(null == _component){
- return _componentId;
- } else {
- return AjaxRendererUtils.getAbsoluteId((UIComponent) getComponent(context));
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.StateHolder#saveState(javax.faces.context.FacesContext)
+ */
+ public Object saveState(FacesContext context) {
+ if (null == _component) {
+ return _componentId;
+ } else {
+ return AjaxRendererUtils
+ .getAbsoluteId((UIComponent) getComponent(context));
+ }
}
- /* (non-Javadoc)
- * @see javax.faces.component.StateHolder#restoreState(javax.faces.context.FacesContext, java.lang.Object)
- */
- public void restoreState(FacesContext context, Object state)
- {
- // TODO Auto-generated method stub
- _componentId = (String)state;
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.StateHolder#restoreState(javax.faces.context.FacesContext,
+ * java.lang.Object)
+ */
+ public void restoreState(FacesContext context, Object state) {
+ // TODO Auto-generated method stub
+ _componentId = (String) state;
}
- /* (non-Javadoc)
- * @see javax.faces.component.StateHolder#isTransient()
- */
- public boolean isTransient()
- {
- // TODO Auto-generated method stub
- return false;
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.StateHolder#isTransient()
+ */
+ public boolean isTransient() {
+ // TODO Auto-generated method stub
+ return false;
}
- /* (non-Javadoc)
- * @see javax.faces.component.StateHolder#setTransient(boolean)
- */
- public void setTransient(boolean newTransientValue)
- {
- // TODO Auto-generated method stub
-
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.StateHolder#setTransient(boolean)
+ */
+ public void setTransient(boolean newTransientValue) {
+ // TODO Auto-generated method stub
+
}
- /* (non-Javadoc)
- * @see javax.faces.el.ValueBinding#getExpressionString()
- */
- public String getExpressionString() {
-// FacesContext context = FacesContext.getCurrentInstance();
-// UIComponent component = (UIComponent) getComponent(context);
-// return "#{ajaxSupport["+component.getClientId(context)+"]}";
- return null;
- }
-
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.el.ValueBinding#getExpressionString()
+ */
+ public String getExpressionString() {
+ // FacesContext context = FacesContext.getCurrentInstance();
+ // UIComponent component = (UIComponent) getComponent(context);
+ // return "#{ajaxSupport["+component.getClientId(context)+"]}";
+ return null;
+ }
+
}
\ No newline at end of file
Modified: trunk/framework/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java
===================================================================
--- trunk/framework/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/framework/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java 2007-04-30 17:31:18 UTC (rev 140)
@@ -228,7 +228,7 @@
Set formParams) throws IOException {
for (Iterator it = formParams.iterator(); it.hasNext();) {
Object name = it.next();
- renderHiddenInputField(writer, name, null);
+ renderHiddenInputField(writer, name, "");
}
}
@@ -237,9 +237,7 @@
writer.startElement(HTML.INPUT_ELEM, null);
writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
writer.writeAttribute(HTML.NAME_ATTRIBUTE, name, null);
- if (value != null) {
- writer.writeAttribute(HTML.value_ATTRIBUTE, value, null);
- }
+ writer.writeAttribute(HTML.value_ATTRIBUTE, value != null?value:"", null);
writer.endElement(HTML.INPUT_ELEM);
}
@@ -298,14 +296,17 @@
}
script.append(");");
script.append("\n}");
-
- // Just to be sure we call this clear method on each load.
- // Otherwise in the case, that someone submits a form by pressing Enter
- // within a text input, the hidden inputs won't be cleared!
script.append("\n");
script.append("function ").append("clearFormHiddenParams_").append(
getValidJavascriptName(formName));
script.append("(){").append(functionName).append("();}\n");
+ // MyFaces 1.1.5 clear form function name
+ script.append("function ").append("clearFormHiddenParams_").append(
+ formName.replace("-", "$_").replace(':', '_'));
+ script.append("(){").append(functionName).append("();}\n");
+ // Just to be sure we call this clear method on each load.
+ // Otherwise in the case, that someone submits a form by pressing Enter
+ // within a text input, the hidden inputs won't be cleared!
script.append(functionName);
script.append("();");
@@ -329,7 +330,7 @@
for (int i = 0, len = s.length(); i < len; i++) {
char c = s.charAt(i);
- if (Character.isLetterOrDigit(c)) {
+ if (Character.isLetterOrDigit(c)||c=='_' ) {
// allowed char
if (buf != null)
buf.append(c);
Modified: trunk/framework/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- trunk/framework/src/main/javascript/ajaxjsf/JSFAJAX.js 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/framework/src/main/javascript/ajaxjsf/JSFAJAX.js 2007-04-30 17:31:18 UTC (rev 140)
@@ -1040,12 +1040,15 @@
_value_query : function(control){
- this.appendParameter(control.name, control.value);
+ LOG.debug("Append "+control.type+" control "+control.name+" with value ["+control.value+"] and value attribute ["+control.getAttribute('value')+"]");
+ if(null != control.value){
+ this.appendParameter(control.name, control.value);
+ }
},
_check_query : function(control){
if( control.checked ) {
- this.appendParameter(control.name, control.value?control.value:"on");
+ this.appendParameter(control.name, control.value?control.value:"on");
}
},
Modified: trunk/samples/ajaxPortlet/pom.xml
===================================================================
--- trunk/samples/ajaxPortlet/pom.xml 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/samples/ajaxPortlet/pom.xml 2007-04-30 17:31:18 UTC (rev 140)
@@ -2,49 +2,39 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>ajaxPortlet</groupId>
- <artifactId>ajaxPortlet</artifactId>
- <packaging>war</packaging>
- <version>0.0.1</version>
- <description>Ajax JSF sample portlet</description>
- <build>
- <defaultGoal>package</defaultGoal>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jboss-maven-plugin</artifactId>
- <configuration>
- <jbossHome>${env.JBOSS_HOME}</jbossHome>
- <hostName>${jboss_host}</hostName>
- <port>8080</port>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>javax.portlet</groupId>
- <artifactId>portlet-api</artifactId>
- <version>1.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.ajax4jsf</groupId>
- <artifactId>a4j-portlet</artifactId>
- <version>1.1.1-SNAPSHOT</version>
- <exclusions>
- <exclusion>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.ajax4jsf</groupId>
+ <artifactId>portalAjaxSample</artifactId>
+ <packaging>war</packaging>
+ <version>0.0.1</version>
+ <description>Ajax JSF sample portlet</description>
+ <build>
+ <defaultGoal>package</defaultGoal>
+ <finalName>portalAjaxSample</finalName>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
<dependency>
+ <groupId>org.ajax4jsf</groupId>
+ <artifactId>a4j-portlet</artifactId>
+ <version>1.1.1-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>1.2_04</version>
@@ -56,6 +46,6 @@
<version>1.2_04</version>
<scope>provided</scope>
</dependency>
- </dependencies>
+ </dependencies>
</project>
Modified: trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/ajaxportlet-object.xml
===================================================================
--- trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/ajaxportlet-object.xml 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/ajaxportlet-object.xml 2007-04-30 17:31:18 UTC (rev 140)
@@ -30,10 +30,8 @@
</page>
</deployment>
<deployment>
- <parent-ref>default</parent-ref>
- <if-exists>overwrite</if-exists>
- <page>
- <page-name>otherAjaxPortlet</page-name>
+ <if-exists>overwrite</if-exists>
+ <parent-ref>default.default</parent-ref>
<window>
<window-name>otherAjaxportletWindow</window-name>
<instance-ref>AjaxPortletInstance</instance-ref>
@@ -41,7 +39,6 @@
<region>center</region>
<height>0</height>
</window>
- </page>
</deployment>
<deployment>
<parent-ref>default</parent-ref>
Modified: trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/faces-config.xml 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/faces-config.xml 2007-04-30 17:31:18 UTC (rev 140)
@@ -3,11 +3,6 @@
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<managed-bean>
- <managed-bean-name>ajaxContext</managed-bean-name>
- <managed-bean-class>org.ajax4jsf.portlet.PortletAjaxContext</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
- </managed-bean>
- <managed-bean>
<managed-bean-name>bean</managed-bean-name>
<managed-bean-class>portal.Bean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
Modified: trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/portlet.xml
===================================================================
--- trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/portlet.xml 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/portlet.xml 2007-04-30 17:31:18 UTC (rev 140)
@@ -8,6 +8,7 @@
<name>default-view</name>
<value>/jsf/start.xhtml</value>
</init-param>
+ <!--
<init-param>
<name>default-edit</name>
<value>/jsf/start-edit.xhtml</value>
@@ -16,6 +17,7 @@
<name>default-help</name>
<value>/jsf/start-help.xhtml</value>
</init-param>
+ -->
<expiration-cache>-0</expiration-cache>
<portlet-info>
<title>Ajax Portlet</title>
@@ -23,8 +25,10 @@
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
+ <!--
<portlet-mode>EDIT</portlet-mode>
<portlet-mode>HELP</portlet-mode>
+ -->
</supports>
</portlet>
</portlet-app>
Added: trunk/samples/createProject.bat
===================================================================
--- trunk/samples/createProject.bat (rev 0)
+++ trunk/samples/createProject.bat 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1 @@
+mvn archetype:create -DarchetypeGroupId=org.ajax4jsf.cdk -DarchetypeArtifactId=maven-archetype-jsfwebapp -DarchetypeVersion=1.1.1-SNAPSHOT -DgroupId=org.richfaces -DartifactId=%1
\ No newline at end of file
Added: trunk/samples/createProject.sh
===================================================================
--- trunk/samples/createProject.sh (rev 0)
+++ trunk/samples/createProject.sh 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,2 @@
+#!/bin/sh
+mvn archetype:create -e -DarchetypeGroupId=org.ajax4jsf.cdk -DarchetypeArtifactId=maven-archetype-jsfwebapp -DarchetypeVersion=1.1.1-SNAPSHOT -DartifactId=${1}
\ No newline at end of file
Modified: trunk/samples/pom.xml
===================================================================
--- trunk/samples/pom.xml 2007-04-27 17:56:16 UTC (rev 139)
+++ trunk/samples/pom.xml 2007-04-30 17:31:18 UTC (rev 140)
@@ -1,19 +1,219 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <!--parent>
- <artifactId>master</artifactId>
- <groupId>org.ajax4jsf</groupId>
- <version>1.1.0-SNAPSHOT</version>
- </parent-->
- <groupId>org.ajax4jsf</groupId>
- <artifactId>samples</artifactId>
- <packaging>pom</packaging>
- <name>Ajax4jsf examples</name>
- <version>1.1.1-SNAPSHOT</version>
- <url>https://ajax4jsf.dev.java.net</url>
- <dependencies/>
- <modules>
- <module>cdk</module>
- </modules>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>master</artifactId>
+ <groupId>org.ajax4jsf</groupId>
+ <version>1.1.1-SNAPSHOT</version>
+ </parent>
+ <groupId>org.ajax4jsf</groupId>
+ <artifactId>samples</artifactId>
+ <packaging>pom</packaging>
+ <name>Ajax4jsf examples</name>
+ <modules>
+ <module>ajaxPortlet</module>
+ <module>tomahawkCompability</module>
+ <module>useCases</module>
+ </modules>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.1</version>
+ <configuration>
+ <scanIntervalSeconds>10</scanIntervalSeconds>
+ <connectors>
+ <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+ <port>8080</port>
+ <maxIdleTime>60000</maxIdleTime>
+ </connector>
+ </connectors>
+ </configuration>
+
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ajax4jsf</groupId>
+ <artifactId>ajax4jsf</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ <version>1.1.12</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>el-impl</groupId>
+ <artifactId>el-impl</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.0</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ <profiles>
+ <profile>
+ <id>jsf1_1</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ <property>
+ <name>jsfVersion</name>
+ <value>1.1</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.4</source>
+ <target>1.4</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>jsf1_2</id>
+ <properties>
+ <jsfVersion>1.2_04</jsfVersion>
+ </properties>
+ <build>
+ <defaultGoal>jetty:run</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>${jsfVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>${jsfVersion}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>myfaces</id>
+ <properties>
+ <myfaces>1.1.5</myfaces>
+ <tomahawk>1.1.5</tomahawk>
+ </properties>
+ <build>
+ <plugins/>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.ajax4jsf</groupId>
+ <artifactId>ajax4jsf</artifactId>
+ <version>1.1.1-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${myfaces}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>${myfaces}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
</project>
\ No newline at end of file
Added: trunk/samples/tomahawkCompability/.exadelproject
===================================================================
--- trunk/samples/tomahawkCompability/.exadelproject (rev 0)
+++ trunk/samples/tomahawkCompability/.exadelproject 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<FILESYSTEMS APPLICATION_NAME="tomahawkCompability" ENTITY="FileSystems"
+ VERSION="8.0.4" WORKSPACE_HOME="./src/main/webapp/WEB-INF">
+ <FILESYSTEM ENTITY="FileSystemFolder" LOCATION="%exadel.workspace%" NAME="WEB-INF"/>
+ <FILESYSTEM ENTITY="FileSystemFolder" INFO="Content-Type=Web"
+ LOCATION="%exadel.workspace%/.." NAME="WEB-ROOT"/>
+ <FILESYSTEM ENTITY="FileSystemFolder"
+ LOCATION="%exadel.workspace%/../../java" NAME="src"/>
+ <FILESYSTEM ENTITY="FileSystemFolder"
+ LOCATION="%exadel.workspace%/../../resources" NAME="src2"/>
+ <FILESYSTEM ENTITY="FileSystemFolder"
+ LOCATION="%exadel.workspace%/../../../test/java" NAME="src3"/>
+ <FILESYSTEM ENTITY="FileSystemFolder"
+ LOCATION="%exadel.workspace%/../../../../target/classes" NAME="classes"/>
+ <FILESYSTEM ENTITY="FileSystemFolder"
+ LOCATION="%exadel.eclipse.project%" NAME="tomahawkCompability"/>
+ <WEB ENTITY="ExadelWeb" MODEL_PATH="/web.xml" SERVLET_VERSION="2.4">
+ <MODULE ENTITY="WebJSFModule" ROOT="WEB-ROOT" SRC="src,src2,src3" URI="/WEB-INF/faces-config.xml"/>
+ </WEB>
+</FILESYSTEMS>
Added: trunk/samples/tomahawkCompability/pom.xml
===================================================================
--- trunk/samples/tomahawkCompability/pom.xml (rev 0)
+++ trunk/samples/tomahawkCompability/pom.xml 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<project>
+ <parent>
+ <artifactId>samples</artifactId>
+ <groupId>org.ajax4jsf</groupId>
+ <version>1.1.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.ajax4jsf</groupId>
+ <artifactId>tomahawkCompability</artifactId>
+ <packaging>war</packaging>
+ <name>tomahawkCompability Maven Webapp</name>
+ <properties>
+ <tomahawk>1.1.5</tomahawk>
+ </properties>
+ <build>
+ <finalName>tomahawkCompability</finalName>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.tomahawk</groupId>
+ <artifactId>tomahawk</artifactId>
+ <version>${tomahawk}</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added: trunk/samples/tomahawkCompability/src/main/java/org/ajax4jsf/Bean.java
===================================================================
--- trunk/samples/tomahawkCompability/src/main/java/org/ajax4jsf/Bean.java (rev 0)
+++ trunk/samples/tomahawkCompability/src/main/java/org/ajax4jsf/Bean.java 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,52 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf;
+/**
+ * @author $Autor$
+ *
+ */
+public class Bean {
+ private int counter;
+
+ /**
+ * @return the counter
+ */
+ public int getCounter() {
+ return counter;
+ }
+
+ /**
+ * @param counter the counter to set
+ */
+ public void setCounter(int counter) {
+ this.counter = counter;
+ }
+
+ public String inc() {
+ counter++;
+ return null;
+ }
+ public String dec() {
+ counter--;
+ return null;
+ }
+}
\ No newline at end of file
Added: trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/faces-config.xml (rev 0)
+++ trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/faces-config.xml 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!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>
+ <managed-bean>
+ <managed-bean-name>bean</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.Bean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>beanB</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.Bean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <render-kit>
+ <renderer>
+ <component-family>javax.faces.Form</component-family>
+ <renderer-type>javax.faces.Form</renderer-type>
+ <renderer-class>org.ajax4jsf.renderkit.html.AjaxFormRenderer</renderer-class>
+ </renderer>
+ <renderer>
+ <component-family>javax.faces.Command</component-family>
+ <renderer-type>javax.faces.Link</renderer-type>
+ <renderer-class>org.ajax4jsf.renderkit.html.HtmlCommandLinkRenderer</renderer-class>
+ </renderer>
+ </render-kit>
+</faces-config>
Added: trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/faces-config.xml.l4t
===================================================================
--- trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/faces-config.xml.l4t (rev 0)
+++ trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/faces-config.xml.l4t 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PROCESS ENTITY="JSFProcess"/>
Added: trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/jboss-web.xml
===================================================================
--- trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/jboss-web.xml (rev 0)
+++ trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/jboss-web.xml 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,10 @@
+<jboss-web>
+ <class-loading java2ClassLoadingCompliance="false">
+ <loader-repository>
+ org.ajax4jsf:loader=tomahawkCompability
+ <loader-repository-config>
+ java2ParentDelegation=false
+ </loader-repository-config>
+ </loader-repository>
+ </class-loading>
+</jboss-web>
\ No newline at end of file
Added: trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ trunk/samples/tomahawkCompability/src/main/webapp/WEB-INF/web.xml 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <display-name>Archetype Created Web Application</display-name>
+ <context-param>
+ <param-name>facelets.REFRESH_PERIOD</param-name>
+ <param-value>2</param-value>
+ </context-param>
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <param-name>com.sun.faces.validateXml</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <param-name>com.sun.faces.verifyObjects</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
+ <param-value>com.sun.facelets.FaceletViewHandler</param-value>
+ </context-param>
+ <context-param>
+ <param-name>facelets.VIEW_MAPPINGS</param-name>
+ <param-value>*.xhtml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
+ <param-value>false</param-value>
+ </context-param>
+ <!--
+ -->
+ <filter>
+ <display-name>Ajax4jsf Filter</display-name>
+ <filter-name>ajax4jsf</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ </filter>
+ <filter>
+ <filter-name>MyFacesExtensionsFilter</filter-name>
+ <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
+ <init-param>
+ <param-name>maxFileSize</param-name>
+ <param-value>20m</param-value>
+ </init-param>
+ </filter>
+ <!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages -->
+ <filter-mapping>
+ <filter-name>MyFacesExtensionsFilter</filter-name>
+ <!-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry -->
+ <servlet-name>Faces Servlet</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ </filter-mapping>
+ <!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.) -->
+<filter-mapping>
+ <filter-name>MyFacesExtensionsFilter</filter-name>
+ <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
+</filter-mapping><filter-mapping>
+ <filter-name>ajax4jsf</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ </filter-mapping>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
+</web-app>
Added: trunk/samples/tomahawkCompability/src/main/webapp/index.jsp
===================================================================
--- trunk/samples/tomahawkCompability/src/main/webapp/index.jsp (rev 0)
+++ trunk/samples/tomahawkCompability/src/main/webapp/index.jsp 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,11 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+
+<html>
+
+<head></head>
+
+ <body>
+ <jsp:forward page="/faces/pages/index.jsp" />
+ </body>
+
+</html>
\ No newline at end of file
Added: trunk/samples/tomahawkCompability/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/tomahawkCompability/src/main/webapp/pages/index.jsp (rev 0)
+++ trunk/samples/tomahawkCompability/src/main/webapp/pages/index.jsp 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,46 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
+<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
+<html>
+<head>
+<title>A4J form sample page</title>
+</head>
+<body>
+<h1>Ajax submitted form with Tomahawk components</h1>
+<f:view>
+ <a4j:form id="ajaxform-with-defis" ajaxSubmit="true" reRender="tabs,counter">
+ <h:panelGrid columns="2" border="1">
+ <h:commandButton action="#{bean.inc}" value="Increment" />
+ <h:commandLink value="Decrement" action="#{bean.dec}"></h:commandLink>
+ <h:outputText value="Counter:" />
+ <h:outputText id="counter" value="#{bean.counter}" />
+ </h:panelGrid>
+ <h:panelGroup id="tabs">
+ <t:panelTabbedPane serverSideTabSwitch="true">
+ <t:panelTab label="A">
+ <h:inputText id="a" value="First" />
+ <h:outputLabel value="First tab input" for="a"></h:outputLabel>
+ </t:panelTab>
+ <t:panelTab label="B">
+ <h:inputText id="b" value="First" />
+ <h:outputLabel value="Second tab input" for="b"></h:outputLabel>
+ </t:panelTab>
+ </t:panelTabbedPane>
+ </h:panelGroup>
+ </a4j:form>
+ <h2>Same form without user-provided ID</h2>
+ <f:subview id="subview">
+ <a4j:form ajaxSubmit="true" reRender="counterB">
+ <h:panelGrid columns="2" border="1">
+ <h:commandButton action="#{beanB.inc}" value="Increment" />
+ <h:commandLink value="Decrement" action="#{beanB.dec}"></h:commandLink>
+ <h:outputText value="Counter:" />
+ <h:outputText id="counterB" value="#{beanB.counter}" />
+ </h:panelGrid>
+ </a4j:form>
+ </f:subview>
+ <a4j:log hotkey="M"/>
+</f:view>
+</body>
+</html>
Added: trunk/samples/tomahawkCompability/src/main/webapp/pages/index.xhtml
===================================================================
--- trunk/samples/tomahawkCompability/src/main/webapp/pages/index.xhtml (rev 0)
+++ trunk/samples/tomahawkCompability/src/main/webapp/pages/index.xhtml 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,12 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
+ >
+ <f:view>
+
+ </f:view>
+</html>
\ No newline at end of file
Added: trunk/samples/tomahawkCompability/src/main/webapp/pages/response.jsp
===================================================================
--- trunk/samples/tomahawkCompability/src/main/webapp/pages/response.jsp (rev 0)
+++ trunk/samples/tomahawkCompability/src/main/webapp/pages/response.jsp 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,13 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j" %>
+<html>
+ <head>
+ <title>Response page</title>
+ </head>
+ <body>
+ <f:view>
+
+ </f:view>
+ </body>
+</html>
Added: trunk/samples/tomahawkCompability/src/test/java/org/ajax4jsf/BeanTest.java
===================================================================
--- trunk/samples/tomahawkCompability/src/test/java/org/ajax4jsf/BeanTest.java (rev 0)
+++ trunk/samples/tomahawkCompability/src/test/java/org/ajax4jsf/BeanTest.java 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,46 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+*/
+public class BeanTest
+ extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public BeanTest( String testName )
+ {
+ super( testName );
+ }
+
+ public void testStub() throws Exception {
+
+ }
+}
Added: trunk/samples/useCases/.exadelproject
===================================================================
--- trunk/samples/useCases/.exadelproject (rev 0)
+++ trunk/samples/useCases/.exadelproject 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<FILESYSTEMS APPLICATION_NAME="useCases" ENTITY="FileSystems"
+ VERSION="8.0.4" WORKSPACE_HOME="./src/main/webapp/WEB-INF">
+ <FILESYSTEM ENTITY="FileSystemFolder" LOCATION="%exadel.workspace%" NAME="WEB-INF"/>
+ <FILESYSTEM ENTITY="FileSystemFolder" INFO="Content-Type=Web"
+ LOCATION="%exadel.workspace%/.." NAME="WEB-ROOT"/>
+ <FILESYSTEM ENTITY="FileSystemFolder"
+ LOCATION="%exadel.workspace%/../../java" NAME="src"/>
+ <FILESYSTEM ENTITY="FileSystemFolder"
+ LOCATION="%exadel.workspace%/../../resources" NAME="src2"/>
+ <FILESYSTEM ENTITY="FileSystemFolder"
+ LOCATION="%exadel.workspace%/../../../test/java" NAME="src3"/>
+ <FILESYSTEM ENTITY="FileSystemFolder"
+ LOCATION="%exadel.workspace%/../../../../target/classes" NAME="classes"/>
+ <FILESYSTEM ENTITY="FileSystemFolder"
+ LOCATION="%exadel.eclipse.project%" NAME="useCases"/>
+ <WEB ENTITY="ExadelWeb" MODEL_PATH="/web.xml" SERVLET_VERSION="2.4">
+ <MODULE ENTITY="WebJSFModule" ROOT="WEB-ROOT" SRC="src,src2,src3" URI="/WEB-INF/faces-config.xml"/>
+ </WEB>
+</FILESYSTEMS>
Added: trunk/samples/useCases/pom.xml
===================================================================
--- trunk/samples/useCases/pom.xml (rev 0)
+++ trunk/samples/useCases/pom.xml 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>samples</artifactId>
+ <groupId>org.ajax4jsf</groupId>
+ <version>1.1.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.ajax4jsf</groupId>
+ <artifactId>useCases</artifactId>
+ <packaging>war</packaging>
+ <name>useCases Maven Webapp</name>
+ <build>
+ <finalName>useCases</finalName>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>com.uwyn</groupId>
+ <artifactId>jhighlight</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added: trunk/samples/useCases/src/main/java/logging.properties
===================================================================
--- trunk/samples/useCases/src/main/java/logging.properties (rev 0)
+++ trunk/samples/useCases/src/main/java/logging.properties 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,21 @@
+handlers org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+org.apache.juli.FileHandler.level ALL
+org.apache.juli.FileHandler.directory ${catalina.base}/logs
+org.apache.juli.FileHandler.prefix ajax4jsf.
+
+java.util.logging.ConsoleHandler.level ALL
+java.util.logging.ConsoleHandler.formatter java.util.logging.SimpleFormatter
+
+facelets.level=ALL
+com.sun.faces.level=ALL
+org.apache.myfaces.level=ALL
+org.ajax4jsf.level=ALL
+javax.enterprise.resource.webcontainer.jsf.level=ALL
+com.exadel.level=ALL
+
\ No newline at end of file
Added: trunk/samples/useCases/src/main/java/org/ajax4jsf/Bean.java
===================================================================
--- trunk/samples/useCases/src/main/java/org/ajax4jsf/Bean.java (rev 0)
+++ trunk/samples/useCases/src/main/java/org/ajax4jsf/Bean.java 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,44 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf;
+/**
+ * @author $Autor$
+ *
+ */
+public class Bean {
+
+ private java.lang.String text;
+
+ public java.lang.String getText() {
+ return text;
+ }
+
+ public void setText(java.lang.String text) {
+ this.text = text;
+ }
+
+ public String ok(){
+ System.out.println("Button pressed");
+ return null;
+ }
+
+}
\ No newline at end of file
Added: trunk/samples/useCases/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/useCases/src/main/webapp/WEB-INF/faces-config.xml (rev 0)
+++ trunk/samples/useCases/src/main/webapp/WEB-INF/faces-config.xml 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<!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>
+ <managed-bean>
+ <managed-bean-name>bean</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.Bean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ <managed-property>
+ <property-name>text</property-name>
+ <property-class>java.lang.String</property-class>
+ <null-value/>
+ </managed-property>
+ </managed-bean>
+</faces-config>
Added: trunk/samples/useCases/src/main/webapp/WEB-INF/faces-config.xml.l4t
===================================================================
--- trunk/samples/useCases/src/main/webapp/WEB-INF/faces-config.xml.l4t (rev 0)
+++ trunk/samples/useCases/src/main/webapp/WEB-INF/faces-config.xml.l4t 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PROCESS ENTITY="JSFProcess"/>
Added: trunk/samples/useCases/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/samples/useCases/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ trunk/samples/useCases/src/main/webapp/WEB-INF/web.xml 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <display-name>Archetype Created Web Application</display-name>
+ <context-param>
+ <param-name>facelets.REFRESH_PERIOD</param-name>
+ <param-value>2</param-value>
+ </context-param>
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <param-name>com.sun.faces.validateXml</param-name>
+ <param-value>false</param-value>
+ </context-param>
+ <context-param>
+ <param-name>com.sun.faces.verifyObjects</param-name>
+ <param-value>false</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
+ <param-value>com.sun.facelets.FaceletViewHandler</param-value>
+ </context-param>
+ <context-param>
+ <param-name>facelets.VIEW_MAPPINGS</param-name>
+ <param-value>*.xhtml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
+ <param-value>false</param-value>
+ </context-param>
+ <!--
+ -->
+ <filter>
+ <display-name>Ajax4jsf Filter</display-name>
+ <filter-name>ajax4jsf</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>ajax4jsf</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ </filter-mapping>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
+</web-app>
Added: trunk/samples/useCases/src/main/webapp/index.jsp
===================================================================
--- trunk/samples/useCases/src/main/webapp/index.jsp (rev 0)
+++ trunk/samples/useCases/src/main/webapp/index.jsp 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,11 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+
+<html>
+
+<head></head>
+
+ <body>
+ <jsp:forward page="/faces/pages/index.jsp" />
+ </body>
+
+</html>
\ No newline at end of file
Added: trunk/samples/useCases/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/useCases/src/main/webapp/pages/index.jsp (rev 0)
+++ trunk/samples/useCases/src/main/webapp/pages/index.jsp 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,12 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<html>
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <f:view>
+
+ </f:view>
+ </body>
+</html>
Added: trunk/samples/useCases/src/main/webapp/pages/index.xhtml
===================================================================
--- trunk/samples/useCases/src/main/webapp/pages/index.xhtml (rev 0)
+++ trunk/samples/useCases/src/main/webapp/pages/index.xhtml 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,12 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
+ >
+ <f:view>
+
+ </f:view>
+</html>
\ No newline at end of file
Added: trunk/samples/useCases/src/main/webapp/pages/prependId.xhtml
===================================================================
--- trunk/samples/useCases/src/main/webapp/pages/prependId.xhtml (rev 0)
+++ trunk/samples/useCases/src/main/webapp/pages/prependId.xhtml 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,18 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+ <body>
+
+ <h:form id="rgForm2" prependId="false">
+
+ <h:inputText value="#{bean.text}">
+ <a4j:support event="onkeyup" reRender="repeater" requestDelay="100"/>
+ </h:inputText>
+ <h:outputText id="repeater" value="#{bean.text}" />
+ <h:commandButton action="#{bean.ok}" value="Ok"></h:commandButton>
+ </h:form>
+ <a4j:log hotkey="M"></a4j:log>
+ </body>
+ </html>
\ No newline at end of file
Added: trunk/samples/useCases/src/test/java/org/ajax4jsf/BeanTest.java
===================================================================
--- trunk/samples/useCases/src/test/java/org/ajax4jsf/BeanTest.java (rev 0)
+++ trunk/samples/useCases/src/test/java/org/ajax4jsf/BeanTest.java 2007-04-30 17:31:18 UTC (rev 140)
@@ -0,0 +1,46 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+*/
+public class BeanTest
+ extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public BeanTest( String testName )
+ {
+ super( testName );
+ }
+
+ public void testStub() throws Exception {
+
+ }
+}
17 years, 8 months
JBoss Ajax4JSF SVN: r139 - trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo.
by ajax4jsf-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-27 13:56:16 -0400 (Fri, 27 Apr 2007)
New Revision: 139
Modified:
trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java
Log:
JavaDoc for mergeXML() updated
Modified: trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java 2007-04-27 17:50:49 UTC (rev 138)
+++ trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java 2007-04-27 17:56:16 UTC (rev 139)
@@ -411,8 +411,8 @@
* name of velocity template for result file.
* @param commonXpath -
* XPath expression fof common part of result file.
- * @param keyXPath TODO
- * @param keySet TODO
+ * @param keyXPath - XPath expression for key part of common parts
+ * @param keySet - {@link Set} to check for duplicate keys. Must not be null
* @param context -
* Velocity context for template processing.
* @throws MojoExecutionException
17 years, 8 months
JBoss Ajax4JSF SVN: r138 - trunk/cdk/generator/src/test/java/org/ajax4jsf/builder/xml.
by ajax4jsf-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-27 13:50:49 -0400 (Fri, 27 Apr 2007)
New Revision: 138
Modified:
trunk/cdk/generator/src/test/java/org/ajax4jsf/builder/xml/XMLBodyTest.java
Log:
XMLBodyTest updated
Modified: trunk/cdk/generator/src/test/java/org/ajax4jsf/builder/xml/XMLBodyTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/ajax4jsf/builder/xml/XMLBodyTest.java 2007-04-27 17:49:29 UTC (rev 137)
+++ trunk/cdk/generator/src/test/java/org/ajax4jsf/builder/xml/XMLBodyTest.java 2007-04-27 17:50:49 UTC (rev 138)
@@ -23,6 +23,7 @@
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+import java.util.HashSet;
import javax.xml.xpath.XPathExpressionException;
@@ -178,7 +179,7 @@
try {
assertEquals(
"<component><test>blabla</test></component><component><test>blabla2</test></component>",
- body.getContentUnique("/faces-config/component", "test/text()", null));
+ body.getContentUnique("/faces-config/component", "test/text()", new HashSet<String>()));
} catch (ParsingException e) {
e.printStackTrace();
assertTrue(e.getMessage(),false);
17 years, 8 months
JBoss Ajax4JSF SVN: r137 - in trunk: cdk/generator/src/main/java/org/ajax4jsf/builder/xml and 2 other directories.
by ajax4jsf-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-27 13:49:29 -0400 (Fri, 27 Apr 2007)
New Revision: 137
Modified:
trunk/a4j-portlet/
trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/xml/XMLBody.java
trunk/cdk/generator/src/test/java/org/ajax4jsf/builder/xml/XMLBodyTest.java
trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java
Log:
http://jira.jboss.com/jira/browse/AJSF-48 fixed
Property changes on: trunk/a4j-portlet
___________________________________________________________________
Name: svn:ignore
+ target
Modified: trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/xml/XMLBody.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/xml/XMLBody.java 2007-04-27 16:26:42 UTC (rev 136)
+++ trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/xml/XMLBody.java 2007-04-27 17:49:29 UTC (rev 137)
@@ -25,6 +25,9 @@
import java.io.InputStream;
import java.io.StringReader;
import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -42,6 +45,7 @@
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.DocumentType;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
@@ -163,4 +167,55 @@
}
return serializeNodes(childNodes);
}
+
+ public String getContentUnique(String xpath, String keyXPath, Set<String> keySet) throws ParsingException{
+ if (keyXPath == null) {
+ return getContent(xpath);
+ } else {
+
+ XPath path = XPathFactory.newInstance().newXPath();
+ NodeList childNodes;
+ try {
+ childNodes = (NodeList) path.evaluate(xpath, xmlDocument,XPathConstants.NODESET);
+
+ List<Node> nodeSet = new ArrayList<Node>();
+
+ for (int i = 0; i < childNodes.getLength(); i++) {
+ Node node = childNodes.item(i).cloneNode(true);
+
+ String key = serializeNodes((NodeList) path.evaluate(keyXPath, node, XPathConstants.NODESET));
+ if (!keySet.contains(key)) {
+ keySet.add(key);
+ nodeSet.add(node);
+ }
+ }
+
+ return serializeNodes(new ArrayNodeList(nodeSet.toArray(new Node[nodeSet.size()])));
+
+ } catch (XPathExpressionException e) {
+ throw new ParsingException("Error evaluate xpath",e);
+ }
+ }
+ }
}
+
+class ArrayNodeList implements NodeList {
+ private Node[] nodes;
+
+ public ArrayNodeList(Node[] nodes) {
+ super();
+ this.nodes = nodes;
+ }
+
+ public int getLength() {
+ return nodes.length;
+ }
+
+ public Node item(int index) {
+ if (index < nodes.length) {
+ return this.nodes[index];
+ }
+
+ return null;
+ }
+}
Modified: trunk/cdk/generator/src/test/java/org/ajax4jsf/builder/xml/XMLBodyTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/ajax4jsf/builder/xml/XMLBodyTest.java 2007-04-27 16:26:42 UTC (rev 136)
+++ trunk/cdk/generator/src/test/java/org/ajax4jsf/builder/xml/XMLBodyTest.java 2007-04-27 17:49:29 UTC (rev 137)
@@ -166,4 +166,22 @@
}
}
+ public void testGetContentUnique() throws ParsingException {
+ String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ + "<!DOCTYPE faces-config PUBLIC \"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN\"\n"
+ + " \"http://java.sun.com/dtd/web-facesconfig_1_1.dtd\">\n"
+ + "<faces-config>\n" + " <component><test>blabla</test></component><component><test>blabla</test></component><component><test>blabla2</test></component>\n"
+ + "</faces-config>";
+ InputStream in = new ByteArrayInputStream(xml.getBytes());
+ XMLBody body = new XMLBody();
+ body.loadXML(in);
+ try {
+ assertEquals(
+ "<component><test>blabla</test></component><component><test>blabla2</test></component>",
+ body.getContentUnique("/faces-config/component", "test/text()", null));
+ } catch (ParsingException e) {
+ e.printStackTrace();
+ assertTrue(e.getMessage(),false);
+ }
+ }
}
Modified: trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java 2007-04-27 16:26:42 UTC (rev 136)
+++ trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java 2007-04-27 17:49:29 UTC (rev 137)
@@ -325,18 +325,18 @@
File resourcesConfig = new File(outputDirectory,
"META-INF/resources-config.xml");
mergeXML(models, "META-INF/resources-config.xml",
- RESOURCES_CONFIG_TEMPLATE, null, new VelocityContext(),
- resourcesConfig);
+ RESOURCES_CONFIG_TEMPLATE, "/resource-config/resource", "name/text()",
+ new VelocityContext(), resourcesConfig);
File tld = new File(outputDirectory, "META-INF/"
+ library.getTaglib().getShortName() + ".tld");
mergeXML(models, includeTld, TLD_TEMPLATE,
- "/taglib/tag | /taglib/listener", new VelocityContext(),
- tld);
+ "/taglib/tag | /taglib/listener",
+ null, new VelocityContext(), tld);
File taglib = new File(outputDirectory, "META-INF/"
+ library.getTaglib().getShortName() + ".taglib.xml");
mergeXML(models, includeTaglib, TAGLIB_TEMPLATE,
"/facelet-taglib/tag | /facelet-taglib/function",
- new VelocityContext(), taglib);
+ null, new VelocityContext(), taglib);
}else {
throw new MojoFailureException("Components library project must have parent pom with components modules");
}
@@ -411,13 +411,16 @@
* name of velocity template for result file.
* @param commonXpath -
* XPath expression fof common part of result file.
+ * @param keyXPath TODO
+ * @param keySet TODO
* @param context -
* Velocity context for template processing.
* @throws MojoExecutionException
*/
private void mergeXML(List models, String filename, String templateName,
- String commonXpath, VelocityContext context, File target)
+ String commonXpath, String keyXPath, VelocityContext context, File target)
throws MojoExecutionException {
+ Set<String> keySet = new HashSet<String>();
StringBuffer content = new StringBuffer();
List<XMLBody> xmls = new ArrayList<XMLBody>(models.size());
String[] split = filename.split(",");
@@ -441,7 +444,11 @@
configBody.loadXML(new FileInputStream(moduleFacesConfig));
xmls.add(configBody);
if (commonXpath != null) {
- content.append(configBody.getContent(commonXpath));
+ if (keyXPath == null) {
+ content.append(configBody.getContent(commonXpath));
+ } else {
+ content.append(configBody.getContentUnique(commonXpath, keyXPath, keySet));
+ }
} else {
content.append(configBody.getContent());
}
17 years, 8 months
JBoss Ajax4JSF SVN: r136 - in trunk/cdk/generator/src/main/resources/META-INF: templates12 and 1 other directory.
by ajax4jsf-svn-commits@lists.jboss.org
Author: dbiatenia
Date: 2007-04-27 12:26:42 -0400 (Fri, 27 Apr 2007)
New Revision: 136
Modified:
trunk/cdk/generator/src/main/resources/META-INF/templates/component.vm
trunk/cdk/generator/src/main/resources/META-INF/templates12/component.vm
Log:
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates/component.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates/component.vm 2007-04-27 15:39:53 UTC (rev 135)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/component.vm 2007-04-27 16:26:42 UTC (rev 136)
@@ -64,7 +64,7 @@
// Getters-setters
#foreach( $prop in $component.properties )
#if( !$prop.exist )
- /*
+ /**
* ${prop.xmlEncodedDescription}
* Setter for $prop.name
* @param $prop.name - new value
@@ -77,7 +77,7 @@
}
- /*
+ /**
* ${prop.xmlEncodedDescription}
* Getter for $prop.name
* @return $prop.name value from local variable or value bindings
@@ -113,7 +113,7 @@
#end
}
#if($prop.raw)
- /*
+ /**
* ${prop.xmlEncodedDescription}
* Raw Setter for $prop.name
* @param $prop.name - new value
@@ -121,7 +121,7 @@
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
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates12/component.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates12/component.vm 2007-04-27 15:39:53 UTC (rev 135)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates12/component.vm 2007-04-27 16:26:42 UTC (rev 136)
@@ -64,7 +64,7 @@
// Getters-setters
#foreach( $prop in $component.properties )
#if( !$prop.exist )
- /*
+ /**
* ${prop.xmlEncodedDescription}
* Setter for $prop.name
* @param $prop.name - new value
@@ -77,7 +77,7 @@
}
- /*
+ /**
* ${prop.xmlEncodedDescription}
* Getter for $prop.name
* @return $prop.name value from local variable or value bindings
@@ -113,7 +113,7 @@
#end
}
#if($prop.raw)
- /*
+ /**
* ${prop.xmlEncodedDescription}
* Raw Setter for $prop.name
* @param $prop.name - new value
@@ -121,7 +121,7 @@
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
@@ -142,7 +142,6 @@
}
#end
-
// Save state
// ----------------------------------------------------- StateHolder Methods
17 years, 8 months
JBoss Ajax4JSF SVN: r135 - trunk/cdk/generator/src/main/resources/META-INF/templates12.
by ajax4jsf-svn-commits@lists.jboss.org
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();
17 years, 8 months
JBoss Ajax4JSF SVN: r134 - trunk/cdk/generator/src/main/resources/META-INF/templates.
by ajax4jsf-svn-commits@lists.jboss.org
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();
17 years, 8 months
JBoss Ajax4JSF SVN: r133 - trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/config.
by ajax4jsf-svn-commits@lists.jboss.org
Author: dbiatenia
Date: 2007-04-27 11:25:52 -0400 (Fri, 27 Apr 2007)
New Revision: 133
Modified:
trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/config/BuilderConfig.java
Log:
Modified: trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/config/BuilderConfig.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/config/BuilderConfig.java 2007-04-27 13:31:25 UTC (rev 132)
+++ trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/config/BuilderConfig.java 2007-04-27 15:25:52 UTC (rev 133)
@@ -227,6 +227,14 @@
digester.addSetProperties(path);
digester.addSetNext(path, "addValidator");
+ path = "components/validator/property";
+ digester.addObjectCreate(path, PropertyBean.class);
+ digester.addBeanPropertySetter(path+"/?");
+ digester.addSetProperties(path);
+ digester.addSetNext(path, "addProperty");
+
+
+
// Converters
path = "components/converter";
@@ -295,11 +303,11 @@
digester.addSetProperties(path);
digester.addSetNext(path, "addProperty");
- path = "components/validator/property";
- digester.addObjectCreate(path, PropertyBean.class);
- digester.addBeanPropertySetter(path+"/?");
- digester.addSetProperties(path);
- digester.addSetNext(path, "addProperty");
+// path = "components/validator/property";
+// digester.addObjectCreate(path, PropertyBean.class);
+// digester.addBeanPropertySetter(path+"/?");
+// digester.addSetProperties(path);
+// digester.addSetNext(path, "addProperty");
path = "components/converter/property";
digester.addObjectCreate(path, PropertyBean.class);
@@ -399,7 +407,7 @@
ComponentBaseBean component = (ComponentBaseBean) iter.next();
component.checkProperties();
}
-
+
for (Iterator iter = this.getValidators().iterator(); iter.hasNext();) {
ComponentBaseBean component = (ComponentBaseBean) iter.next();
component.checkProperties();
17 years, 8 months