@Test public void testOnAppCategorySelectionChanged_zeroSelected() { when(mockAppGrpSelectionChangedEvent.getAppCategorySelection()).thenReturn(Collections.<AppCategory>emptyList()); uut.onAppCategorySelectionChanged(mockAppGrpSelectionChangedEvent); verify(mockAppGrpSelectionChangedEvent).getAppCategorySelection(); verify(mockAddCategory).setEnabled(eq(true)); verify(mockDeleteCat).setEnabled(eq(false)); verify(mockRenameCategory).setEnabled(eq(false)); verify(mockMoveCategory).setEnabled(eq(false)); verifyNoMoreInteractions(mockAppGrpSelectionChangedEvent, mockRestoreApp, mockDeleteApp, mockCategorizeApp); verifyZeroInteractions(mockRestoreApp, mockDeleteApp, mockCategorizeApp); }
@Override public void onAppCategorySelectionChanged(AppCategorySelectionChangedEvent event) { appCategorySelection = event.getAppCategorySelection(); if(!appCategorySelection.isEmpty()){ appSearch.clear(); } boolean renameCategoryEnabled, deleteEnabled, moveCatEnabled, addCategoryEnabled; switch (appCategorySelection.size()) { case 1: renameCategoryEnabled = true; deleteEnabled = true; moveCatEnabled = true; addCategoryEnabled = true; break; default: renameCategoryEnabled = false; deleteEnabled = false; moveCatEnabled = false; addCategoryEnabled = true; } addCategory.setEnabled(addCategoryEnabled); renameCategory.setEnabled(renameCategoryEnabled); deleteCat.setEnabled(deleteEnabled); moveCategory.setEnabled(moveCatEnabled); }
AdminAppsToolbarViewImpl extends Composite implements AdminAppsToolbarView { @Override public void onAppCategorySelectionChanged(AppCategorySelectionChangedEvent event) { appCategorySelection = event.getAppCategorySelection(); if(!appCategorySelection.isEmpty()){ appSearch.clear(); } boolean renameCategoryEnabled, deleteEnabled, moveCatEnabled, addCategoryEnabled; switch (appCategorySelection.size()) { case 1: renameCategoryEnabled = true; deleteEnabled = true; moveCatEnabled = true; addCategoryEnabled = true; break; default: renameCategoryEnabled = false; deleteEnabled = false; moveCatEnabled = false; addCategoryEnabled = true; } addCategory.setEnabled(addCategoryEnabled); renameCategory.setEnabled(renameCategoryEnabled); deleteCat.setEnabled(deleteEnabled); moveCategory.setEnabled(moveCatEnabled); } }
AdminAppsToolbarViewImpl extends Composite implements AdminAppsToolbarView { @Override public void onAppCategorySelectionChanged(AppCategorySelectionChangedEvent event) { appCategorySelection = event.getAppCategorySelection(); if(!appCategorySelection.isEmpty()){ appSearch.clear(); } boolean renameCategoryEnabled, deleteEnabled, moveCatEnabled, addCategoryEnabled; switch (appCategorySelection.size()) { case 1: renameCategoryEnabled = true; deleteEnabled = true; moveCatEnabled = true; addCategoryEnabled = true; break; default: renameCategoryEnabled = false; deleteEnabled = false; moveCatEnabled = false; addCategoryEnabled = true; } addCategory.setEnabled(addCategoryEnabled); renameCategory.setEnabled(renameCategoryEnabled); deleteCat.setEnabled(deleteEnabled); moveCategory.setEnabled(moveCatEnabled); } @Inject  AdminAppsToolbarViewImpl(final ToolbarAppearance appearance,
                             @Assisted final PagingLoader<FilterPagingLoadConfig, PagingLoadResult<App>> loader); }
AdminAppsToolbarViewImpl extends Composite implements AdminAppsToolbarView { @Override public void onAppCategorySelectionChanged(AppCategorySelectionChangedEvent event) { appCategorySelection = event.getAppCategorySelection(); if(!appCategorySelection.isEmpty()){ appSearch.clear(); } boolean renameCategoryEnabled, deleteEnabled, moveCatEnabled, addCategoryEnabled; switch (appCategorySelection.size()) { case 1: renameCategoryEnabled = true; deleteEnabled = true; moveCatEnabled = true; addCategoryEnabled = true; break; default: renameCategoryEnabled = false; deleteEnabled = false; moveCatEnabled = false; addCategoryEnabled = true; } addCategory.setEnabled(addCategoryEnabled); renameCategory.setEnabled(renameCategoryEnabled); deleteCat.setEnabled(deleteEnabled); moveCategory.setEnabled(moveCatEnabled); } @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 onAppCategorySelectionChanged(AppCategorySelectionChangedEvent event) { appCategorySelection = event.getAppCategorySelection(); if(!appCategorySelection.isEmpty()){ appSearch.clear(); } boolean renameCategoryEnabled, deleteEnabled, moveCatEnabled, addCategoryEnabled; switch (appCategorySelection.size()) { case 1: renameCategoryEnabled = true; deleteEnabled = true; moveCatEnabled = true; addCategoryEnabled = true; break; default: renameCategoryEnabled = false; deleteEnabled = false; moveCatEnabled = false; addCategoryEnabled = true; } addCategory.setEnabled(addCategoryEnabled); renameCategory.setEnabled(renameCategoryEnabled); deleteCat.setEnabled(deleteEnabled); moveCategory.setEnabled(moveCatEnabled); } @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);  }