当前位置: 首页>>代码示例>>Java>>正文


Java MenuItem.addItem方法代码示例

本文整理汇总了Java中com.vaadin.ui.MenuBar.MenuItem.addItem方法的典型用法代码示例。如果您正苦于以下问题:Java MenuItem.addItem方法的具体用法?Java MenuItem.addItem怎么用?Java MenuItem.addItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vaadin.ui.MenuBar.MenuItem的用法示例。


在下文中一共展示了MenuItem.addItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildUserMenu

import com.vaadin.ui.MenuBar.MenuItem; //导入方法依赖的package包/类
private Component buildUserMenu(final UiProperties uiProperties) {
    final MenuBar settings = new MenuBar();
    settings.addStyleName("user-menu");
    settings.setHtmlContentAllowed(true);

    final MenuItem settingsItem = settings.addItem("", getImage(uiProperties.isGravatar()), null);

    final String formattedTenant = UserDetailsFormatter.formatCurrentTenant();
    if (!StringUtils.isEmpty(formattedTenant)) {
        settingsItem.setText(formattedTenant);
        UserDetailsFormatter.getCurrentTenant().ifPresent(tenant -> settingsItem.setDescription(i18n
                .getMessage("menu.user.description", tenant, UserDetailsFormatter.getCurrentUser().getUsername())));
    } else {
        settingsItem.setText("...");
    }

    settingsItem.setStyleName("user-menuitem");

    final String logoutUrl = generateLogoutUrl();

    settingsItem.addItem("Sign Out", selectedItem -> Page.getCurrent().setLocation(logoutUrl));
    return settings;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:24,代码来源:DashboardMenu.java

示例2: initApplicationMenuBar

import com.vaadin.ui.MenuBar.MenuItem; //导入方法依赖的package包/类
/**
 * Inits the application menu bar.
 *
 * @param menuBar
 *            the menu bar
 */
protected final void initApplicationMenuBar(final MenuBar menuBar) {
	menuBar.removeItems();
	menuBar.setWidth(MENU_BAR_WIDTH);
	menuBar.setStyleName(HEADER_STYLE_NAME);
	final MenuItem mainViewItem = menuBar.addItem(APPLICATION, VaadinIcons.SERVER, null);

	mainViewItem.addItem(START_TEXT, VaadinIcons.STAR, COMMAND_MAINVIEW_OVERVIEW);

	final MenuItem mainItem = mainViewItem.addItem(MAIN, VaadinIcons.STAR, null);

	mainItem.addItem(PAGE_VISIT_HISTORY_TEXT, VaadinIcons.LINE_CHART, COMMAND_MAINVIEW_PAGEVISITHISTORY);


	if (UserContextUtil.allowRoleInSecurityContext(ROLE_ADMIN) || UserContextUtil.allowRoleInSecurityContext(ROLE_USER)) {
		mainViewItem.addItem(USERHOME, VaadinIcons.USER,COMMAND_USERHOME);
		createAdminMenu(mainViewItem);
		mainViewItem.addItem(LOGOUT, VaadinIcons.SIGN_OUT, COMMAND_LOGOUT);
	} else {
		mainViewItem.addItem(LOGIN, VaadinIcons.SIGN_IN, COMMAND_LOGIN);
		mainViewItem.addItem(REGISTER, VaadinIcons.FILE_ADD, COMMAND_REGISTER);
	}

}
 
开发者ID:Hack23,项目名称:cia,代码行数:30,代码来源:AbstractMenuItemFactoryImpl.java

示例3: addSourcesAndIndicatorsToMenu

import com.vaadin.ui.MenuBar.MenuItem; //导入方法依赖的package包/类
/**
 * Adds the sources and indicators to menu.
 *
 * @param countryIndicators
 *            the country indicators
 * @param sourceIndicatorMap
 *            the source indicator map
 */
private static void addSourcesAndIndicatorsToMenu(final MenuItem countryIndicators,
		final Map<String, List<ViewWorldbankIndicatorDataCountrySummary>> sourceIndicatorMap) {

	final Map<String, List<ViewWorldbankIndicatorDataCountrySummary>> sortedIndicatorMap = sourceIndicatorMap
			.entrySet().stream().sorted((e1, e2) -> e1.getKey().compareTo(e2.getKey()))
			.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));

	for (final Entry<String, List<ViewWorldbankIndicatorDataCountrySummary>> entry : sortedIndicatorMap
			.entrySet()) {

		final MenuItem sourceItems = countryIndicators.addItem(entry.getKey(), null, null);

		final List<ViewWorldbankIndicatorDataCountrySummary> sortedEntries = entry.getValue().stream()
				.sorted((e1, e2) -> e1.getIndicatorName().compareTo(e2.getIndicatorName()))
				.collect(Collectors.toList());

		for (final ViewWorldbankIndicatorDataCountrySummary indciatorSummary : sortedEntries) {
			sourceItems.addItem(indciatorSummary.getIndicatorName(),
					new PageModeMenuCommand(UserViews.COUNTRY_RANKING_VIEW_NAME, PageMode.INDICATORS,
							indciatorSummary.getEmbeddedId().getIndicatorId()));
		}
	}

}
 
开发者ID:Hack23,项目名称:cia,代码行数:33,代码来源:CountryMenuItemFactoryImpl.java

示例4: createMenuItem

import com.vaadin.ui.MenuBar.MenuItem; //导入方法依赖的package包/类
/**
 * @param actionGroup
 * @param menuItemByGroupName
 * @return
 */
private MenuItem createMenuItem(JNActionGroup actionGroup, Map<String, MenuItem> menuItemByGroupName) {
	MenuItem menuItem = null;
	MenuItem parentItem = null;
	if (StringHelper.isNotEmptyWithTrim(actionGroup.parent())) {
		parentItem = menuItemByGroupName.get(actionGroup.parent());

		if (parentItem == null) {
			JNActionGroup parentActionGroup = actionGroupByName.get(actionGroup.parent());
			if (parentActionGroup != null) {
				parentItem = createMenuItem(parentActionGroup, menuItemByGroupName);
				menuItemByGroupName.put(parentActionGroup.name(), parentItem);
			}
		}
	}

	menuItem = parentItem == null ? menuBar.addItem(actionGroup.name(), null) : parentItem.addItem(actionGroup.name(), null);
	findNAddIcon(actionGroup.icon(), menuItem);

	if (StringHelper.isNotEmptyWithTrim(actionGroup.description()))
		menuItem.setDescription(actionGroup.description());

	if (StringHelper.isNotEmptyWithTrim(actionGroup.style()))
		menuItem.setStyleName(actionGroup.style());
	return menuItem;
}
 
开发者ID:lkumarjain,项目名称:jain-I18n,代码行数:31,代码来源:ActionMenuBar.java

示例5: processAction

import com.vaadin.ui.MenuBar.MenuItem; //导入方法依赖的package包/类
/**
 * @param parentItem
 * @param first
 * @param style
 * @param i
 * @param action
 * @return
 */
private MenuItem processAction(MenuItem parentItem, String first, String style, int i, JNAction action) {
	MenuItem lastItem;
	lastItem = parentItem == null ? menuBar.addItem(actionsToName.get(action), listener) : parentItem.addItem(actionsToName.get(action), listener);

	findNAddIcon(action.icon(), lastItem);
	lastItem.setVisible(validatePermission (action));

	if (StringHelper.isNotEmptyWithTrim(action.description()))
		lastItem.setDescription(action.description());
	else
		lastItem.setDescription(actionsToName.get(action));

	if (i == 0)
		lastItem.setStyleName(first);
	else 
		lastItem.setStyleName(style);

	if (action.separator() && parentItem != null) {
		parentItem.addSeparator();
	}
	return lastItem;
}
 
开发者ID:lkumarjain,项目名称:jain-I18n,代码行数:31,代码来源:ActionMenuBar.java

示例6: addMenuItems

import com.vaadin.ui.MenuBar.MenuItem; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected void addMenuItems(MenuItem subMenu, Map<String, Object> value) {
    
    Set<Entry<String, Object>> sortedEntrySet = getSortedSubmenuGroup(subMenu.getText(), value);
    for(Entry<String, Object> entry : sortedEntrySet) {
        String commandKey = entry.getKey();
        if(entry.getValue() instanceof Map) {
            MenuBar.MenuItem subMenuItem = subMenu.addItem(commandKey, null);
            addMenuItems(subMenuItem, (Map<String, Object>) entry.getValue());
        }else {
            if(commandKey.startsWith("separator")) {
                subMenu.addSeparator();
            }else {
                subMenu.addItem(removeLabelProperties(commandKey), (Command) entry.getValue());
            }
        }
        
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:20,代码来源:MenuBarBuilder.java

示例7: appendStructureMenu

import com.vaadin.ui.MenuBar.MenuItem; //导入方法依赖的package包/类
public void appendStructureMenu(MenuItem parent){
	MenuItem structureMenu=parent.addItem("Add structure", null);

	for(String superclass:CoreDictionary.getSuperclasses()){
		MenuItem superClassMenu=structureMenu.addItem(superclass,null);
		for(final CoreType t:CoreDictionary.getCores(superclass)){
			superClassMenu.addItem(t.getName(), new Command(){
				private static final long serialVersionUID=-148395291969656325L;

				@Override
				public void menuSelected(MenuItem selectedItem) {
					theCanvas.addSequenceByName(t.getName());
				}
			});
		}
	}
	
	createAddResidueMenu(parent);
	createInsertResidueMenu(parent);
	createChangeResidueMenu(parent);
	createTerminalMenu(parent);
}
 
开发者ID:alternativeTime,项目名称:GlycanBuilderVaadin7Version,代码行数:23,代码来源:VaadinGlycanCanvas.java

示例8: createAddResidueMenu

import com.vaadin.ui.MenuBar.MenuItem; //导入方法依赖的package包/类
public void createAddResidueMenu(MenuItem parent) {
	String notation=theCanvas.getWorkspace().getGlycanRenderer().getGraphicOptions().NOTATION;
	
	MenuItem structureMenu=parent.addItem("Add residue", null);

	for (String superclass : ResidueDictionary.getSuperclasses()) {
		MenuItem superClassMenu=structureMenu.addItem(superclass,null);
		for (ResidueType t : ResidueDictionary.getResidues(superclass)) {
			if (t.canHaveParent()){
				superClassMenu.addItem(t.getName(), new Command(){
					private static final long serialVersionUID=4750928193466060500L;

					@Override
					public void menuSelected(MenuItem selectedItem) {
						theCanvas.addResidueByNameToSelected(selectedItem.getText());
					}		
				}).setIcon(new ThemeResource("icons"+File.separator+"residues"+File.separator+notation+File.separator+t.getName()+".png"));
			}		
		}
		
		if(superClassMenu.getChildren()==null){
			structureMenu.removeChild(superClassMenu);
		}
	}
}
 
开发者ID:alternativeTime,项目名称:GlycanBuilderVaadin7Version,代码行数:26,代码来源:VaadinGlycanCanvas.java

示例9: createChangeResidueMenu

import com.vaadin.ui.MenuBar.MenuItem; //导入方法依赖的package包/类
private void createChangeResidueMenu(MenuItem parent) {
	MenuItem structureMenu=parent.addItem("Change residue", null);

	String notation=theCanvas.getWorkspace().getGlycanRenderer().getGraphicOptions().NOTATION;
	
	for (String superclass : ResidueDictionary.getSuperclasses()) {
		MenuItem superClassMenu=structureMenu.addItem(superclass,null);
		for (ResidueType t : ResidueDictionary.getResidues(superclass)){
			superClassMenu.addItem(t.getName(), new Command(){
				private static final long serialVersionUID=-7886271503255704127L;

				@Override
				public void menuSelected(MenuItem selectedItem) {
					theCanvas.changeSelectedToResidueByName(selectedItem.getText());
				}
			}).setIcon(new ThemeResource("icons"+File.separator+"residues"+File.separator+notation+File.separator+t.getName()+".png"));
		}
		if(superClassMenu.getChildren()==null){
			structureMenu.removeChild(superClassMenu);
		}
	}
	
	structureMenu.setEnabled(false);
	menuItemsWithResidueSelectionDependency.add(structureMenu);
}
 
开发者ID:alternativeTime,项目名称:GlycanBuilderVaadin7Version,代码行数:26,代码来源:VaadinGlycanCanvas.java

示例10: getMenuItem

import com.vaadin.ui.MenuBar.MenuItem; //导入方法依赖的package包/类
/**
 * Searches for a menu item. If it doesn't exist it will be created.
 * 
 * @param parentItem
 * @param displayName
 * @param currentPath
 * @return
 */
private MenuItem getMenuItem(MenuItem parentItem, final String displayName) // ,
																			// String
																			// currentPath)
{
	MenuItem currentItem = findMenuItem(parentItem.getChildren(), displayName);

	if (currentItem == null)
	{
		currentItem = parentItem.addItem(displayName, null);
	}
	// if (currentItem != null)
	// {
	// currentItem = parentItem.addItem(menuName, new MenuBar.Command()
	// {
	// private static final long serialVersionUID = 1L;
	//
	// public void menuSelected(MenuItem selectedItem)
	// {
	// UI.getCurrent().getNavigator().navigateTo(menuName);
	// }
	// });
	//
	// }
	return currentItem;
}
 
开发者ID:rlsutton1,项目名称:VaadinUtils,代码行数:34,代码来源:MenuBuilder.java

示例11: extendMenu

import com.vaadin.ui.MenuBar.MenuItem; //导入方法依赖的package包/类
@Override
public void extendMenu(MenuBar menuBar, SharedProject project) {

	Command commit = createCommitCommand();
	Command github = createGitHubCommand();
	
	MenuItem gitItem = menuBar.addItem("Git", null);

	if (commit != null) {
		gitItem.addItem("Commit", commit);
	}
	
	if (github != null) {
		gitHubItem = gitItem.addItem("GitHub", github);
		gitHubItem.setIcon(new ClassResource("/org/vaadin/addon/oauthpopupbuttons/icons/github16.png"));
		gitHubItem.setEnabled(repo.hasCommit());
	}
}
 
开发者ID:ahn,项目名称:mideaas,代码行数:19,代码来源:GitPlugin.java

示例12: addVariousThemes

import com.vaadin.ui.MenuBar.MenuItem; //导入方法依赖的package包/类
private void addVariousThemes(MenuItem parent) {

		parent.addItem("Dark", getCommandObject("dark"));
		parent.addItem("Facebook", getCommandObject("facebook"));
		parent.addItem("Flat", getCommandObject("flat"));
		parent.addItem("Flat Dark", getCommandObject("flatdark"));
		parent.addItem("Metro", getCommandObject("Metro"));
		parent.addItem("Blue Print", getCommandObject("blueprint"));
		parent.addItem("Light", getCommandObject("light"));
	}
 
开发者ID:KrishnaPhani,项目名称:KrishnasSpace,代码行数:11,代码来源:HomeView.java

示例13: createDocumentsMenuBar

import com.vaadin.ui.MenuBar.MenuItem; //导入方法依赖的package包/类
@Override
public void createDocumentsMenuBar(final MenuBar menuBar) {
	initApplicationMenuBar(menuBar);

	applicationMenuItemFactory.addRankingMenu(menuBar);
	final MenuItem documentsItem = menuBar.addItem(DOCUMENTS, VaadinIcons.FILE, null);
	documentsItem.addItem("List all",VaadinIcons.GROUP, COMMAND_DOCUMENTS);
	documentsItem.addItem("Search Documents",VaadinIcons.GROUP, COMMAND_SEARCH_DOCUMENT);

}
 
开发者ID:Hack23,项目名称:cia,代码行数:11,代码来源:DocumentMenuItemFactoryImpl.java

示例14: createPartyRankingTopics

import com.vaadin.ui.MenuBar.MenuItem; //导入方法依赖的package包/类
@Override
public void createPartyRankingTopics(final MenuItem partynMenuItem) {

	partynMenuItem.addItem(OVERVIEW_TEXT, VaadinIcons.GROUP,
			COMMAND_OVERVIEW);

	final MenuItem listByTopic = partynMenuItem.addItem(RANKING_LIST_BY_TOPIC_TEXT, VaadinIcons.GROUP, null);

	final MenuItem listItem = listByTopic.addItem(TOTAL_MEMBERS,VaadinIcons.GROUP,
			COMMAND_DATAGRID);
	listItem.setDescription(PARTY_BY_TOTAL_MEMBERS_BASED_ON_ROLES_IN_DEPARTMENTS_COMMITTEES_AND_PARLIAMENT);

	final MenuItem chartByTopic = partynMenuItem.addItem(CHART_BY_TOPIC_TEXT, VaadinIcons.GROUP, null);


	chartByTopic.addItem(CURRENT_PARTIES_ACTIVE_IN_MINISTRIES_HEAD_COUNT_TEXT,VaadinIcons.GROUP,
			COMMAND_CHARTS_CURRENT_GOVERNMENT_PARTIES);

	chartByTopic.addItem(CURRENT_PARTIES_ACTIVE_IN_COMMITTEES_HEAD_COUNT,VaadinIcons.GROUP,
			COMMAND_CHARTS_CURRENT_COMMITTEES);

	chartByTopic.addItem(CURRENT_PARTIES_ACTIVE_IN_PARLIAMENT_HEAD_COUNT,VaadinIcons.GROUP,
			COMMAND_CHARTS_CURRENT_PARTIES);
	chartByTopic.addItem(ALL_PARTIES_TOTAL_DAYS_SERVED_IN_PARLIAMENT,VaadinIcons.GROUP,
			COMMAND_CHARTS_ALL_PARTIES);

	partynMenuItem.addItem(PAGE_VISIT_HISTORY_TEXT, VaadinIcons.GROUP,
			COMMAND_PAGEVISITHISTORY);
}
 
开发者ID:Hack23,项目名称:cia,代码行数:30,代码来源:PartyRankingMenuItemFactoryImpl.java

示例15: initSortMenu

import com.vaadin.ui.MenuBar.MenuItem; //导入方法依赖的package包/类
protected void initSortMenu() {
  MenuBar menuBar = new MenuBar();
  menuBar.addStyleName(ExplorerLayout.STYLE_SEARCHBOX_SORTMENU);
  
  //TODO: Adding types of sorting manually and listener/events
  MenuItem rootItem = menuBar.addItem("Sort by", null);
  rootItem.addItem("Id", null);
  rootItem.addItem("Name", null);
  rootItem.addItem("Due date", null);
  rootItem.addItem("Creation date", null);
  
  layout.addComponent(menuBar);
  layout.setComponentAlignment(menuBar, Alignment.MIDDLE_RIGHT);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:15,代码来源:TaskListHeader.java


注:本文中的com.vaadin.ui.MenuBar.MenuItem.addItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。