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.HtmlCommandLink;
23  import org.apache.myfaces.shared_tomahawk.taglib.html.HtmlCommandLinkTagBase;
24  
25  import javax.faces.component.UIComponent;
26  
27  /**
28   * @author Manfred Geiler (latest modification by $Author: grantsmith $)
29   * @version $Revision: 564616 $ $Date: 2007-08-10 10:22:19 -0500 (Fri, 10 Aug 2007) $
30   */
31  public class HtmlCommandLinkTag
32          extends HtmlCommandLinkTagBase
33  {
34      //private static final Log log = LogFactory.getLog(HtmlCommandLinkTag.class);
35  
36      public String getComponentType()
37      {
38          return HtmlCommandLink.COMPONENT_TYPE;
39      }
40  
41      public String getRendererType()
42      {
43          return HtmlCommandLink.DEFAULT_RENDERER_TYPE;
44      }
45  
46  
47      // User Role support
48      private String _enabledOnUserRole;
49      private String _visibleOnUserRole;
50  
51      private String _actionFor;
52      private String _disabled;
53      private String _disabledStyle;
54      private String _disabledStyleClass;
55  
56      public void release() {
57          super.release();
58  
59          _enabledOnUserRole=null;
60          _visibleOnUserRole=null;
61          _actionFor = null;
62          _disabled = null;
63          _disabledStyle = null;
64          _disabledStyleClass = null;
65      }
66  
67      protected void setProperties(UIComponent component)
68      {
69          super.setProperties(component);
70          setStringProperty(component, UserRoleAware.ENABLED_ON_USER_ROLE_ATTR, _enabledOnUserRole);
71          setStringProperty(component, UserRoleAware.VISIBLE_ON_USER_ROLE_ATTR, _visibleOnUserRole);
72          setStringProperty(component, "actionFor", _actionFor);
73          setBooleanProperty(component, "disabled", _disabled);
74          setStringProperty(component, "disabledStyle",_disabledStyle);
75          setStringProperty(component, "disabledStyleClass",_disabledStyleClass);
76      }
77  
78  
79      public void setEnabledOnUserRole(String enabledOnUserRole)
80      {
81          _enabledOnUserRole = enabledOnUserRole;
82      }
83  
84      public void setVisibleOnUserRole(String visibleOnUserRole)
85      {
86          _visibleOnUserRole = visibleOnUserRole;
87      }
88  
89      public void setActionFor(String actionFor)
90      {
91          _actionFor = actionFor;
92      }
93  
94      public void setDisabled(String disabled)
95      {
96          _disabled = disabled;
97      }
98  
99      public void setDisabledStyle(String disabledStyle)
100     {
101         _disabledStyle = disabledStyle;
102     }
103 
104     public void setDisabledStyleClass(String disabledStyleClass)
105     {
106         _disabledStyleClass = disabledStyleClass;
107     }
108 }