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


Java Menu.add方法代码示例

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


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

示例1: buildReportsMenu

import com.extjs.gxt.ui.client.widget.menu.Menu; //导入方法依赖的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: getMenuItem

import com.extjs.gxt.ui.client.widget.menu.Menu; //导入方法依赖的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

示例3: getGridContextMenu

import com.extjs.gxt.ui.client.widget.menu.Menu; //导入方法依赖的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

示例4: ClosedFilter

import com.extjs.gxt.ui.client.widget.menu.Menu; //导入方法依赖的package包/类
public ClosedFilter(String dataIndex) {

		super(dataIndex);

		menu = new Menu();

		noneFilter = new CheckMenuItem(I18N.CONSTANTS.noneFilter());
		noneFilter.setGroup(RADIOS_GROUP_NAME);
		noneFilter.setChecked(true);
		menu.add(noneFilter);

		sixMonthsFilter = new CheckMenuItem(I18N.CONSTANTS.sixMonthsFilter());
		sixMonthsFilter.setGroup(RADIOS_GROUP_NAME);
		menu.add(sixMonthsFilter);

		twelveMonthsFilter = new CheckMenuItem(I18N.CONSTANTS.twelveMonthsFilter());
		twelveMonthsFilter.setGroup(RADIOS_GROUP_NAME);
		menu.add(twelveMonthsFilter);

		customFilter = new CheckMenuItem(I18N.CONSTANTS.customFilter());
		customFilter.setGroup(RADIOS_GROUP_NAME);
		menu.add(customFilter);

		dateMenu = new DateMenu();

		dateMenu.setDate(new Date());
		dateMenu.addListener(Events.Select, menuListener);

		customFilter.setSubMenu(dateMenu);

		customFilter.addListener(Events.Select, handler);
		sixMonthsFilter.addListener(Events.Select, handler);
		twelveMonthsFilter.addListener(Events.Select, handler);
		noneFilter.addListener(Events.Select, handler);
		currentItem = noneFilter;
	}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:37,代码来源:ClosedFilter.java

示例5: createMenu

import com.extjs.gxt.ui.client.widget.menu.Menu; //导入方法依赖的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

示例6: saveSplitButton

import com.extjs.gxt.ui.client.widget.menu.Menu; //导入方法依赖的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

示例7: updateMenu

import com.extjs.gxt.ui.client.widget.menu.Menu; //导入方法依赖的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

示例8: updateMenu

import com.extjs.gxt.ui.client.widget.menu.Menu; //导入方法依赖的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,代码来源:CIInstanceReferenceTree.java

示例9: doAssignmentTreeGrid

import com.extjs.gxt.ui.client.widget.menu.Menu; //导入方法依赖的package包/类
private TreeGrid<ModelData> doAssignmentTreeGrid(){
	assignmentStore = new TreeStore<ModelData>();
	
	ColumnConfig name = new ColumnConfig("name", "Name", 100);
    name.setRenderer(new TreeGridCellRenderer<ModelData>());  
    ColumnConfig index = new ColumnConfig("assignmentIndex", "Index", 100);
    index.setSortable(false);
    index.setFixed(true);
    index.setMenuDisabled(true);
    ColumnConfig status = new ColumnConfig("status", "Status", 100);  
    ColumnModel cm = new ColumnModel(Arrays.asList(name, index, status)); 
	
	
	
	
	assignmentTreeGrid = new TreeGrid<ModelData>(assignmentStore, cm);  
	assignmentTreeGrid.setBorders(true);  
	assignmentTreeGrid.setAutoExpandColumn("name");  
	assignmentTreeGrid.setTrackMouseOver(false);
	assignmentTreeGrid.setLoadMask(true);
	assignmentTreeGrid.setWidth(600);
	assignmentTreeGrid.setHeight(580);
	assignmentTreeGrid.setBorders(true);
	assignmentTreeGrid.getView().setEmptyText("no data");
	assignmentTreeGrid.setId("myAssignmentTreeGridid");
	assignmentTreeGrid.getSelectionModel().addListener(Events.SelectionChange,  
		            new Listener<SelectionChangedEvent<ModelData>>() {  
	            public void handleEvent(SelectionChangedEvent<ModelData> be) { 
	              if (be.getSelection().size() > 0) {  
	            	  assignmentId	= Integer.parseInt(assignmentTreeGrid.getSelectionModel().getSelectedItem().get("index").toString());
	            	  userDepartmentReportContentPanel.loadData(assignmentId, departmentId);
	            	  loadUserAssignmentCheckGrid();
	            	  assignmentDetailPanel.setData(assignmentId, departmentId);
	              } else {  
	            	//panel.clear();  
	              }
	            }
	          }); 
	
	Menu menu = new Menu();
	MenuItem addUserToAssignmentMenuItem = new MenuItem();
	addUserToAssignmentMenuItem.setText("Add/Remove User to Assignment");
	addUserToAssignmentMenuItem.setIcon(Resources.ICONS.add16());
	addUserToAssignmentMenuItem.addSelectionListener(new SelectionListener<MenuEvent>(){
		@Override		public void componentSelected(MenuEvent ce) {
				addUserToAssignmentWindow();
				
		}
		
	});
	menu.add(addUserToAssignmentMenuItem);
	assignmentTreeGrid.setContextMenu(menu);
	
	return assignmentTreeGrid;
}
 
开发者ID:treblereel,项目名称:Opensheet,代码行数:56,代码来源:DepartmentPanel.java


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