2009/05/20 - Apache Shale has been retired.

For more information, please explore the Attic.

View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to you under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.shale.validator.faces;
19  
20  import javax.faces.component.UIComponent;
21  import javax.faces.context.FacesContext;
22  import javax.faces.webapp.UIComponentTag;
23  import org.apache.shale.faces.ShaleConstants;
24  
25  /***
26   * The tag class for the <code>s:validatorScript</code> tag.
27   *
28   * $Id: ValidatorScriptTag.java 464373 2006-10-16 04:21:54Z rahul $
29   */
30  public class ValidatorScriptTag extends UIComponentTag {
31  
32  
33      /***
34       * <p>The function name for validating the enclosing form.</p>
35       */
36     private String functionName;
37  
38  
39      /***
40       * <p>A Utility object to aid in developing JSF tags. See
41       *    <code>org.apache.shale.util.Tags</code> for more
42       *    information.</p>
43       */
44     private org.apache.shale.util.Tags tagUtils = null;
45  
46  
47      /***
48       * <p>This constructor retrieves a managed bean
49       *    that has utility methods for implementing JSP
50       *    custom tags for JSF components.</p>
51       */
52      public ValidatorScriptTag() {
53          FacesContext context = FacesContext.getCurrentInstance();
54          tagUtils = (org.apache.shale.util.Tags) context
55                       .getApplication()
56                       .getVariableResolver()
57                       .resolveVariable(context, ShaleConstants.TAG_UTILITY_BEAN);
58      }
59  
60  
61      /***
62       * <p>Setter method for the function name.</p>
63       *
64       * @param newValue The new value for the function name.
65       */
66      public void setFunctionName(String newValue) {
67          functionName = newValue;
68      }
69  
70  
71      /***
72       * <p>Sets properties for the component.</p>
73       *
74       * @param component The component whose properties we're setting
75       */
76      public void setProperties(UIComponent component) {
77          super.setProperties(component);
78          tagUtils.setString(component, "functionName",
79            functionName);
80      }
81  
82  
83      /***
84       * <p>Sets the <code>functionName</code> property to null.</p>
85       */
86      public void release() {
87          functionName = null;
88      }
89  
90  
91      /***
92       * @return Returns the renderer type, which is null.
93       */
94      public String getRendererType() {
95          return null;
96      }
97  
98  
99      /***
100      * @return Returns the component type, which is
101      *    <code>org.apache.shale.ValidatorScript</code>.
102      */
103     public String getComponentType() {
104         return "org.apache.shale.ValidatorScript";
105     }
106 
107 
108 }