當前位置: 首頁>>代碼示例>>Java>>正文


Java ContextMenu類代碼示例

本文整理匯總了Java中com.vaadin.contextmenu.ContextMenu的典型用法代碼示例。如果您正苦於以下問題:Java ContextMenu類的具體用法?Java ContextMenu怎麽用?Java ContextMenu使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ContextMenu類屬於com.vaadin.contextmenu包,在下文中一共展示了ContextMenu類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onGenericContextMenu

import com.vaadin.contextmenu.ContextMenu; //導入依賴的package包/類
private void onGenericContextMenu(ContextMenuOpenEvent event) {
    GridContextClickEvent<String[]> gridE = (GridContextClickEvent<String[]>) event
            .getContextClickEvent();
    ContextMenu menu = event.getContextMenu();
    menu.removeItems();
    if (gridE.getColumn() != null) {
        menu.addItem(
                "Called from column " + gridE.getColumn().getCaption()
                        + " on row " + gridE.getRowIndex(),
                f -> Notification.show("did something"));
    } else if (gridE.getRowIndex() >= 0) {
        menu.addItem("Called on row " + gridE.getRowIndex(),
                f -> Notification.show("did something"));
    } else {
        menu.addItem("Called on background",
                f -> Notification.show("did something"));

    }
}
 
開發者ID:vaadin,項目名稱:context-menu,代碼行數:20,代碼來源:GridWithGenericListener.java

示例2: adaptAction

import com.vaadin.contextmenu.ContextMenu; //導入依賴的package包/類
private static MenuItem adaptAction(ContextMenu menu, Action action) {
	MenuItem item = menu.addItem(action.getName(), e -> action.action());
	action.setChangeListener(new ActionChangeListener() {
		{
			update();
		}
		
		@Override
		public void change() {
			update();
		}

		protected void update() {
			item.setEnabled(action.isEnabled());
			item.setDescription(action.getDescription());
		}
	});
	return item;
}
 
開發者ID:BrunoEberhard,項目名稱:minimal-j,代碼行數:20,代碼來源:Vaadin.java

示例3: buildFollowToMenu

import com.vaadin.contextmenu.ContextMenu; //導入依賴的package包/類
protected void buildFollowToMenu() {
    ForeignKey[] foreignKeys = resultTable.getForeignKeys();
    for (final ForeignKey foreignKey : foreignKeys) {
        String optionTitle = foreignKey.getForeignTableName() + " (";
        for (Reference ref : foreignKey.getReferences()) {
            optionTitle += ref.getLocalColumnName() + ", ";
        }
        optionTitle = optionTitle.substring(0, optionTitle.length() - 2) + ")";
        followToMenu.addItem(optionTitle, new ContextMenu.Command() {

            private static final long serialVersionUID = 1L;

            @Override
            public void menuSelected(MenuItem selectedItem) {
                followTo(foreignKey);
            }
        });
    }
}
 
開發者ID:JumpMind,項目名稱:sqlexplorer-vaadin,代碼行數:20,代碼來源:TabularResultLayout.java

示例4: GridContextMenuOpenEvent

import com.vaadin.contextmenu.ContextMenu; //導入依賴的package包/類
public GridContextMenuOpenEvent(ContextMenu contextMenu,
        GridContextClickEvent contextClickEvent) {
    super(contextMenu, contextClickEvent);
    itemId = contextClickEvent.getItemId();
    rowIndex = contextClickEvent.getRowIndex();
    propertyId = contextClickEvent.getPropertyId();
    section = contextClickEvent.getSection();
}
 
開發者ID:vaadin,項目名稱:context-menu,代碼行數:9,代碼來源:GridContextMenu.java

示例5: GridWithGenericListener

import com.vaadin.contextmenu.ContextMenu; //導入依賴的package包/類
public GridWithGenericListener() {
    setCaption("Grid with generic listener");

    ContextMenu contextMenu2 = new ContextMenu(this, true);
    setHeightByRows(3);
    addColumn(arr -> arr[0]).setCaption(FIRST_NAME);
    addColumn(arr -> arr[1]).setCaption(LAST_NAME);
    addColumn(arr -> arr[2]).setCaption(SHOE_SIZE);

    ListDataProvider<String[]> ds = new ListDataProvider<>(Collections
            .singletonList(new String[] { "John", "Doe", "57" }));
    setDataProvider(ds);
    contextMenu2.addContextMenuOpenListener(this::onGenericContextMenu);
}
 
開發者ID:vaadin,項目名稱:context-menu,代碼行數:15,代碼來源:GridWithGenericListener.java

示例6: createMenu

import com.vaadin.contextmenu.ContextMenu; //導入依賴的package包/類
private ContextMenu createMenu(AbstractComponent parentComponent, List<Action> actions) {
	if (actions != null && actions.size() > 0) {
		ContextMenu menu = new ContextMenu(parentComponent, true);
		addActions(menu, actions);
		return menu;
	}
	return null;
}
 
開發者ID:BrunoEberhard,項目名稱:minimal-j,代碼行數:9,代碼來源:Vaadin.java

示例7: addActions

import com.vaadin.contextmenu.ContextMenu; //導入依賴的package包/類
private static void addActions(ContextMenu menu, List<Action> actions) {
	for (Action action : actions) {
		if (action instanceof ActionGroup) {
			ActionGroup actionGroup = (org.minimalj.frontend.action.ActionGroup) action;
			MenuItem subMenu = menu.addItem(actionGroup.getName(), e -> {});
			addActions(subMenu, actionGroup.getItems());
		} else if (action instanceof Separator) {
			menu.addSeparator();
		} else {
			adaptAction(menu, action);
		}
	}
}
 
開發者ID:BrunoEberhard,項目名稱:minimal-j,代碼行數:14,代碼來源:Vaadin.java


注:本文中的com.vaadin.contextmenu.ContextMenu類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。