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.shared_tomahawk.component.DisplayValueOnlyCapable;
22  import org.apache.myfaces.component.UserRoleAware;
23  import org.apache.myfaces.component.html.ext.HtmlSelectOneMenu;
24  import org.apache.myfaces.shared_tomahawk.taglib.html.HtmlSelectMenuTagBase;
25  import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
26  
27  import javax.faces.component.UIComponent;
28  
29  /**
30   * @author Manfred Geiler (latest modification by $Author: skitching $)
31   * @version $Revision: 673833 $ $Date: 2008-07-03 16:58:05 -0500 (Thu, 03 Jul 2008) $
32   */
33  public class HtmlSelectOneMenuTag
34          extends HtmlSelectMenuTagBase
35  {
36      public String getComponentType()
37      {
38          return HtmlSelectOneMenu.COMPONENT_TYPE;
39      }
40  
41      public String getRendererType()
42      {
43          return HtmlSelectOneMenu.DEFAULT_RENDERER_TYPE;
44      }
45  
46      private String _escape;
47      private String _enabledOnUserRole;
48      private String _visibleOnUserRole;
49  
50      private String _displayValueOnly;
51      private String _displayValueOnlyStyle;
52      private String _displayValueOnlyStyleClass;
53  
54      public void release() {
55          super.release();
56          _escape=null;
57          _enabledOnUserRole=null;
58          _visibleOnUserRole=null;
59  
60          _displayValueOnly=null;
61          _displayValueOnlyStyle=null;
62          _displayValueOnlyStyleClass=null;
63      }
64  
65      protected void setProperties(UIComponent component)
66      {
67          super.setProperties(component);
68          setBooleanProperty(component, JSFAttr.ESCAPE_ATTR, _escape);
69          setStringProperty(component, UserRoleAware.ENABLED_ON_USER_ROLE_ATTR, _enabledOnUserRole);
70          setStringProperty(component, UserRoleAware.VISIBLE_ON_USER_ROLE_ATTR, _visibleOnUserRole);
71  
72          setBooleanProperty(component, DisplayValueOnlyCapable.DISPLAY_VALUE_ONLY_ATTR, _displayValueOnly);
73          setStringProperty(component, DisplayValueOnlyCapable.DISPLAY_VALUE_ONLY_STYLE_ATTR, _displayValueOnlyStyle);
74          setStringProperty(component, DisplayValueOnlyCapable.DISPLAY_VALUE_ONLY_STYLE_CLASS_ATTR, _displayValueOnlyStyleClass);
75      }
76  
77      public void setEscape(String escape)
78      {
79          _escape = escape;
80      }
81  
82      public void setEnabledOnUserRole(String enabledOnUserRole)
83      {
84          _enabledOnUserRole = enabledOnUserRole;
85      }
86  
87      public void setVisibleOnUserRole(String visibleOnUserRole)
88      {
89          _visibleOnUserRole = visibleOnUserRole;
90      }
91  
92      public void setDisplayValueOnly(String displayValueOnly)
93      {
94          _displayValueOnly = displayValueOnly;
95      }
96  
97      public void setDisplayValueOnlyStyle(String displayValueOnlyStyle)
98      {
99          _displayValueOnlyStyle = displayValueOnlyStyle;
100     }
101 
102     public void setDisplayValueOnlyStyleClass(String displayValueOnlyStyleClass)
103     {
104         _displayValueOnlyStyleClass = displayValueOnlyStyleClass;
105     }
106 }