This repository was archived by the owner on Nov 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
PrimeFaces: Menu & Breadcrumb
pinguet62 edited this page Oct 26, 2014
·
1 revision
This class is used to generate dynamically the Breadcrumb.
The MenuManagedBean need a Spring bean of type org.springframework.context.MessageSource named messageSource to translate text.
The messages can be translated with the method String getMessage(String key). An exception is thrown if no message exists for the key.
The Managed Bean need to extends the abstract class AbstractMenuManagedBean and implement the initMenu() method to initialize the menu model.
@ManagedBean
@RequestScoped
public class MenuManagedBean extends AbstractMenuManagedBean {
@Override
protected DefaultMenuItem getHome() {
DefaultMenuItem home = new DefaultMenuItem(getMessage("menubar.index"));
home.setOutcome("index");
home.setIcon("ui-icon-home");
return home;
}
@Override
protected void initMenu() {
model.addElement(home);
DefaultMenuItem item = new DefaultMenuItem(
getMessage("menubar.administration.users"));
item.setOutcome("users");
item.setIcon("ui-icon-person");
model.addElement(item);
}
}