View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package javax.faces.webapp;
21  
22  import java.util.logging.Logger;
23  
24  import javax.el.ELContext;
25  import javax.faces.component.UIComponent;
26  import javax.faces.context.FacesContext;
27  import javax.servlet.jsp.tagext.JspTag;
28  
29  /**
30   * @since 1.2
31   */
32  
33  public abstract class UIComponentTagBase extends Object implements JspTag
34  {
35      protected static final Logger log = Logger.getLogger("javax.faces.webapp");
36      
37      /**
38       * @see http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentTagBase.html#addChild(javax.faces.component.UIComponent)
39       * @param child
40       */
41  
42      protected abstract void addChild(UIComponent child);
43  
44      /**
45       * @see http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentTagBase.html#addFacet(java.lang.String)
46       * @param name
47       */
48  
49      protected abstract void addFacet(String name);
50  
51      /**
52       * @see http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentTagBase.html#getComponentInstance()
53       * @return
54       */
55  
56      public abstract UIComponent getComponentInstance();
57  
58      /**
59       * Specify the "component type name" used together with the component's
60       * family and the Application object to create a UIComponent instance for
61       * this tag. This method is called by other methods in this class, and is
62       * intended to be overridden in subclasses to specify the actual component
63       * type to be created.
64       *
65       * @see http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentTagBase.html#getComponentType()
66       * @return a registered component type name, never null.
67       */
68  
69      public abstract String getComponentType();
70  
71      /**
72       * @see http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentTagBase.html#getCreated()
73       * @return
74       */
75  
76      public abstract boolean getCreated();
77  
78      /**
79       * @see http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentTagBase.html#getELContext()
80       * @return
81       */
82  
83      protected ELContext getELContext()
84      {
85  
86          FacesContext ctx = getFacesContext();
87  
88          if (ctx == null)
89          {
90              throw new NullPointerException("FacesContext ctx");
91          }
92  
93          return getFacesContext().getELContext();
94      }
95  
96      /**
97       * @see http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentTagBase.html#getFacesContext()
98       * @return
99       */
100 
101     protected abstract FacesContext getFacesContext();
102 
103     /**
104      * @see http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentTagBase.html#getIndexOfNextChildTag()
105      * @return
106      */
107 
108     protected abstract int getIndexOfNextChildTag();
109 
110     /**
111      * Specify the "renderer type name" used together with the current
112      * renderKit to get a Renderer instance for the corresponding UIComponent.
113      * <p>
114      * A JSP tag can return null here to use the default renderer type string.
115      * If non-null is returned, then the UIComponent's setRendererType method
116      * will be called passing this value, and this will later affect the
117      * type of renderer object returned by UIComponent.getRenderer().
118      * 
119      * @see http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentTagBase.html#getRendererType()
120      * @return
121      */
122     public abstract String getRendererType();
123 
124     /**
125      * @see http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentTagBase.html#setId(java.lang.String)
126      * @param id
127      */
128 
129     public abstract void setId(String id);
130 }