@Test public void testAddItems() { final String d1Name = "ClassOne"; final String d2Name = "ClassTwo"; final String d3Name = "ClassThree"; final DataObject d1 = new DataObject(d1Name); final DataObject d2 = new DataObject(d2Name); final DataObject d3 = new DataObject(d3Name); final List<DataObject> dataObjects = Arrays.asList(d1, d2, d3); final TreeListItem list1 = mock(TreeListItem.class); final TreeListItem list2 = mock(TreeListItem.class); final TreeListItem list3 = mock(TreeListItem.class); doReturn(list1).when(view).createTreeListItem(d1); doReturn(list2).when(view).createTreeListItem(d2); doReturn(list3).when(view).createTreeListItem(d3); view.addItems(dataObjects); verify(itemsContainer).appendChild(treeListElement); verify(treeList).populate(itemsCaptor.capture()); final List<TreeListItem> dataObjectItems = itemsCaptor.getValue(); assertEquals(3, dataObjectItems.size()); assertTrue(dataObjectItems.contains(list1)); assertTrue(dataObjectItems.contains(list2)); assertTrue(dataObjectItems.contains(list3)); }
@Override public void addItems(final List<DataObject> dataObjects) { final List<TreeListItem> dataObjectItems = new ArrayList<>(); for (final DataObject data : dataObjects) { dataObjectItems.add(createTreeListItem(data)); } treeList.populate(dataObjectItems); itemsContainer.appendChild(treeList.getElement()); }
ImportDataObjectModalView implements ImportDataObjectModal.View { @Override public void addItems(final List<DataObject> dataObjects) { final List<TreeListItem> dataObjectItems = new ArrayList<>(); for (final DataObject data : dataObjects) { dataObjectItems.add(createTreeListItem(data)); } treeList.populate(dataObjectItems); itemsContainer.appendChild(treeList.getElement()); } }
ImportDataObjectModalView implements ImportDataObjectModal.View { @Override public void addItems(final List<DataObject> dataObjects) { final List<TreeListItem> dataObjectItems = new ArrayList<>(); for (final DataObject data : dataObjects) { dataObjectItems.add(createTreeListItem(data)); } treeList.populate(dataObjectItems); itemsContainer.appendChild(treeList.getElement()); } @Inject  ImportDataObjectModalView(final HTMLDivElement header,
                                     final HTMLDivElement body,
                                     final HTMLDivElement footer,
                                     final TreeList treeList,
                                     @Named("span") final HTMLElement noteText,
                                     final HTMLLabelElement noteLabel,
                                     final HTMLDivElement itemsContainer,
                                     final HTMLAnchorElement clearSelection,
                                     final ManagedInstance<TreeListItem> items,
                                     final HTMLButtonElement buttonImport,
                                     final HTMLButtonElement buttonCancel,
                                     final HTMLDivElement warningContainer); }
ImportDataObjectModalView implements ImportDataObjectModal.View { @Override public void addItems(final List<DataObject> dataObjects) { final List<TreeListItem> dataObjectItems = new ArrayList<>(); for (final DataObject data : dataObjects) { dataObjectItems.add(createTreeListItem(data)); } treeList.populate(dataObjectItems); itemsContainer.appendChild(treeList.getElement()); } @Inject  ImportDataObjectModalView(final HTMLDivElement header,
                                     final HTMLDivElement body,
                                     final HTMLDivElement footer,
                                     final TreeList treeList,
                                     @Named("span") final HTMLElement noteText,
                                     final HTMLLabelElement noteLabel,
                                     final HTMLDivElement itemsContainer,
                                     final HTMLAnchorElement clearSelection,
                                     final ManagedInstance<TreeListItem> items,
                                     final HTMLButtonElement buttonImport,
                                     final HTMLButtonElement buttonCancel,
                                     final HTMLDivElement warningContainer); @PostConstruct void setup(); @Override String getHeader(); @Override HTMLElement getBody(); @Override HTMLElement getFooter(); @Override void init(final ImportDataObjectModal presenter); @Override void addItems(final List<DataObject> dataObjects); @Override void clear(); @Override void showDataTypeWithSameNameWarning(); @Override void hideDataTypeWithSameNameWarning(); }
ImportDataObjectModalView implements ImportDataObjectModal.View { @Override public void addItems(final List<DataObject> dataObjects) { final List<TreeListItem> dataObjectItems = new ArrayList<>(); for (final DataObject data : dataObjects) { dataObjectItems.add(createTreeListItem(data)); } treeList.populate(dataObjectItems); itemsContainer.appendChild(treeList.getElement()); } @Inject  ImportDataObjectModalView(final HTMLDivElement header,
                                     final HTMLDivElement body,
                                     final HTMLDivElement footer,
                                     final TreeList treeList,
                                     @Named("span") final HTMLElement noteText,
                                     final HTMLLabelElement noteLabel,
                                     final HTMLDivElement itemsContainer,
                                     final HTMLAnchorElement clearSelection,
                                     final ManagedInstance<TreeListItem> items,
                                     final HTMLButtonElement buttonImport,
                                     final HTMLButtonElement buttonCancel,
                                     final HTMLDivElement warningContainer); @PostConstruct void setup(); @Override String getHeader(); @Override HTMLElement getBody(); @Override HTMLElement getFooter(); @Override void init(final ImportDataObjectModal presenter); @Override void addItems(final List<DataObject> dataObjects); @Override void clear(); @Override void showDataTypeWithSameNameWarning(); @Override void hideDataTypeWithSameNameWarning();  }