Author: alexsmirnov
Date: 2007-07-18 14:23:27 -0400 (Wed, 18 Jul 2007)
New Revision: 1684
Added:
trunk/cdk/generator/src/main/resources/META-INF/templates12/tag.vm
Modified:
trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/config/PropertyBean.java
trunk/docs/ajaxguide/pom.xml
trunk/framework/test/src/test/resources/log4j.xml
trunk/ui/suggestionbox/src/main/config/component/suggestionbox.xml
Log:
fix build for a SuggestionBox component
Modified: trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/config/PropertyBean.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/config/PropertyBean.java 2007-07-18
18:10:03 UTC (rev 1683)
+++
trunk/cdk/generator/src/main/java/org/ajax4jsf/builder/config/PropertyBean.java 2007-07-18
18:23:27 UTC (rev 1684)
@@ -23,6 +23,7 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.regex.Pattern;
/**
* Describe JavaBean property of component.
@@ -32,6 +33,8 @@
*/
public class PropertyBean extends JsfBean {
+ private static final Pattern SEPARATOR_PATTERN =
Pattern.compile("\\s*,\\s*");
+
/**
* Hold default values for java classes and base types
*/
@@ -233,6 +236,26 @@
public void setMethodargs(String methodargs) {
_methodargs = methodargs;
}
+
+ /**
+ * @return comma-separated list of classes for method args ( need to build method
signature )
+ */
+ public String getMethodArgsClasses(){
+ if(null != this._methodargs){
+ StringBuffer result = new StringBuffer();
+ String[] classes = SEPARATOR_PATTERN.split(this._methodargs);
+ for (int i = 0; i < classes.length; i++) {
+ String argumentClass = classes[i];
+ if(i!=0){
+ result.append(',');
+ }
+ result.append(argumentClass).append(".class");
+ }
+ return result.toString();
+ } else {
+ return null;
+ }
+ }
/**
* @return Returns the transient.
Added: trunk/cdk/generator/src/main/resources/META-INF/templates12/tag.vm
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates12/tag.vm
(rev 0)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates12/tag.vm 2007-07-18 18:23:27
UTC (rev 1684)
@@ -0,0 +1,154 @@
+/**
+ * GENERATED FILE - DO NOT EDIT
+ *
+ */
+package ${tag.packageName};
+
+#foreach($import in $imports)
+import $import ;
+#end
+import javax.faces.component.UIComponent;
+import ${component.classname};
+
+/**
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.2 $ $Date: 2007/01/03 21:05:14 $
+ *
+ */
+public class $tag.simpleClassName extends $tag.superclass {
+
+// Fields
+#foreach( $prop in $component.properties )
+ #if( !$prop.existintag )
+ /*
+ * $prop.name
+ * ${prop.xmlEncodedDescription}
+ */
+ private String _$prop.name = null;
+
+ #end
+#end
+// Setters
+#foreach( $prop in $component.properties )
+ #if( !$prop.existintag )
+ /*
+ * $prop.name
+ * ${prop.xmlEncodedDescription}
+ */
+ /*
+ * $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
+// Release
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.components.taglib.html.HtmlCommandButtonTagBase#release()
+ */
+ public void release()
+ {
+ // TODO Auto-generated method stub
+ super.release();
+#foreach( $prop in $component.properties )
+ #if( !$prop.existintag )
+ this._${prop.name} = null;
+ #end
+#end
+ }
+
+ /* (non-Javadoc)
+ * @see
org.ajax4jsf.components.taglib.html.HtmlCommandButtonTagBase#setProperties(javax.faces.component.UIComponent)
+ */
+ protected void setProperties(UIComponent component)
+ {
+ // TODO Auto-generated method stub
+ super.setProperties(component);
+
+#foreach( $prop in $component.properties )
+ #if( !$prop.existintag )
+ #if(!$prop.el)
+ if(isValueReference(this._${prop.name})){
+ throw new IllegalArgumentException("Component ${component.name} with Id " +
component.getClientId(getFacesContext()) +" not allowed EL expression for property
${prop.name}");
+ }
+ #end
+ #if($prop.name == "action")
+ setActionProperty(component, this._${prop.name});
+ #elseif($prop.name == "actionListener")
+ setActionListenerProperty(component, this._${prop.name});
+ #elseif($prop.name == "converter")
+ setConverterProperty(component, this._${prop.name});
+ #elseif($prop.name == "validator")
+ setValidatorProperty(component, this._${prop.name});
+ #elseif($prop.name == "valueChangeListener")
+ setValueChangedListenerProperty(component, this._${prop.name});
+ #elseif($prop.name == "value")
+ setValueProperty(component, this._${prop.name});
+ #elseif($prop.elonly || $prop.isInstanceof("javax.faces.el.ValueBinding") )
+ setValueBinding(component, "${prop.name}",this._${prop.name});
+ #elseif(${prop.simpleType})
+ // Simple type - ${prop.simpleClassName}
+ set${prop.boxingClass}Property(component,
"${prop.name}",this._${prop.name});
+ #elseif($prop.classname == "java.lang.Boolean" || $prop.classname ==
"java.lang.Integer" || $prop.classname == "java.lang.Long")
+ set${prop.simpleClassName}Property(component,
"${prop.name}",this._${prop.name});
+ #elseif( $prop.classname == "java.lang.String")
+ setStringProperty(component, "${prop.name}",this._${prop.name});
+ #elseif( $prop.classname == "java.lang.Object")
+ // TODO - handle object
+ setStringProperty(component, "${prop.name}",this._${prop.name});
+ #elseif( $prop.isInstanceof("javax.faces.el.MethodBinding") )
+ if(null != this._${prop.name}){
+ if (isValueReference(this._${prop.name}))
+ {
+ MethodBinding mb =
getFacesContext().getApplication().createMethodBinding(this._${prop.name},
+ new
Class[]{${prop.methodargs}});
+ ((${component.simpleClassName})component).${prop.setterName}(mb);
+ }
+ else
+ {
+ getFacesContext().getExternalContext().log("Component " +
component.getClientId(getFacesContext()) + " has invalid ${prop.name} value: " +
this._${prop.name});
+ }
+ }
+ #else
+ // TODO - setup properties for other cases.
+ // name ${prop.name} with type $prop.classname
+ #end
+ #end
+#end
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.webapp.UIComponentTag#getComponentType()
+ */
+ public String getComponentType() {
+ // TODO Auto-generated method stub
+ return "${component.name}";
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.webapp.UIComponentTag#getRendererType()
+ */
+ public String getRendererType() {
+ #if($renderer)
+ return "${renderer.name}";
+ #else
+ return null;
+ #end
+ }
+
+}
Modified: trunk/docs/ajaxguide/pom.xml
===================================================================
--- trunk/docs/ajaxguide/pom.xml 2007-07-18 18:10:03 UTC (rev 1683)
+++ trunk/docs/ajaxguide/pom.xml 2007-07-18 18:23:27 UTC (rev 1684)
@@ -13,21 +13,6 @@
<packaging>pom</packaging>
<name>Ajax4jsf user guide</name>
<description>Ajax4jsf user guide</description>
- <pluginRepositories>
- <pluginRepository>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- <updatePolicy>never</updatePolicy>
- </snapshots>
- <id>repository.jboss.com</id>
- <name>Jboss Repository for Maven</name>
- <
url>http://repository.jboss.com/maven2/</url>
- <layout>default</layout>
- </pluginRepository>
- </pluginRepositories>
<build>
<pluginManagement>
<plugins>
Modified: trunk/framework/test/src/test/resources/log4j.xml
===================================================================
--- trunk/framework/test/src/test/resources/log4j.xml 2007-07-18 18:10:03 UTC (rev 1683)
+++ trunk/framework/test/src/test/resources/log4j.xml 2007-07-18 18:23:27 UTC (rev 1684)
@@ -43,39 +43,39 @@
</appender>
-->
<category name="com.sun.faces">
- <priority value="INFO" />
+ <priority value="WARN" />
<appender-ref ref="DEFAULT"/>
</category>
<category name="org.apache.myfaces">
- <priority value="INFO" />
+ <priority value="WARN" />
<appender-ref ref="DEFAULT"/>
</category>
<category name="javax.faces">
- <priority value="INFO" />
+ <priority value="WARN" />
<appender-ref ref="DEFAULT"/>
</category>
<category name="faces">
- <priority value="INFO" />
+ <priority value="WARN" />
<appender-ref ref="DEFAULT"/>
</category>
<category name="com.exadel.vcp">
- <priority value="INFO" />
+ <priority value="WARN" />
<appender-ref ref="DEFAULT"/>
</category>
<category name="org.ajax4jsf">
- <priority value="INFO" />
+ <priority value="WARN" />
<appender-ref ref="DEFAULT"/>
</category>
<!--
<root>
- <priority value ="info" />
+ <priority value ="WARN" />
<appender-ref ref="DEFAULT" />
</root>
-->
Modified: trunk/ui/suggestionbox/src/main/config/component/suggestionbox.xml
===================================================================
--- trunk/ui/suggestionbox/src/main/config/component/suggestionbox.xml 2007-07-18 18:10:03
UTC (rev 1683)
+++ trunk/ui/suggestionbox/src/main/config/component/suggestionbox.xml 2007-07-18 18:23:27
UTC (rev 1684)
@@ -68,7 +68,7 @@
<name>suggestionAction</name>
<classname>javax.faces.el.MethodBinding</classname>
<methodargs>
- java.lang.Object
+ java.lang.Object.class
</methodargs>
<description>
<![CDATA[Method calls an expression to get a collection of suggestion
data on request. It must have one parameter with a type of Object with content of input
component and must return any type allowed for <h:datatable> ]]>