本文整理汇总了Java中org.primefaces.model.menu.DefaultMenuModel类的典型用法代码示例。如果您正苦于以下问题:Java DefaultMenuModel类的具体用法?Java DefaultMenuModel怎么用?Java DefaultMenuModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultMenuModel类属于org.primefaces.model.menu包,在下文中一共展示了DefaultMenuModel类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMenu
import org.primefaces.model.menu.DefaultMenuModel; //导入依赖的package包/类
private Menu createMenu(String widgetId, String widgetType) {
Menu menu = (Menu) JSFHelper.createComponent(Menu.COMPONENT_TYPE);
DefaultMenuModel menuModel = new DefaultMenuModel();
DefaultMenuItem editItem = new DefaultMenuItem("Edit");
editItem.setCommand("#{ideController.editWidget('" + widgetId + "')}");
editItem.setAjax(true);
editItem.setImmediate(true);
editItem.setOncomplete("PF('" + widgetType + "Dialog').show();");
editItem.setUpdate(":" + widgetType + "Form:" + widgetType + "Dialog");
DefaultMenuItem deleteItem = new DefaultMenuItem("Delete");
deleteItem.setCommand("#{ideController.deleteWidget('" + widgetId + "')}");
deleteItem.setAjax(true);
deleteItem.setImmediate(true);
menuModel.addElement(editItem);
menuModel.addElement(deleteItem);
menu.setModel(menuModel);
return menu;
}
示例2: getMenuItems
import org.primefaces.model.menu.DefaultMenuModel; //导入依赖的package包/类
/**
*
* @return
*/
public MenuModel getMenuItems(){
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
Map<String,String> request = externalContext.getRequestParameterMap();
String groupId = request.get("g");
MenuModel model = new DefaultMenuModel();
DefaultSubMenu submenu = new DefaultSubMenu();
submenu.setId("influencersMenu");
List<GroupRating> groups = getGroupsRating();
if(groups.size()>0){
groups = groups.subList(3, groups.size());
groups.stream().forEach((group) -> {
String displayValue = group.getGroupName() + " ("+group.getRatio()+")";
DefaultMenuItem item = new DefaultMenuItem();
item.setValue(displayValue);
item.setId(group.getGroupId());
item.setUrl("/groupTop20.xhtml?g="+ group.getGroupId());
item.setStyle("font-size:12px;");
if(group.getGroupId().equals(groupId)){
item.setStyle("color:red;font-size:12px;");
}
submenu.addElement(item);
});
model.addElement(submenu);
}
return model;
}
示例3: init
import org.primefaces.model.menu.DefaultMenuModel; //导入依赖的package包/类
@PostConstruct
public void init(){
this.listarMenu();
model = new DefaultMenuModel();
this.establecerPermisos();
}
示例4: getMenuBar
import org.primefaces.model.menu.DefaultMenuModel; //导入依赖的package包/类
public DefaultMenuModel getMenuBar() {
return menuBar;
}
示例5: setMenuBar
import org.primefaces.model.menu.DefaultMenuModel; //导入依赖的package包/类
public void setMenuBar(DefaultMenuModel menuBar) {
this.menuBar = menuBar;
}
示例6: init
import org.primefaces.model.menu.DefaultMenuModel; //导入依赖的package包/类
@PostConstruct
public void init() {
menubar = new DefaultMenuModel();
DefaultMenuItem menuItemDashboard = new DefaultMenuItem();
menuItemDashboard.setUrl("dashboard.xhtml");
menuItemDashboard.setValue("Dashboard");
menubar.addElement(menuItemDashboard);
DefaultSubMenu subMenuChecks = new DefaultSubMenu();
subMenuChecks.setLabel("Checks");
DefaultMenuItem menuItemUncategorizedChecks = new DefaultMenuItem();
menuItemUncategorizedChecks.setUrl("checks.xhtml");
menuItemUncategorizedChecks.setValue("Uncategorized");
subMenuChecks.addElement(menuItemUncategorizedChecks);
for (Page page : pageService.findAll()) {
DefaultMenuItem menuItemDynamicPage = new DefaultMenuItem();
menuItemDynamicPage.setUrl("checks.xhtml?page=" + page.getId());
menuItemDynamicPage.setValue(page.getName());
subMenuChecks.addElement(menuItemDynamicPage);
}
menubar.addElement(subMenuChecks);
DefaultMenuItem menuItemPages = new DefaultMenuItem();
menuItemPages.setUrl("pages.xhtml");
menuItemPages.setValue("Manage pages");
menubar.addElement(menuItemPages);
DefaultMenuItem menuItemConfiguration = new DefaultMenuItem();
menuItemConfiguration.setUrl("configuration.xhtml");
menuItemConfiguration.setValue("Configuration");
menubar.addElement(menuItemConfiguration);
DefaultMenuItem menuItemLogout = new DefaultMenuItem();
menuItemLogout.setUrl("../logout");
menuItemLogout.setValue("Logout");
menubar.addElement(menuItemLogout);
}