@Test public void finishLoadListTest() { final List<Archetype> archetypes = new ArrayList<>(); archetypes.add(createArchetypeWithAlias("archetype 1")); archetypes.add(createArchetypeWithAlias("archetype 2")); archetypes.add(createArchetypeWithAlias("archetype 3")); final Map<String, Boolean> selectionMap = new HashMap<>(); selectionMap.put("archetype 1", true); selectionMap.put("archetype 2", true); selectionMap.put("archetype 3", true); final PaginatedArchetypeList paginatedArchetypeList = new PaginatedArchetypeList(archetypes, 0, 10, 3); doReturn(selectionMap).when(archetypePreferences).getArchetypeSelectionMap(); doReturn("archetype 1").when(archetypePreferences).getDefaultSelection(); presenter.finishLoadList(paginatedArchetypeList); verify(archetypeListPresenter).setup(any(), any(), any()); verify(view).setSelectionCounter(anyString()); verify(busyIndicatorView).hideBusyIndicator(); verify(view).show(true); }
protected void finishLoadList(final PaginatedArchetypeList paginatedList) { final List<ArchetypeItem> archetypeItems = paginatedList.getArchetypes() .stream() .map(archetype -> new ArchetypeItem(archetype, getSelectionMap().get(archetype.getAlias()), archetype.getAlias().equals(archetypePreferences.getDefaultSelection()))) .collect(Collectors.toList()); archetypeListPresenter.setup(view.getTableBody(), archetypeItems, (property, presenter) -> presenter.setup(property, this)); updateSelectionCounter(); hideBusyIndicator(); view.show(true); }
AbstractArchetypeTablePresenter implements ArchetypeTablePresenter,
                                                                 HasBusyIndicator { protected void finishLoadList(final PaginatedArchetypeList paginatedList) { final List<ArchetypeItem> archetypeItems = paginatedList.getArchetypes() .stream() .map(archetype -> new ArchetypeItem(archetype, getSelectionMap().get(archetype.getAlias()), archetype.getAlias().equals(archetypePreferences.getDefaultSelection()))) .collect(Collectors.toList()); archetypeListPresenter.setup(view.getTableBody(), archetypeItems, (property, presenter) -> presenter.setup(property, this)); updateSelectionCounter(); hideBusyIndicator(); view.show(true); } }
AbstractArchetypeTablePresenter implements ArchetypeTablePresenter,
                                                                 HasBusyIndicator { protected void finishLoadList(final PaginatedArchetypeList paginatedList) { final List<ArchetypeItem> archetypeItems = paginatedList.getArchetypes() .stream() .map(archetype -> new ArchetypeItem(archetype, getSelectionMap().get(archetype.getAlias()), archetype.getAlias().equals(archetypePreferences.getDefaultSelection()))) .collect(Collectors.toList()); archetypeListPresenter.setup(view.getTableBody(), archetypeItems, (property, presenter) -> presenter.setup(property, this)); updateSelectionCounter(); hideBusyIndicator(); view.show(true); } AbstractArchetypeTablePresenter(final View view,
                                           final ArchetypeListPresenter archetypeListPresenter,
                                           final BusyIndicatorView busyIndicatorView,
                                           final TranslationService ts,
                                           final AddArchetypeModalPresenter addArchetypeModalPresenter,
                                           final ArchetypePreferences archetypePreferences,
                                           final Caller<ArchetypeService> archetypeService,
                                           final PreferenceScopeFactory preferenceScopeFactory,
                                           final Promises promises); }
AbstractArchetypeTablePresenter implements ArchetypeTablePresenter,
                                                                 HasBusyIndicator { protected void finishLoadList(final PaginatedArchetypeList paginatedList) { final List<ArchetypeItem> archetypeItems = paginatedList.getArchetypes() .stream() .map(archetype -> new ArchetypeItem(archetype, getSelectionMap().get(archetype.getAlias()), archetype.getAlias().equals(archetypePreferences.getDefaultSelection()))) .collect(Collectors.toList()); archetypeListPresenter.setup(view.getTableBody(), archetypeItems, (property, presenter) -> presenter.setup(property, this)); updateSelectionCounter(); hideBusyIndicator(); view.show(true); } AbstractArchetypeTablePresenter(final View view,
                                           final ArchetypeListPresenter archetypeListPresenter,
                                           final BusyIndicatorView busyIndicatorView,
                                           final TranslationService ts,
                                           final AddArchetypeModalPresenter addArchetypeModalPresenter,
                                           final ArchetypePreferences archetypePreferences,
                                           final Caller<ArchetypeService> archetypeService,
                                           final PreferenceScopeFactory preferenceScopeFactory,
                                           final Promises promises); void onArchetypeListUpdatedEvent(@Observes final ArchetypeListUpdatedEvent event); abstract Promise<Void> makeDefaultValue(String alias,
                                                   boolean updateList); abstract Promise<Void> loadPreferences(PaginatedArchetypeList paginatedList); abstract boolean canMakeChanges(); @Override void showBusyIndicator(final String message); @Override void hideBusyIndicator(); @Override boolean isSetup(); @Override ArchetypePreferences getPreferences(); @Override boolean isEmpty(); @Override void reset(); @Override Promise<Void> setup(final boolean isRefresh,
                               final Runnable onChangedCallback); View getView(); void setCurrentPage(final int currentPage); void goToPreviousPage(); void goToNextPage(); void goToFirstPage(); void goToLastPage(); void search(final String searchText); void addArchetype(); List<String> getIncluded(); boolean isShowIncludeColumn(); boolean isShowStatusColumn(); boolean isShowDeleteAction(); boolean isShowValidateAction(); void setSelected(final ArchetypeItem archetypeItem,
                            final boolean isSelected); void updateSelectionCounter(); Promise<Void> savePreferences(final PreferenceScope scope,
                                         final boolean updateList); Promise<Void> savePreferences(final PreferenceScopeResolutionStrategyInfo strategyInfo,
                                         final boolean updateList); }
AbstractArchetypeTablePresenter implements ArchetypeTablePresenter,
                                                                 HasBusyIndicator { protected void finishLoadList(final PaginatedArchetypeList paginatedList) { final List<ArchetypeItem> archetypeItems = paginatedList.getArchetypes() .stream() .map(archetype -> new ArchetypeItem(archetype, getSelectionMap().get(archetype.getAlias()), archetype.getAlias().equals(archetypePreferences.getDefaultSelection()))) .collect(Collectors.toList()); archetypeListPresenter.setup(view.getTableBody(), archetypeItems, (property, presenter) -> presenter.setup(property, this)); updateSelectionCounter(); hideBusyIndicator(); view.show(true); } AbstractArchetypeTablePresenter(final View view,
                                           final ArchetypeListPresenter archetypeListPresenter,
                                           final BusyIndicatorView busyIndicatorView,
                                           final TranslationService ts,
                                           final AddArchetypeModalPresenter addArchetypeModalPresenter,
                                           final ArchetypePreferences archetypePreferences,
                                           final Caller<ArchetypeService> archetypeService,
                                           final PreferenceScopeFactory preferenceScopeFactory,
                                           final Promises promises); void onArchetypeListUpdatedEvent(@Observes final ArchetypeListUpdatedEvent event); abstract Promise<Void> makeDefaultValue(String alias,
                                                   boolean updateList); abstract Promise<Void> loadPreferences(PaginatedArchetypeList paginatedList); abstract boolean canMakeChanges(); @Override void showBusyIndicator(final String message); @Override void hideBusyIndicator(); @Override boolean isSetup(); @Override ArchetypePreferences getPreferences(); @Override boolean isEmpty(); @Override void reset(); @Override Promise<Void> setup(final boolean isRefresh,
                               final Runnable onChangedCallback); View getView(); void setCurrentPage(final int currentPage); void goToPreviousPage(); void goToNextPage(); void goToFirstPage(); void goToLastPage(); void search(final String searchText); void addArchetype(); List<String> getIncluded(); boolean isShowIncludeColumn(); boolean isShowStatusColumn(); boolean isShowDeleteAction(); boolean isShowValidateAction(); void setSelected(final ArchetypeItem archetypeItem,
                            final boolean isSelected); void updateSelectionCounter(); Promise<Void> savePreferences(final PreferenceScope scope,
                                         final boolean updateList); Promise<Void> savePreferences(final PreferenceScopeResolutionStrategyInfo strategyInfo,
                                         final boolean updateList);  }