Search in sources :

Example 1 with MenuBar

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

the class MenuBuilderTest method createTopLevelMenuWithAdditionsTest.

@Test
public void createTopLevelMenuWithAdditionsTest() {
    MenuBuilder builder = new MenuBuilder();
    builder.setTopLevelMenuOrder(Lists.newArrayList("File", "Edit", "View", "Additions", "Help"));
    builder.createPath("Edit");
    builder.createPath("Test2");
    builder.createPath("File");
    builder.createPath("Test1");
    builder.createPath("Help");
    builder.createPath("View");
    MenuBar menuBar = builder.build(Lists.newArrayList(), createTestOperationContext());
    List<MenuBar.MenuItem> menuItems = menuBar.getItems();
    assertEquals(6, menuItems.size());
    assertEquals("File", menuItems.get(0).getText());
    assertEquals("Edit", menuItems.get(1).getText());
    assertEquals("View", menuItems.get(2).getText());
    assertEquals("Test1", menuItems.get(3).getText());
    assertEquals("Test2", menuItems.get(4).getText());
    assertEquals("Help", menuItems.get(5).getText());
}
Also used : MenuBar(com.vaadin.ui.MenuBar) Test(org.junit.Test)

Example 2 with MenuBar

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

the class MenuBuilderTest method createMenuTest.

@Test
public void createMenuTest() {
    MenuBuilder builder = new MenuBuilder();
    builder.setTopLevelMenuOrder(Lists.newArrayList("File", "Edit", "View"));
    builder.createPath("File");
    builder.createPath("View");
    builder.createPath("Edit");
    builder.addMenuItem(createEmptyMenuItem("Test"), "File");
    MenuBar menuBar = builder.build(Lists.newArrayList(), createTestOperationContext());
    List<MenuBar.MenuItem> menuItems = menuBar.getItems();
    assertEquals(3, menuItems.size());
    assertEquals("File", menuItems.get(0).getText());
    assertEquals("Edit", menuItems.get(1).getText());
    assertEquals("View", menuItems.get(2).getText());
}
Also used : MenuBar(com.vaadin.ui.MenuBar) Test(org.junit.Test)

Example 3 with MenuBar

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

the class MenuBuilderTest method menuOrderNoAdditionalTest.

@Test
public void menuOrderNoAdditionalTest() {
    MenuBuilder builder = new MenuBuilder();
    builder.setTopLevelMenuOrder(Lists.newArrayList("File", "Edit", "View", "Help"));
    builder.createPath("Edit");
    builder.createPath("Test2");
    builder.createPath("File");
    builder.createPath("Test1");
    builder.createPath("Help");
    builder.createPath("View");
    MenuBar menuBar = builder.build(Lists.newArrayList(), createTestOperationContext());
    List<MenuBar.MenuItem> menuItems = menuBar.getItems();
    assertEquals(6, menuItems.size());
    assertEquals("File", menuItems.get(0).getText());
    assertEquals("Edit", menuItems.get(1).getText());
    assertEquals("View", menuItems.get(2).getText());
    assertEquals("Help", menuItems.get(3).getText());
    assertEquals("Test1", menuItems.get(4).getText());
    assertEquals("Test2", menuItems.get(5).getText());
}
Also used : MenuBar(com.vaadin.ui.MenuBar) Test(org.junit.Test)

Example 4 with MenuBar

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

the class MenuBuilderTest method menuItemNoOrderTest.

@Test
public void menuItemNoOrderTest() {
    MenuBuilder builder = new MenuBuilder();
    builder.createPath("Edit");
    builder.createPath("Test2");
    builder.createPath("File");
    builder.createPath("Test1");
    builder.createPath("Help");
    builder.createPath("View");
    MenuBar menuBar = builder.build(Lists.newArrayList(), createTestOperationContext());
    List<MenuBar.MenuItem> menuItems = menuBar.getItems();
    assertEquals(6, menuItems.size());
    assertEquals("Edit", menuItems.get(0).getText());
    assertEquals("File", menuItems.get(1).getText());
    assertEquals("Help", menuItems.get(2).getText());
    assertEquals("Test1", menuItems.get(3).getText());
    assertEquals("Test2", menuItems.get(4).getText());
    assertEquals("View", menuItems.get(5).getText());
}
Also used : MenuBar(com.vaadin.ui.MenuBar) Test(org.junit.Test)

Example 5 with MenuBar

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

the class OperationManagerTest method layoutEditMenuGroupingTest.

@Test
public void layoutEditMenuGroupingTest() {
    OperationManager cmdManager = new OperationManager();
    cmdManager.addOrUpdateGroupOrder("Edit", Lists.newArrayList("new", "layout", "additions"));
    cmdManager.onBind(createTestOperation(), createProperties("Edit", "Circle Layout?group=layout", ""));
    cmdManager.onBind(createTestOperation(), createProperties("Edit", "FR Layout?group=layout", ""));
    cmdManager.onBind(createTestOperation(), createProperties("Edit", "ISOM Layout?group=layout", ""));
    cmdManager.onBind(createTestOperation(), createProperties("Edit", "KK Layout?group=layout", ""));
    cmdManager.onBind(createTestOperation(), createProperties("Edit", "Redo Layout", ""));
    cmdManager.onBind(createTestOperation(), createProperties("Edit", "Spring Layout?group=layout", ""));
    MenuBar menuBar = getMenuBar(cmdManager);
    List<MenuBar.MenuItem> menuItems = menuBar.getItems();
    assertEquals(1, menuItems.size());
    List<MenuBar.MenuItem> subMenuItems = menuItems.get(0).getChildren();
    assertEquals(7, subMenuItems.size());
    assertEquals("Circle Layout", subMenuItems.get(0).getText());
    assertEquals("FR Layout", subMenuItems.get(1).getText());
    assertEquals("ISOM Layout", subMenuItems.get(2).getText());
    assertEquals("KK Layout", subMenuItems.get(3).getText());
    assertEquals("Spring Layout", subMenuItems.get(4).getText());
    assertEquals(Boolean.TRUE, subMenuItems.get(5).isSeparator());
    assertEquals("Redo Layout", subMenuItems.get(6).getText());
}
Also used : MenuBar(com.vaadin.ui.MenuBar) Test(org.junit.Test)

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