You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2008/08/28 04:23:10 UTC
svn commit: r689701 - in
/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF:
componentClass12.vm facelets-taglib.vm faces-config11.vm faces-config12.vm
tagClass11.vm tagClass12.vm tomahawk12.vm
Author: lu4242
Date: Wed Aug 27 19:23:10 2008
New Revision: 689701
URL: http://svn.apache.org/viewvc?rev=689701&view=rev
Log:
update and add missing default templates
Added:
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/componentClass12.vm
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/facelets-taglib.vm
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/faces-config12.vm
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/tagClass12.vm
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/tomahawk12.vm
Modified:
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/faces-config11.vm
myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/tagClass11.vm
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/componentClass12.vm
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/componentClass12.vm?rev=689701&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/componentClass12.vm (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/componentClass12.vm Wed Aug 27 19:23:10 2008
@@ -0,0 +1,251 @@
+## Velocity template used to generate JSF1.2-compatible component classes
+## from component meta-data.
+##
+## Note that there are two types of component generation:
+## * "subclass mode" (use annotated class as a parent class)
+## * "template mode" (use annotated class as a template)
+## This template file is used for both.
+##
+## Variable $component refers to a ComponentMeta object to process
+## Variable $utils refers to an instance of MyfacesUtils.
+##
+## When "template mode" is being used then variable $innersource
+## holds a String containing all the non-abstract functions defined
+## in the annotated class.
+##
+## The java package of the generated class is always the same as
+## the package in which the annotated class exists.
+##
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package ${component.packageName};
+
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+$utils.importTagClasses($component)
+
+#if ($component.isTemplate())
+#set ($generatedClassParent = $component.sourceClassParentClassName)
+#else
+#set ($generatedClassParent = $component.sourceClassName)
+#end
+// Generated from class ${component.sourceClassName}.
+//
+// WARNING: This file was automatically generated. Do not edit it directly,
+// or you will lose your changes.
+public class ${utils.getClassFromFullClass($component.className)} extends $generatedClassParent
+#if ($component.implements)
+ implements $component.implements
+#end
+{
+#if ($component.serialuid)
+ private static final long serialVersionUID = ${component.serialuid};
+#end
+
+ static public final String COMPONENT_FAMILY =
+ "$component.family";
+ static public final String COMPONENT_TYPE =
+ "$component.type";
+#if ($component.rendererType)
+#if (!($component.rendererType == ""))
+ static public final String DEFAULT_RENDERER_TYPE =
+ "$component.rendererType";
+#end
+#end
+
+#if ($innersource)
+ //BEGIN CODE COPIED FROM $component.sourceClassName
+$innersource
+ //END CODE COPIED FROM $component.sourceClassName
+#end
+
+ public ${utils.getClassFromFullClass($component.className)}()
+ {
+#if ($component.rendererType)
+#if ($component.rendererType == "")
+ setRendererType(null);
+#else
+ setRendererType("$component.rendererType");
+#end
+#else
+ setRendererType(null);
+#end
+ }
+
+## On myfaces 1.1 the family is inherited, so this could be commented
+## On other this should not be commented
+ public String getFamily()
+ {
+ return COMPONENT_FAMILY;
+ }
+
+#set ($propertyList = ${component.propertyComponentList})
+
+#foreach( $property in $propertyList )
+#set ($field = $property.fieldName)
+#set ($type = $utils.getClassFromFullClass($property.className))
+#if($utils.getDefaultValueField($property))
+#set ($defaultValue = $utils.getDefaultValueField($property))
+#else
+#set ($defaultValue = false)
+#end
+ // Property: $property.name
+#if ($property.isLiteralOnly() || $property.isTagExcluded() )
+ private $type $field #if($defaultValue) = $defaultValue;#{else};#{end}
+
+
+#else
+ private $type $field;
+
+#end
+#if($utils.isPrimitiveClass($type) && !$property.isTagExcluded() )
+ private boolean ${field}Set;
+
+#if ($property.isSetMethod())
+ $property.setMethodScope boolean $utils.getPrefixedPropertyName("isSet", $property.name)()
+ {
+ return ${field}Set;
+ }
+#end
+#end
+#if($property.isLocalMethod())
+#if("boolean" == $type)
+#set ($methodName = $utils.getPrefixedPropertyName("isLocal", $property.name))
+#else
+#set ($methodName = $utils.getPrefixedPropertyName("getLocal", $property.name))
+#end
+ final $property.localMethodScope $type ${methodName}()
+ {
+ return $field;
+ }
+
+#end
+ public $type $utils.getMethodReaderFromProperty($property.name, $type)()
+ {
+#if ($property.isTagExcluded() || $property.isLiteralOnly())
+ return $field;
+#else
+#if ($utils.isPrimitiveClass($type))
+ if (${field}Set)
+#else
+ if ($field != null)
+#end
+ {
+ return $field;
+ }
+ ValueExpression vb = getValueExpression("$property.name");
+ if (vb != null)
+ {
+#if ($utils.isPrimitiveClass($type))
+ return ($utils.castIfNecessary($type) vb.getValue(getFacesContext().getELContext())).${type}Value();
+#else
+#set ($pritype = $utils.getPrimitiveType($property.className))
+#if ($utils.isPrimitiveClass($pritype))
+ Object value = vb == null ? null : vb.getValue(getFacesContext().getELContext());
+ if (!(value instanceof $type)){
+ value = ${type}.valueOf(value.toString());
+ }
+ return $utils.castIfNecessary($type) value;
+#else
+ return $utils.castIfNecessary($type) vb.getValue(getFacesContext().getELContext());
+#end
+#end
+ }
+#if ($defaultValue)
+ return $defaultValue;
+#elseif ($utils.isPrimitiveClass($type))
+ return $utils.primitiveDefaultValue($type);
+#else
+ return null;
+#end
+#end
+ }
+
+ public void $utils.getPrefixedPropertyName("set", $property.name)($type $utils.getVariableFromName($property.name))
+ {
+ this.$field = $utils.getVariableFromName($property.name);
+#if ($utils.isPrimitiveClass($type) && !$property.isTagExcluded() )
+ this.${field}Set = true;
+#end
+ }
+#end
+
+ public Object saveState(FacesContext facesContext)
+ {
+#set ($primitiveCount = $propertyList.size() + 1)
+#foreach( $property in $propertyList )
+#if($utils.isPrimitiveClass($property.className))
+#set ($primitiveCount = $primitiveCount + 1)
+#end
+#end
+ Object[] values = new Object[$primitiveCount];
+ values[0] = super.saveState(facesContext);
+#set ($arrayIndex = 0)
+#foreach( $property in $propertyList )
+#set ($field = $property.fieldName)
+#set ($type = $property.className)
+#set ($arrayIndex = $arrayIndex + 1)
+#if ($property.jspName == "validator" && $property.isMethodBinding() )
+ values[$arrayIndex] = saveAttachedState(facesContext,${field}List);
+#elseif ( $property.isStateHolder() )## || $utils.isConverter($type)
+ values[$arrayIndex] = saveAttachedState(facesContext,$field);
+#elseif($utils.isPrimitiveClass($type))
+ values[$arrayIndex] = ${utils.getBoxedClass($type)}.valueOf($field);
+#else
+ values[$arrayIndex] = $field;
+#end
+#if($utils.isPrimitiveClass($type) && !$property.isTagExcluded())
+#set ($arrayIndex = $arrayIndex + 1)
+ values[$arrayIndex] = Boolean.valueOf(${field}Set);
+#end
+#end
+ return values;
+ }
+
+ public void restoreState(FacesContext facesContext, Object state)
+ {
+ Object[] values = (Object[])state;
+ super.restoreState(facesContext,values[0]);
+#set ($arrayIndex = 0)
+#foreach( $property in $propertyList )
+#set ($field = $property.fieldName)
+#set ($type = $property.className)
+#set ($arrayIndex = $arrayIndex + 1)
+#if ( $property.isStateHolder() )
+#if ($property.jspName == "validator" && $property.isMethodBinding() )
+ ${field}List = (List<Validator>) restoreAttachedState(facesContext,values[$arrayIndex]);
+#elseif ($utils.isList($type))
+ $field = (List) restoreAttachedState(facesContext,values[$arrayIndex]);
+#else
+ $field = $utils.castIfNecessary($type) restoreAttachedState(facesContext,values[$arrayIndex]);
+#end
+#elseif ($utils.isConverter($type))
+ $field = (Converter) restoreAttachedState(facesContext,values[$arrayIndex]);
+#elseif ($utils.isPrimitiveClass($type))
+ $field = ($utils.castIfNecessary($type) values[$arrayIndex]).${type}Value();
+#else
+ $field = $utils.castIfNecessary($type) values[$arrayIndex];
+#end
+#if($utils.isPrimitiveClass($type) && !$property.isTagExcluded() )
+#set ($arrayIndex = $arrayIndex + 1)
+ ${field}Set = ((Boolean) values[$arrayIndex]).booleanValue();
+#end
+#end
+ }
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/facelets-taglib.vm
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/facelets-taglib.vm?rev=689701&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/facelets-taglib.vm (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/facelets-taglib.vm Wed Aug 27 19:23:10 2008
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!DOCTYPE facelet-taglib
+ PUBLIC "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN" "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
+<facelet-taglib xmlns="http://java.sun.com/JSF/Facelet">
+
+ <namespace>$uri</namespace>
+
+ <!-- Component Tags -->
+#set ($componentList = ${model.getComponents()})
+#foreach( $component in $componentList )
+#if ($modelIds.contains($component.modelId)
+ && ($component.name))
+#if (!$component.isConfigExcluded())
+ <tag>
+ <tag-name>$utils.getTagName($component.name)</tag-name>
+ <component>
+ <component-type>$component.type</component-type>
+#if ($component.rendererType)
+#if (!($component.rendererType == ""))
+ <renderer-type>$component.rendererType</renderer-type>
+#end
+#end
+#if ($component.tagHandler)
+ <handler-class>$component.tagHandler</handler-class>
+#end
+ </component>
+ </tag>
+#end
+#end
+#end
+
+ <!-- Converter tags -->
+#set ($componentList = ${model.getConverters()})
+#foreach( $component in $componentList )
+#if ($modelIds.contains($component.modelId)
+ && ($component.name))
+#if ($component.converterId)
+ <tag>
+ <tag-name>$utils.getTagName($component.name)</tag-name>
+ <converter>
+ <converter-id>$component.converterId</converter-id>
+ </converter>
+ </tag>
+#end
+#end
+#end
+
+ <!-- Validator tags -->
+#set ($componentList = ${model.getValidators()})
+#foreach( $component in $componentList )
+#if ($modelIds.contains($component.modelId)
+ && ($component.name))
+#if ($component.validatorId)
+ <tag>
+ <tag-name>$utils.getTagName($component.name)</tag-name>
+ <validator>
+ <validator-id>$component.validatorId</validator-id>
+ </validator>
+ </tag>
+#end
+#end
+#end
+
+ <!-- Single Tags -->
+#set ($tagList = $model.getTags())
+#foreach( $tag in $tagList )
+#if ($modelIds.contains($tag.modelId))
+#if ($tag.tagHandler)
+ <tag>
+ <tag-name>$utils.getTagName($tag.name)</tag-name>
+ <handler-class>$tag.tagHandler</handler-class>
+ </tag>
+#end
+#end
+#end
+
+</facelet-taglib>
\ No newline at end of file
Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/faces-config11.vm
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/faces-config11.vm?rev=689701&r1=689700&r2=689701&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/faces-config11.vm (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/faces-config11.vm Wed Aug 27 19:23:10 2008
@@ -30,7 +30,8 @@
#set ($componentList = ${model.getComponents()})
#foreach( $component in $componentList )
#if ($modelIds.contains($component.modelId)
- && !($component.className.contains("UIComponent")))
+ && !($component.className.contains("UIComponent"))
+ && !($component.isConfigExcluded()))
<component>
<component-type>$component.type</component-type>
<component-class>$component.className</component-class>
@@ -48,7 +49,9 @@
#end
#set ($validatorList = ${model.getValidators()})
#foreach( $validator in $validatorList )
-#if ($modelIds.contains($validator.modelId))
+#if ($modelIds.contains($validator.modelId) &&
+ !($validator.isConfigExcluded().booleanValue()) &&
+ $validator.validatorId)
<validator>
<validator-id>$validator.validatorId</validator-id>
<validator-class>$validator.className</validator-class>
@@ -72,4 +75,4 @@
#end
</render-kit>
#end
-</faces-config>
\ No newline at end of file
+</faces-config>
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/faces-config12.vm
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/faces-config12.vm?rev=689701&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/faces-config12.vm (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/faces-config12.vm Wed Aug 27 19:23:10 2008
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
+ version="1.2">
+
+$baseContent
+
+#set ($componentList = ${model.getComponents()})
+#foreach( $component in $componentList )
+#if ($modelIds.contains($component.modelId)
+ && !($component.className.contains("UIComponent"))
+ && !($component.isConfigExcluded()))
+ <component>
+ <component-type>$component.type</component-type>
+ <component-class>$component.className</component-class>
+ </component>
+#end
+#end
+#set ($converterList = ${model.getConverters()})
+#foreach( $converter in $converterList )
+#if ($modelIds.contains($converter.modelId))
+ <converter>
+ <converter-id>$converter.converterId</converter-id>
+ <converter-class>$converter.className</converter-class>
+ </converter>
+#end
+#end
+#set ($validatorList = ${model.getValidators()})
+#foreach( $validator in $validatorList )
+#if ($modelIds.contains($validator.modelId) &&
+ !($validator.isConfigExcluded().booleanValue()) &&
+ $validator.validatorId)
+ <validator>
+ <validator-id>$validator.validatorId</validator-id>
+ <validator-class>$validator.className</validator-class>
+ </validator>
+#end
+#end
+#set ($renderKitList = ${model.getRenderKits()})
+#foreach( $renderKit in $renderKitList )
+ <render-kit>
+ <render-kit-id>$renderKit.renderKitId</render-kit-id>
+#if ($renderKit.className)
+ <render-kit-class>$renderKit.className</render-kit-class>
+#end
+#set ($rendererList = ${renderKit.getRenderers()})
+#foreach( $renderer in $rendererList )
+ <renderer>
+ <component-family>$renderer.componentFamily</component-family>
+ <renderer-type>$renderer.rendererType</renderer-type>
+ <renderer-class>$renderer.className</renderer-class>
+ </renderer>
+#end
+ </render-kit>
+#end
+</faces-config>
Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/tagClass11.vm
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/tagClass11.vm?rev=689701&r1=689700&r2=689701&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/tagClass11.vm (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/tagClass11.vm Wed Aug 27 19:23:10 2008
@@ -43,7 +43,7 @@
public String getRendererType()
{
-#if ($component.rendererType)
+#if ($component.rendererType && !($component.rendererType == ""))
return "$component.rendererType";
#else
return null;
@@ -56,7 +56,7 @@
#set ($type = $utils.getJspPropertyType11($property))
private $type $field;
-
+
#set ($var = $utils.getVariableFromName($property.name))
public void $utils.getPrefixedPropertyName("set", $property.jspName)($type $var)
{
@@ -163,4 +163,4 @@
$field = $empty;
#end
}
-}
\ No newline at end of file
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/tagClass12.vm
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/tagClass12.vm?rev=689701&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/tagClass12.vm (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/tagClass12.vm Wed Aug 27 19:23:10 2008
@@ -0,0 +1,170 @@
+// WARNING: This file was automatically generated. Do not edit it directly,
+// or you will lose your changes.
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package ${component.tagPackage};
+
+import javax.faces.component.UIComponent;
+import javax.el.ValueExpression;
+import javax.el.MethodExpression;
+import javax.faces.context.FacesContext;
+$utils.importTagClasses12($component)
+
+public class $utils.getClassFromFullClass($component.tagClass)
+#if (${component.tagSuperclass})
+ extends ${component.tagSuperclass}
+#else
+ extends javax.faces.webapp.UIComponentTag
+#end
+{
+ public $utils.getClassFromFullClass($component.tagClass)()
+ {
+ }
+
+ public String getComponentType()
+ {
+#if ($component.type)
+ return "$component.type";
+#else
+ return null;
+#end
+ }
+
+ public String getRendererType()
+ {
+#if ($component.rendererType && !($component.rendererType == ""))
+ return "$component.rendererType";
+#else
+ return null;
+#end
+ }
+
+#set ($propertyList = ${component.propertyTagList})
+#foreach( $property in $propertyList )
+#set ($field = $property.fieldName)
+#set ($type = $utils.getJspPropertyType12($property))
+
+ private $type $field;
+
+#set ($var = $utils.getVariableFromName($property.name))
+ public void $utils.getPrefixedPropertyName("set", $property.jspName)($type $var)
+ {
+ $field = $var;
+ }
+#end
+
+ protected void setProperties(UIComponent component)
+ {
+ if (!(component instanceof $component.className))
+ {
+ throw new IllegalArgumentException("Component "+
+ component.getClass().getName() +" is no $component.className");
+ }
+
+ $component.className comp = ($component.className) component;
+
+ super.setProperties(component);
+
+ FacesContext context = getFacesContext();
+
+#foreach( $property in $propertyList )## 1
+#set ($field = $property.fieldName)
+#set ($type = $utils.getJspPropertyType12($property))
+#if ($utils.isConverter($property.className))## 2
+ if ($field != null)
+ {
+ if (!${field}.isLiteralText())
+ {
+ comp.setValueExpression("$property.name", $field);
+ }
+ else
+ {
+ String s = ${field}.getExpressionString();
+ if (s != null)
+ {
+ Converter converter = getFacesContext().getApplication().createConverter(s);
+ comp.setConverter(converter);
+ }
+ }
+ }
+#elseif ($property.isMethodBinding())## 2
+ if ($field != null)
+ {
+#if ($property.jspName == "actionListener")
+ comp.addActionListener(new MethodExpressionActionListener($field));
+#elseif ($property.jspName == "valueChangeListener")
+ comp.addValueChangeListener(new MethodExpressionValueChangeListener($field));
+#elseif ($property.jspName == "validator")
+ comp.addValidator(new MethodExpressionValidator($field));
+#elseif ($utils.isStringMethodBindingReturnType($property.methodBindingSignature))##3
+ MethodBinding mb;
+ if (isValueReference($field))
+ {
+ mb = context.getApplication().createMethodBinding(
+ $field, $utils.getSignatureParams($property.methodBindingSignature));
+ }
+ else
+ {
+ throw new IllegalStateException("Invalid expression " + $field);
+ }
+ comp.${utils.getPrefixedPropertyName("set",$property.name)}(mb);
+#else## 3
+ MethodBinding mb = context.getApplication().createMethodBinding(
+ $field, $utils.getSignatureParams($property.methodBindingSignature));
+ comp.${utils.getPrefixedPropertyName("set",$property.name)}(mb);
+#end## 3
+ }
+#elseif ($property.isMethodExpression())## 2
+ if ($field != null)
+ {
+#if ($property.jspName == "action")
+ comp.setActionExpression($field);
+#elseif ($property.jspName == "actionListener")
+ comp.addActionListener(new MethodExpressionActionListener($field));
+#else
+ comp.${utils.getPrefixedPropertyName("set",$property.name)}($field);
+#end
+ }
+#else## 2
+ if ($field != null)
+ {
+#if ($property.isLiteralOnly())## 3
+ comp.getAttributes().put("$property.name", $field);
+#else## 3
+ comp.setValueExpression("$property.name", $field);
+#end## 3
+ }
+#end## 2
+#end## 1
+ }
+
+ public void release()
+ {
+ super.release();
+#foreach( $property in $propertyList )
+#set ($field = $property.fieldName)
+#if($utils.getJspPropertyType12($property) == "boolean")
+#set ($empty = "false")
+#else
+#set ($empty = "null")
+#end
+ $field = $empty;
+#end
+ }
+}
Added: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/tomahawk12.vm
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/tomahawk12.vm?rev=689701&view=auto
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/tomahawk12.vm (added)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/tomahawk12.vm Wed Aug 27 19:23:10 2008
@@ -0,0 +1,225 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<taglib xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
+ version="2.1">
+ <tlib-version>1.1.7</tlib-version>
+ <short-name>$shortname</short-name>
+ <uri>$uri</uri>
+ <display-name>$displayname</display-name>
+ <description>$description</description>
+
+$baseContent
+
+ <!-- Component Tags -->
+#set ($componentList = ${model.getComponents()})
+#foreach( $component in $componentList )
+#if ($modelIds.contains($component.modelId)
+ && ($component.name))
+#if ($utils.getTagPrefix($component.name) == $shortname)
+ <tag>
+ <name>$utils.getTagName($component.name)</name>
+ <tag-class>$component.tagClass</tag-class>
+#if ($component.bodyContent)
+ <body-content>$component.bodyContent</body-content>
+#else
+ <body-content>JSP</body-content>
+#end
+ <description><![CDATA[$component.longDescription]]></description>
+
+#set ($propertyList = ${component.propertyList})
+#foreach( $property in $propertyList )
+#if (!$property.isTagExcluded())
+ <attribute>
+ <name>$property.jspName</name>
+#if ($property.isRequired())
+ <required>$property.isRequired()</required>
+#end
+#if ($property.isMethodExpression() || $property.isMethodBinding())
+#if ($property.getMethodBindingSignature())
+ <deferred-method>
+#set ($sig = $property.getMethodBindingSignature())
+ <method-signature>$sig.returnType myMethod( $sig.parameterTypesAsString )</method-signature>
+
+ </deferred-method>
+#else
+## This is a very special case. If a property is MethodBinding or MethodExpression
+## this should have a signature. If not, for allow multiple MethodBinding
+## simulate a ValueExpression and write a custom code like in
+## org.apache.myfaces.custom.suggestajax.AbstractSuggestAjaxTag
+ <deferred-value/>
+#end
+#elseif ($property.isLiteralOnly())
+ <rtexprvalue>false</rtexprvalue>
+#else
+#set ($type = $utils.getClassFromFullClass($property.className))
+#if ($type == "String")
+ <deferred-value></deferred-value>
+#else
+ <deferred-value>
+ <type>$property.className</type>
+ </deferred-value>
+#end
+#end
+#if ($property.longDescription)
+ <description><![CDATA[$property.longDescription]]></description>
+#else
+ <description><![CDATA[]]></description>
+#end
+ </attribute>
+#end
+#end
+ </tag>
+#end
+#end
+#end
+ <!-- Converter tags -->
+#set ($componentList = ${model.getConverters()})
+#foreach( $component in $componentList )
+#if ($modelIds.contains($component.modelId)
+ && ($component.name))
+#if ($utils.getTagPrefix($component.name) == $shortname)
+ <tag>
+ <name>$utils.getTagName($component.name)</name>
+ <tag-class>$component.tagClass</tag-class>
+#if ($component.bodyContent)
+ <body-content>$component.bodyContent</body-content>
+#else
+ <body-content>empty</body-content>
+#end
+ <description><![CDATA[$component.longDescription]]></description>
+
+#set ($propertyList = ${component.propertyList})
+#foreach( $property in $propertyList )
+#if (!$property.isTagExcluded())
+ <attribute>
+ <name>$property.name</name>
+#if ($property.isRequired())
+ <required>$property.isRequired()</required>
+#end
+#if ($property.isLiteralOnly())
+ <rtexprvalue>false</rtexprvalue>
+#else
+#set ($type = $utils.getClassFromFullClass($property.className))
+#if ($type == "String")
+ <deferred-value></deferred-value>
+#else
+ <deferred-value>
+ <type>$property.className</type>
+ </deferred-value>
+#end
+#end
+#if ($property.longDescription)
+ <description><![CDATA[$property.longDescription]]></description>
+#else
+ <description><![CDATA[]]></description>
+#end
+ </attribute>
+#end
+#end
+ </tag>
+#end
+#end
+#end
+ <!-- Validator tags -->
+#set ($componentList = ${model.getValidators()})
+#foreach( $component in $componentList )
+#if ($modelIds.contains($component.modelId)
+ && ($component.name))
+#if ($utils.getTagPrefix($component.name) == $shortname)
+ <tag>
+ <name>$utils.getTagName($component.name)</name>
+ <tag-class>$component.tagClass</tag-class>
+#if ($component.bodyContent)
+ <body-content>$component.bodyContent</body-content>
+#else
+ <body-content>empty</body-content>
+#end
+ <description><![CDATA[$component.longDescription]]></description>
+
+#set ($propertyList = ${component.propertyList})
+#foreach( $property in $propertyList )
+#if (!$property.isTagExcluded())
+ <attribute>
+ <name>$property.name</name>
+#if ($property.isRequired())
+ <required>$property.isRequired()</required>
+#end
+#if ($property.isLiteralOnly())
+ <rtexprvalue>false</rtexprvalue>
+#else
+#set ($type = $utils.getClassFromFullClass($property.className))
+#if ($type == "String")
+ <deferred-value></deferred-value>
+#else
+ <deferred-value>
+ <type>$property.className</type>
+ </deferred-value>
+#end
+#end
+#if ($property.longDescription)
+ <description><![CDATA[$property.longDescription]]></description>
+#else
+ <description><![CDATA[]]></description>
+#end
+ </attribute>
+#end
+#end
+ </tag>
+#end
+#end
+#end
+ <!-- Single Tags -->
+#set ($tagList = $model.getTags())
+#foreach( $tag in $tagList )
+#if ($modelIds.contains($tag.modelId))
+ <tag>
+ <name>$utils.getTagName($tag.name)</name>
+ <tag-class>$tag.className</tag-class>
+ <body-content>$tag.bodyContent</body-content>
+ <description><![CDATA[$tag.longDescription]]></description>
+#set ($attributeList = ${tag.attributeList})
+#foreach( $attribute in $attributeList )
+ <attribute>
+ <name>$attribute.name</name>
+ <required>$attribute.isRequired()</required>
+#set ($type = $utils.getClassFromFullClass($attribute.className))
+#if ($type == "ValueExpression")
+ <deferred-value></deferred-value>
+#else
+ <rtexprvalue>$attribute.isRtexprvalue()</rtexprvalue>
+#if ($attribute.className)
+ <type>$attribute.className</type>
+#else
+ <type>java.lang.String</type>
+#end
+#end
+#if ($property.longDescription)
+ <description><![CDATA[$property.longDescription]]></description>
+#else
+ <description><![CDATA[]]></description>
+#end
+ </attribute>
+#end
+ </tag>
+#end
+#end
+</taglib>