@Test public void testOnAppSelectionChanged_oneSelected_notDeleted() { final App mock = mock(App.class); when(mock.isDeleted()).thenReturn(false); when(mockAppSelectionChangedEvent.getAppSelection()).thenReturn(Lists.newArrayList(mock)); uut.onAppSelectionChanged(mockAppSelectionChangedEvent); verify(mockAppSelectionChangedEvent).getAppSelection(); verify(mock).isDeleted(); verify(mockRestoreApp).setEnabled(eq(false)); verify(mockDeleteApp).setEnabled(eq(true)); verify(mockCategorizeApp).setEnabled(eq(true)); verify(mockAddCategory).setEnabled(eq(false)); verify(mockRenameCategory).setEnabled(eq(false)); verifyNoMoreInteractions(mockAppSelectionChangedEvent, mockRestoreApp, mockDeleteApp, mockCategorizeApp, mockAddCategory, mockRenameCategory, mock); }
@Override public void onAppSelectionChanged(AppSelectionChangedEvent event) { appSelection = event.getAppSelection(); boolean deleteEnabled, restoreAppEnabled, categorizeAppEnabled; switch (appSelection.size()) { case 1: final boolean isDeleted = appSelection.get(0).isDeleted(); deleteEnabled = !isDeleted; restoreAppEnabled = isDeleted; categorizeAppEnabled = !isDeleted; break; default: deleteEnabled = false; restoreAppEnabled = false; categorizeAppEnabled = false; } addCategory.setEnabled(false); renameCategory.setEnabled(false); deleteApp.setEnabled(deleteEnabled); restoreApp.setEnabled(restoreAppEnabled); categorizeApp.setEnabled(categorizeAppEnabled); }
AdminAppsToolbarViewImpl extends Composite implements AdminAppsToolbarView { @Override public void onAppSelectionChanged(AppSelectionChangedEvent event) { appSelection = event.getAppSelection(); boolean deleteEnabled, restoreAppEnabled, categorizeAppEnabled; switch (appSelection.size()) { case 1: final boolean isDeleted = appSelection.get(0).isDeleted(); deleteEnabled = !isDeleted; restoreAppEnabled = isDeleted; categorizeAppEnabled = !isDeleted; break; default: deleteEnabled = false; restoreAppEnabled = false; categorizeAppEnabled = false; } addCategory.setEnabled(false); renameCategory.setEnabled(false); deleteApp.setEnabled(deleteEnabled); restoreApp.setEnabled(restoreAppEnabled); categorizeApp.setEnabled(categorizeAppEnabled); } }
AdminAppsToolbarViewImpl extends Composite implements AdminAppsToolbarView { @Override public void onAppSelectionChanged(AppSelectionChangedEvent event) { appSelection = event.getAppSelection(); boolean deleteEnabled, restoreAppEnabled, categorizeAppEnabled; switch (appSelection.size()) { case 1: final boolean isDeleted = appSelection.get(0).isDeleted(); deleteEnabled = !isDeleted; restoreAppEnabled = isDeleted; categorizeAppEnabled = !isDeleted; break; default: deleteEnabled = false; restoreAppEnabled = false; categorizeAppEnabled = false; } addCategory.setEnabled(false); renameCategory.setEnabled(false); deleteApp.setEnabled(deleteEnabled); restoreApp.setEnabled(restoreAppEnabled); categorizeApp.setEnabled(categorizeAppEnabled); } @Inject  AdminAppsToolbarViewImpl(final ToolbarAppearance appearance,
                             @Assisted final PagingLoader<FilterPagingLoadConfig, PagingLoadResult<App>> loader); }
AdminAppsToolbarViewImpl extends Composite implements AdminAppsToolbarView { @Override public void onAppSelectionChanged(AppSelectionChangedEvent event) { appSelection = event.getAppSelection(); boolean deleteEnabled, restoreAppEnabled, categorizeAppEnabled; switch (appSelection.size()) { case 1: final boolean isDeleted = appSelection.get(0).isDeleted(); deleteEnabled = !isDeleted; restoreAppEnabled = isDeleted; categorizeAppEnabled = !isDeleted; break; default: deleteEnabled = false; restoreAppEnabled = false; categorizeAppEnabled = false; } addCategory.setEnabled(false); renameCategory.setEnabled(false); deleteApp.setEnabled(deleteEnabled); restoreApp.setEnabled(restoreAppEnabled); categorizeApp.setEnabled(categorizeAppEnabled); } @Inject  AdminAppsToolbarViewImpl(final ToolbarAppearance appearance,
                             @Assisted final PagingLoader<FilterPagingLoadConfig, PagingLoadResult<App>> loader); @Override HandlerRegistration addAddCategorySelectedHandler(AddCategorySelected.AddCategorySelectedHandler handler); @Override HandlerRegistration addAppSearchResultLoadEventHandler(AppSearchResultLoadEvent.AppSearchResultLoadEventHandler handler); @Override HandlerRegistration addBeforeAppSearchEventHandler(BeforeAppSearchEvent.BeforeAppSearchEventHandler handler); @Override HandlerRegistration addCategorizeAppSelectedHandler(CategorizeAppSelected.CategorizeAppSelectedHandler handler); @Override HandlerRegistration addDeleteAppsSelectedHandler(DeleteAppsSelected.DeleteAppsSelectedHandler handler); @Override HandlerRegistration addDeleteCategorySelectedHandler(DeleteCategorySelected.DeleteCategorySelectedHandler handler); @Override HandlerRegistration addMoveCategorySelectedHandler(MoveCategorySelected.MoveCategorySelectedHandler handler); @Override HandlerRegistration addRenameCategorySelectedHandler(RenameCategorySelected.RenameCategorySelectedHandler handler); @Override HandlerRegistration addRestoreAppSelectedHandler(RestoreAppSelected.RestoreAppSelectedHandler handler); @Override void onAppCategorySelectionChanged(AppCategorySelectionChangedEvent event); @Override void onAppSelectionChanged(AppSelectionChangedEvent event); }
AdminAppsToolbarViewImpl extends Composite implements AdminAppsToolbarView { @Override public void onAppSelectionChanged(AppSelectionChangedEvent event) { appSelection = event.getAppSelection(); boolean deleteEnabled, restoreAppEnabled, categorizeAppEnabled; switch (appSelection.size()) { case 1: final boolean isDeleted = appSelection.get(0).isDeleted(); deleteEnabled = !isDeleted; restoreAppEnabled = isDeleted; categorizeAppEnabled = !isDeleted; break; default: deleteEnabled = false; restoreAppEnabled = false; categorizeAppEnabled = false; } addCategory.setEnabled(false); renameCategory.setEnabled(false); deleteApp.setEnabled(deleteEnabled); restoreApp.setEnabled(restoreAppEnabled); categorizeApp.setEnabled(categorizeAppEnabled); } @Inject  AdminAppsToolbarViewImpl(final ToolbarAppearance appearance,
                             @Assisted final PagingLoader<FilterPagingLoadConfig, PagingLoadResult<App>> loader); @Override HandlerRegistration addAddCategorySelectedHandler(AddCategorySelected.AddCategorySelectedHandler handler); @Override HandlerRegistration addAppSearchResultLoadEventHandler(AppSearchResultLoadEvent.AppSearchResultLoadEventHandler handler); @Override HandlerRegistration addBeforeAppSearchEventHandler(BeforeAppSearchEvent.BeforeAppSearchEventHandler handler); @Override HandlerRegistration addCategorizeAppSelectedHandler(CategorizeAppSelected.CategorizeAppSelectedHandler handler); @Override HandlerRegistration addDeleteAppsSelectedHandler(DeleteAppsSelected.DeleteAppsSelectedHandler handler); @Override HandlerRegistration addDeleteCategorySelectedHandler(DeleteCategorySelected.DeleteCategorySelectedHandler handler); @Override HandlerRegistration addMoveCategorySelectedHandler(MoveCategorySelected.MoveCategorySelectedHandler handler); @Override HandlerRegistration addRenameCategorySelectedHandler(RenameCategorySelected.RenameCategorySelectedHandler handler); @Override HandlerRegistration addRestoreAppSelectedHandler(RestoreAppSelected.RestoreAppSelectedHandler handler); @Override void onAppCategorySelectionChanged(AppCategorySelectionChangedEvent event); @Override void onAppSelectionChanged(AppSelectionChangedEvent event);  }