Search in sources :

Example 11 with MenuBar

use of com.vaadin.ui.MenuBar in project opennms by OpenNMS.

the class MenuBuilderTest method createContextMenuTest.

@Test
public void createContextMenuTest() {
    MenuBuilder builder = new MenuBuilder();
    builder.addMenuItem(createEmptyMenuItem("Test"), "Layout");
    MenuBar menubar = builder.build(Lists.newArrayList(), new TestOperationContext(null));
    TopologyContextMenu contextMenu = new TopologyContextMenu(menubar);
    List<ContextMenuState.ContextMenuItemState> contextMenuItems = contextMenu.getItems();
    assertEquals(1, contextMenuItems.size());
    assertEquals("Layout", contextMenuItems.get(0).caption);
    List<ContextMenuState.ContextMenuItemState> subMenuItems = contextMenuItems.get(0).getChildren();
    assertEquals(1, subMenuItems.size());
    ContextMenuState.ContextMenuItemState submenuItem = subMenuItems.get(0);
    assertEquals("Test", submenuItem.caption);
}
Also used : TestOperationContext(org.opennms.features.topology.app.internal.TestOperationContext) ContextMenuState(org.vaadin.peter.contextmenu.client.ContextMenuState) MenuBar(com.vaadin.ui.MenuBar) Test(org.junit.Test)

Example 12 with MenuBar

use of com.vaadin.ui.MenuBar in project opennms by OpenNMS.

the class OperationManagerTest method groupingSeparatorTest.

@Test
public void groupingSeparatorTest() {
    OperationManager cmdManager = new OperationManager();
    cmdManager.addOrUpdateGroupOrder("Default", Lists.newArrayList("new", "help", "additions"));
    cmdManager.onBind(createTestOperation(), createProperties("Device", "Operation1?group=additions", ""));
    cmdManager.onBind(createTestOperation(), createProperties("Device", "Operation3?group=additions", ""));
    cmdManager.onBind(createTestOperation(), createProperties("Device", "Operation4?group=additions", ""));
    cmdManager.onBind(createTestOperation(), createProperties("Device", "Operation2?group=additions", ""));
    cmdManager.onBind(createTestOperation(), createProperties(null, "Get Info?group=new", ""));
    cmdManager.onBind(createTestOperation(), createProperties("Device", "NewOperation?group=additions", ""));
    MenuBar menuBar = getMenuBar(cmdManager);
    List<MenuBar.MenuItem> menuItems = menuBar.getItems();
    assertEquals(1, menuItems.size());
    List<MenuBar.MenuItem> subMenuItems = menuItems.get(0).getChildren();
    assertEquals(5, subMenuItems.size());
    assertEquals("NewOperation", subMenuItems.get(0).getText());
    assertEquals("Operation1", subMenuItems.get(1).getText());
    assertEquals("Operation2", subMenuItems.get(2).getText());
    assertEquals("Operation3", subMenuItems.get(3).getText());
    assertEquals("Operation4", subMenuItems.get(4).getText());
}
Also used : MenuBar(com.vaadin.ui.MenuBar) Test(org.junit.Test)

Example 13 with MenuBar

use of com.vaadin.ui.MenuBar in project opennms by OpenNMS.

the class OperationManagerTest method submenuAlphabeticalOrderTest.

@Test
public void submenuAlphabeticalOrderTest() {
    OperationManager cmdManager = new OperationManager();
    cmdManager.addOrUpdateGroupOrder("File", Lists.newArrayList("new", "additions"));
    cmdManager.onBind(createTestOperation(), createProperties("File", "Operation1?group=new", ""));
    cmdManager.onBind(createTestOperation(), createProperties("File", "Operation3", ""));
    cmdManager.onBind(createTestOperation(), createProperties("File", "Operation4", ""));
    cmdManager.onBind(createTestOperation(), createProperties("File", "Operation2", ""));
    cmdManager.onBind(createTestOperation(), createProperties("File|New", "NewOperation", ""));
    MenuBar menuBar = getMenuBar(cmdManager);
    List<MenuBar.MenuItem> menuItems = menuBar.getItems();
    assertEquals(1, menuItems.size());
    List<MenuBar.MenuItem> subMenuItems = menuItems.get(0).getChildren();
    assertEquals(6, subMenuItems.size());
    assertEquals("Operation1", subMenuItems.get(0).getText());
    assertEquals(Boolean.TRUE, subMenuItems.get(1).isSeparator());
    assertEquals("New", subMenuItems.get(2).getText());
    assertEquals("Operation2", subMenuItems.get(3).getText());
    assertEquals("Operation3", subMenuItems.get(4).getText());
    assertEquals("Operation4", subMenuItems.get(5).getText());
    assertEquals(1, subMenuItems.get(2).getChildren().size());
}
Also used : MenuBar(com.vaadin.ui.MenuBar) Test(org.junit.Test)

Example 14 with MenuBar

use of com.vaadin.ui.MenuBar in project Activiti by Activiti.

the class TaskListHeader method initSortMenu.

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);
}
Also used : MenuBar(com.vaadin.ui.MenuBar) MenuItem(com.vaadin.ui.MenuBar.MenuItem)

Example 15 with MenuBar

use of com.vaadin.ui.MenuBar in project Activiti by Activiti.

the class ToolbarPopupEntry method initLabelComponent.

protected void initLabelComponent() {
    menuBar = new MenuBar();
    menuBar.addStyleName(ExplorerLayout.STYLE_TOOLBAR_POPUP);
    rootItem = menuBar.addItem(title, null);
    layout.addComponent(menuBar);
}
Also used : MenuBar(com.vaadin.ui.MenuBar)

Aggregations

MenuBar (com.vaadin.ui.MenuBar)15 Test (org.junit.Test)10 MenuItem (com.vaadin.ui.MenuBar.MenuItem)2 Command (com.vaadin.ui.MenuBar.Command)1 LoggedInUser (org.activiti.explorer.identity.LoggedInUser)1 ChangePasswordPopupWindow (org.activiti.explorer.ui.profile.ChangePasswordPopupWindow)1 OperationContext (org.opennms.features.topology.api.OperationContext)1 DefaultOperationContext (org.opennms.features.topology.app.internal.DefaultOperationContext)1 TestOperationContext (org.opennms.features.topology.app.internal.TestOperationContext)1 ContextMenuState (org.vaadin.peter.contextmenu.client.ContextMenuState)1