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