Developer

Application Left Menus

Application left-menu items are specific to individual applications and pages.

Declare a Spring bean list of the possible left-menu options, for example:
 ...         
<util:list id="myLeftMenuList" value-type="java.util.LinkedList" list-class="java.util.LinkedList">       
<bean id="myLeftMenu1" 
class="com.sybase365.mobiliser.util.tools.wicketutils.menu.MenuEntry">       
<property name="name" value="dashboard.leftmenu.home.1" />       
<property name="page" value="com.sybase365.mobiliser.web.dashboard.pages.home.MyFirstPage"/>       
<property name="privilege" value="UI_DASHBOARD_LOGIN" />     
</bean> 
               
<bean id="myLeftMenu2" 
class="com.sybase365.mobiliser.util.tools.wicketutils.menu.MenuEntry">       
<property name="name" value="dashboard.leftmenu.home.2" />      
<property name="page" value="com.sybase365.mobiliser.web.dashboard.pages.home.MySecondPage"/>       
<property name="privilege" value="UI_DASHBOARD_PREFS" />     
</bean>     
</util:list>   
... 
The left menu list bean is injected into the page where the menus are relevant and used to build the left menu items.
 ...   
@AuthorizeInstantiation(Constants.PRIV_DASHBOARD_LOGIN)   
public class MyPagePage extends BaseDashboardPortalPage {       
private static final long serialVersionUID = 1L;       
@SpringBean(name = "myLeftMenuList")     
private LinkedList<IMenuEntry> myLeftMenu;       
public void setMyLeftMenu(LinkedList<IMenuEntry> myLeftMenu) {         
   this.myLeftMenu = myLeftMenu;    
}   
...      
@Override    public LinkedList<IMenuEntry> buildLeftMenu() {          
   LOG.debug("#buildLeftMenu()");          
   setActiveTopMenuByName("top.menu.dashboard.mymenu");           
   return this.myLeftMenu;     }   
...