Matthias, Could you revise these to match ADF Faces formatting rules? Two space indent, braces on new lines.
Thanks, Adam On 6/7/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Author: matzew Date: Wed Jun 7 12:17:35 2006 New Revision: 412491 URL: http://svn.apache.org/viewvc?rev=412491&view=rev Log: added taghandlers for facelets support Added: incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/ResetActionListenerTag.java incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/ReturnActionListenerTag.java Modified: incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/conf/META-INF/af-base.taglib.xml incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/AdfListenersTagRule.java incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/SetActionListenerTag.java Modified: incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/conf/META-INF/af-base.taglib.xml URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/conf/META-INF/af-base.taglib.xml?rev=412491&r1=412490&r2=412491&view=diff ============================================================================== --- incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/conf/META-INF/af-base.taglib.xml (original) +++ incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/conf/META-INF/af-base.taglib.xml Wed Jun 7 12:17:35 2006 @@ -24,4 +24,12 @@ <tag-name>setActionListener</tag-name> <handler-class>org.apache.myfaces.adfinternal.facelets.SetActionListenerTag</handler-class> </tag> + <tag> + <tag-name>resetActionListener</tag-name> + <handler-class>org.apache.myfaces.adfinternal.facelets.ResetActionListenerTag</handler-class> + </tag> + <tag> + <tag-name>returnActionListener</tag-name> + <handler-class>org.apache.myfaces.adfinternal.facelets.ReturnActionListenerTag</handler-class> + </tag> </facelet-taglib> Modified: incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/AdfListenersTagRule.java URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/AdfListenersTagRule.java?rev=412491&r1=412490&r2=412491&view=diff ============================================================================== --- incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/AdfListenersTagRule.java (original) +++ incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/AdfListenersTagRule.java Wed Jun 7 12:17:35 2006 @@ -15,24 +15,20 @@ */ package org.apache.myfaces.adfinternal.facelets; -import java.beans.PropertyDescriptor; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import java.util.ArrayList; -import java.util.StringTokenizer; - -import javax.el.MethodExpression; -import javax.faces.el.MethodBinding; - -import com.sun.facelets.FaceletContext; -import com.sun.facelets.el.LegacyMethodBinding; -import com.sun.facelets.tag.Metadata; -import com.sun.facelets.tag.MetadataTarget; -import com.sun.facelets.tag.MetaRule; -import com.sun.facelets.tag.TagAttribute; -import com.sun.facelets.tag.TagAttributeException; +import java.beans.PropertyDescriptor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import javax.el.MethodExpression; +import javax.faces.el.MethodBinding; + +import com.sun.facelets.FaceletContext; +import com.sun.facelets.el.LegacyMethodBinding; +import com.sun.facelets.tag.MetaRule; +import com.sun.facelets.tag.Metadata; +import com.sun.facelets.tag.MetadataTarget; +import com.sun.facelets.tag.TagAttribute; +import com.sun.facelets.tag.TagAttributeException; /** * Added: incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/ResetActionListenerTag.java URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/ResetActionListenerTag.java?rev=412491&view=auto ============================================================================== --- incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/ResetActionListenerTag.java (added) +++ incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/ResetActionListenerTag.java Wed Jun 7 12:17:35 2006 @@ -0,0 +1,54 @@ +/* +* Copyright 2006 The Apache Software Foundation. +* +* Licensed 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 org.apache.myfaces.adfinternal.facelets; + +import java.io.IOException; + +import javax.el.ELException; +import javax.faces.FacesException; +import javax.faces.component.ActionSource; +import javax.faces.component.UIComponent; + +import org.apache.myfaces.adfinternal.taglib.listener.ResetActionListener; + +import com.sun.facelets.FaceletContext; +import com.sun.facelets.FaceletException; +import com.sun.facelets.tag.TagConfig; +import com.sun.facelets.tag.TagHandler; +import com.sun.facelets.tag.jsf.ComponentSupport; + +/** + * @author Matthias Wessendorf + * + */ +public class ResetActionListenerTag extends TagHandler { + + public ResetActionListenerTag(TagConfig tagConfig) { + super(tagConfig); + } + + public void apply(FaceletContext faceletContext, UIComponent parent) + throws IOException, FacesException, FaceletException, ELException { + + if(ComponentSupport.isNew(parent)) + { + ActionSource actionSource = (ActionSource)parent; + ResetActionListener listener = new ResetActionListener(); + + actionSource.addActionListener(listener); + } + } +} \ No newline at end of file Added: incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/ReturnActionListenerTag.java URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/ReturnActionListenerTag.java?rev=412491&view=auto ============================================================================== --- incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/ReturnActionListenerTag.java (added) +++ incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/ReturnActionListenerTag.java Wed Jun 7 12:17:35 2006 @@ -0,0 +1,64 @@ +/* +* Copyright 2006 The Apache Software Foundation. +* +* Licensed 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 org.apache.myfaces.adfinternal.facelets; + +import java.io.IOException; + +import javax.el.ELException; +import javax.el.ValueExpression; +import javax.faces.FacesException; +import javax.faces.component.ActionSource; +import javax.faces.component.UIComponent; + +import org.apache.myfaces.adfinternal.taglib.listener.ReturnActionListener; + +import com.sun.facelets.FaceletContext; +import com.sun.facelets.FaceletException; +import com.sun.facelets.el.LegacyValueBinding; +import com.sun.facelets.tag.TagAttribute; +import com.sun.facelets.tag.TagConfig; +import com.sun.facelets.tag.TagHandler; +import com.sun.facelets.tag.jsf.ComponentSupport; + +/** + * @author Matthias Wessendorf + * + */ +public class ReturnActionListenerTag extends TagHandler { + + public ReturnActionListenerTag(TagConfig tagConfig) { + super(tagConfig); + _value = getAttribute("value"); + } + + public void apply(FaceletContext faceletContext, UIComponent parent) + throws IOException, FacesException, FaceletException, ELException { + + if(ComponentSupport.isNew(parent)) + { + ValueExpression valueExp = _value.getValueExpression(faceletContext, Object.class); + ActionSource actionSource = (ActionSource)parent; + ReturnActionListener listener = new ReturnActionListener(); + listener.setValueBinding(listener.VALUE_KEY, + new LegacyValueBinding(valueExp)); + + actionSource.addActionListener(listener); + } + } + + private final TagAttribute _value; + +} \ No newline at end of file Modified: incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/SetActionListenerTag.java URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/SetActionListenerTag.java?rev=412491&r1=412490&r2=412491&view=diff ============================================================================== --- incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/SetActionListenerTag.java (original) +++ incubator/adffaces/trunk/adf-faces/adf-faces-impl/src/main/java/org/apache/myfaces/adfinternal/facelets/SetActionListenerTag.java Wed Jun 7 12:17:35 2006 @@ -15,22 +15,20 @@ */ package org.apache.myfaces.adfinternal.facelets; -import java.io.IOException; - -import javax.el.ELException; -import javax.el.ValueExpression; -import javax.faces.component.ActionSource; -import javax.faces.component.UIComponent; - -import com.sun.facelets.FaceletContext; -import com.sun.facelets.FaceletException; -import com.sun.facelets.el.LegacyValueBinding; -import com.sun.facelets.tag.TagAttribute; -import com.sun.facelets.tag.TagConfig; -import com.sun.facelets.tag.TagHandler; -import com.sun.facelets.tag.jsf.ComponentSupport; - -import org.apache.myfaces.adfinternal.taglib.listener.SetActionListener; +import javax.el.ELException; +import javax.el.ValueExpression; +import javax.faces.component.ActionSource; +import javax.faces.component.UIComponent; + +import org.apache.myfaces.adfinternal.taglib.listener.SetActionListener; + +import com.sun.facelets.FaceletContext; +import com.sun.facelets.FaceletException; +import com.sun.facelets.el.LegacyValueBinding; +import com.sun.facelets.tag.TagAttribute; +import com.sun.facelets.tag.TagConfig; +import com.sun.facelets.tag.TagHandler; +import com.sun.facelets.tag.jsf.ComponentSupport; /** * @author Emmanuel Pirsch
