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.HtmlCommandButton;
23  import org.apache.myfaces.shared_tomahawk.taglib.html.HtmlCommandButtonTagBase;
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 HtmlCommandButtonTag
32          extends HtmlCommandButtonTagBase
33  {
34      public String getComponentType()
35      {
36          return HtmlCommandButton.COMPONENT_TYPE;
37      }
38  
39      public String getRendererType()
40      {
41          return HtmlCommandButton.DEFAULT_RENDERER_TYPE;
42      }
43  
44      private String _enabledOnUserRole;
45      private String _visibleOnUserRole;
46      private String _actionFor;
47  
48      public void release() {
49          super.release();
50  
51          _enabledOnUserRole=null;
52          _visibleOnUserRole=null;
53          _actionFor=null;
54      }
55  
56      protected void setProperties(UIComponent component)
57      {
58          super.setProperties(component);
59          setStringProperty(component, UserRoleAware.ENABLED_ON_USER_ROLE_ATTR, _enabledOnUserRole);
60          setStringProperty(component, UserRoleAware.VISIBLE_ON_USER_ROLE_ATTR, _visibleOnUserRole);
61          setStringProperty(component, "actionFor", _actionFor);
62      }
63  
64      public void setEnabledOnUserRole(String enabledOnUserRole)
65      {
66          _enabledOnUserRole = enabledOnUserRole;
67      }
68  
69      public void setVisibleOnUserRole(String visibleOnUserRole)
70      {
71          _visibleOnUserRole = visibleOnUserRole;
72      }
73  
74      public void setActionFor(String actionFor)
75      {
76          _actionFor = actionFor;
77      }
78  
79  }