@Test public void groupingSeparatorTest() { CommandManager cmdManager = new CommandManager(); cmdManager.addOrUpdateGroupOrder("Default", Arrays.asList("new", "help", "additions")); cmdManager.onBind(getTestOperation(), getProps("Device", "Operation1?group=additions", "")); cmdManager.onBind(getTestOperation(), getProps("Device", "Operation3?group=additions", "")); cmdManager.onBind(getTestOperation(), getProps("Device", "Operation4?group=additions", "")); cmdManager.onBind(getTestOperation(), getProps("Device", "Operation2?group=additions", "")); cmdManager.onBind(getTestOperation(), getProps(null, "Get Info?group=new", "")); cmdManager.onBind(getTestOperation(), getProps("Device", "NewOperation?group=additions", "")); MenuBar menuBar = cmdManager.getMenuBar(null, null, null); List<MenuItem> menuItems = menuBar.getItems(); assertEquals(1, menuItems.size()); List<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()); }
@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();  }