diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property/PropertyGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property/PropertyGrid.java index 66463af68d14926845abb9e1e09a421d999ea9d3..f63c62069dcc15596a2350c17076bd2264f5cff8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property/PropertyGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property/PropertyGrid.java @@ -24,8 +24,23 @@ import java.util.Map; import com.google.gwt.user.client.ui.Grid; import com.google.gwt.user.client.ui.Widget; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.PropertyValueRenderers; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider; import ch.systemsx.cisd.openbis.generic.shared.basic.BasicConstant; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ContainerDataSet; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSet; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Invalidation; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ManagedEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Project; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermEntityProperty; /** * A <code>HTMLTable</code> that displays a couple of properties. @@ -41,12 +56,15 @@ public final class PropertyGrid extends Grid private Map<String, ?> properties; + private final IViewContext<?> viewContext; + private final IMessageProvider messageProvider; - public PropertyGrid(final IMessageProvider messageProvider, final int rows) + public PropertyGrid(final IViewContext<?> viewContext, final int rows) { super(rows, 2); - this.messageProvider = messageProvider; + this.messageProvider = viewContext; + this.viewContext = viewContext; setStyleName("property-grid"); getColumnFormatter().addStyleName(0, "header"); defaultPropertyValueRenderer = new ObjectPropertyValueRenderer(messageProvider); @@ -56,8 +74,35 @@ public final class PropertyGrid extends Grid /** Registers default <code>PropertyValueRenderer</code>. */ private final void registerDefaultPropertyValueRenderers() { - propertyValueRenderers.put(Date.class, new DatePropertyValueRenderer(messageProvider, + registerPropertyValueRenderer(Date.class, new DatePropertyValueRenderer(messageProvider, BasicConstant.DATE_WITHOUT_TIMEZONE_PATTERN)); + // Common + registerPropertyValueRenderer(Person.class, + PropertyValueRenderers.createPersonPropertyValueRenderer(messageProvider)); + + // Entities + registerPropertyValueRenderer(Invalidation.class, + PropertyValueRenderers.createInvalidationPropertyValueRenderer(messageProvider)); + + registerPropertyValueRenderer(ContainerDataSet.class, + PropertyValueRenderers.createExternalDataPropertyValueRenderer(viewContext)); + registerPropertyValueRenderer(DataSet.class, + PropertyValueRenderers.createExternalDataPropertyValueRenderer(viewContext)); + registerPropertyValueRenderer(Experiment.class, + PropertyValueRenderers.createExperimentPropertyValueRenderer(viewContext)); + registerPropertyValueRenderer(Sample.class, + PropertyValueRenderers.createSamplePropertyValueRenderer(viewContext, true)); + registerPropertyValueRenderer(Project.class, + PropertyValueRenderers.createProjectPropertyValueRenderer(viewContext)); + + // Properties + final IPropertyValueRenderer<IEntityProperty> propertyValueRenderer = + PropertyValueRenderers.createEntityPropertyPropertyValueRenderer(viewContext); + registerPropertyValueRenderer(EntityProperty.class, propertyValueRenderer); + registerPropertyValueRenderer(GenericEntityProperty.class, propertyValueRenderer); + registerPropertyValueRenderer(ManagedEntityProperty.class, propertyValueRenderer); + registerPropertyValueRenderer(MaterialEntityProperty.class, propertyValueRenderer); + registerPropertyValueRenderer(VocabularyTermEntityProperty.class, propertyValueRenderer); } /** diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertiesPanel.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertiesPanel.java index 3966d7dcd7af11941de96b5379959e64370566db..e2e7d8458ef9176a8fc716a33c9da91457d9083a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertiesPanel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetPropertiesPanel.java @@ -25,7 +25,6 @@ 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.PropertyValueRenderers; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.IPropertyValueRenderer; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.PropertyGrid; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.ExternalHyperlink; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider; @@ -33,18 +32,9 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ContainerDataSet; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSet; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataStore; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericEntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Invalidation; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ManagedEntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialEntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Project; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermEntityProperty; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.PropertiesPanelUtils; /** @@ -72,35 +62,14 @@ public class DataSetPropertiesPanel extends ContentPanel private final PropertyGrid createPropertyGrid() { + final IMessageProvider messageProvider = viewContext; final Map<String, Object> properties = createProperties(viewContext); final PropertyGrid propertyGrid = new PropertyGrid(viewContext, properties.size()); propertyGrid.getElement().setId(PROPERTIES_ID_PREFIX + dataset.getIdentifier()); - propertyGrid.registerPropertyValueRenderer(Person.class, - PropertyValueRenderers.createPersonPropertyValueRenderer(viewContext)); propertyGrid.registerPropertyValueRenderer(DataSetType.class, - PropertyValueRenderers.createDataSetTypePropertyValueRenderer(viewContext)); - propertyGrid.registerPropertyValueRenderer(Invalidation.class, - PropertyValueRenderers.createInvalidationPropertyValueRenderer(viewContext)); - propertyGrid.registerPropertyValueRenderer(Project.class, - PropertyValueRenderers.createProjectPropertyValueRenderer(viewContext)); - final IPropertyValueRenderer<IEntityProperty> propertyRenderer = - PropertyValueRenderers.createEntityPropertyPropertyValueRenderer(viewContext); - propertyGrid.registerPropertyValueRenderer(EntityProperty.class, propertyRenderer); - propertyGrid.registerPropertyValueRenderer(GenericEntityProperty.class, propertyRenderer); - propertyGrid.registerPropertyValueRenderer(VocabularyTermEntityProperty.class, - propertyRenderer); - propertyGrid.registerPropertyValueRenderer(MaterialEntityProperty.class, propertyRenderer); - propertyGrid.registerPropertyValueRenderer(ManagedEntityProperty.class, propertyRenderer); - propertyGrid.registerPropertyValueRenderer(Sample.class, - PropertyValueRenderers.createSamplePropertyValueRenderer(viewContext, true)); - propertyGrid.registerPropertyValueRenderer(Experiment.class, - PropertyValueRenderers.createExperimentPropertyValueRenderer(viewContext)); - propertyGrid.registerPropertyValueRenderer(DataSet.class, - PropertyValueRenderers.createExternalDataPropertyValueRenderer(viewContext)); - propertyGrid.registerPropertyValueRenderer(ContainerDataSet.class, - PropertyValueRenderers.createExternalDataPropertyValueRenderer(viewContext)); + PropertyValueRenderers.createDataSetTypePropertyValueRenderer(messageProvider)); propertyGrid.registerPropertyValueRenderer(DataStore.class, - PropertyValueRenderers.createDataStorePropertyValueRenderer(viewContext)); + PropertyValueRenderers.createDataStorePropertyValueRenderer(messageProvider)); propertyGrid.setProperties(properties); return propertyGrid; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/EntityPropertyGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/EntityPropertyGrid.java deleted file mode 100644 index c1f67dec06cd7be363e0030243aa4657c6b2f927..0000000000000000000000000000000000000000 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/EntityPropertyGrid.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2009 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.plugin.generic.client.web.client.application.experiment; - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.PropertyValueRenderers; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.IPropertyValueRenderer; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.PropertyGrid; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityTypePropertyType; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericEntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ManagedEntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialEntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermEntityProperty; - -/** - * @author Izabela Adamczyk - */ -public class EntityPropertyGrid<T extends EntityType, S extends EntityTypePropertyType<T>, P extends IEntityProperty> -{ - private PropertyGrid grid; - - private IViewContext<?> viewContext; - - private List<P> properties; - - public EntityPropertyGrid(IViewContext<?> viewContext, List<P> initialProperties) - { - assert initialProperties != null : "Initial properties undefined"; - this.viewContext = viewContext; - this.properties = initialProperties; - grid = new PropertyGrid(viewContext, properties.size()); - registerRenderers(); - setProperties(properties); - } - - private void registerRenderers() - { - final IPropertyValueRenderer<IEntityProperty> renderer = - PropertyValueRenderers.createEntityPropertyPropertyValueRenderer(viewContext); - grid.registerPropertyValueRenderer(EntityProperty.class, renderer); - grid.registerPropertyValueRenderer(GenericEntityProperty.class, renderer); - grid.registerPropertyValueRenderer(VocabularyTermEntityProperty.class, renderer); - grid.registerPropertyValueRenderer(MaterialEntityProperty.class, renderer); - grid.registerPropertyValueRenderer(ManagedEntityProperty.class, renderer); - } - - private final Map<String, Object> createProperties(List<P> list) - { - final Map<String, Object> map = new LinkedHashMap<String, Object>(); - for (final P property : list) - { - final String simpleCode = property.getPropertyType().getLabel(); - map.put(simpleCode, property); - } - return map; - } - - /** - * Updates the grid with new list of properties. - */ - public void setProperties(List<P> list) - { - properties = list; - grid.resizeRows(properties.size()); - grid.setProperties(createProperties(properties)); - } - - /** - * Returns currently used properties. - */ - public List<P> getProperties() - { - return properties; - } - - public PropertyGrid getWidget() - { - return grid; - } - -} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertiesPanel.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertiesPanel.java index 899b67393e1474390434c617f5101e243205c52f..ebea917100c029600f8d295343e29668fe5dd7dd 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertiesPanel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertiesPanel.java @@ -34,24 +34,15 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewConte import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.AbstractDatabaseModificationObserverWithCallback; import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.IDatabaseModificationObserverWithCallback; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.PropertyValueRenderers; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.IPropertyValueRenderer; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.PropertyGrid; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.ExternalHyperlink; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider; 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.DatabaseModificationKind.ObjectKind; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentType; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericEntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Invalidation; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ManagedEntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialEntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Project; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermEntityProperty; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.IGenericClientServiceAsync; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.PropertiesPanelUtils; @@ -89,7 +80,7 @@ public class ExperimentPropertiesPanel extends ContentPanel pp.add(grid); add(pp, new BorderLayoutData(LayoutRegion.CENTER)); } - + public void addSouthComponent(Component component) { add(component, new BorderLayoutData(LayoutRegion.SOUTH)); @@ -103,24 +94,11 @@ public class ExperimentPropertiesPanel extends ContentPanel private final PropertyGrid createPropertyGrid(Map<String, Object> properties) { - IMessageProvider messageProvider = viewContext; - final PropertyGrid propertyGrid = new PropertyGrid(messageProvider, properties.size()); + final IMessageProvider messageProvider = viewContext; + final PropertyGrid propertyGrid = new PropertyGrid(viewContext, properties.size()); propertyGrid.getElement().setId(PROPERTIES_ID_PREFIX + experimentId); - propertyGrid.registerPropertyValueRenderer(Person.class, - PropertyValueRenderers.createPersonPropertyValueRenderer(messageProvider)); propertyGrid.registerPropertyValueRenderer(ExperimentType.class, PropertyValueRenderers.createExperimentTypePropertyValueRenderer(messageProvider)); - propertyGrid.registerPropertyValueRenderer(Invalidation.class, - PropertyValueRenderers.createInvalidationPropertyValueRenderer(messageProvider)); - propertyGrid.registerPropertyValueRenderer(Project.class, - PropertyValueRenderers.createProjectPropertyValueRenderer(viewContext)); - final IPropertyValueRenderer<IEntityProperty> renderer = - PropertyValueRenderers.createEntityPropertyPropertyValueRenderer(viewContext); - propertyGrid.registerPropertyValueRenderer(EntityProperty.class, renderer); - propertyGrid.registerPropertyValueRenderer(GenericEntityProperty.class, renderer); - propertyGrid.registerPropertyValueRenderer(VocabularyTermEntityProperty.class, renderer); - propertyGrid.registerPropertyValueRenderer(MaterialEntityProperty.class, renderer); - propertyGrid.registerPropertyValueRenderer(ManagedEntityProperty.class, renderer); propertyGrid.setProperties(properties); return propertyGrid; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/GenericMaterialViewer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/GenericMaterialViewer.java index c47390fbdbadaee51ac26817ce83a6fd92b8294e..886203b9194af80f8801bca8600f9b795770f7b6 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/GenericMaterialViewer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/GenericMaterialViewer.java @@ -40,22 +40,13 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework. import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.IDatabaseModificationObserver; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.AbstractViewerWithVerticalSplit; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.PropertyValueRenderers; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.IPropertyValueRenderer; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.PropertyGrid; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.SectionsPanel; 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.DatabaseModificationKind.ObjectKind; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericEntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Invalidation; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ManagedEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermEntityProperty; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.IGenericClientServiceAsync; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.PropertiesPanelUtils; @@ -179,20 +170,8 @@ abstract public class GenericMaterialViewer extends AbstractViewerWithVerticalSp { final Map<String, Object> properties = createProperties(viewContext, material); final PropertyGrid propertyGrid = new PropertyGrid(viewContext, properties.size()); - propertyGrid.registerPropertyValueRenderer(Person.class, - PropertyValueRenderers.createPersonPropertyValueRenderer(viewContext)); propertyGrid.registerPropertyValueRenderer(MaterialType.class, PropertyValueRenderers.createMaterialTypePropertyValueRenderer(viewContext)); - propertyGrid.registerPropertyValueRenderer(Invalidation.class, - PropertyValueRenderers.createInvalidationPropertyValueRenderer(viewContext)); - final IPropertyValueRenderer<IEntityProperty> propertyRenderer = - PropertyValueRenderers.createEntityPropertyPropertyValueRenderer(viewContext); - propertyGrid.registerPropertyValueRenderer(EntityProperty.class, propertyRenderer); - propertyGrid.registerPropertyValueRenderer(GenericEntityProperty.class, propertyRenderer); - propertyGrid.registerPropertyValueRenderer(VocabularyTermEntityProperty.class, - propertyRenderer); - propertyGrid.registerPropertyValueRenderer(MaterialEntityProperty.class, propertyRenderer); - propertyGrid.registerPropertyValueRenderer(ManagedEntityProperty.class, propertyRenderer); propertyGrid.setProperties(properties); propertyGrid.getElement().setId(PROPERTIES_ID_PREFIX + material.getIdentifier()); return propertyGrid; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java index 9dc585ff4790752250eecb290a965e72307ccb42..84e7cce07413fed8be7f07e40e40201f734f304b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java @@ -48,29 +48,21 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework. import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.IDatabaseModificationObserver; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.AbstractViewerWithVerticalSplit; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.PropertyValueRenderers; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.IPropertyValueRenderer; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.property.PropertyGrid; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.sample.SampleListDeletionConfirmationDialog; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.ExternalHyperlink; 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.client.web.client.application.util.IMessageProvider; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdAndCodeHolder; 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.DatabaseModificationKind.ObjectKind; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericEntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Invalidation; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ManagedEntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialEntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Project; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleParentWithDerived; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermEntityProperty; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.IGenericClientServiceAsync; import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.PropertiesPanelUtils; @@ -329,34 +321,13 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli public static PropertyGrid createPropertyGrid(final TechId sampleId, final SampleParentWithDerived sampleGeneration, final IViewContext<?> viewContext) { + final IMessageProvider messageProvider = viewContext; final Map<String, Object> properties = createProperties(viewContext, sampleGeneration); final PropertyGrid propertyGrid = new PropertyGrid(viewContext, properties.size()); - propertyGrid.registerPropertyValueRenderer(Person.class, - PropertyValueRenderers.createPersonPropertyValueRenderer(viewContext)); propertyGrid.registerPropertyValueRenderer(SampleType.class, - PropertyValueRenderers.createSampleTypePropertyValueRenderer(viewContext)); - propertyGrid.registerPropertyValueRenderer(Sample.class, - PropertyValueRenderers.createSamplePropertyValueRenderer(viewContext, true)); - propertyGrid.registerPropertyValueRenderer(Invalidation.class, - PropertyValueRenderers.createInvalidationPropertyValueRenderer(viewContext)); - propertyGrid.registerPropertyValueRenderer(Project.class, - PropertyValueRenderers.createProjectPropertyValueRenderer(viewContext)); - final IPropertyValueRenderer<IEntityProperty> propertyValueRenderer = - PropertyValueRenderers.createEntityPropertyPropertyValueRenderer(viewContext); - propertyGrid.registerPropertyValueRenderer(EntityProperty.class, propertyValueRenderer); - propertyGrid.registerPropertyValueRenderer(GenericEntityProperty.class, - propertyValueRenderer); - propertyGrid.registerPropertyValueRenderer(VocabularyTermEntityProperty.class, - propertyValueRenderer); - propertyGrid.registerPropertyValueRenderer(MaterialEntityProperty.class, - propertyValueRenderer); - propertyGrid.registerPropertyValueRenderer(ManagedEntityProperty.class, - propertyValueRenderer); - propertyGrid.registerPropertyValueRenderer(Experiment.class, - PropertyValueRenderers.createExperimentPropertyValueRenderer(viewContext)); + PropertyValueRenderers.createSampleTypePropertyValueRenderer(messageProvider)); propertyGrid.setProperties(properties); propertyGrid.getElement().setId(PROPERTIES_ID_PREFIX + sampleId); - return propertyGrid; }