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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations