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.custom.navmenu.jscookmenu;
20  
21  import javax.faces.component.UICommand;
22  
23  import org.apache.myfaces.component.LibraryLocationAware;
24  import org.apache.myfaces.component.LocationAware;
25  import org.apache.myfaces.component.UserRoleAware;
26  import org.apache.myfaces.component.UserRoleUtils;
27  
28  /**
29   * Renders a Javascript Menu. Nested NavigationMenuItem(s) are rendered 
30   * as Javascript Menu. 
31   *
32   * <p>
33   * This component is based based on the excellent
34   * <a href="http://jscook.sourceforge.net/JSCookMenu">JSCookMenu</a>
35   * by Heng Yuan.
36   * </p>
37   * 
38   * Unless otherwise specified, all attributes accept static values or EL expressions.
39   * 
40   * @JSFComponent
41   *   name = "t:jscookMenu"
42   *   class = "org.apache.myfaces.custom.navmenu.jscookmenu.HtmlCommandJSCookMenu"
43   *   tagClass = "org.apache.myfaces.custom.navmenu.jscookmenu.HtmlJSCookMenuTag"
44   * 
45   * @JSFJspProperty name = "value" tagExcluded = "true"
46   * @JSFJspProperty name = "actionListener" tagExcluded = "true"
47   * @JSFJspProperty name = "action" tagExcluded = "true"
48   * @since 1.1.7
49   * @author Thomas Spiegl (latest modification by $Author: lu4242 $)
50   * @version $Revision: 691856 $ $Date: 2008-09-03 21:40:30 -0500 (miƩ, 03 sep 2008) $
51   */
52  public abstract class AbstractHtmlCommandJSCookMenu
53      extends UICommand
54      implements UserRoleAware, LocationAware, LibraryLocationAware
55  {
56      //private static final Log log = LogFactory.getLog(HtmlCommandJSCookMenu.class);
57  
58      public static final String COMPONENT_TYPE = "org.apache.myfaces.JSCookMenu";
59      public static final String COMPONENT_FAMILY = "javax.faces.Command";
60      private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.JSCookMenu";
61      
62      /**
63       * @JSFProperty
64       *   required = "true"
65       */
66      public abstract String getLayout();
67  
68      /**
69       * @JSFProperty
70       *   required = "true"
71       */
72      public abstract String getTheme();
73  
74      public boolean isRendered()
75      {
76          if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
77          return super.isRendered();
78      }
79  
80  }