org.zeroexchange.web.navigation.menu
Class DefaultMenuService

java.lang.Object
  extended by org.zeroexchange.web.navigation.menu.DefaultMenuService
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, MenuService

public class DefaultMenuService
extends Object
implements MenuService, org.springframework.beans.factory.InitializingBean

Author:
black

Constructor Summary
DefaultMenuService()
           
 
Method Summary
 void afterPropertiesSet()
          
 List<MenuItem> filterAccordingPermissions(List<MenuItem> items)
          Filters specified list according current user's permissions.
protected  MenuItem findItemByKey(List<MenuItem> items, String key)
          Finds item by the key
 String getImage(MenuItem menuItem)
          Safely returns the menu image.
 String getKey(MenuItem menuItem)
          Safely returns the menu key.
 List<MenuItem> getSubmenu(String key)
          Returns submenu of the current menu.
 String getTitle(MenuItem menuItem)
          Returns the title of the menu item.
 List<MenuItem> getTopItems()
          Returns top menu items.
protected  boolean isMenuItemAllowed(MenuItem menuItem)
          Returns true if the menu item is allowed for the current user.
 void setImageExtension(String imageExtension)
           
 void setMenuDescriptionResource(org.springframework.core.io.Resource menuDescriptionResource)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMenuService

public DefaultMenuService()
Method Detail

setImageExtension

public void setImageExtension(String imageExtension)
Parameters:
imageExtension - the imageExtension to set

setMenuDescriptionResource

public void setMenuDescriptionResource(org.springframework.core.io.Resource menuDescriptionResource)
Parameters:
menuDescriptionResource - the menuDescriptionResource to set.

filterAccordingPermissions

public List<MenuItem> filterAccordingPermissions(List<MenuItem> items)
Description copied from interface: MenuService
Filters specified list according current user's permissions.

Specified by:
filterAccordingPermissions in interface MenuService

getTopItems

public List<MenuItem> getTopItems()
Description copied from interface: MenuService
Returns top menu items.

Specified by:
getTopItems in interface MenuService

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

getSubmenu

public List<MenuItem> getSubmenu(String key)
Description copied from interface: MenuService
Returns submenu of the current menu.

Specified by:
getSubmenu in interface MenuService

findItemByKey

protected MenuItem findItemByKey(List<MenuItem> items,
                                 String key)
Finds item by the key


isMenuItemAllowed

protected boolean isMenuItemAllowed(MenuItem menuItem)
Returns true if the menu item is allowed for the current user.


getKey

public String getKey(MenuItem menuItem)
Safely returns the menu key.

Specified by:
getKey in interface MenuService

getImage

public String getImage(MenuItem menuItem)
Description copied from interface: MenuService
Safely returns the menu image.

Specified by:
getImage in interface MenuService

getTitle

public String getTitle(MenuItem menuItem)
Description copied from interface: MenuService
Returns the title of the menu item.

Specified by:
getTitle in interface MenuService


Copyright © 2013. All Rights Reserved.