diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/ICommonClientService.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/ICommonClientService.java index 1698ab9ce628ffd5d53eb604fed636b370f4f368..fb54fc78c941dae976b78937c71046da88835f4b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/ICommonClientService.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/ICommonClientService.java @@ -163,11 +163,17 @@ public interface ICommonClientService extends IClientService throws UserFailureException; /** - * Returns a list of all metaproject assignment counts. + * Returns a list of all metaproject assignments counts. */ public List<MetaprojectAssignmentsCount> listMetaprojectAssignmentsCounts() throws UserFailureException; + /** + * Returns metaproject assignments count. + */ + public MetaprojectAssignmentsCount getMetaprojectAssignmentsCount(Long metaprojectId) + throws UserFailureException; + /** * Returns metaproject assignments. */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/ICommonClientServiceAsync.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/ICommonClientServiceAsync.java index 644fe4c24ccac6fcfc4cdca84370072191566bf5..cfd86ca76612c172e61fee5fa4a3e023fcb9491e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/ICommonClientServiceAsync.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/ICommonClientServiceAsync.java @@ -150,6 +150,10 @@ public interface ICommonClientServiceAsync extends IClientServiceAsync public void listMetaprojectAssignmentsCounts( final AsyncCallback<List<MetaprojectAssignmentsCount>> asyncCallback); + /** @see ICommonClientService#getMetaprojectAssignmentsCount(Long) */ + public void getMetaprojectAssignmentsCount(Long metaprojectId, + final AsyncCallback<MetaprojectAssignmentsCount> asyncCallback); + /** * @see ICommonClientService#getMetaprojectAssignments(Long, * MetaprojectAssignmentsFetchOption[]) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java index 879ad557054744aa0b265d80bd19e2404f51bbbe..de54cd3260faea9e7b9a5dad531592e798c11665 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java @@ -958,6 +958,12 @@ public abstract class Dict public static final String METAPROJECT_TREE_INFO_LINK = "metaproject_tree_info_link"; + public static final String METAPROJECT_TREE_DESCRIPTION_NOT_AVAILABLE = + "metaproject_tree_description_not_available"; + + public static final String METAPROJECT_TREE_METAPROJECT_TOOLTIP = + "metaproject_tree_metaproject_tooltip"; + // // Metaproject Browser // @@ -968,6 +974,22 @@ public abstract class Dict public static final String METAPROJECT_BROWSER_TREE_TOOLTIP = "metaproject_browser_tree_tooltip"; + public static final String METAPROJECT_BROWSER_ENTITIES_TITLE = + "metaproject_browser_entities_title"; + + // + // Metaproject Entities + // + + public static final String METAPROJECT_ENTITIES_EXPERIMENTS = + "metaproject_entities_experiments"; + + public static final String METAPROJECT_ENTITIES_SAMPLES = "metaproject_entities_samples"; + + public static final String METAPROJECT_ENTITIES_DATA_SETS = "metaproject_entities_data_sets"; + + public static final String METAPROJECT_ENTITIES_MATERIALS = "metaproject_entities_materials"; + // // Detailed Search // diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DisplayTypeIDGenerator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DisplayTypeIDGenerator.java index 5568763d63ec878f3c6b561a0cc48df4324c1728..bb80e3f890f7ebc51c675801a828006bd27476cb 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DisplayTypeIDGenerator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/DisplayTypeIDGenerator.java @@ -32,6 +32,8 @@ public enum DisplayTypeIDGenerator implements IDisplayTypeIDGenerator EXPERIMENT_DETAILS_GRID("experiment-details-grid"), + METAPROJECT_DETAILS_GRID("metaproject-details-grid"), + SAMPLE_DETAILS_GRID("sample-details-grid"), TYPE_BROWSER_GRID("type-browser-grid"), @@ -94,8 +96,14 @@ public enum DisplayTypeIDGenerator implements IDisplayTypeIDGenerator PARENT_SAMPLES_SECTION("parent-samples-section"), + EXPERIMENTS_SECTION("experiments-section"), + + SAMPLES_SECTION("samples-section"), + DATA_SETS_SECTION("data-sets-section"), + MATERIALS_SECTION("materials-section"), + ENTITY_HISTORY_SECTION("entity-history-section"), DATA_SET_PARENTS_SECTION("data-set-parents-section"), @@ -120,6 +128,8 @@ public enum DisplayTypeIDGenerator implements IDisplayTypeIDGenerator GENERIC_MATERIAL_VIEWER("generic_material_viewer"), + GENERIC_METAPROJECT_VIEWER("generic_metaproject_viewer"), + ; private final String genericNameOrPrefix; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/MetaprojectBrowserGrids.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/MetaprojectBrowserGrids.java deleted file mode 100644 index 8add1dce6be48671df933ea93558091298c1becb..0000000000000000000000000000000000000000 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/MetaprojectBrowserGrids.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2012 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.ui.experiment; - -import java.util.Set; - -import com.extjs.gxt.ui.client.widget.Composite; -import com.extjs.gxt.ui.client.widget.Text; - -import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; - -/** - * @author pkupczyk - */ -public class MetaprojectBrowserGrids extends Composite implements IDisposableComponent -{ - - public MetaprojectBrowserGrids(IViewContext<?> viewContext) - { - initComponent(new Text("grids")); - } - - @Override - public void update(Set<DatabaseModificationKind> observedModifications) - { - } - - @Override - public DatabaseModificationKind[] getRelevantModifications() - { - return null; - } - - @Override - public void dispose() - { - } - -} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/browser/MetaprojectBrowser.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/browser/MetaprojectBrowser.java index d75875ec5bb3c580abc7bd231300e25c7f1fb54e..4c8ccc1aaf0af8a65b58066f17a67bd4e0f854ae 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/browser/MetaprojectBrowser.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/browser/MetaprojectBrowser.java @@ -19,17 +19,26 @@ package ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.metapr import java.util.Set; import com.extjs.gxt.ui.client.Style.LayoutRegion; +import com.extjs.gxt.ui.client.event.SelectionChangedEvent; +import com.extjs.gxt.ui.client.event.SelectionChangedListener; import com.extjs.gxt.ui.client.util.Margins; import com.extjs.gxt.ui.client.widget.Component; import com.extjs.gxt.ui.client.widget.ContentPanel; import com.extjs.gxt.ui.client.widget.layout.BorderLayout; import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict; import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.experiment.MetaprojectBrowserGrids; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.DisposableComposite; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.metaproject.entity.MetaprojectEntities; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.metaproject.tree.MetaprojectTree; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.metaproject.tree.model.MetaprojectTreeEntityItemData; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.metaproject.tree.model.MetaprojectTreeEntityKindItemData; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.metaproject.tree.model.MetaprojectTreeItemData; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.metaproject.tree.model.MetaprojectTreeMetaprojectItemData; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.GWTUtils; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; /** @@ -38,11 +47,16 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKin public class MetaprojectBrowser extends ContentPanel implements IDisposableComponent { + // TODO add logic to handle new metaprojectId parameter in + // ListSampleCriteria + + // TODO add remove assignments button to entity grids + public static final String ID = GenericConstants.ID_PREFIX + "metaproject-browser"; - private MetaprojectBrowserTree tree; + private MetaprojectTree tree; - private MetaprojectBrowserGrids grids; + private MetaprojectEntities entities; private DisposableComposite composite; @@ -51,13 +65,42 @@ public class MetaprojectBrowser extends ContentPanel implements IDisposableCompo setId(ID); setLayout(new BorderLayout()); - tree = new MetaprojectBrowserTree(viewContext); - // GWTUtils.setToolTip(tree, viewContext.getMessage(Dict.METAPROJECT_BROWSER_TREE_TOOLTIP)); - - grids = new MetaprojectBrowserGrids(viewContext); - composite = new DisposableComposite(this, tree, grids); - - BorderLayoutData treeLayout = new BorderLayoutData(LayoutRegion.WEST, 400, 20, 2000); + tree = new MetaprojectTree(viewContext, getId()); + tree.getSelectionModel().addSelectionChangedListener( + new SelectionChangedListener<MetaprojectTreeItemData>() + { + @Override + public void selectionChanged( + SelectionChangedEvent<MetaprojectTreeItemData> se) + { + MetaprojectTreeItemData item = se.getSelectedItem(); + + if (item instanceof MetaprojectTreeMetaprojectItemData) + { + MetaprojectTreeMetaprojectItemData metaprojectItem = + (MetaprojectTreeMetaprojectItemData) item; + entities.showEntities(metaprojectItem.getMetaproject().getId()); + } else if (item instanceof MetaprojectTreeEntityKindItemData) + { + MetaprojectTreeEntityKindItemData entityKindItem = + (MetaprojectTreeEntityKindItemData) item; + entities.showEntities(entityKindItem.getMetaprojectId(), + entityKindItem.getEntityKind()); + } else if (item instanceof MetaprojectTreeEntityItemData) + { + MetaprojectTreeEntityItemData entityItem = + (MetaprojectTreeEntityItemData) item; + entities.showEntities(entityItem.getMetaprojectId(), entityItem + .getEntity().getEntityKind()); + } + } + }); + + GWTUtils.setToolTip(tree, viewContext.getMessage(Dict.METAPROJECT_BROWSER_TREE_TOOLTIP)); + entities = new MetaprojectEntities(viewContext, getId()); + composite = new DisposableComposite(this, tree, entities); + + BorderLayoutData treeLayout = new BorderLayoutData(LayoutRegion.WEST, 300, 20, 2000); treeLayout.setSplit(true); treeLayout.setMargins(new Margins(2)); treeLayout.setCollapsible(true); @@ -69,8 +112,8 @@ public class MetaprojectBrowser extends ContentPanel implements IDisposableCompo gridsLayout.setCollapsible(true); gridsLayout.setFloatable(false); - add(tree, treeLayout); - add(grids, gridsLayout); + add(new MetaprojectBrowserTreePanel(viewContext, tree), treeLayout); + add(new MetaprojectBrowserEntitiesPanel(viewContext, entities), gridsLayout); layout(); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/browser/MetaprojectBrowserEntitiesPanel.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/browser/MetaprojectBrowserEntitiesPanel.java new file mode 100644 index 0000000000000000000000000000000000000000..09f0c645db3ba4f5e9e2a8dfeb8ffdc341724cfd --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/browser/MetaprojectBrowserEntitiesPanel.java @@ -0,0 +1,45 @@ +/* + * 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.ui.metaproject.browser; + +import com.extjs.gxt.ui.client.widget.ContentPanel; +import com.extjs.gxt.ui.client.widget.layout.FitLayout; + +import ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.metaproject.entity.MetaprojectEntities; + +/** + * @author pkupczyk + */ +public final class MetaprojectBrowserEntitiesPanel extends ContentPanel +{ + + public static final String ID = GenericConstants.ID_PREFIX + + "metaproject-browser-entities-panel"; + + public MetaprojectBrowserEntitiesPanel(final IViewContext<?> viewContext, + final MetaprojectEntities entities) + { + setLayout(new FitLayout()); + setBodyBorder(false); + setHeading(viewContext.getMessage(Dict.METAPROJECT_BROWSER_ENTITIES_TITLE)); + add(entities); + } + +} \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/browser/MetaprojectBrowserTree.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/browser/MetaprojectBrowserTreePanel.java similarity index 63% rename from openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/browser/MetaprojectBrowserTree.java rename to openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/browser/MetaprojectBrowserTreePanel.java index 62e53c36bae903b2a8b2843db5e64d2e2cdd3207..8b5d06b3d5ba8de53be9cf9fed922c3119d6f5d1 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/browser/MetaprojectBrowserTree.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/browser/MetaprojectBrowserTreePanel.java @@ -16,61 +16,28 @@ package ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.metaproject.browser; -import java.util.Set; - -import com.extjs.gxt.ui.client.widget.Component; import com.extjs.gxt.ui.client.widget.ContentPanel; import com.extjs.gxt.ui.client.widget.layout.FitLayout; import ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict; import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.metaproject.tree.MetaprojectTree; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; /** * @author pkupczyk */ -public final class MetaprojectBrowserTree extends ContentPanel implements IDisposableComponent +public final class MetaprojectBrowserTreePanel extends ContentPanel { public static final String ID = GenericConstants.ID_PREFIX + "metaproject-browser-tree-panel"; - private final MetaprojectTree tree; - - public MetaprojectBrowserTree(final IViewContext<?> viewContext) + public MetaprojectBrowserTreePanel(final IViewContext<?> viewContext, final MetaprojectTree tree) { setLayout(new FitLayout()); setBodyBorder(false); setHeading(viewContext.getMessage(Dict.METAPROJECT_BROWSER_TREE_TITLE)); - - tree = new MetaprojectTree(viewContext); add(tree); } - @Override - public void update(Set<DatabaseModificationKind> observedModifications) - { - - } - - @Override - public DatabaseModificationKind[] getRelevantModifications() - { - return null; - } - - @Override - public Component getComponent() - { - return null; - } - - @Override - public void dispose() - { - - } - } \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/entity/MetaprojectDataSetsSection.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/entity/MetaprojectDataSetsSection.java new file mode 100644 index 0000000000000000000000000000000000000000..868362533e4506a052e2db6bd7cc4fc4e9e7ca49 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/entity/MetaprojectDataSetsSection.java @@ -0,0 +1,82 @@ +/* + * Copyright 2012 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.ui.metaproject.entity; + +import java.util.Set; + +import com.extjs.gxt.ui.client.widget.Component; +import com.extjs.gxt.ui.client.widget.Text; + +import ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.DisposableTabContent; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DisplayTypeIDGenerator; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; +import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; + +/** + * @author pkupczyk + */ +public class MetaprojectDataSetsSection extends DisposableTabContent +{ + public static final String ID_PREFIX = GenericConstants.ID_PREFIX + + "metaproject-data-sets-section_"; + + private final TechId metaprojectId; + + public MetaprojectDataSetsSection(IViewContext<?> viewContext, TechId metaprojectId) + { + super(viewContext.getMessage(Dict.METAPROJECT_ENTITIES_DATA_SETS), viewContext, + metaprojectId); + this.metaprojectId = metaprojectId; + setIds(DisplayTypeIDGenerator.DATA_SETS_SECTION); + } + + @Override + protected IDisposableComponent createDisposableContent() + { + return new IDisposableComponent() + { + + @Override + public void update(Set<DatabaseModificationKind> observedModifications) + { + + } + + @Override + public DatabaseModificationKind[] getRelevantModifications() + { + return new DatabaseModificationKind[] {}; + } + + @Override + public Component getComponent() + { + return new Text("Data sets for metaproject: " + metaprojectId); + } + + @Override + public void dispose() + { + } + }; + } + +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/entity/MetaprojectEntities.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/entity/MetaprojectEntities.java new file mode 100644 index 0000000000000000000000000000000000000000..cd3a3d8cc6b025767c20b20f9435bc1a0fbda441 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/entity/MetaprojectEntities.java @@ -0,0 +1,193 @@ +/* + * Copyright 2012 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.ui.metaproject.entity; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import com.extjs.gxt.ui.client.widget.Component; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.Panel; +import com.google.gwt.user.client.ui.SimplePanel; + +import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.DisposableTabContent; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DisplayTypeIDGenerator; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.SectionsPanel; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedAction; +import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MetaprojectAssignmentsCount; + +/** + * @author pkupczyk + */ +public class MetaprojectEntities extends Composite implements IDisposableComponent +{ + + public static final String ID_SUFFIX = "_metaproject-entities"; + + private IViewContext<?> viewContext; + + private Panel panel; + + private SectionsPanel sectionsPanel; + + private Map<EntityKind, DisposableTabContent> sectionsMap; + + private Long currentMetaprojectId; + + private EntityKind currentEntityKind; + + public MetaprojectEntities(IViewContext<?> viewContext, String idPrefix) + { + this.viewContext = viewContext; + + panel = new SimplePanel(); + panel.getElement().setId(idPrefix + ID_SUFFIX); + + initWidget(panel); + } + + private void initSections(final Long metaprojectId, final IDelegatedAction callback) + { + currentMetaprojectId = metaprojectId; + + viewContext.getCommonService().getMetaprojectAssignmentsCount(metaprojectId, + new AbstractAsyncCallback<MetaprojectAssignmentsCount>(viewContext) + { + @Override + protected void process(MetaprojectAssignmentsCount count) + { + panel.clear(); + + sectionsPanel = + new SectionsPanel(viewContext.getCommonViewContext(), + getElement().getId()); + sectionsPanel.setDisplayID( + DisplayTypeIDGenerator.GENERIC_METAPROJECT_VIEWER, null); + sectionsMap = new HashMap<EntityKind, DisposableTabContent>(); + + if (count.getExperimentCount() > 0) + { + addSection(EntityKind.EXPERIMENT, + new MetaprojectExperimentsSection(viewContext, new TechId( + metaprojectId))); + } + if (count.getSampleCount() > 0) + { + addSection(EntityKind.SAMPLE, new MetaprojectSamplesSection( + viewContext, new TechId(metaprojectId))); + } + if (count.getDataSetCount() > 0) + { + addSection(EntityKind.DATA_SET, new MetaprojectDataSetsSection( + viewContext, new TechId(metaprojectId))); + } + if (count.getMaterialCount() > 0) + { + addSection(EntityKind.MATERIAL, new MetaprojectMaterialsSection( + viewContext, new TechId(metaprojectId))); + } + + panel.add(sectionsPanel); + } + }); + } + + private void addSection(EntityKind entityKind, DisposableTabContent section) + { + sectionsPanel.addSection(section); + sectionsMap.put(entityKind, section); + } + + private void selectSection(EntityKind entityKind) + { + DisposableTabContent section = sectionsMap.get(entityKind); + if (section != null) + { + sectionsPanel.selectSection(section); + currentEntityKind = entityKind; + } + } + + public void showEntities(Long metaprojectId) + { + if (currentMetaprojectId != metaprojectId) + { + initSections(metaprojectId, new IDelegatedAction() + { + @Override + public void execute() + { + selectSection(currentEntityKind); + } + }); + } + } + + public void showEntities(Long metaprojectId, final EntityKind entityKind) + { + if (currentMetaprojectId != metaprojectId) + { + initSections(metaprojectId, new IDelegatedAction() + { + @Override + public void execute() + { + selectSection(entityKind); + } + }); + } else + { + selectSection(entityKind); + } + } + + @Override + public void update(Set<DatabaseModificationKind> observedModifications) + { + // TODO Auto-generated method stub + + } + + @Override + public DatabaseModificationKind[] getRelevantModifications() + { + // TODO Auto-generated method stub + return null; + } + + @Override + public Component getComponent() + { + // TODO Auto-generated method stub + return null; + } + + @Override + public void dispose() + { + // TODO Auto-generated method stub + + } + +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/entity/MetaprojectExperimentsSection.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/entity/MetaprojectExperimentsSection.java new file mode 100644 index 0000000000000000000000000000000000000000..6ef729b4ac0207dfd98696f44288cc0ff63c28ba --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/entity/MetaprojectExperimentsSection.java @@ -0,0 +1,82 @@ +/* + * Copyright 2012 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.ui.metaproject.entity; + +import java.util.Set; + +import com.extjs.gxt.ui.client.widget.Component; +import com.extjs.gxt.ui.client.widget.Text; + +import ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.DisposableTabContent; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DisplayTypeIDGenerator; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; +import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; + +/** + * @author pkupczyk + */ +public class MetaprojectExperimentsSection extends DisposableTabContent +{ + public static final String ID_PREFIX = GenericConstants.ID_PREFIX + + "metaproject-experiments-section_"; + + private final TechId metaprojectId; + + public MetaprojectExperimentsSection(IViewContext<?> viewContext, TechId metaprojectId) + { + super(viewContext.getMessage(Dict.METAPROJECT_ENTITIES_EXPERIMENTS), viewContext, + metaprojectId); + this.metaprojectId = metaprojectId; + setIds(DisplayTypeIDGenerator.EXPERIMENTS_SECTION); + } + + @Override + protected IDisposableComponent createDisposableContent() + { + return new IDisposableComponent() + { + + @Override + public void update(Set<DatabaseModificationKind> observedModifications) + { + + } + + @Override + public DatabaseModificationKind[] getRelevantModifications() + { + return new DatabaseModificationKind[] {}; + } + + @Override + public Component getComponent() + { + return new Text("Experiments for metaproject: " + metaprojectId); + } + + @Override + public void dispose() + { + } + }; + } + +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/entity/MetaprojectMaterialsSection.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/entity/MetaprojectMaterialsSection.java new file mode 100644 index 0000000000000000000000000000000000000000..3172d8a362fce03c2e02823c9917d44b55dcddde --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/entity/MetaprojectMaterialsSection.java @@ -0,0 +1,82 @@ +/* + * Copyright 2012 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.ui.metaproject.entity; + +import java.util.Set; + +import com.extjs.gxt.ui.client.widget.Component; +import com.extjs.gxt.ui.client.widget.Text; + +import ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.DisposableTabContent; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DisplayTypeIDGenerator; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; +import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; + +/** + * @author pkupczyk + */ +public class MetaprojectMaterialsSection extends DisposableTabContent +{ + public static final String ID_PREFIX = GenericConstants.ID_PREFIX + + "metaproject-materials-section_"; + + private final TechId metaprojectId; + + public MetaprojectMaterialsSection(IViewContext<?> viewContext, TechId metaprojectId) + { + super(viewContext.getMessage(Dict.METAPROJECT_ENTITIES_MATERIALS), viewContext, + metaprojectId); + this.metaprojectId = metaprojectId; + setIds(DisplayTypeIDGenerator.MATERIALS_SECTION); + } + + @Override + protected IDisposableComponent createDisposableContent() + { + return new IDisposableComponent() + { + + @Override + public void update(Set<DatabaseModificationKind> observedModifications) + { + + } + + @Override + public DatabaseModificationKind[] getRelevantModifications() + { + return new DatabaseModificationKind[] {}; + } + + @Override + public Component getComponent() + { + return new Text("Materials for metaproject: " + metaprojectId); + } + + @Override + public void dispose() + { + } + }; + } + +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/entity/MetaprojectSamplesSection.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/entity/MetaprojectSamplesSection.java new file mode 100644 index 0000000000000000000000000000000000000000..f3238f4be124ab9bfaf2988d3af4b360dbe7596f --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/entity/MetaprojectSamplesSection.java @@ -0,0 +1,109 @@ +/* + * Copyright 2012 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.ui.metaproject.entity; + +import java.util.Set; + +import com.extjs.gxt.ui.client.widget.Component; +import com.extjs.gxt.ui.client.widget.Text; +import com.extjs.gxt.ui.client.widget.form.CheckBox; + +import ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.DisposableTabContent; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DisplayTypeIDGenerator; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; +import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; +import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.AbstractEntityDataSetsSection; + +/** + * @author pkupczyk + */ +public class MetaprojectSamplesSection extends DisposableTabContent +{ + public static final String ID_PREFIX = GenericConstants.ID_PREFIX + + "metaproject-samples-section_"; + + private final TechId metaprojectId; + + private final CheckBox showOnlyDirectlyConnectedCheckBox; + + public MetaprojectSamplesSection(IViewContext<?> viewContext, TechId metaprojectId) + { + super(viewContext.getMessage(Dict.METAPROJECT_ENTITIES_SAMPLES), viewContext, metaprojectId); + this.metaprojectId = metaprojectId; + setIds(DisplayTypeIDGenerator.SAMPLES_SECTION); + this.showOnlyDirectlyConnectedCheckBox = createShowOnlyDirectlyConnectedCheckBox(); + } + + private CheckBox createShowOnlyDirectlyConnectedCheckBox() + { + CheckBox result = new CheckBox(); + result.setId(getId() + + AbstractEntityDataSetsSection.SHOW_ONLY_DIRECTLY_CONNECTED_CHECKBOX_ID_POSTFIX); + result.setBoxLabel(viewContext.getMessage(Dict.SHOW_ONLY_DIRECTLY_CONNECTED)); + result.setValue(true); + return result; + } + + private static String createBrowserId(TechId metaprojectId) + { + return ID_PREFIX + metaprojectId + "-browser"; + } + + @Override + protected IDisposableComponent createDisposableContent() + { + /* + * IDisposableComponent disposableComponent = + * SampleBrowserGrid.createGridForMetaprojectSamples(viewContext .getCommonViewContext(), + * metaprojectId, createBrowserId(metaprojectId), new + * EntityConnectionTypeProvider(showOnlyDirectlyConnectedCheckBox)); + * getHeader().addTool(showOnlyDirectlyConnectedCheckBox); return disposableComponent; + */ + + return new IDisposableComponent() + { + + @Override + public void update(Set<DatabaseModificationKind> observedModifications) + { + + } + + @Override + public DatabaseModificationKind[] getRelevantModifications() + { + return new DatabaseModificationKind[] {}; + } + + @Override + public Component getComponent() + { + return new Text("Samples for metaproject: " + metaprojectId); + } + + @Override + public void dispose() + { + } + }; + } + +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/tree/MetaprojectTree.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/tree/MetaprojectTree.java index 197a6b8b94faa7c464edfa046096fd1b095f5ada..13657c85b99c30c05741f5839dc0afcb08ab8c48 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/tree/MetaprojectTree.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/tree/MetaprojectTree.java @@ -21,6 +21,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import com.extjs.gxt.ui.client.Style.SelectionMode; import com.extjs.gxt.ui.client.data.BaseTreeLoader; @@ -32,6 +33,7 @@ import com.extjs.gxt.ui.client.event.SelectionChangedEvent; import com.extjs.gxt.ui.client.event.SelectionChangedListener; import com.extjs.gxt.ui.client.store.ListStore; import com.extjs.gxt.ui.client.store.TreeStore; +import com.extjs.gxt.ui.client.widget.Component; import com.extjs.gxt.ui.client.widget.grid.ColumnConfig; import com.extjs.gxt.ui.client.widget.grid.ColumnData; import com.extjs.gxt.ui.client.widget.grid.ColumnModel; @@ -43,8 +45,8 @@ import com.google.gwt.user.client.ui.Widget; import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback; import ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants; import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.metaproject.tree.model.MetaprojectTreeEntityItemData; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.metaproject.tree.model.MetaprojectTreeEntityKindItemData; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.metaproject.tree.model.MetaprojectTreeItemData; @@ -55,6 +57,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.metapro import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.metaproject.tree.widget.MetaprojectTreeMetaprojectItemWidget; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedAction; import ch.systemsx.cisd.openbis.generic.shared.basic.IEntityInformationHolderWithIdentifier; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MetaprojectAssignments; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MetaprojectAssignmentsCount; @@ -63,27 +66,28 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MetaprojectAssignmentsF /** * @author pkupczyk */ -public class MetaprojectTree extends TreeGrid<MetaprojectTreeItemData> +public class MetaprojectTree extends TreeGrid<MetaprojectTreeItemData> implements + IDisposableComponent { - public static final String ID = GenericConstants.ID_PREFIX + "metaproject-tree"; + public static final String ID_SUFFIX = "_metaproject-tree"; public static final String COLUMN_ID = "metaproject-tree-column"; private MetaprojectTreeItemData selectedItem; - public MetaprojectTree(IViewContext<?> viewContext) + public MetaprojectTree(IViewContext<?> viewContext, String idPrefix) { - this(viewContext, new MetaprojectTreeLoader(viewContext), new MetaprojectTreeColumns( - viewContext)); + this(viewContext, idPrefix, new MetaprojectTreeLoader(viewContext), + new MetaprojectTreeColumns(viewContext)); } - private MetaprojectTree(final IViewContext<?> viewContext, final MetaprojectTreeLoader loader, - final MetaprojectTreeColumns columns) + private MetaprojectTree(final IViewContext<?> viewContext, String idPrefix, + final MetaprojectTreeLoader loader, final MetaprojectTreeColumns columns) { super(new TreeStore<MetaprojectTreeItemData>(loader), columns.getModel()); - setId(ID); + setId(idPrefix + ID_SUFFIX); setLazyRowRender(0); setBorders(true); setAutoExpandColumn(COLUMN_ID); @@ -421,4 +425,32 @@ public class MetaprojectTree extends TreeGrid<MetaprojectTreeItemData> } } + @Override + public void update(Set<DatabaseModificationKind> observedModifications) + { + // TODO Auto-generated method stub + + } + + @Override + public DatabaseModificationKind[] getRelevantModifications() + { + // TODO Auto-generated method stub + return null; + } + + @Override + public Component getComponent() + { + // TODO Auto-generated method stub + return null; + } + + @Override + public void dispose() + { + // TODO Auto-generated method stub + + } + } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/tree/widget/MetaprojectTreeEntityKindItemWidget.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/tree/widget/MetaprojectTreeEntityKindItemWidget.java index c3a393f0700f82929708c885fe3911601d93f65d..e5f08ff382b0703674c0af6e3eec820ca5367f65 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/tree/widget/MetaprojectTreeEntityKindItemWidget.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/tree/widget/MetaprojectTreeEntityKindItemWidget.java @@ -32,8 +32,8 @@ public class MetaprojectTreeEntityKindItemWidget extends MetaprojectTreeItemWidg { super(viewContext); - initWidget(new InlineLabel(model.getEntityKind().name() + " (" + model.getEntityCount() - + ")")); + initWidget(new InlineLabel(model.getEntityKind().getDescription() + "s (" + + model.getEntityCount() + ")")); } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/tree/widget/MetaprojectTreeMetaprojectItemWidget.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/tree/widget/MetaprojectTreeMetaprojectItemWidget.java index 727523ba91a35da7501cb788aa910ac168c55cb8..186545210a5cef1efdf7e08f43c73e0b6783fc36 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/tree/widget/MetaprojectTreeMetaprojectItemWidget.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/metaproject/tree/widget/MetaprojectTreeMetaprojectItemWidget.java @@ -28,6 +28,7 @@ import com.google.gwt.user.client.ui.Widget; import ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict; import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.metaproject.tree.model.MetaprojectTreeMetaprojectItemData; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.lang.StringEscapeUtils; /** * @author pkupczyk @@ -35,20 +36,20 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.metapro public class MetaprojectTreeMetaprojectItemWidget extends MetaprojectTreeItemWidget { + private MetaprojectTreeMetaprojectItemData data; + private Widget link; public MetaprojectTreeMetaprojectItemWidget(IViewContext<?> viewContext, - MetaprojectTreeMetaprojectItemData model) + MetaprojectTreeMetaprojectItemData data) { super(viewContext); - // TODO make a real link that opens a metaproject detail view - link = new InlineLabel(viewContext.getMessage(Dict.METAPROJECT_TREE_INFO_LINK)); - link.setVisible(isSelected()); + this.data = data; FlowPanel panel = new FlowPanel(); - panel.add(new InlineLabel(model.getMetaproject().getName() + " ")); - panel.add(link); + panel.add(getLabel()); + panel.add(getLink()); FocusPanel focusPanel = new FocusPanel(); focusPanel.add(panel); @@ -57,7 +58,7 @@ public class MetaprojectTreeMetaprojectItemWidget extends MetaprojectTreeItemWid @Override public void onMouseOver(MouseOverEvent event) { - link.setVisible(true); + getLink().setVisible(true); } }); focusPanel.addMouseOutHandler(new MouseOutHandler() @@ -65,17 +66,52 @@ public class MetaprojectTreeMetaprojectItemWidget extends MetaprojectTreeItemWid @Override public void onMouseOut(MouseOutEvent event) { - link.setVisible(isSelected()); + getLink().setVisible(isSelected()); } }); + focusPanel.setTitle(getTooltip()); initWidget(focusPanel); } + private Widget getLabel() + { + return new InlineLabel(data.getMetaproject().getName() + " "); + } + + private Widget getLink() + { + if (link == null) + { + // TODO make a real link that opens a metaproject detail view + link = new InlineLabel(getViewContext().getMessage(Dict.METAPROJECT_TREE_INFO_LINK)); + link.setVisible(isSelected()); + } + return link; + } + + private String getTooltip() + { + String name = StringEscapeUtils.unescapeHtml(data.getMetaproject().getName()); + String description = data.getMetaproject().getDescription(); + + if (description == null) + { + description = + getViewContext().getMessage(Dict.METAPROJECT_TREE_DESCRIPTION_NOT_AVAILABLE); + } else + { + description = StringEscapeUtils.unescapeHtml(description); + } + + return getViewContext().getMessage(Dict.METAPROJECT_TREE_METAPROJECT_TOOLTIP, name, + description); + } + @Override protected void onSelectedChange() { - link.setVisible(isSelected()); + getLink().setVisible(isSelected()); } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/SampleBrowserGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/SampleBrowserGrid.java index 9c09977591b3b9dd1874f595beac4e07160f4ad4..d40efb1e00ed4d3996d9dd9b481ceffa9d3b5614 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/SampleBrowserGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/SampleBrowserGrid.java @@ -114,6 +114,8 @@ public class SampleBrowserGrid extends AbstractEntityGrid<Sample> public static final String SHOW_DETAILS_BUTTON_ID_SUFFIX = "_show-details-button"; + public static final String METAPROJECT_TYPE = "metaproject"; + public static final String createGridId(final String browserId) { return browserId + GRID_POSTFIX; @@ -247,6 +249,23 @@ public class SampleBrowserGrid extends AbstractEntityGrid<Sample> return browserGrid.asDisposableWithoutToolbar(); } + public static IDisposableComponent createGridForMetaprojectSamples( + final IViewContext<ICommonClientServiceAsync> viewContext, final TechId metaprojectId, + final String browserId, IDirectlyConnectedController directlyConnectedController) + { + final ListSampleDisplayCriteria criteria = + ListSampleDisplayCriteria.createForMetaproject(metaprojectId); + + final SampleBrowserGrid browserGrid = + createGridAsComponent(viewContext, browserId, criteria, METAPROJECT_TYPE, + DisplayTypeIDGenerator.METAPROJECT_DETAILS_GRID, + directlyConnectedController); + + browserGrid.updateCriteriaProviderAndRefresh(); + browserGrid.extendBottomToolbar(); + return browserGrid.asDisposableWithoutToolbar(); + } + private static SampleBrowserGrid createGridAsComponent( final IViewContext<ICommonClientServiceAsync> viewContext, final String browserId, final ListSampleDisplayCriteria criteria, final String entityTypeCode, diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/widget/SectionsPanel.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/widget/SectionsPanel.java index 6cb4af0e3fa77ca8defbe3d56c89c7a9c56e15b0..a3c7ca941d74f9a24cb937f3b9adf75f9cbdcd6b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/widget/SectionsPanel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/widget/SectionsPanel.java @@ -102,6 +102,18 @@ public class SectionsPanel extends LayoutContainer tabContent.setParentDisplayID(getDisplayID()); } + public void selectSection(final TabContent tabContent) + { + for (SectionElement element : elements) + { + if (element.getTabContent().equals(tabContent)) + { + tabPanel.setSelection(element); + break; + } + } + } + @Override protected void onDetach() { @@ -153,7 +165,7 @@ public class SectionsPanel extends LayoutContainer } }); // WORKAROUND to fix problems when paging toolbar's layout is performed in a hidden tab - setHideMode(HideMode.OFFSETS); + setHideMode(HideMode.OFFSETS); } void setTabContent(TabContent tabContent) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/ListSampleDisplayCriteria.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/ListSampleDisplayCriteria.java index 220f8ae59424d98718224065817b5def783e0f32..6c1ce9ffd09c28aaebcdebcb9718ba252d310691 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/ListSampleDisplayCriteria.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/dto/ListSampleDisplayCriteria.java @@ -37,8 +37,8 @@ public class ListSampleDisplayCriteria extends DefaultResultSetConfig<String, Sa { public static ListSampleDisplayCriteria createForContainer(final TechId containerSampleId) { - return new ListSampleDisplayCriteria(ListSampleCriteria - .createForContainer(containerSampleId)); + return new ListSampleDisplayCriteria( + ListSampleCriteria.createForContainer(containerSampleId)); } public static ListSampleDisplayCriteria createForParent(final TechId parentSampleId) @@ -56,6 +56,11 @@ public class ListSampleDisplayCriteria extends DefaultResultSetConfig<String, Sa return new ListSampleDisplayCriteria(ListSampleCriteria.createForExperiment(experimentId)); } + public static ListSampleDisplayCriteria createForMetaproject(final TechId metaprojectId) + { + return new ListSampleDisplayCriteria(ListSampleCriteria.createForMetaproject(metaprojectId)); + } + public static ListSampleDisplayCriteria createForSearch() { return createForSearch(new DetailedSearchCriteria()); @@ -77,7 +82,7 @@ public class ListSampleDisplayCriteria extends DefaultResultSetConfig<String, Sa private ListSampleCriteria listCriteriaOrNull; - ListSampleDisplayCriteria(final DetailedSearchCriteria searchCriteria) + ListSampleDisplayCriteria(final DetailedSearchCriteria searchCriteria) { assert searchCriteria != null : "search criteria not set"; this.criteriaKind = ListEntityDisplayCriteriaKind.SEARCH; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/CommonClientService.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/CommonClientService.java index dea297251552945c8d4e897732753b18d516f473..1abc45121479df95486c2e5d3881da26132cabb5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/CommonClientService.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/server/CommonClientService.java @@ -710,6 +710,14 @@ public final class CommonClientService extends AbstractClientService implements return commonServer.listMetaprojectAssignmentsCounts(getSessionToken()); } + @Override + public MetaprojectAssignmentsCount getMetaprojectAssignmentsCount(Long metaprojectId) + throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException + { + return commonServer.getMetaprojectAssignmentsCount(getSessionToken(), + new MetaprojectTechIdId(metaprojectId)); + } + @Override public MetaprojectAssignments getMetaprojectAssignments(Long metaprojectId, MetaprojectAssignmentsFetchOption[] fetchOptions) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java index b885fc78a55623cc5aed9421c44b81cd94e3f1e5..80f46946fac93e5ca1cd85497cf167bd71182085 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java @@ -3599,35 +3599,27 @@ public final class CommonServer extends AbstractCommonServer<ICommonServerForInt @RolesAllowed(RoleWithHierarchy.SPACE_USER) public List<MetaprojectAssignmentsCount> listMetaprojectAssignmentsCounts(String sessionToken) { - IMetaprojectDAO metaprojectDAO = getDAOFactory().getMetaprojectDAO(); - List<Metaproject> metaprojects = listMetaprojects(sessionToken); List<MetaprojectAssignmentsCount> counts = new ArrayList<MetaprojectAssignmentsCount>(metaprojects.size()); for (Metaproject metaproject : metaprojects) { - MetaprojectAssignmentsCount count = new MetaprojectAssignmentsCount(); - count.setMetaproject(metaproject); - - count.setExperimentCount(metaprojectDAO.getMetaprojectAssignmentsCount( - metaproject.getId(), - ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind.EXPERIMENT)); - count.setSampleCount(metaprojectDAO.getMetaprojectAssignmentsCount(metaproject.getId(), - ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind.SAMPLE)); - count.setDataSetCount(metaprojectDAO.getMetaprojectAssignmentsCount( - metaproject.getId(), - ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind.DATA_SET)); - count.setMaterialCount(metaprojectDAO.getMetaprojectAssignmentsCount( - metaproject.getId(), - ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind.MATERIAL)); - - counts.add(count); + counts.add(getMetaprojectAssignmentsCount(metaproject)); } return counts; } + @Override + public MetaprojectAssignmentsCount getMetaprojectAssignmentsCount(String sessionToken, + IMetaprojectId metaprojectId) + { + MetaprojectPE metaprojectPE = getMetaproject(sessionToken, metaprojectId); + Metaproject metaproject = MetaprojectTranslator.translate(metaprojectPE); + return getMetaprojectAssignmentsCount(metaproject); + } + @Override @RolesAllowed(RoleWithHierarchy.SPACE_USER) public MetaprojectAssignments getMetaprojectAssignments(String sessionToken, @@ -3646,21 +3638,16 @@ public final class CommonServer extends AbstractCommonServer<ICommonServerForInt { throw new UserFailureException("Metaproject id cannot be null"); } - - Session session = getSession(sessionToken); - String baseIndexURL = getBaseIndexURL(sessionToken); - - IMetaprojectBO metaprojectBO = getBusinessObjectFactory().createMetaprojectBO(session); - MetaprojectPE metaprojectPE = metaprojectBO.tryFindByMetaprojectId(metaprojectId); - - if (metaprojectPE == null) + if (fetchOptions == null) { - throw new UserFailureException("Metaproject with id: " + metaprojectId - + " doesn't exist"); + throw new UserFailureException("Fetch options cannot be null"); } + Session session = getSession(sessionToken); + String baseIndexURL = getBaseIndexURL(sessionToken); AuthorizationServiceUtils authorizationUtils = getAuthorizationService(session); - authorizationUtils.checkAccessMetaproject(metaprojectPE); + + MetaprojectPE metaprojectPE = getMetaproject(sessionToken, metaprojectId); MetaprojectAssignments metaprojectAssignments = new MetaprojectAssignments(); metaprojectAssignments.setMetaproject(MetaprojectTranslator.translate(metaprojectPE)); @@ -3877,6 +3864,30 @@ public final class CommonServer extends AbstractCommonServer<ICommonServerForInt return MetaprojectTranslator.translate(metaprojectPE); } + private MetaprojectPE getMetaproject(String sessionToken, IMetaprojectId metaprojectId) + { + if (metaprojectId == null) + { + throw new UserFailureException("Metaproject id cannot be null"); + } + + Session session = getSession(sessionToken); + + IMetaprojectBO metaprojectBO = getBusinessObjectFactory().createMetaprojectBO(session); + MetaprojectPE metaprojectPE = metaprojectBO.tryFindByMetaprojectId(metaprojectId); + + if (metaprojectPE == null) + { + throw new UserFailureException("Metaproject with id: " + metaprojectId + + " doesn't exist"); + } + + AuthorizationServiceUtils authorizationUtils = getAuthorizationService(session); + authorizationUtils.checkAccessMetaproject(metaprojectPE); + + return metaprojectPE; + } + private Collection<MetaprojectAssignmentPE> getMetaprojectAssignments( MetaprojectPE metaproject, EntityKind entityKind) { @@ -3884,6 +3895,23 @@ public final class CommonServer extends AbstractCommonServer<ICommonServerForInt DtoConverters.convertEntityKind(entityKind)); } + private MetaprojectAssignmentsCount getMetaprojectAssignmentsCount(Metaproject metaproject) + { + IMetaprojectDAO metaprojectDAO = getDAOFactory().getMetaprojectDAO(); + + MetaprojectAssignmentsCount count = new MetaprojectAssignmentsCount(); + count.setMetaproject(metaproject); + count.setExperimentCount(metaprojectDAO.getMetaprojectAssignmentsCount(metaproject.getId(), + ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind.EXPERIMENT)); + count.setSampleCount(metaprojectDAO.getMetaprojectAssignmentsCount(metaproject.getId(), + ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind.SAMPLE)); + count.setDataSetCount(metaprojectDAO.getMetaprojectAssignmentsCount(metaproject.getId(), + ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind.DATA_SET)); + count.setMaterialCount(metaprojectDAO.getMetaprojectAssignmentsCount(metaproject.getId(), + ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind.MATERIAL)); + return count; + } + private AuthorizationServiceUtils getAuthorizationService(Session session) { return new AuthorizationServiceUtils(getDAOFactory(), session.tryGetPerson()); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServerLogger.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServerLogger.java index 9e867816de5ce3bd596e31ba789d479e3193d876..a373fa4d6e697742e939e584864b6e70c593c68a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServerLogger.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServerLogger.java @@ -1521,6 +1521,15 @@ final class CommonServerLogger extends AbstractServerLogger implements ICommonSe return null; } + @Override + public MetaprojectAssignmentsCount getMetaprojectAssignmentsCount(String sessionToken, + IMetaprojectId metaprojectId) + { + logAccess(sessionToken, "getMetaprojectAssignmentsCount", "METAPROJECT_ID(%s)", + metaprojectId); + return null; + } + @Override public MetaprojectAssignments getMetaprojectAssignments(String sessionToken, IMetaprojectId metaprojectId, EnumSet<MetaprojectAssignmentsFetchOption> fetchOptions) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java index 27456fc4d5855e2127d805fb8de7fc05f6bc1647..474a204fc9277e61c41d89e238c89ea5c732f6cb 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java @@ -1383,6 +1383,13 @@ public interface ICommonServer extends IServer @Transactional(readOnly = true) public List<MetaprojectAssignmentsCount> listMetaprojectAssignmentsCounts(String sessionToken); + /** + * Get metaproject assignments counts for given user and metaproject. + */ + @Transactional(readOnly = true) + public MetaprojectAssignmentsCount getMetaprojectAssignmentsCount(String sessionToken, + IMetaprojectId metaprojectId); + /** * Returns object containing all entities assigned to given metaproject. */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ListSampleCriteria.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ListSampleCriteria.java index 49cbb97880f5c4975f55137d1e3d367b46a1f628..6f3cac86a767bb94d45fcba71996357dcb56a1c9 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ListSampleCriteria.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ListSampleCriteria.java @@ -64,6 +64,8 @@ public class ListSampleCriteria implements Serializable // --------- filter 5 fields private TechId experimentId; + private TechId metaprojectId; + private boolean onlyDirectlyConnected = true; // --------- filter 6 fields @@ -111,6 +113,13 @@ public class ListSampleCriteria implements Serializable return criteria; } + public static ListSampleCriteria createForMetaproject(final TechId metaprojectId) + { + final ListSampleCriteria criteria = new ListSampleCriteria(); + criteria.setMetaprojectId(metaprojectId); + return criteria; + } + public Collection<Long> getContainerSampleIds() { return containerSampleIds; @@ -211,6 +220,16 @@ public class ListSampleCriteria implements Serializable this.experimentId = experimentId; } + public TechId getMetaprojectId() + { + return metaprojectId; + } + + private void setMetaprojectId(TechId metaprojectId) + { + this.metaprojectId = metaprojectId; + } + public boolean isOnlyDirectlyConnected() { return onlyDirectlyConnected; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/metaproject/.gitignore b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/metaproject/.gitignore deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js index eb3cd2e062207afe8bd6ac0f90be8c44ef8e674f..997a90e93cc62718dcfd457a8b02a57c7bc1859d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js +++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js @@ -732,6 +732,8 @@ var common = { metaproject_tree_column_header: "Metaproject / Entity Kind / Entity", metaproject_tree_info_link: "(info)", + metaproject_tree_description_not_available: "(not available)", + metaproject_tree_metaproject_tooltip: "Name: {0}\nDescription: {1}", // // Metaproject Browser @@ -739,6 +741,16 @@ var common = { metaproject_browser: "Metaproject Browser", metaproject_browser_tree_title: "Metaprojects", metaproject_browser_tree_tooltip: "Click on a row with an entity type (i.e. Experiments, Samples, Data Sets, Materials) to see entities of that type that belong to the given metaproject.", + metaproject_browser_entities_title: "Entities", + + // + // Metaproject Entities + // + + metaproject_entities_experiments: "Experiments", + metaproject_entities_samples: "Samples", + metaproject_entities_data_sets: "Data Sets", + metaproject_entities_materials: "Materials", // // Project Registration diff --git a/openbis_api/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Metaproject.java b/openbis_api/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Metaproject.java index 8eb836473d0fb4a2e5af496efdb5e88deaada3e7..67f4ac183dd38af9a4b5468fe2240d04968fb39f 100644 --- a/openbis_api/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Metaproject.java +++ b/openbis_api/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Metaproject.java @@ -20,12 +20,13 @@ import java.io.Serializable; import java.util.Date; import ch.systemsx.cisd.base.annotation.JsonObject; +import ch.systemsx.cisd.openbis.generic.shared.basic.IIdHolder; /** * @author Pawel Glyzewski */ @JsonObject("Metaproject") -public class Metaproject implements Serializable +public class Metaproject implements Serializable, IIdHolder { private static final long serialVersionUID = ServiceVersionHolder.VERSION; @@ -41,6 +42,7 @@ public class Metaproject implements Serializable private Date creationDate; + @Override public Long getId() { return id;