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  package org.apache.myfaces.taglib.html.ext;
20  
21  import org.apache.myfaces.component.UserRoleAware;
22  import org.apache.myfaces.component.html.ext.HtmlMessages;
23  import org.apache.myfaces.shared_tomahawk.taglib.html.HtmlMessagesTagBase;
24  
25  import javax.faces.component.UIComponent;
26  
27  
28  /**
29   * @author Manfred Geiler (latest modification by $Author: mkienenb $)
30   * @version $Revision: 523868 $ $Date: 2007-03-29 18:02:29 -0500 (Thu, 29 Mar 2007) $
31   */
32  public class HtmlMessagesTag
33          extends HtmlMessagesTagBase
34  {
35      //private static final Log log = LogFactory.getLog(HtmlOutputFormatTag.class);
36  
37      public String getComponentType()
38      {
39          return HtmlMessages.COMPONENT_TYPE;
40      }
41  
42      public String getRendererType()
43      {
44          return HtmlMessages.DEFAULT_RENDERER_TYPE;
45      }
46  
47      private String _summaryFormat;
48      private String _globalSummaryFormat;
49      private String _detailFormat;
50      private String _enabledOnUserRole;
51      private String _visibleOnUserRole;
52      private String _replaceIdWithLabel;
53      private String _forceSpan;
54  
55      public void release() {
56          super.release();
57  
58          _summaryFormat=null;
59          _globalSummaryFormat=null;
60          _detailFormat=null;
61          _enabledOnUserRole=null;
62          _visibleOnUserRole=null;
63          _replaceIdWithLabel=null;
64          _forceSpan = null;
65      }
66  
67      protected void setProperties(UIComponent component)
68      {
69          super.setProperties(component);
70  
71          setStringProperty(component, "summaryFormat", _summaryFormat);
72          setStringProperty(component, "globalSummaryFormat", _globalSummaryFormat);
73          setStringProperty(component, "detailFormat", _detailFormat);
74          setStringProperty(component, UserRoleAware.ENABLED_ON_USER_ROLE_ATTR, _enabledOnUserRole);
75          setStringProperty(component, UserRoleAware.VISIBLE_ON_USER_ROLE_ATTR, _visibleOnUserRole);
76          setBooleanProperty(component, "replaceIdWithLabel",_replaceIdWithLabel==null?Boolean.TRUE.toString():_replaceIdWithLabel);
77          setBooleanProperty(component, "forceSpan",_forceSpan ==null?Boolean.FALSE.toString():_forceSpan);
78      }
79  
80      public void setSummaryFormat(String summaryFormat)
81      {
82          _summaryFormat = summaryFormat;
83      }
84  
85      public void setGlobalSummaryFormat(String globalSummaryFormat)
86      {
87          _globalSummaryFormat = globalSummaryFormat;
88      }
89  
90      public void setDetailFormat(String detailFormat)
91      {
92          _detailFormat = detailFormat;
93      }
94  
95      public void setEnabledOnUserRole(String enabledOnUserRole)
96      {
97          _enabledOnUserRole = enabledOnUserRole;
98      }
99  
100     public void setVisibleOnUserRole(String visibleOnUserRole)
101     {
102         _visibleOnUserRole = visibleOnUserRole;
103     }
104 
105     public void setReplaceIdWithLabel(String replaceIdWithLabel)
106     {
107         _replaceIdWithLabel = replaceIdWithLabel;
108     }
109 
110     public void setForceSpan(String forceSpan)
111     {
112         _forceSpan = forceSpan;
113     }
114 }