KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > taglib > html > ext > HtmlMessagesTag


1 /*
2  * Copyright 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 package org.apache.myfaces.taglib.html.ext;
17
18 import org.apache.myfaces.component.UserRoleAware;
19 import org.apache.myfaces.component.html.ext.HtmlMessages;
20 import org.apache.myfaces.taglib.html.HtmlMessagesTagBase;
21
22 import javax.faces.component.UIComponent;
23
24
25 /**
26  * @author Manfred Geiler (latest modification by $Author: matzew $)
27  * @version $Revision: 1.10 $ $Date: 2005/02/18 17:19:29 $
28  * $Log: HtmlMessagesTag.java,v $
29  * Revision 1.10 2005/02/18 17:19:29 matzew
30  * added release() to tag clazzes.
31  *
32  * Revision 1.9 2005/01/22 19:47:44 mmarinschek
33  * Message rendering updated - if a validation exception needs to be rendered, the id of the component is replaced with a label.
34  *
35  * Revision 1.8 2004/10/13 11:50:59 matze
36  * renamed packages to org.apache
37  *
38  * Revision 1.7 2004/07/01 21:53:06 mwessendorf
39  * ASF switch
40  *
41  * Revision 1.6 2004/05/18 14:31:38 manolito
42  * user role support completely moved to components source tree
43  *
44  * Revision 1.5 2004/04/05 11:04:55 manolito
45  * setter for renderer type removed, no more default renderer type needed
46  *
47  * Revision 1.4 2004/04/01 14:34:23 manolito
48  * new globalSummaryFormat attribute
49  *
50  * Revision 1.3 2004/04/01 12:57:42 manolito
51  * additional extended component classes for user role support
52  *
53  */

54 public class HtmlMessagesTag
55         extends HtmlMessagesTagBase
56 {
57     //private static final Log log = LogFactory.getLog(HtmlOutputFormatTag.class);
58

59     public String JavaDoc getComponentType()
60     {
61         return HtmlMessages.COMPONENT_TYPE;
62     }
63
64     public String JavaDoc getRendererType()
65     {
66         return "org.apache.myfaces.Messages";
67     }
68
69     private String JavaDoc _summaryFormat;
70     private String JavaDoc _globalSummaryFormat;
71     private String JavaDoc _detailFormat;
72     private String JavaDoc _enabledOnUserRole;
73     private String JavaDoc _visibleOnUserRole;
74     private String JavaDoc _replaceIdWithLabel;
75     
76     public void release() {
77         super.release();
78
79         _summaryFormat=null;
80         _globalSummaryFormat=null;
81         _detailFormat=null;
82         _enabledOnUserRole=null;
83         _visibleOnUserRole=null;
84         _replaceIdWithLabel=null;
85     }
86
87     protected void setProperties(UIComponent component)
88     {
89         super.setProperties(component);
90
91         setStringProperty(component, "summaryFormat", _summaryFormat);
92         setStringProperty(component, "globalSummaryFormat", _globalSummaryFormat);
93         setStringProperty(component, "detailFormat", _detailFormat);
94         setStringProperty(component, UserRoleAware.ENABLED_ON_USER_ROLE_ATTR, _enabledOnUserRole);
95         setStringProperty(component, UserRoleAware.VISIBLE_ON_USER_ROLE_ATTR, _visibleOnUserRole);
96         setBooleanProperty(component, "replaceIdWithLabel",_replaceIdWithLabel==null?Boolean.TRUE.toString():_replaceIdWithLabel);
97     }
98
99     public void setSummaryFormat(String JavaDoc summaryFormat)
100     {
101         _summaryFormat = summaryFormat;
102     }
103
104     public void setGlobalSummaryFormat(String JavaDoc globalSummaryFormat)
105     {
106         _globalSummaryFormat = globalSummaryFormat;
107     }
108
109     public void setDetailFormat(String JavaDoc detailFormat)
110     {
111         _detailFormat = detailFormat;
112     }
113
114     public void setEnabledOnUserRole(String JavaDoc enabledOnUserRole)
115     {
116         _enabledOnUserRole = enabledOnUserRole;
117     }
118
119     public void setVisibleOnUserRole(String JavaDoc visibleOnUserRole)
120     {
121         _visibleOnUserRole = visibleOnUserRole;
122     }
123
124     public void setReplaceIdWithLabel(String JavaDoc replaceIdWithLabel)
125     {
126         _replaceIdWithLabel = replaceIdWithLabel;
127     }
128 }
129
Popular Tags