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