@Test public void addItemWithParentIndex() { when(tree.getItemByUuid(PARENT_UUID)).thenReturn(parentItem); final List<TreeItem> items = new ArrayList<>(1); items.add(item); when(parentItem.getChildren()).thenReturn(items); testedTreeExplorerView.addItem(ITEM_UUID, PARENT_UUID, NAME, widgetIcon, true, true, OptionalInt.of(0)); ArgumentCaptor<TreeItem> itemCaptor = ArgumentCaptor.forClass(TreeItem.class); verify(parentItem, times(1)).insertItem(itemCaptor.capture(), eq(0)); final TreeItem treeItem = itemCaptor.getValue(); assertEquals(TreeItem.Type.CONTAINER, treeItem.getType()); assertEquals(ITEM_UUID, treeItem.getUuid()); assertEquals(NAME, treeItem.getLabel()); }
@SuppressWarnings("unchecked") public TreeExplorer.View addItem(final String uuid, final String name, final IsWidget icon, final boolean isContainer, final boolean state) { checkNotExist(uuid); final TreeItem.Type itemType = isContainer ? TreeItem.Type.CONTAINER : TreeItem.Type.ITEM; final TreeItem item = buildItem(uuid, name, icon, itemType); tree.addItem(item); item.setState(getState(state)); return this; }
TreeExplorerView extends Composite implements TreeExplorer.View { @SuppressWarnings("unchecked") public TreeExplorer.View addItem(final String uuid, final String name, final IsWidget icon, final boolean isContainer, final boolean state) { checkNotExist(uuid); final TreeItem.Type itemType = isContainer ? TreeItem.Type.CONTAINER : TreeItem.Type.ITEM; final TreeItem item = buildItem(uuid, name, icon, itemType); tree.addItem(item); item.setState(getState(state)); return this; } }
TreeExplorerView extends Composite implements TreeExplorer.View { @SuppressWarnings("unchecked") public TreeExplorer.View addItem(final String uuid, final String name, final IsWidget icon, final boolean isContainer, final boolean state) { checkNotExist(uuid); final TreeItem.Type itemType = isContainer ? TreeItem.Type.CONTAINER : TreeItem.Type.ITEM; final TreeItem item = buildItem(uuid, name, icon, itemType); tree.addItem(item); item.setState(getState(state)); return this; } @Inject  TreeExplorerView(final Tree<TreeItem> tree);   TreeExplorerView(final TreeExplorer presenter,
                     final Tree<TreeItem> tree,
                     final HandlerRegistration handlerRegistration
    ); }
TreeExplorerView extends Composite implements TreeExplorer.View { @SuppressWarnings("unchecked") public TreeExplorer.View addItem(final String uuid, final String name, final IsWidget icon, final boolean isContainer, final boolean state) { checkNotExist(uuid); final TreeItem.Type itemType = isContainer ? TreeItem.Type.CONTAINER : TreeItem.Type.ITEM; final TreeItem item = buildItem(uuid, name, icon, itemType); tree.addItem(item); item.setState(getState(state)); return this; } @Inject  TreeExplorerView(final Tree<TreeItem> tree);   TreeExplorerView(final TreeExplorer presenter,
                     final Tree<TreeItem> tree,
                     final HandlerRegistration handlerRegistration
    ); @Override void init(final TreeExplorer presenter); @SuppressWarnings("unchecked") TreeExplorer.View addItem(final String uuid,
                                     final String name,
                                     final IsWidget icon,
                                     final boolean isContainer,
                                     final boolean state); @SuppressWarnings("unchecked") TreeExplorer.View addItem(final String uuid,
                                     final String parentsUuid,
                                     final String name,
                                     final IsWidget icon,
                                     final boolean isContainer,
                                     final boolean state,
                                     final OptionalInt index); boolean isItemChanged(final String uuid,
                                 final String parentUuid,
                                 final String name,
                                 final int childCount,
                                 final OptionalInt indexIntoParent); @Override TreeExplorer.View clear(); TreeExplorer.View destroy(); @Override boolean isContainer(final String uuid); TreeExplorer.View setSelectedItem(final String uuid); TreeExplorer.View removeItem(String uuid); }
TreeExplorerView extends Composite implements TreeExplorer.View { @SuppressWarnings("unchecked") public TreeExplorer.View addItem(final String uuid, final String name, final IsWidget icon, final boolean isContainer, final boolean state) { checkNotExist(uuid); final TreeItem.Type itemType = isContainer ? TreeItem.Type.CONTAINER : TreeItem.Type.ITEM; final TreeItem item = buildItem(uuid, name, icon, itemType); tree.addItem(item); item.setState(getState(state)); return this; } @Inject  TreeExplorerView(final Tree<TreeItem> tree);   TreeExplorerView(final TreeExplorer presenter,
                     final Tree<TreeItem> tree,
                     final HandlerRegistration handlerRegistration
    ); @Override void init(final TreeExplorer presenter); @SuppressWarnings("unchecked") TreeExplorer.View addItem(final String uuid,
                                     final String name,
                                     final IsWidget icon,
                                     final boolean isContainer,
                                     final boolean state); @SuppressWarnings("unchecked") TreeExplorer.View addItem(final String uuid,
                                     final String parentsUuid,
                                     final String name,
                                     final IsWidget icon,
                                     final boolean isContainer,
                                     final boolean state,
                                     final OptionalInt index); boolean isItemChanged(final String uuid,
                                 final String parentUuid,
                                 final String name,
                                 final int childCount,
                                 final OptionalInt indexIntoParent); @Override TreeExplorer.View clear(); TreeExplorer.View destroy(); @Override boolean isContainer(final String uuid); TreeExplorer.View setSelectedItem(final String uuid); TreeExplorer.View removeItem(String uuid);  }