From 2b4a49f9826ff865fd06dfce133908d5f7783a00 Mon Sep 17 00:00:00 2001 From: buczekp <buczekp> Date: Tue, 17 Mar 2009 10:44:45 +0000 Subject: [PATCH] [LMS-786] remove left menu and related code SVN: 10260 --- .../web/client/application/MenuCategory.java | 59 ------ .../web/client/application/MenuElement.java | 58 ------ .../client/application/framework/AppView.java | 16 +- .../framework/CategoriesBuilder.java | 187 ------------------ .../application/framework/LeftMenu.java | 132 ------------- .../web/client/testframework/GWTTestUtil.java | 32 --- 6 files changed, 1 insertion(+), 483 deletions(-) delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/MenuCategory.java delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/MenuElement.java delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/CategoriesBuilder.java delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/LeftMenu.java diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/MenuCategory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/MenuCategory.java deleted file mode 100644 index 7728681e9fe..00000000000 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/MenuCategory.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2008 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.generic.client.web.client.application; - -import java.util.List; - -import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.CategoriesBuilder.MenuCategoryKind; - -/** - * Category in the menu. - * - * @author Izabela Adamczyk - */ -public class MenuCategory -{ - - private final String name; - - private final List<MenuElement> elements; - - private final String partOfId; - - public MenuCategory(final MenuCategoryKind partOfId, final String name, - final List<MenuElement> elements) - { - this.partOfId = partOfId.name(); - this.name = name; - this.elements = elements; - } - - public String getName() - { - return name; - } - - public List<MenuElement> getElements() - { - return elements; - } - - public String getPartOfId() - { - return partOfId; - } -} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/MenuElement.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/MenuElement.java deleted file mode 100644 index 625b71aee64..00000000000 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/MenuElement.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2008 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.generic.client.web.client.application; - -import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.ITabItemFactory; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.CategoriesBuilder.MenuElementKind; - -/** - * Element of the {@link MenuCategory}. - * - * @author Izabela Adamczyk - */ -public final class MenuElement -{ - private final String title; - - private final ITabItemFactory tabItemFactory; - - private final String partOfId; - - public MenuElement(final MenuElementKind partOfId, final String title, - final ITabItemFactory tabItemFactory) - { - this.partOfId = partOfId.name(); - this.title = title; - this.tabItemFactory = tabItemFactory; - } - - public String getTitle() - { - return title; - } - - public ITabItemFactory getTabItem() - { - return tabItemFactory; - } - - public String getPartOfId() - { - return partOfId; - } - -} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/AppView.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/AppView.java index 5a4743a4680..67b37db5703 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/AppView.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/AppView.java @@ -21,7 +21,6 @@ import com.extjs.gxt.ui.client.mvc.AppEvent; import com.extjs.gxt.ui.client.mvc.Controller; import com.extjs.gxt.ui.client.mvc.View; import com.extjs.gxt.ui.client.util.Margins; -import com.extjs.gxt.ui.client.widget.ContentPanel; import com.extjs.gxt.ui.client.widget.Viewport; import com.extjs.gxt.ui.client.widget.layout.BorderLayout; import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData; @@ -42,16 +41,12 @@ final class AppView extends View private Viewport viewport; - private ContentPanel west; - private MainTabPanel center; private TopMenu north; private ComponentProvider componentProvider; - private CategoriesBuilder categoriesBuilder; - AppView(final Controller controller, final CommonViewContext viewContext) { super(controller); @@ -74,7 +69,6 @@ final class AppView extends View viewport = new Viewport(); viewport.setLayout(new BorderLayout()); createNorth(); - createWest(); createCenter(); createSouth(); RootPanel.get().clear(); @@ -88,14 +82,6 @@ final class AppView extends View viewport.add(north, data); } - private final void createWest() - { - west = new LeftMenu(categoriesBuilder.getCategories()); - final BorderLayoutData data = new BorderLayoutData(LayoutRegion.WEST, 200, 150, 350); - data.setMargins(new Margins(5, 0, 5, 5)); - viewport.add(west, data); - } - private final void createCenter() { center = new MainTabPanel(viewContext); @@ -119,7 +105,7 @@ final class AppView extends View protected final void initialize() { componentProvider = new ComponentProvider(viewContext); - categoriesBuilder = new CategoriesBuilder(componentProvider); + // categoriesBuilder = new CategoriesBuilder(componentProvider); } @Override diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/CategoriesBuilder.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/CategoriesBuilder.java deleted file mode 100644 index ef215bae5d9..00000000000 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/CategoriesBuilder.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright 2008 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.generic.client.web.client.application.framework; - -import java.util.ArrayList; -import java.util.List; - -import ch.systemsx.cisd.openbis.generic.client.web.client.application.MenuCategory; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.MenuElement; - -/** - * Allows to define categories which will be displayed in {@link LeftMenu}. - * - * @author Izabela Adamczyk - */ -public class CategoriesBuilder -{ - private static final String IMPORT_LABEL = "Import"; - - private static final String LABEL_REGISTER = "New"; - - private static final String LABEL_BROWSE = "Browse"; - - private static final String BROWSE_TYPES_LABEL = "Types"; - - public static enum MenuCategoryKind - { - VOCABULARIES, MATERIALS, EXPERIMENTS, PERSONS, PROJECTS, GROUPS, ROLES, SAMPLES, DATA_SETS, - PROPERTY_TYPES; - } - - public static enum MenuElementKind - { - ADD_ROLE, ASSIGN, ASSIGN_STPT, ASSIGN_ETPT, REGISTER, IMPORT, BROWSE, BROWSE_TYPES, MANAGE, - LIST_ASSIGNMENTS, SEARCH; - } - - public final ComponentProvider provider; - - public final List<MenuCategory> categories; - - CategoriesBuilder(final ComponentProvider provider) - { - this.provider = provider; - categories = new ArrayList<MenuCategory>(); - defineCategories(); - } - - private void defineCategories() - { - categories.add(createSampleCategory()); - categories.add(createExperimentCategory()); - categories.add(createMaterialCategory()); - categories.add(createPropertyTypesCategory()); - categories.add(createVocabulariesCategory()); - categories.add(createProjectsTypesCategory()); - categories.add(createDataSetsCategory()); - categories.add(createGroupsCategory()); - categories.add(createPersonsCategory()); - categories.add(createRolesCategory()); - } - - private MenuCategory createSampleCategory() - { - final List<MenuElement> elements = new ArrayList<MenuElement>(); - elements.add(new MenuElement(MenuElementKind.BROWSE, LABEL_BROWSE, provider - .getSampleBrowser())); - elements.add(new MenuElement(MenuElementKind.REGISTER, LABEL_REGISTER, provider - .getSampleRegistration())); - elements.add(new MenuElement(MenuElementKind.IMPORT, IMPORT_LABEL, provider - .getSampleBatchRegistration())); - elements.add(new MenuElement(MenuElementKind.BROWSE_TYPES, BROWSE_TYPES_LABEL, provider - .getSampleTypeBrowser())); - return new MenuCategory(MenuCategoryKind.SAMPLES, "Samples", elements); - } - - private MenuCategory createRolesCategory() - { - final List<MenuElement> elements = new ArrayList<MenuElement>(); - elements - .add(new MenuElement(MenuElementKind.BROWSE, LABEL_BROWSE, provider.getRolesView())); - return new MenuCategory(MenuCategoryKind.ROLES, "Roles", elements); - } - - private MenuCategory createGroupsCategory() - { - final List<MenuElement> elements = new ArrayList<MenuElement>(); - elements - .add(new MenuElement(MenuElementKind.BROWSE, LABEL_BROWSE, provider.getGroupsView())); - return new MenuCategory(MenuCategoryKind.GROUPS, "Groups", elements); - } - - private MenuCategory createProjectsTypesCategory() - { - final List<MenuElement> elements = new ArrayList<MenuElement>(); - elements.add(new MenuElement(MenuElementKind.BROWSE, LABEL_BROWSE, provider - .getProjectBrowser())); - elements.add(new MenuElement(MenuElementKind.REGISTER, LABEL_REGISTER, provider - .getProjectRegistration())); - return new MenuCategory(MenuCategoryKind.PROJECTS, "Projects", elements); - } - - private MenuCategory createPersonsCategory() - { - final List<MenuElement> elements = new ArrayList<MenuElement>(); - elements.add(new MenuElement(MenuElementKind.BROWSE, LABEL_BROWSE, provider - .getPersonsView())); - return new MenuCategory(MenuCategoryKind.PERSONS, "Persons", elements); - } - - private MenuCategory createPropertyTypesCategory() - { - final List<MenuElement> elements = new ArrayList<MenuElement>(); - elements.add(new MenuElement(MenuElementKind.BROWSE, LABEL_BROWSE, provider - .getPropertyTypeBrowser())); - elements.add(new MenuElement(MenuElementKind.LIST_ASSIGNMENTS, "Browse Assignments", - provider.getPropertyTypeAssignmentBrowser())); - elements.add(new MenuElement(MenuElementKind.REGISTER, LABEL_REGISTER, provider - .getPropertyTypeRegistration())); - elements.add(new MenuElement(MenuElementKind.ASSIGN_ETPT, "Assign to Experiment Type", - provider.getPropertyTypeExperimentTypeAssignmentForm())); - elements.add(new MenuElement(MenuElementKind.ASSIGN_STPT, "Assign to Sample Type", provider - .getPropertyTypeSampleTypeAssignmentForm())); - return new MenuCategory(MenuCategoryKind.PROPERTY_TYPES, "Property Types", elements); - } - - private MenuCategory createDataSetsCategory() - { - final List<MenuElement> elements = new ArrayList<MenuElement>(); - elements - .add(new MenuElement(MenuElementKind.SEARCH, "Search", provider.getDataSetSearch())); - return new MenuCategory(MenuCategoryKind.DATA_SETS, "Data Sets", elements); - } - - private MenuCategory createVocabulariesCategory() - { - final List<MenuElement> elements = new ArrayList<MenuElement>(); - elements.add(new MenuElement(MenuElementKind.BROWSE, LABEL_BROWSE, provider - .getVocabularyBrowser())); - elements.add(new MenuElement(MenuElementKind.REGISTER, LABEL_REGISTER, provider - .getVocabularyRegistration())); - return new MenuCategory(MenuCategoryKind.VOCABULARIES, "Vocabularies", elements); - } - - private MenuCategory createMaterialCategory() - { - final List<MenuElement> elements = new ArrayList<MenuElement>(); - elements.add(new MenuElement(MenuElementKind.BROWSE, LABEL_BROWSE, provider - .getMaterialBrowser())); - elements.add(new MenuElement(MenuElementKind.IMPORT, IMPORT_LABEL, provider - .getMaterialBatchRegistration())); - elements.add(new MenuElement(MenuElementKind.BROWSE_TYPES, BROWSE_TYPES_LABEL, provider - .getMaterialTypeBrowser())); - return new MenuCategory(MenuCategoryKind.MATERIALS, "Materials", elements); - } - - private MenuCategory createExperimentCategory() - { - final List<MenuElement> elements = new ArrayList<MenuElement>(); - elements.add(new MenuElement(MenuElementKind.BROWSE, LABEL_BROWSE, provider - .getExperimentBrowser())); - elements.add(new MenuElement(MenuElementKind.REGISTER, LABEL_REGISTER, provider - .getExperimentRegistration())); - elements.add(new MenuElement(MenuElementKind.BROWSE_TYPES, BROWSE_TYPES_LABEL, provider - .getExperimentTypeBrowser())); - return new MenuCategory(MenuCategoryKind.EXPERIMENTS, "Experiments", elements); - } - - public List<MenuCategory> getCategories() - { - return categories; - } -} \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/LeftMenu.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/LeftMenu.java deleted file mode 100644 index 3c21d473bec..00000000000 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/LeftMenu.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright 2008 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.generic.client.web.client.application.framework; - -import java.util.List; - -import com.extjs.gxt.ui.client.event.Listener; -import com.extjs.gxt.ui.client.event.TreeEvent; -import com.extjs.gxt.ui.client.widget.ContentPanel; -import com.extjs.gxt.ui.client.widget.layout.AccordionLayout; -import com.extjs.gxt.ui.client.widget.tree.Tree; -import com.extjs.gxt.ui.client.widget.tree.TreeItem; -import com.google.gwt.user.client.Event; - -import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.MenuCategory; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.MenuElement; - -/** - * User menu allowing to get to wanted functionality of application (e.g. sample listing). - * - * @author Izabela Adamczyk - */ -public class LeftMenu extends ContentPanel -{ - public static final String ID = GenericConstants.ID_PREFIX + "left-menu"; - - public static final String TREE_SUFFIX = "_tree"; - - private final List<MenuCategory> categories; - - LeftMenu(final List<MenuCategory> categories) - { - this.categories = categories; - setId(ID); - setBodyBorder(true); - setLayoutOnChange(true); - setCollapsible(true); - setHeaderVisible(false); - setLayout(new AccordionLayout()); - addCategories(); - } - - final void addCategories() - { - for (final MenuCategory menuCategory : categories) - { - final String categoryId = ID + "_" + menuCategory.getPartOfId(); - final SubMenu subMenu = new SubMenu(menuCategory.getName(), categoryId); - for (final MenuElement me : menuCategory.getElements()) - { - subMenu.addCommand(categoryId + "_" + me.getPartOfId(), me.getTitle(), me - .getTabItem()); - } - add(subMenu); - } - } - - // - // Helper classes - // - - private final static class SubMenu extends ContentPanel - { - public static final String TAB_ITEM_KEY = "tabItemKey"; - - private final Tree tree; - - SubMenu(final String title, final String id) - { - setHeading(title); - setId(id); - tree = new Tree(); - tree.setId(id + TREE_SUFFIX); - tree.addListener(Event.ONCLICK, new Listener<TreeEvent>() - { - - // - // Listener - // - - public final void handleEvent(final TreeEvent be) - { - TreeItem selectedItem = tree.getSelectedItem(); - if (selectedItem == null) - { - return; - } - - if (selectedItem.isLeaf()) - { - ITabItemFactory tab = selectedItem.getData(TAB_ITEM_KEY); - DispatcherHelper.dispatchNaviEvent(tab); - } else - { - selectedItem.setExpanded(true); - } - } - }); - tree.setAnimate(false); - setBodyStyleName("pad-text"); - tree.getStyle().setNodeCloseIconStyle(""); - tree.getStyle().setNodeOpenIconStyle(""); - add(tree); - } - - private final void addCommand(final String id, final String name, - final ITabItemFactory tabItemFactory) - { - final TreeItem item = new TreeItem(name); - item.setId(id); - item.setData(TAB_ITEM_KEY, tabItemFactory); - tree.getRootItem().add(item); - } - - } - -} \ No newline at end of file diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/GWTTestUtil.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/GWTTestUtil.java index eb8c127d2ff..abc11e838b9 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/GWTTestUtil.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/GWTTestUtil.java @@ -42,8 +42,6 @@ import com.extjs.gxt.ui.client.widget.menu.Menu; import com.extjs.gxt.ui.client.widget.menu.MenuItem; import com.extjs.gxt.ui.client.widget.toolbar.AdapterToolItem; import com.extjs.gxt.ui.client.widget.toolbar.ToolItem; -import com.extjs.gxt.ui.client.widget.tree.Tree; -import com.extjs.gxt.ui.client.widget.tree.TreeItem; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.ui.ComplexPanel; import com.google.gwt.user.client.ui.ListBox; @@ -324,9 +322,6 @@ public final class GWTTestUtil } else if (widget instanceof Menu) { return new MenuHandler(this).handle((Menu) widget); - } else if (widget instanceof Tree) - { - return new TreeHandler(this).handle((Tree) widget); } else if (widget instanceof Container) { return new ContainerHandler(this).handle((Container<Component>) widget); @@ -469,33 +464,6 @@ public final class GWTTestUtil } - private static final class TreeHandler implements IWidgetHandler<Tree> - { - private final IWidgetHandler<Widget> handler; - - TreeHandler(final IWidgetHandler<Widget> handler) - { - this.handler = handler; - } - - // - // IWidgetHandler - // - - public final boolean handle(final Tree tree) - { - for (final TreeItem i : tree.getAllItems()) - { - if (handler.handle(i)) - { - return true; - } - - } - return false; - } - } - private static final class ComplexPanelHandler implements IWidgetHandler<ComplexPanel> { private final IWidgetHandler<Widget> handler; -- GitLab