• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Menu类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Menu类属于com.extjs.gxt.ui.client.widget.menu包,在下文中一共展示了Menu类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: createAttachFileMenu

import com.extjs.gxt.ui.client.widget.menu.Menu; //导入依赖的package包/类
/**
 * Creates the <em>attach file</em> menu.
 * 
 * @return The menu.
 */
private Menu createAttachFileMenu() {

	// Retrieves all the files list elements in the current project.
	final List<LocalizedElement<FilesListElementDTO>> filesListElements = getProject().getLocalizedElements(FilesListElementDTO.class);

	return createMenu(filesListElements, false);
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:13,代码来源:ProjectReportsPresenter.java


示例6: createCreateReportMenu

import com.extjs.gxt.ui.client.widget.menu.Menu; //导入依赖的package包/类
/**
 * Creates the <em>create report</em> menu.
 * 
 * @return The menu.
 */
private Menu createCreateReportMenu() {

	// Retrieves all the report and report list elements in the current project.
	final List reportElements = getProject().getLocalizedElements(ReportElementDTO.class);
	final List reportsListElements = getProject().getLocalizedElements(ReportListElementDTO.class);

	return createMenu(ClientUtils.concat(reportElements, reportsListElements), true);
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:14,代码来源:ProjectReportsPresenter.java


示例7: ActionsMenu

import com.extjs.gxt.ui.client.widget.menu.Menu; //导入依赖的package包/类
public ActionsMenu(final FlexTableView view) {

		this.view = view;
		actions = new ArrayList<MenuAction>();

		// Menu.
		menu = new Menu();

		// Adds a listener to update the menu each time it is shown.
		menu.addListener(Events.BeforeShow, new Listener<BaseEvent>() {

			@Override
			public void handleEvent(BaseEvent be) {

				for (final MenuAction action : actions) {

					// Checks if this action can be performed in the current
					// state.
					final String msg = action.canBePerformed();

					// The action can be performed.
					if (msg == null || "".equals(msg.trim())) {
						action.active();
					}
					// The action cannot be performed.
					else {
						action.inactive(msg);
					}
				}
			}
		});
	}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:33,代码来源:ActionsMenu.java


示例8: createAttachFileMenu

import com.extjs.gxt.ui.client.widget.menu.Menu; //导入依赖的package包/类
/**
 * Creates the <em>attach file</em> menu.
 * 
 * @return The menu.
 */
private Menu createAttachFileMenu() {

	// Retrieves all the files list elements in the current project.
	final List<LocalizedElement> filesListElements = getOrgUnit().getLocalizedElements(FilesListElementDTO.class);

	return createMenu(filesListElements, false);
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:13,代码来源:OrgUnitReportsPresenter.java


示例9: createCreateReportMenu

import com.extjs.gxt.ui.client.widget.menu.Menu; //导入依赖的package包/类
/**
 * Creates the <em>create report</em> menu.
 * 
 * @return The menu.
 */
private Menu createCreateReportMenu() {

	// Retrieves all the report and report list elements in the current project.
	final List<LocalizedElement> reportElements = getOrgUnit().getLocalizedElements(ReportElementDTO.class);
	final List<LocalizedElement> reportsListElements = getOrgUnit().getLocalizedElements(ReportListElementDTO.class);

	return createMenu(ClientUtils.concat(reportElements, reportsListElements), true);
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:14,代码来源:OrgUnitReportsPresenter.java


示例10: 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


示例11: 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


示例12: 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


示例13: 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


示例14: setContextMenu

import com.extjs.gxt.ui.client.widget.menu.Menu; //导入依赖的package包/类
public void setContextMenu(Menu context) {
	super.setContextMenu(context);
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:4,代码来源:ContentSelectorWidget.java


示例15: 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


示例16: newColumnHeader

import com.extjs.gxt.ui.client.widget.menu.Menu; //导入依赖的package包/类
@Override
protected ColumnHeader newColumnHeader() {
	header = new ColumnHeader(grid, cm) {

		@SuppressWarnings("unchecked")
		@Override
		protected ComponentEvent createColumnEvent(ColumnHeader header, int column, Menu menu) {
			GridEvent<ModelData> event = (GridEvent<ModelData>) MyTreeGridView.this.createComponentEvent(null);
			event.setColIndex(column);
			event.setMenu(menu);
			return event;
		}

		@Override
		protected Menu getContextMenu(int column) {
			return createContextMenu(column);
		}

		@Override
		protected void onColumnSplitterMoved(int colIndex, int width) {
			super.onColumnSplitterMoved(colIndex, width);
			MyTreeGridView.this.onColumnSplitterMoved(colIndex, width);
		}

		@Override
		protected void onHeaderClick(ComponentEvent ce, int column) {
			super.onHeaderClick(ce, column);
			MyTreeGridView.this.onHeaderClick(grid, column);
		}

		@Override
		protected void onKeyDown(ComponentEvent ce, int index) {
			ce.cancelBubble();
			if (grid.getSelectionModel() instanceof CellSelectionModel<?>) {
				CellSelectionModel<?> csm = (CellSelectionModel<?>) grid.getSelectionModel();
				csm.selectCell(0, index);
			} else {
				grid.getSelectionModel().select(0, false);
			}
		}

		@Override
		// was need override this method.
		public void updateTotalWidth(int offset, int width) {
			if (offset != -1) {
				table.getElement().getParentElement().getStyle().setPropertyPx("width", ++offset);
			}
			width += headsOffset; // in some tables headsOffset == cm.getColumnCount();
			table.getElement().getStyle().setProperty("width", (width) + "px");
		}
	};
	header.setSplitterWidth(splitterWidth);
	header.setMinColumnWidth(grid.getMinColumnWidth());

	return header;
}
 
开发者ID:treblereel,项目名称:Opensheet,代码行数:57,代码来源:MyTreeGridView.java


示例17: setAttachFileButtonMenu

import com.extjs.gxt.ui.client.widget.menu.Menu; //导入依赖的package包/类
/**
 * Sets the <em>attach file</em> button's menu.<br>
 * The button is enabled only if the given {@code menu} is enabled.
 * 
 * @param menu
 *          The menu.
 */
public void setAttachFileButtonMenu(final Menu menu) {
	view.getReportsListAttachButton().setMenu(menu);
	view.getReportsListAttachButton().setEnabled(menu != null && menu.isEnabled());
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:12,代码来源:ReportsPresenter.java


示例18: setCreateReportButtonMenu

import com.extjs.gxt.ui.client.widget.menu.Menu; //导入依赖的package包/类
/**
 * Sets the <em>creates report</em> button's menu.<br>
 * The button is enabled only if the given {@code menu} is enabled.
 * 
 * @param menu
 *          The menu.
 */
public void setCreateReportButtonMenu(final Menu menu) {
	view.getReportsListCreateButton().setMenu(menu);
	view.getReportsListCreateButton().setEnabled(menu != null && menu.isEnabled());
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:12,代码来源:ReportsPresenter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SpnegoCredential类代码示例发布时间:2022-05-22
下一篇:
Java AssetRendererFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap