@Test public void createContextMenuTest() { ContextMenuBuilder builder = new ContextMenuBuilder(); builder.addMenuCommand(createEmpyCommand(), "Layout|Test"); m_cMenu = builder.get(); List<TopoContextMenuItem> contextMenuItems = m_cMenu.getItems(); assertEquals(1, contextMenuItems.size()); assertEquals("Layout", contextMenuItems.get(0).getName()); assertNull(contextMenuItems.get(0).getOperation()); List<TopoContextMenuItem> subMenuItems = contextMenuItems.get(0).getChildren(); assertEquals(1, subMenuItems.size()); TopoContextMenuItem submenuItem = subMenuItems.get(0); assertEquals("Test", submenuItem.getName()); assertNotNull(submenuItem.getOperation()); }
public TopoContextMenu get() { TopoContextMenu cMenu = new TopoContextMenu(); Set<Entry<String, Object>> sortedEntrySet = getSortedMenuItems(); for(Entry<String, Object> entry : sortedEntrySet) { if(entry.getValue() instanceof Map) { TopoContextMenuItem menuItem = cMenu.addItem(entry.getKey(), null); addMenuItems(menuItem, (Map<String, Object>) entry.getValue()); }else { OperationCommand command = (OperationCommand) entry.getValue(); cMenu.addItem(entry.getKey(), command.getOperation()); } } return cMenu; }
ContextMenuBuilder extends MenuBuilder<Command, TopoContextMenuItem> { public TopoContextMenu get() { TopoContextMenu cMenu = new TopoContextMenu(); Set<Entry<String, Object>> sortedEntrySet = getSortedMenuItems(); for(Entry<String, Object> entry : sortedEntrySet) { if(entry.getValue() instanceof Map) { TopoContextMenuItem menuItem = cMenu.addItem(entry.getKey(), null); addMenuItems(menuItem, (Map<String, Object>) entry.getValue()); }else { OperationCommand command = (OperationCommand) entry.getValue(); cMenu.addItem(entry.getKey(), command.getOperation()); } } return cMenu; } }
ContextMenuBuilder extends MenuBuilder<Command, TopoContextMenuItem> { public TopoContextMenu get() { TopoContextMenu cMenu = new TopoContextMenu(); Set<Entry<String, Object>> sortedEntrySet = getSortedMenuItems(); for(Entry<String, Object> entry : sortedEntrySet) { if(entry.getValue() instanceof Map) { TopoContextMenuItem menuItem = cMenu.addItem(entry.getKey(), null); addMenuItems(menuItem, (Map<String, Object>) entry.getValue()); }else { OperationCommand command = (OperationCommand) entry.getValue(); cMenu.addItem(entry.getKey(), command.getOperation()); } } return cMenu; }  }
ContextMenuBuilder extends MenuBuilder<Command, TopoContextMenuItem> { public TopoContextMenu get() { TopoContextMenu cMenu = new TopoContextMenu(); Set<Entry<String, Object>> sortedEntrySet = getSortedMenuItems(); for(Entry<String, Object> entry : sortedEntrySet) { if(entry.getValue() instanceof Map) { TopoContextMenuItem menuItem = cMenu.addItem(entry.getKey(), null); addMenuItems(menuItem, (Map<String, Object>) entry.getValue()); }else { OperationCommand command = (OperationCommand) entry.getValue(); cMenu.addItem(entry.getKey(), command.getOperation()); } } return cMenu; }  TopoContextMenu get(); }
ContextMenuBuilder extends MenuBuilder<Command, TopoContextMenuItem> { public TopoContextMenu get() { TopoContextMenu cMenu = new TopoContextMenu(); Set<Entry<String, Object>> sortedEntrySet = getSortedMenuItems(); for(Entry<String, Object> entry : sortedEntrySet) { if(entry.getValue() instanceof Map) { TopoContextMenuItem menuItem = cMenu.addItem(entry.getKey(), null); addMenuItems(menuItem, (Map<String, Object>) entry.getValue()); }else { OperationCommand command = (OperationCommand) entry.getValue(); cMenu.addItem(entry.getKey(), command.getOperation()); } } return cMenu; }  TopoContextMenu get();  }