Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

UI-337 Create dropdown menu to replace DETabPanel in Apps #340

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import org.iplantc.de.apps.client.events.selection.AppInfoSelectedEvent;
import org.iplantc.de.apps.client.events.selection.CopyAppSelected;
import org.iplantc.de.apps.client.events.selection.CopyWorkflowSelected;
import org.iplantc.de.apps.client.AppNavigationView;
import org.iplantc.de.client.models.HasId;
import org.iplantc.de.client.models.IsMaskable;
import org.iplantc.de.client.models.apps.App;
import org.iplantc.de.client.models.apps.AppCategory;
import org.iplantc.de.commons.client.widgets.DETabPanel;

import com.google.gwt.user.client.ui.IsWidget;

Expand Down Expand Up @@ -75,7 +75,7 @@ interface Presenter extends AppSearchResultLoadEvent.AppSearchResultLoadEventHan

AppCategoriesView getWorkspaceView();

void go(HasId selectedAppCategory, boolean selectDefaultCategory, DETabPanel tabPanel);
void go(HasId selectedAppCategory, boolean selectDefaultCategory, AppNavigationView appNavigationView);

void setViewDebugId(String baseID);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package org.iplantc.de.apps.client;

import org.iplantc.de.client.models.IsMaskable;

import com.google.gwt.event.logical.shared.HasSelectionHandlers;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.Widget;

import java.util.List;

/**
* A view in the Apps window for navigating groups of app categories or hierarchy roots
* This is effectively the same as TabPanel, except the tabs are replaced with a dropdown menu
* Adding a String + Widget to the view ties a dropdown selection with that name to a Widget
* that should be displayed below the dropdown. Changing the dropdown selection will then change
* the widget displayed.
*/
public interface AppNavigationView extends IsWidget,
IsMaskable,
HasSelectionHandlers<Widget> {

/**
* Add a category/hierarchy root to the view with the specified name
* @param widget
* @param name
*/
void add(Widget widget, String name);

/**
* Add a category/hierarchy root to the view at the specified index with the specified name
* @param widget
* @param name
*/
void insert(Widget widget, int index, String name);

/**
* Remove all options from the view
*/
void clear();

/**
* Set the navigation view to the specified widget
* @param widget
*/
void setActiveWidget(Widget widget);

/**
* Return the widget at that particular index
* @param index
*/
Widget getWidget(int index);

/**
* @return true if there are no options in the view
*/
boolean isEmpty();

/**
* @return the list of all widgets added to the view
*/
List<Widget> getWidgets();

/**
* @return the count of all the options in the view
*/
int getWidgetCount();
}
6 changes: 3 additions & 3 deletions de-lib/src/main/java/org/iplantc/de/apps/client/AppsView.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.iplantc.de.apps.client;

import org.iplantc.de.apps.client.AppNavigationView;
import org.iplantc.de.client.models.HasId;
import org.iplantc.de.client.models.IsMaskable;
import org.iplantc.de.client.models.apps.App;
import org.iplantc.de.client.models.apps.AppCategory;
import org.iplantc.de.commons.client.widgets.DETabPanel;

import com.google.gwt.user.client.ui.HasOneWidget;
import com.google.gwt.user.client.ui.IsWidget;
Expand Down Expand Up @@ -84,13 +84,13 @@ void go(HasOneWidget container,
public boolean isDetailsCollapsed();
}

DETabPanel getCategoryTabPanel();
AppNavigationView getAppNavigationView();

void hideAppMenu();

void hideWorkflowMenu();

void clearTabPanel();
void resetAppNavigationView();

boolean isNavPanelCollapsed();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import org.iplantc.de.apps.client.events.SelectedHierarchyNotFound;
import org.iplantc.de.apps.client.events.selection.AppInfoSelectedEvent;
import org.iplantc.de.apps.client.events.selection.OntologyHierarchySelectionChangedEvent;
import org.iplantc.de.apps.client.AppNavigationView;
import org.iplantc.de.client.models.IsMaskable;
import org.iplantc.de.client.models.ontologies.OntologyHierarchy;
import org.iplantc.de.commons.client.widgets.DETabPanel;

import com.google.gwt.user.client.ui.IsWidget;

Expand All @@ -31,7 +31,7 @@ interface Presenter extends AppInfoSelectedEvent.AppInfoSelectedEventHandler,
OntologyHierarchySelectionChangedEvent.HasOntologyHierarchySelectionChangedEventHandlers,
SelectedHierarchyNotFound.HasSelectedHierarchyNotFoundHandlers {

void go(OntologyHierarchy selectedHierarchy, DETabPanel tabPanel);
void go(OntologyHierarchy selectedHierarchy, AppNavigationView appNavigationView);

void setViewDebugId(String baseID);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.iplantc.de.apps.client.AppCategoriesView;
import org.iplantc.de.apps.client.AppDetailsView;
import org.iplantc.de.apps.client.AppNavigationView;
import org.iplantc.de.apps.client.AppsListView;
import org.iplantc.de.apps.client.AppsToolbarView;
import org.iplantc.de.apps.client.AppsView;
Expand Down Expand Up @@ -33,6 +34,7 @@
import org.iplantc.de.apps.client.views.list.AppsGridViewImpl;
import org.iplantc.de.apps.client.views.list.AppsTileViewImpl;
import org.iplantc.de.apps.client.views.list.widgets.AppTypeFilterCombo;
import org.iplantc.de.apps.client.views.navigation.AppNavigationViewImpl;
import org.iplantc.de.apps.client.views.sharing.AppSharingView;
import org.iplantc.de.apps.client.views.sharing.AppSharingViewImpl;
import org.iplantc.de.apps.client.views.submit.SubmitAppForPublicUseViewImpl;
Expand Down Expand Up @@ -116,6 +118,9 @@ protected void configure() {
install(new GinFactoryModuleBuilder().implement(AppDocEditView.class, AppDocEditViewImpl.class)
.build(AppDocEditViewFactory.class));

// Navigation
bind(AppNavigationView.class).to(AppNavigationViewImpl.class);

bind(AppDetailsView.Presenter.class).to(AppDetailsViewPresenterImpl.class);
bind(AppDetailsDialog.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
import org.iplantc.de.apps.client.OntologyHierarchiesView;
import org.iplantc.de.apps.client.events.selection.RefreshAppsSelectedEvent;
import org.iplantc.de.apps.client.gin.factory.AppsViewFactory;
import org.iplantc.de.apps.client.AppNavigationView;
import org.iplantc.de.client.models.HasId;
import org.iplantc.de.client.models.UserInfo;
import org.iplantc.de.client.models.apps.App;
import org.iplantc.de.client.models.apps.AppCategory;
import org.iplantc.de.client.models.ontologies.OntologyHierarchy;
import org.iplantc.de.client.util.OntologyUtil;
import org.iplantc.de.commons.client.widgets.DETabPanel;

import com.google.common.base.Strings;
import com.google.gwt.user.client.ui.HasOneWidget;
Expand Down Expand Up @@ -97,10 +97,10 @@ public AppCategory getSelectedAppCategory() {
public void go(final HasOneWidget container,
final HasId selectedAppCategory,
final HasId selectedApp, final String activeView, final boolean catPanelCollapsed) {
DETabPanel tabPanel = view.getCategoryTabPanel();
if (isEmpty(tabPanel)) {
categoriesPresenter.go(selectedAppCategory, true, tabPanel);
hierarchiesPresenter.go(null, tabPanel);
AppNavigationView appNavigationView = view.getAppNavigationView();
if (appNavigationView.isEmpty()) {
categoriesPresenter.go(selectedAppCategory, true, appNavigationView);
hierarchiesPresenter.go(null, appNavigationView);
}
if (!Strings.isNullOrEmpty(activeView)) {
appsListPresenter.setActiveView(activeView);
Expand Down Expand Up @@ -163,11 +163,11 @@ public void onRefreshAppsSelected(RefreshAppsSelectedEvent event) {
boolean hasSearchPhrase = toolbarPresenter.getView().hasSearchPhrase();
boolean useDefaultSelection = !hasSearchPhrase && selectedHierarchy == null;

view.clearTabPanel();
DETabPanel categoryTabPanel = view.getCategoryTabPanel();
view.resetAppNavigationView();
AppNavigationView appNavigationView = view.getAppNavigationView();

categoriesPresenter.go(selectedAppCategory, useDefaultSelection, categoryTabPanel);
hierarchiesPresenter.go(selectedHierarchy, categoryTabPanel);
categoriesPresenter.go(selectedAppCategory, useDefaultSelection, appNavigationView);
hierarchiesPresenter.go(selectedHierarchy, appNavigationView);
if (hasSearchPhrase) {
toolbarPresenter.reloadSearchResults();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.iplantc.de.apps.client.events.selection.CopyWorkflowSelected;
import org.iplantc.de.apps.client.gin.AppCategoryTreeStoreProvider;
import org.iplantc.de.apps.client.gin.factory.AppCategoriesViewFactory;
import org.iplantc.de.apps.client.AppNavigationView;
import org.iplantc.de.apps.client.views.details.dialogs.AppDetailsDialog;
import org.iplantc.de.apps.shared.AppsModule;
import org.iplantc.de.client.events.EventBus;
Expand All @@ -29,7 +30,6 @@
import org.iplantc.de.commons.client.info.IplantAnnouncer;
import org.iplantc.de.commons.client.info.SuccessAnnouncementConfig;
import org.iplantc.de.commons.client.views.dialogs.AgaveAuthPrompt;
import org.iplantc.de.commons.client.widgets.DETabPanel;
import org.iplantc.de.shared.AppsCallback;
import org.iplantc.de.shared.AsyncProviderWrapper;
import org.iplantc.de.shared.DEProperties;
Expand All @@ -54,7 +54,6 @@
import com.sencha.gxt.data.shared.SortDir;
import com.sencha.gxt.data.shared.Store;
import com.sencha.gxt.data.shared.TreeStore;
import com.sencha.gxt.widget.core.client.TabItemConfig;
import com.sencha.gxt.widget.core.client.tree.Tree;

import java.util.Arrays;
Expand Down Expand Up @@ -108,7 +107,7 @@ public int compare(AppCategory group1, AppCategory group2) {
List<AppCategory> workspaceCategories = Lists.newArrayList();
List<AppCategory> hpcCategories = Lists.newArrayList();
List<Tree<AppCategory, String>> trees = Lists.newArrayList();
DETabPanel viewTabPanel;
AppNavigationView appNavigationView;
AppCategoriesViewFactory viewFactory;
HandlerManager handlerManager;
AppCategoriesView workspaceView;
Expand Down Expand Up @@ -167,11 +166,11 @@ public AppCategoriesView getWorkspaceView() {
}

@Override
public void go(final HasId selectedAppCategory, final boolean selectDefaultCategory, final DETabPanel tabPanel) {
this.viewTabPanel = tabPanel;
public void go(final HasId selectedAppCategory, final boolean selectDefaultCategory, final AppNavigationView appNavigationView) {
this.appNavigationView = appNavigationView;

viewTabPanel.add(workspaceView.getTree(), new TabItemConfig(appearance.workspaceTab()), baseId + AppsModule.Ids.WORKSPACE_TAB);
viewTabPanel.add(hpcView.getTree(), new TabItemConfig(appearance.hpcTab()), baseId + AppsModule.Ids.HPC_TAB);
this.appNavigationView.add(workspaceView.getTree(), appearance.workspaceTab());
this.appNavigationView.add(hpcView.getTree(), appearance.hpcTab());

workspaceView.getTree().mask(appearance.getAppCategoriesLoadingMask());
hpcView.getTree().mask(appearance.getAppCategoriesLoadingMask());
Expand All @@ -180,7 +179,7 @@ public void go(final HasId selectedAppCategory, final boolean selectDefaultCateg
@Override
public void onFailure(Integer statusCode, Throwable caught) {
ErrorHandler.post(caught);
viewTabPanel.unmask();
appNavigationView.unmask();
}

@Override
Expand Down Expand Up @@ -247,7 +246,7 @@ void selectDesiredCategory(HasId selectedAppCategory, boolean selectDefaultCateg
boolean doSelectCategory(Tree<AppCategory, String> tree, AppCategory category) {
Tree.TreeNode<AppCategory> node = tree.findNode(category);
if (node != null) {
viewTabPanel.setActiveWidget(tree);
appNavigationView.setActiveWidget(tree);
tree.getSelectionModel().select(node.getModel(), true);
return true;
}
Expand All @@ -256,7 +255,7 @@ boolean doSelectCategory(Tree<AppCategory, String> tree, AppCategory category) {

void selectDefaultCategory() {
Tree<AppCategory, String> tree = workspaceView.getTree();
viewTabPanel.setActiveWidget(tree);
appNavigationView.setActiveWidget(tree);
tree.getSelectionModel().select(tree.getStore().getRootItems().get(0), true);
}

Expand All @@ -266,7 +265,7 @@ public void onSelectedHierarchyNotFound(SelectedHierarchyNotFound event) {
}

void addHPCTabSelectionHandler() {
viewTabPanel.addSelectionHandler(new SelectionHandler<Widget>() {
appNavigationView.addSelectionHandler(new SelectionHandler<Widget>() {
@Override
public void onSelection(SelectionEvent<Widget> event) {
if (event.getSelectedItem() == hpcView.getTree() && hpcCategories.size() == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.iplantc.de.apps.client.presenter.callbacks.DeleteRatingCallback;
import org.iplantc.de.apps.client.presenter.callbacks.ParentFilteredHierarchyCallback;
import org.iplantc.de.apps.client.presenter.callbacks.RateAppCallback;
import org.iplantc.de.apps.client.AppNavigationView;
import org.iplantc.de.apps.client.views.details.dialogs.AppDetailsDialog;
import org.iplantc.de.client.events.EventBus;
import org.iplantc.de.client.models.apps.App;
Expand All @@ -31,7 +32,6 @@
import org.iplantc.de.commons.client.ErrorHandler;
import org.iplantc.de.commons.client.info.ErrorAnnouncementConfig;
import org.iplantc.de.commons.client.info.IplantAnnouncer;
import org.iplantc.de.commons.client.widgets.DETabPanel;
import org.iplantc.de.shared.AppsCallback;

import com.google.common.collect.Lists;
Expand All @@ -47,7 +47,6 @@
import com.sencha.gxt.data.shared.SortDir;
import com.sencha.gxt.data.shared.Store;
import com.sencha.gxt.data.shared.TreeStore;
import com.sencha.gxt.widget.core.client.TabItemConfig;
import com.sencha.gxt.widget.core.client.tree.Tree;

import java.util.List;
Expand Down Expand Up @@ -155,7 +154,7 @@ public void setParent(ParentFilteredHierarchyCallback parent) {
OntologyUtil ontologyUtil;
@Inject AsyncProvider<AppDetailsDialog> appDetailsDlgAsyncProvider;
@Inject AppUserServiceFacade appUserService;
DETabPanel viewTabPanel;
AppNavigationView appNavigationView;
private OntologyServiceFacade serviceFacade;
private OntologyHierarchiesView.OntologyHierarchiesAppearance appearance;
protected String searchRegexPattern;
Expand Down Expand Up @@ -184,11 +183,11 @@ public OntologyHierarchiesPresenterImpl(OntologyHierarchiesViewFactory viewFacto
}

@Override
public void go(final OntologyHierarchy selectedHierarchy, final DETabPanel tabPanel) {
public void go(final OntologyHierarchy selectedHierarchy, final AppNavigationView appNavigationView) {
desiredHierarchyFound = false;
unclassifiedHierarchies = Lists.newArrayList();
views = Lists.newArrayList();
viewTabPanel = tabPanel;
this.appNavigationView = appNavigationView;
serviceFacade.getRootHierarchies(new AppsCallback<List<OntologyHierarchy>>() {
@Override
public void onFailure(Integer statusCode, Throwable caught) {
Expand Down Expand Up @@ -258,7 +257,7 @@ void createViewTabs(final OntologyHierarchy selectedHierarchy, List<OntologyHier
view.asWidget().ensureDebugId(hierarchyDebugId);
view.addOntologyHierarchySelectionChangedEventHandler(this);
//As a preference, insert the hierarchy tabs before the HPC tab which is last
viewTabPanel.insert(tree, viewTabPanel.getWidgetCount() - 1, new TabItemConfig(appearance.hierarchyLabelName(hierarchy)), hierarchyDebugId);
appNavigationView.insert(tree, appNavigationView.getWidgetCount() - 1, appearance.hierarchyLabelName(hierarchy));
}

populateViewTabs(selectedHierarchy);
Expand Down Expand Up @@ -295,7 +294,7 @@ public void handleSuccess() {
@Override
public void onAppSearchResultLoad(AppSearchResultLoadEvent event) {
searchRegexPattern = event.getSearchPattern();
for (Widget widget : viewTabPanel) {
for (Widget widget : appNavigationView.getWidgets()) {
if (widget instanceof Tree) {
((Tree)widget).getSelectionModel().deselectAll();
}
Expand Down Expand Up @@ -324,7 +323,7 @@ boolean doSelectHierarchy(Tree<OntologyHierarchy, String> tree,
OntologyHierarchy selectedHierarchy) {
Tree.TreeNode<OntologyHierarchy> node = tree.findNode(selectedHierarchy);
if (node != null) {
viewTabPanel.setActiveWidget(tree);
appNavigationView.setActiveWidget(tree);
tree.getSelectionModel().select(node.getModel(), true);
return true;
}
Expand Down Expand Up @@ -408,11 +407,11 @@ public void onDetailsHierarchyClicked(DetailsHierarchyClicked event) {
checkNotNull(hierarchy);

String id = ontologyUtil.getOrCreateHierarchyPathTag(hierarchy);
for (int i = 0; i < viewTabPanel.getWidgetCount(); i++) {
Tree<OntologyHierarchy, String> tree = ((Tree)viewTabPanel.getWidget(i));
for (int i = 0; i < appNavigationView.getWidgetCount(); i++) {
Tree<OntologyHierarchy, String> tree = ((Tree)appNavigationView.getWidget(i));
OntologyHierarchy selectedHierarchy = tree.getStore().findModelWithKey(id);
if (selectedHierarchy != null) {
viewTabPanel.setActiveWidget(tree);
appNavigationView.setActiveWidget(tree);
tree.scrollIntoView(selectedHierarchy);
tree.getSelectionModel().select(selectedHierarchy, true);
break;
Expand All @@ -425,11 +424,11 @@ public void onDetailsCategoryClicked(DetailsCategoryClicked event) {
AppCategory category = event.getCategory();
checkNotNull(category);

for (int i = 0 ; i < viewTabPanel.getWidgetCount() ; i++) {
Tree<AppCategory, String> tree = ((Tree)viewTabPanel.getWidget(i));
for (int i = 0; i < appNavigationView.getWidgetCount() ; i++) {
Tree<AppCategory, String> tree = ((Tree)appNavigationView.getWidget(i));
AppCategory selectedCategory = tree.getStore().findModelWithKey(category.getId());
if (selectedCategory != null) {
viewTabPanel.setActiveWidget(tree);
appNavigationView.setActiveWidget(tree);
tree.scrollIntoView(selectedCategory);
tree.getSelectionModel().select(selectedCategory, true);
break;
Expand Down
Loading