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   * @author Dennis Byrne
31   * @since 1.2
32   */
33  
34  public abstract class UIComponentTagBase extends Object implements JspTag
35  {
36  
37      protected static Logger log = Logger.getLogger("javax.faces.webapp");
38      
39      /**
40       * @see http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentTagBase.html#addChild(javax.faces.component.UIComponent)
41       * @param child
42       */
43  
44      protected abstract void addChild(UIComponent child);
45  
46      /**
47       * @see http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentTagBase.html#addFacet(java.lang.String)
48       * @param name
49       */
50  
51      protected abstract void addFacet(String name);
52  
53      /**
54       * @see http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentTagBase.html#getComponentInstance()
55       * @return
56       */
57  
58      public abstract UIComponent getComponentInstance();
59  
60      /**
61       * Specify the "component type name" used together with the component's
62       * family and the Application object to create a UIComponent instance for
63       * this tag. This method is called by other methods in this class, and is
64       * intended to be overridden in subclasses to specify the actual component
65       * type to be created.
66       *
67       * @see http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentTagBase.html#getComponentType()
68       * @return a registered component type name, never null.
69       */
70  
71      public abstract String getComponentType();
72  
73      /**
74       * @see http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentTagBase.html#getCreated()
75       * @return
76       */
77  
78      public abstract boolean getCreated();
79  
80      /**
81       * @see http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentTagBase.html#getELContext()
82       * @return
83       */
84  
85      protected ELContext getELContext()
86      {
87  
88          FacesContext ctx = getFacesContext();
89  
90          if (ctx == null)
91              throw new NullPointerException("FacesContext ctx");
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 }