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


Java MenuItem类代码示例

本文整理汇总了Java中com.extjs.gxt.ui.client.widget.menu.MenuItem的典型用法代码示例。如果您正苦于以下问题:Java MenuItem类的具体用法?Java MenuItem怎么用?Java MenuItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: buildReportsMenu

import com.extjs.gxt.ui.client.widget.menu.MenuItem; //导入依赖的package包/类
private void buildReportsMenu(MenuBar mainMenu)
{
    Menu reportsMenu = new Menu();
    List<Map<String, Object>> reports = getClientModel().getAvailableReports();
    for (final Map<String, Object> report : reports)
    {
        MenuItem menuItem = new MenuItem((String)report.get(Constants.I18N), new SelectionListener<MenuEvent>()
        {
            @Override
            public void componentSelected(MenuEvent ce)
            {
                displayReportDialog(report);
            }
        });
        reportsMenu.add(menuItem);
    }
    mainMenu.add(new MenuBarItem(textMessages.reports(), reportsMenu));
}
 
开发者ID:alfameCom,项目名称:salasanasiilo,代码行数:19,代码来源:WebPasswordSafe.java

示例2: buildFilterMenu

import com.extjs.gxt.ui.client.widget.menu.MenuItem; //导入依赖的package包/类
/**
 * Builds a new filter {@link MenuItem}.
 * 
 * @param label
 *          The menu label.
 * @param icon
 *          The menu icon, may be {@code null}.
 * @param filterListener
 *          The filter listener triggered when menu item is selected.
 * @param storeFilter
 *          The store filter instance, may be {@code null}.
 * @return The menu item component.
 */
private static <E extends AbstractModelDataEntityDTO<?>> MenuItem buildFilterMenu(final String label, final AbstractImagePrototype icon,
		final FilterSelectionListener<E> filterListener, final StoreFilter<E> storeFilter) {

	final MenuItem filterMenu = new MenuItem(label, icon);

	filterMenu.addSelectionListener(new SelectionListener<MenuEvent>() {

		@Override
		public void componentSelected(final MenuEvent ce) {
			if (filterListener != null) {
				filterListener.filter(filterMenu, storeFilter);
			}
		}
	});

	return filterMenu;
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:31,代码来源:ProjectDashboardView.java

示例3: GroupActionMenu

import com.extjs.gxt.ui.client.widget.menu.MenuItem; //导入依赖的package包/类
/**
 * Builds this menu.
 * 
 * @param view
 *          The view where this menu is displayed.
 * @param group
 *          The group managed by this menu.
 */
public GroupActionMenu(FlexTableView view, RowsGroup<?> group) {
	super(view);

	this.group = group;

	// Rename action.
	final MenuItem renameMenuItem = createRenameAction();

	// Menu.
	menu.add(renameMenuItem);

	// Remove action.
	final MenuItem removeMenuItem = createRemoveAction();

	// Add remove menu
	menu.add(removeMenuItem);
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:26,代码来源:GroupActionMenu.java

示例4: MenuAction

import com.extjs.gxt.ui.client.widget.menu.MenuItem; //导入依赖的package包/类
/**
 * Builds this action.
 */
public MenuAction() {

	item = new MenuItem(getText(), getIcon());

	// Action.
	item.addListener(Events.Select, new Listener<BaseEvent>() {

		@Override
		public void handleEvent(BaseEvent be) {
			perform();
		}
	});

	// Defines the default policy.
	inactivationPolicy = InactivationPolicy.DISABLE_POLICY;
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:20,代码来源:MenuAction.java

示例5: createLastLoginDateItem

import com.extjs.gxt.ui.client.widget.menu.MenuItem; //导入依赖的package包/类
/**
 * Creates the last login info entry on the start menu.
 * @param startMenu The start menu to add the entry to.
 */
private void createLastLoginDateItem(StartMenu startMenu)
{
	// Show their last login date in the start menu,
	// if they have one
	Date lastLogin = staticLoginData.getLastLogin();		
	if (lastLogin != null)
	{
		// Build the menu item
		MenuItem menuItem = new MenuItem();
		menuItem.setStyleAttribute("fontWeight", "bold");
		menuItem.setText("Last login: " 
						+ Utils.formatFriendlyDateTime
						(lastLogin));
		
		// The user shouldn't actually be clicking
		// on this
		menuItem.setEnabled(false);							
		startMenu.add(menuItem);			
	}		
}
 
开发者ID:recon-null,项目名称:eve_finger,代码行数:25,代码来源:Net_eve_finger.java

示例6: getMenuItem

import com.extjs.gxt.ui.client.widget.menu.MenuItem; //导入依赖的package包/类
public static Item getMenuItem(final CMDBDesktopMenuItem desktopItem) {
	if (desktopItem.isSeparator()) {
		return(new SeparatorMenuItem());
	}
	MenuItem item = new MenuItem();
	item.setText(desktopItem.getText());
	item.setIconStyle(desktopItem.getIconStyle());
	String toolTip = desktopItem.getTooltip();
	if (toolTip != null && toolTip.length() > 0) {
		item.setToolTip(toolTip);
	}
	if (desktopItem.getWindowItem() != null) {
		item.addSelectionListener(new SelectionListener<ComponentEvent>() {

			@Override
			public void componentSelected(ComponentEvent ce) {
				Dispatcher.get().dispatch(new AppEvent<CMDBDesktopMenuItem>(CMDBEvents.DESKTOP_MENU_SELECTED, desktopItem));
			}
		});
		if (desktopItem.getWindowItem().isOpenAtStartup()) {
			Dispatcher.get().dispatch(new AppEvent<CMDBDesktopMenuItem>(CMDBEvents.DESKTOP_MENU_SELECTED, desktopItem));
		}
	}
	
	// Check if submenus.
	if (desktopItem.getMenuItem()!= null && desktopItem.getMenuItem().size() > 0) {
		Menu subMenu = new Menu();
		List items = desktopItem.getMenuItem();
		for (CMDBDesktopMenuItem dItem : desktopItem.getMenuItem()) {
			subMenu.add(getMenuItem(dItem));
		}
		item.setSubMenu(subMenu);
	}
	
	return(item);
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:37,代码来源:DesktopMenuFactory.java

示例7: getGridContextMenu

import com.extjs.gxt.ui.client.widget.menu.MenuItem; //导入依赖的package包/类
private Menu getGridContextMenu(final Grid grid) {
	Menu menu = new Menu();
	MenuItem item = new MenuItem("Properties", new SelectionListener<ComponentEvent>() {

		@Override
		public void componentSelected(ComponentEvent ce) {
			CellSelectionModel<ModelData> selectionModel = (CellSelectionModel<ModelData>) grid.getSelectionModel();
			ModelData data = selectionModel.getSelectCell().model;
		}
		
	});
	menu.add(item);
	
	return(menu);
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:16,代码来源:InstanceList.java

示例8: buildToolbar

import com.extjs.gxt.ui.client.widget.menu.MenuItem; //导入依赖的package包/类
/**
 * Builds the actions toolbar.
 * 
 * @return The actions toolbar.
 */
private ToolBar buildToolbar() {
	// Save or cancel changes button.
	saveButton = Forms.saveSplitButton();
	saveItem = (MenuItem) saveButton.getMenu().getItem(0);
	discardChangesItem = (MenuItem) saveButton.getMenu().getItem(1);
	
	// New indicator group button.
	newIndicatorGroupButton = Forms.button(I18N.CONSTANTS.newIndicatorGroup());
	
	// New indicator button.
	newIndicatorButton = Forms.button(I18N.CONSTANTS.newIndicator());
	
	// Delete button.
	deleteButton = Forms.button(I18N.CONSTANTS.delete());
	
	// Refresh button.
	refreshButton = Forms.button(I18N.CONSTANTS.refreshPreview(), IconImageBundle.ICONS.refresh());
	
	// Export form button.
	exportButton = Forms.button(I18N.CONSTANTS.export(), IconImageBundle.ICONS.excel());

	// Create the toolbar instance and add the buttons.
	final ToolBar toolBar = new ToolBar();
	toolBar.add(saveButton);
	toolBar.add(newIndicatorGroupButton);
	toolBar.add(newIndicatorButton);
	toolBar.add(deleteButton);
	toolBar.add(refreshButton);
	toolBar.add(new FillToolItem());
	toolBar.add(exportButton);
	
	return toolBar;
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:39,代码来源:ProjectIndicatorManagementView.java

示例9: RowActionsMenu

import com.extjs.gxt.ui.client.widget.menu.MenuItem; //导入依赖的package包/类
/**
 * Builds this menu.
 * 
 * @param view
 *          The view where this menu is displayed.
 * @param row
 *          The row managed by this menu.
 * @param isActivity
 *          indicate if the view is a log frame activity.
 */
public RowActionsMenu(final FlexTableView view, final Row<?> row, final boolean isActivity) {

	super(view);

	// Sets local attributes.
	this.row = row;

	// Move up action.
	final MenuItem upMenuItem = createMoveUpAction();

	// Move down action.
	final MenuItem downMenuItem = createMoveDownAction();

	// Delete action.
	final MenuItem deleteMenuItem = createDeleteAction();

	// Menu.
	menu.add(upMenuItem);
	menu.add(downMenuItem);
	// Add the modify item for the log frame activities elements.
	if (isActivity) {
		// Modify action
		final MenuItem modifyMenuItem = createModifyAction();
		menu.add(modifyMenuItem);
	}
	menu.add(deleteMenuItem);
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:38,代码来源:RowActionsMenu.java

示例10: createModifyAction

import com.extjs.gxt.ui.client.widget.menu.MenuItem; //导入依赖的package包/类
/**
 * Builds and returns the modify action.
 * 
 * @return The modify action.
 */
private MenuItem createModifyAction() {

	final MenuAction action = new MenuAction() {

		@Override
		public void perform() {
			// Show the action property window
			buidModifyActionPopUp();
		}

		@Override
		public String getText() {
			return I18N.CONSTANTS.edit();
		}

		@Override
		public AbstractImagePrototype getIcon() {
			return IconImageBundle.ICONS.editActivity();
		}

		@Override
		public String canBePerformed() {
			// the update action can be performed
			return null;
		}
	};

	action.setInactivationPolicy(inactivationPolicy);

	// Adds it locally.
	actions.add(action);

	return action.getMenuItem();
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:40,代码来源:RowActionsMenu.java

示例11: createMenu

import com.extjs.gxt.ui.client.widget.menu.MenuItem; //导入依赖的package包/类
/**
 * Creates the menu for the given {@code elements}.
 * 
 * @param elements
 *          The localized elements.
 * @param createReportMenu
 *          {@code true} to build a <em>create report</em> menu, {@code false} to build an <em>attach file</em> menu.
 * @return The menu for the given {@code elements}.
 */
private Menu createMenu(final List<LocalizedElement> elements, final boolean createReportMenu) {

	final Menu menu = new Menu();
	menu.setEnabled(false);

	if (elements == null) {
		return menu;
	}

	// For each files list.
	for (final LocalizedElement element : elements) {

		boolean itemEnabled = false;

		// Builds the corresponding menu item.
		final MenuItem item = new MenuItem(I18N.CONSTANTS.projectDetails() + " | " + element.getElement().getLabel());

		// If the phase is the details page.
		item.addSelectionListener(new ReportMenuSelectionListener(eventBus, getOrgUnit().getId(), I18N.CONSTANTS.projectDetails(), element.getElement(),
			createReportMenu));
		item.setTitle(I18N.CONSTANTS.flexibleElementFilesListAddErrorPhaseInactive());
		itemEnabled = true;

		if (itemEnabled) {
			reportsPresenter.setMenuItemEnabled(item, getOrgUnit().getId(), element.getElement(), createReportMenu);
			menu.setEnabled(true);
		}

		menu.add(item);
	}

	return menu;
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:43,代码来源:OrgUnitReportsPresenter.java

示例12: saveSplitButton

import com.extjs.gxt.ui.client.widget.menu.MenuItem; //导入依赖的package包/类
/**
 * Creates a new save split button and its menu composed of a save item and
 * a discard changes item.
 * 
 * @return A new save split button.
 */
public static SplitButton saveSplitButton() {
	final SplitButton saveButton = Forms.splitButton(I18N.CONSTANTS.save(), IconImageBundle.ICONS.save());

	// Menu attached to the save button.
	final Menu menu = new Menu();
	menu.add(new MenuItem(I18N.CONSTANTS.save(), IconImageBundle.ICONS.save()));
	menu.add(new MenuItem(I18N.CONSTANTS.discardChanges(), IconImageBundle.ICONS.cancel()));
	saveButton.setMenu(menu);

	return saveButton;
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:18,代码来源:Forms.java

示例13: addStartMenuEntry

import com.extjs.gxt.ui.client.widget.menu.MenuItem; //导入依赖的package包/类
/**
 * Creates an automatically handled start menu entry to
 * open/bring to front the given window
 * @param entryName The name used in the start menu.
 * @param window The window to use.
 */
public void addStartMenuEntry(String entryName, Window window)
{		
	MenuItem menuItem = new MenuItem(entryName);
	menuItem.setData("window", window);
	menuItem.addSelectionListener(menuListener);
	desktop.getStartMenu().add(menuItem);		
}
 
开发者ID:recon-null,项目名称:eve_finger,代码行数:14,代码来源:DesktopMgr.java

示例14: setContextMenuItem

import com.extjs.gxt.ui.client.widget.menu.MenuItem; //导入依赖的package包/类
public void setContextMenuItem(MenuItem item) {
	this.contextMenuItem = item;
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:4,代码来源:EditableCIInstanceGrid.java

示例15: updateMenu

import com.extjs.gxt.ui.client.widget.menu.MenuItem; //导入依赖的package包/类
private void updateMenu(TreeItem item, Menu menu) {
	final ModelData model = item.getModel();
	menu.removeAll();
	if (!permissions.getCurrentState().equals(CMDBPermissions.PermissionState.READONLY)) {
		if (model instanceof RelationTypeModel) {

			MenuItem addRelation = new MenuItem("Add Relation", "add-icon");
			addRelation.addSelectionListener(getAddRelation((CIModel)item.getParentItem().getModel(), (RelationTypeModel)model));

			MenuItem newRelation = new MenuItem("New Relation", "new-icon");
			newRelation.addSelectionListener(getNewRelation((CIModel)item.getParentItem().getModel(), (RelationTypeModel)model));

			menu.add(addRelation);
			menu.add(newRelation);
			menu.add(new SeparatorMenuItem());

		}
		if (model instanceof CIModel) {
			boolean insert = false;
			if (!(item.getParentItem().getParentItem() == null)) {
				MenuItem deleteRel = new MenuItem("Delete Relation", "delete-relation-icon");
				CIModel parent = (CIModel) item.getParentItem().getParentItem().getModel();
				CIModel child = (CIModel)model;
				RelationTypeModel relation = (RelationTypeModel)item.getParentItem().getModel();
				deleteRel.addSelectionListener(getDeleteRelation(parent, relation, child));
				menu.add(deleteRel);
				insert = true;
			}
			if (permissions.getCurrentState().equals(CMDBPermissions.PermissionState.DELETE)) {
				MenuItem deleteCI = new MenuItem("Delete CI", "delete-icon");
				deleteCI.addSelectionListener(getDeleteCI((CIModel)model));
				menu.add(deleteCI);
				insert = true;
			}
			if (insert) {
				menu.add(new SeparatorMenuItem());
			}
		}
		
	}

	MenuItem refresh = new MenuItem("Referesh", "refresh-icon");
	refresh.addSelectionListener(new SelectionListener<ComponentEvent>() {

		@Override
		public void componentSelected(ComponentEvent ce) {
			reloadChildren((ModelItem)model);
		}
		
	});
	menu.add(refresh);
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:53,代码来源:CITemplateReferenceTree.java


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