myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject svn commit: r991442 - in /myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib: ./ listener/
Date Wed, 01 Sep 2010 06:09:37 GMT
Author: matzew
Date: Wed Sep  1 06:09:36 2010
New Revision: 991442

URL: http://svn.apache.org/viewvc?rev=991442&view=rev
Log:
TRINIDAD-1898 - Stop using the TagSupport convenience class

introducing a non serializable 'TrinidadTagSupport' clazz. Code was take from Apache Tomcat'

Added:
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/TrinidadTagSupport.java
Modified:
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentDefTag.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/FacetRefTag.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListenerTag.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentDefTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentDefTag.java?rev=991442&r1=991441&r2=991442&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentDefTag.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ComponentDefTag.java
Wed Sep  1 06:09:36 2010
@@ -19,17 +19,13 @@
 package org.apache.myfaces.trinidadinternal.taglib;
 
 import javax.faces.component.UIComponent;
-
-import javax.servlet.jsp.tagext.TagSupport;
+import javax.faces.webapp.UIComponentClassicTagBase;
+import javax.servlet.jsp.JspException;
 
 import org.apache.myfaces.trinidad.component.UIXComponentRef;
-
-import javax.servlet.jsp.JspException;
-import org.apache.myfaces.trinidadinternal.taglib.util.TagUtils;
-import javax.faces.webapp.UIComponentClassicTagBase;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 
-public class ComponentDefTag extends TagSupport
+public class ComponentDefTag extends TrinidadTagSupport
 {
   public ComponentDefTag()
   {

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/FacetRefTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/FacetRefTag.java?rev=991442&r1=991441&r2=991442&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/FacetRefTag.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/FacetRefTag.java
Wed Sep  1 06:09:36 2010
@@ -21,20 +21,18 @@ package org.apache.myfaces.trinidadinter
 import javax.faces.component.UIComponent;
 import javax.faces.webapp.FacetTag;
 import javax.faces.webapp.UIComponentClassicTagBase;
-
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.tagext.Tag;
-import javax.servlet.jsp.tagext.TagSupport;
 
-import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import org.apache.myfaces.trinidad.component.UIXComponentRef;
+import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 
 
 /**
  * Use this tag to copy children or facets from a declarative component
  * on to a component within the corresponding definition.
  */
-public class FacetRefTag extends TagSupport
+public class FacetRefTag extends TrinidadTagSupport
 {
   public FacetRefTag()
   {

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java?rev=991442&r1=991441&r2=991442&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java
Wed Sep  1 06:09:36 2010
@@ -19,9 +19,7 @@
 package org.apache.myfaces.trinidadinternal.taglib;
 
 import java.io.Serializable;
-
 import java.lang.reflect.Array;
-
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -30,12 +28,9 @@ import javax.el.ELContext;
 import javax.el.PropertyNotWritableException;
 import javax.el.ValueExpression;
 import javax.el.VariableMapper;
-
 import javax.faces.context.FacesContext;
-
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.JspTagException;
-import javax.servlet.jsp.tagext.TagSupport;
 import javax.servlet.jsp.jstl.core.IndexedValueExpression;
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -61,7 +56,7 @@ import org.apache.myfaces.trinidad.loggi
 /**
  *
  */
-public class ForEachTag extends TagSupport
+public class ForEachTag extends TrinidadTagSupport
 {
   public void setItems(ValueExpression items)
   {

Added: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/TrinidadTagSupport.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/TrinidadTagSupport.java?rev=991442&view=auto
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/TrinidadTagSupport.java
(added)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/TrinidadTagSupport.java
Wed Sep  1 06:09:36 2010
@@ -0,0 +1,318 @@
+/*
+ * 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 org.apache.myfaces.trinidadinternal.taglib;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.tagext.IterationTag;
+import javax.servlet.jsp.tagext.Tag;
+
+/**
+ * This is the Trinidad version of the JSP <code>TagSupport</code> class.
+ * The main difference is that this class is <b>NOT</b> implementing the
+ * <code>Serializable</code> interface.
+ * 
+ * @author Apache Tomcat team
+ */
+public class TrinidadTagSupport implements IterationTag
+{
+  /**
+   * Find the instance of a given class type that is closest to a given
+   * instance. This method uses the getParent method from the Tag interface.
+   * This method is used for coordination among cooperating tags.
+   * 
+   * <p>
+   * The current version of the specification only provides one formal way of
+   * indicating the observable type of a tag handler: its tag handler
+   * implementation class, described in the tag-class subelement of the tag
+   * element. This is extended in an informal manner by allowing the tag library
+   * author to indicate in the description subelement an observable type. The
+   * type should be a subtype of the tag handler implementation class or void.
+   * This addititional constraint can be exploited by a specialized container
+   * that knows about that specific tag library, as in the case of the JSP
+   * standard tag library.
+   * 
+   * <p>
+   * When a tag library author provides information on the observable type of a
+   * tag handler, client programmatic code should adhere to that constraint.
+   * Specifically, the Class passed to findAncestorWithClass should be a subtype
+   * of the observable type.
+   * 
+   * 
+   * @param from
+   *          The instance from where to start looking.
+   * @param klass
+   *          The subclass of Tag or interface to be matched
+   * @return the nearest ancestor that implements the interface or is an
+   *         instance of the class specified
+   */
+  public static final Tag findAncestorWithClass(Tag from,
+  // TCK signature test fails with generics
+      @SuppressWarnings("unchecked") Class klass)
+  {
+    boolean isInterface = false;
+
+    if (from == null
+        || klass == null
+        || (!Tag.class.isAssignableFrom(klass) && !(isInterface = klass
+            .isInterface())))
+    {
+      return null;
+    }
+
+    for (;;)
+    {
+      Tag tag = from.getParent();
+
+      if (tag == null)
+      {
+        return null;
+      }
+
+      if ((isInterface && klass.isInstance(tag))
+          || klass.isAssignableFrom(tag.getClass()))
+        return tag;
+      else
+        from = tag;
+    }
+  }
+
+  /**
+   * Default constructor, all subclasses are required to define only a public
+   * constructor with the same signature, and to call the superclass
+   * constructor.
+   * 
+   * This constructor is called by the code generated by the JSP translator.
+   */
+
+  public TrinidadTagSupport()
+  {
+  }
+
+  /**
+   * Default processing of the start tag, returning SKIP_BODY.
+   * 
+   * @return SKIP_BODY
+   * @throws JspException
+   *           if an error occurs while processing this tag
+   * 
+   * @see Tag#doStartTag()
+   */
+
+  public int doStartTag() throws JspException
+  {
+    return SKIP_BODY;
+  }
+
+  /**
+   * Default processing of the end tag returning EVAL_PAGE.
+   * 
+   * @return EVAL_PAGE
+   * @throws JspException
+   *           if an error occurs while processing this tag
+   * 
+   * @see Tag#doEndTag()
+   */
+
+  public int doEndTag() throws JspException
+  {
+    return EVAL_PAGE;
+  }
+
+  /**
+   * Default processing for a body.
+   * 
+   * @return SKIP_BODY
+   * @throws JspException
+   *           if an error occurs while processing this tag
+   * 
+   * @see IterationTag#doAfterBody()
+   */
+
+  public int doAfterBody() throws JspException
+  {
+    return SKIP_BODY;
+  }
+
+  // Actions related to body evaluation
+
+  /**
+   * Release state.
+   * 
+   * @see Tag#release()
+   */
+
+  public void release()
+  {
+    parent = null;
+    id = null;
+    if (values != null)
+    {
+      values.clear();
+    }
+    values = null;
+  }
+
+  /**
+   * Set the nesting tag of this tag.
+   * 
+   * @param t
+   *          The parent Tag.
+   * @see Tag#setParent(Tag)
+   */
+
+  public void setParent(Tag t)
+  {
+    parent = t;
+  }
+
+  /**
+   * The Tag instance most closely enclosing this tag instance.
+   * 
+   * @see Tag#getParent()
+   * 
+   * @return the parent tag instance or null
+   */
+
+  public Tag getParent()
+  {
+    return parent;
+  }
+
+  /**
+   * Set the id attribute for this tag.
+   * 
+   * @param id
+   *          The String for the id.
+   */
+
+  public void setId(String id)
+  {
+    this.id = id;
+  }
+
+  /**
+   * The value of the id attribute of this tag; or null.
+   * 
+   * @return the value of the id attribute, or null
+   */
+
+  public String getId()
+  {
+    return id;
+  }
+
+  /**
+   * Set the page context.
+   * 
+   * @param pageContext
+   *          The PageContext.
+   * @see Tag#setPageContext
+   */
+
+  public void setPageContext(PageContext pageContext)
+  {
+    this.pageContext = pageContext;
+  }
+
+  /**
+   * Associate a value with a String key.
+   * 
+   * @param k
+   *          The key String.
+   * @param o
+   *          The value to associate.
+   */
+
+  public void setValue(String k, Object o)
+  {
+    if (values == null)
+    {
+      values = new Hashtable<String, Object>();
+    }
+    values.put(k, o);
+  }
+
+  /**
+   * Get a the value associated with a key.
+   * 
+   * @param k
+   *          The string key.
+   * @return The value associated with the key, or null.
+   */
+
+  public Object getValue(String k)
+  {
+    if (values == null)
+    {
+      return null;
+    } else
+    {
+      return values.get(k);
+    }
+  }
+
+  /**
+   * Remove a value associated with a key.
+   * 
+   * @param k
+   *          The string key.
+   */
+
+  public void removeValue(String k)
+  {
+    if (values != null)
+    {
+      values.remove(k);
+    }
+  }
+
+  /**
+   * Enumerate the keys for the values kept by this tag handler.
+   * 
+   * @return An enumeration of all the keys for the values set, or null or an
+   *         empty Enumeration if no values have been set.
+   */
+
+  public Enumeration<String> getValues()
+  {
+    if (values == null)
+    {
+      return null;
+    }
+    return values.keys();
+  }
+
+  // private fields
+
+  private Tag parent;
+  private Hashtable<String, Object> values;
+  /**
+   * The value of the id attribute of this tag; or null.
+   */
+  protected String id;
+
+  // protected fields
+
+  /**
+   * The PageContext.
+   */
+  protected PageContext pageContext;
+}

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListenerTag.java?rev=991442&r1=991441&r2=991442&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListenerTag.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/FileDownloadActionListenerTag.java
Wed Sep  1 06:09:36 2010
@@ -18,28 +18,22 @@
  */
 package org.apache.myfaces.trinidadinternal.taglib.listener;
 
-import org.apache.myfaces.trinidadinternal.taglib.util.TagUtils;
-
-import java.io.OutputStream;
-
 import javax.el.MethodExpression;
 import javax.el.ValueExpression;
-
-import javax.servlet.jsp.tagext.TagSupport;
-import javax.servlet.jsp.JspException;
-
 import javax.faces.application.Application;
 import javax.faces.component.ActionSource;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.webapp.UIComponentTag;
+import javax.servlet.jsp.JspException;
 
-import org.apache.myfaces.trinidad.webapp.ELContextTag;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
+import org.apache.myfaces.trinidad.webapp.ELContextTag;
+import org.apache.myfaces.trinidadinternal.taglib.TrinidadTagSupport;
 
 /**
  */
-public class FileDownloadActionListenerTag extends TagSupport
+public class FileDownloadActionListenerTag extends TrinidadTagSupport
 {
   public void setContentType(ValueExpression contentType)
   {

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java?rev=991442&r1=991441&r2=991442&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ResetActionListenerTag.java
Wed Sep  1 06:09:36 2010
@@ -21,15 +21,15 @@ package org.apache.myfaces.trinidadinter
 import javax.faces.component.ActionSource;
 import javax.faces.component.UIComponent;
 import javax.faces.webapp.UIComponentClassicTagBase;
-
 import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.tagext.TagSupport;
+
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
+import org.apache.myfaces.trinidadinternal.taglib.TrinidadTagSupport;
 
 /**
  *
  */
-public class ResetActionListenerTag extends TagSupport
+public class ResetActionListenerTag extends TrinidadTagSupport
 {
   @Override
   public int doStartTag() throws JspException

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java?rev=991442&r1=991441&r2=991442&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/ReturnActionListenerTag.java
Wed Sep  1 06:09:36 2010
@@ -18,27 +18,23 @@
  */
 package org.apache.myfaces.trinidadinternal.taglib.listener;
 
-import org.apache.myfaces.trinidadinternal.taglib.util.TagUtils;
-
 import javax.el.ValueExpression;
-
-import javax.servlet.jsp.tagext.TagSupport;
-import javax.servlet.jsp.JspException;
-
 import javax.faces.application.Application;
 import javax.faces.component.ActionSource;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.webapp.UIComponentClassicTagBase;
+import javax.servlet.jsp.JspException;
 
-import org.apache.myfaces.trinidad.webapp.ELContextTag;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
+import org.apache.myfaces.trinidad.webapp.ELContextTag;
+import org.apache.myfaces.trinidadinternal.taglib.TrinidadTagSupport;
 
 
 /**
  * creates a ReturnActionListener on the parent ActionSource component.
  */
-public class ReturnActionListenerTag extends TagSupport
+public class ReturnActionListenerTag extends TrinidadTagSupport
 {
   public void setValue(ValueExpression value)
   {

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java?rev=991442&r1=991441&r2=991442&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/listener/SetActionListenerTag.java
Wed Sep  1 06:09:36 2010
@@ -18,29 +18,25 @@
  */
 package org.apache.myfaces.trinidadinternal.taglib.listener;
 
-import org.apache.myfaces.trinidadinternal.taglib.util.TagUtils;
-
 import javax.el.ValueExpression;
-
-import javax.servlet.jsp.tagext.TagSupport;
-import javax.servlet.jsp.JspException;
-
 import javax.faces.application.Application;
 import javax.faces.component.ActionSource;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.webapp.UIComponentClassicTagBase;
+import javax.servlet.jsp.JspException;
 
 import org.apache.myfaces.trinidad.event.SetActionListener;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import org.apache.myfaces.trinidad.webapp.ELContextTag;
+import org.apache.myfaces.trinidadinternal.taglib.TrinidadTagSupport;
 
 /**
  * JavaServer Faces version 1.2 a <code>setPropertyActionListener</code>, which
provides the 
  * same functionality. In JSF 1.2 days this class should be <code>deprecated</code>.
  *
  */
-public class SetActionListenerTag extends TagSupport
+public class SetActionListenerTag extends TrinidadTagSupport
 {
   public void setFrom(ValueExpression from)
   {



Mime
View raw message