@Test public void layoutEditMenuGroupingTest() { CommandManager cmdManager = new CommandManager(); cmdManager.addOrUpdateGroupOrder("Edit", Arrays.asList("new", "layout", "additions")); cmdManager.onBind(getTestOperation(), getProps("Edit", "Circle Layout?group=layout", "")); cmdManager.onBind(getTestOperation(), getProps("Edit", "FR Layout?group=layout", "")); cmdManager.onBind(getTestOperation(), getProps("Edit", "ISOM Layout?group=layout", "")); cmdManager.onBind(getTestOperation(), getProps("Edit", "KK Layout?group=layout", "")); cmdManager.onBind(getTestOperation(), getProps("Edit", "Redo Layout", "")); cmdManager.onBind(getTestOperation(), getProps("Edit", "Spring Layout?group=layout", "")); MenuBar menuBar = cmdManager.getMenuBar(null, null, null); List<MenuItem> menuItems = menuBar.getItems(); assertEquals(1, menuItems.size()); List<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("", subMenuItems.get(5).getText()); assertEquals("Redo Layout", subMenuItems.get(6).getText()); }
@SuppressWarnings("unchecked") public MenuBar get() { MenuBar menuBar = new MenuBar(); Set<Entry<String, Object>> sortedEntrySet = getSortedMenuItems(); for(Entry<String, Object> entry : sortedEntrySet) { if(entry.getValue() instanceof Map) { MenuBar.MenuItem menuItem = menuBar.addItem(entry.getKey(), null); addMenuItems(menuItem, (Map<String, Object>) entry.getValue()); }else { menuBar.addItem(entry.getKey(), (Command) entry.getValue()); } } return menuBar; }
MenuBarBuilder extends MenuBuilder<MenuBar.Command, MenuItem> { @SuppressWarnings("unchecked") public MenuBar get() { MenuBar menuBar = new MenuBar(); Set<Entry<String, Object>> sortedEntrySet = getSortedMenuItems(); for(Entry<String, Object> entry : sortedEntrySet) { if(entry.getValue() instanceof Map) { MenuBar.MenuItem menuItem = menuBar.addItem(entry.getKey(), null); addMenuItems(menuItem, (Map<String, Object>) entry.getValue()); }else { menuBar.addItem(entry.getKey(), (Command) entry.getValue()); } } return menuBar; } }
MenuBarBuilder extends MenuBuilder<MenuBar.Command, MenuItem> { @SuppressWarnings("unchecked") public MenuBar get() { MenuBar menuBar = new MenuBar(); Set<Entry<String, Object>> sortedEntrySet = getSortedMenuItems(); for(Entry<String, Object> entry : sortedEntrySet) { if(entry.getValue() instanceof Map) { MenuBar.MenuItem menuItem = menuBar.addItem(entry.getKey(), null); addMenuItems(menuItem, (Map<String, Object>) entry.getValue()); }else { menuBar.addItem(entry.getKey(), (Command) entry.getValue()); } } return menuBar; } MenuBarBuilder(); }
MenuBarBuilder extends MenuBuilder<MenuBar.Command, MenuItem> { @SuppressWarnings("unchecked") public MenuBar get() { MenuBar menuBar = new MenuBar(); Set<Entry<String, Object>> sortedEntrySet = getSortedMenuItems(); for(Entry<String, Object> entry : sortedEntrySet) { if(entry.getValue() instanceof Map) { MenuBar.MenuItem menuItem = menuBar.addItem(entry.getKey(), null); addMenuItems(menuItem, (Map<String, Object>) entry.getValue()); }else { menuBar.addItem(entry.getKey(), (Command) entry.getValue()); } } return menuBar; } MenuBarBuilder(); @SuppressWarnings("unchecked") MenuBar get(); }
MenuBarBuilder extends MenuBuilder<MenuBar.Command, MenuItem> { @SuppressWarnings("unchecked") public MenuBar get() { MenuBar menuBar = new MenuBar(); Set<Entry<String, Object>> sortedEntrySet = getSortedMenuItems(); for(Entry<String, Object> entry : sortedEntrySet) { if(entry.getValue() instanceof Map) { MenuBar.MenuItem menuItem = menuBar.addItem(entry.getKey(), null); addMenuItems(menuItem, (Map<String, Object>) entry.getValue()); }else { menuBar.addItem(entry.getKey(), (Command) entry.getValue()); } } return menuBar; } MenuBarBuilder(); @SuppressWarnings("unchecked") MenuBar get();  }