View Javadoc

1   /*
2    * Copyright 2002-2004 The Apache Software Foundation.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.struts.faces.taglib;
18  
19  
20  import javax.faces.component.UIComponent;
21  
22  
23  /***
24   * <p>Render a localized message, with optional substitution parameters, for
25   * the <em>Struts-Faces Integration Library</em>.</p>
26   *
27   *
28   * @version $Rev: 421138 $ $Date: 2006-07-11 22:41:40 -0700 (Tue, 11 Jul 2006) $
29   */
30  
31  public class MessageTag extends AbstractFacesTag {
32  
33  
34      // ---------------------------------------------------------- Tag Attributes
35  
36  
37      /***
38       * <p>Flag indicating that rendered content should be filtered for
39       * characters that are sensitive in HTML.</p>
40       */
41      private String filter = null;
42  
43      public void setFilter(String filter) {
44          this.filter = filter;
45      }
46  
47  
48      /***
49       * <p>Message key used to retrieve the requested message
50       */
51      private String key = null;
52  
53      public void setKey(String key) {
54          this.key = key;
55      }
56  
57  
58      // ------------------------------------------------------------- Tag Methods
59  
60  
61      /***
62       * <p>Release any allocated resources.
63       */
64      public void release() {
65  
66          super.release();
67          filter = null;
68          key = null;
69  
70      }
71  
72  
73      // ---------------------------------------------------------- Public Methods
74  
75  
76      /***
77       * <p>Return the type of component to be created for this tag.</p>
78       */
79      public String getComponentType() {
80  
81          return ("org.apache.struts.faces.Message");
82  
83      }
84  
85  
86      /***
87       * <p>Return the <code>rendererType</code> to be used for rendering
88       * our component.</p>
89       */
90      public String getRendererType() {
91  
92          return ("org.apache.struts.faces.Message");
93  
94      }
95  
96  
97      // ------------------------------------------------------- Protected Methods
98  
99  
100     /***
101      * <p>Override attributes set on this tag instance.</p>
102      *
103      * @param component Component whose attributes should be overridden
104      */
105     protected void setProperties(UIComponent component) {
106 
107         super.setProperties(component);
108         setBooleanAttribute(component, "filter", filter);
109         setStringAttribute(component, "key", key);
110 
111     }
112 
113 
114 }