diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/DataSetTypeModel.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/DataSetTypeModel.java index 94371c0f7c8294b42cbae3a57f0426cd439e4824..a229c72898233e3470430f6ec9aa5bbdf99abc20 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/DataSetTypeModel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/DataSetTypeModel.java @@ -22,7 +22,7 @@ import java.util.List; import com.extjs.gxt.ui.client.data.BaseModelData; import com.extjs.gxt.ui.client.data.ModelData; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.renderer.EntityTypeTooltipRenderer; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.renderer.TooltipRenderer; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType; /** @@ -39,7 +39,8 @@ public class DataSetTypeModel extends BaseModelData { set(ModelDataPropertyNames.CODE, dataSetType.getCode()); set(ModelDataPropertyNames.OBJECT, dataSetType); - set(ModelDataPropertyNames.TOOLTIP, EntityTypeTooltipRenderer.renderAsTooltip(dataSetType)); + set(ModelDataPropertyNames.TOOLTIP, TooltipRenderer.renderAsTooltip(dataSetType.getCode(), + dataSetType.getDescription())); } public final static List<DataSetTypeModel> convert(final List<DataSetType> dataSetTypes) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/ExperimentTypeModel.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/ExperimentTypeModel.java index 4d910896cd3c2108d59f9c8be07d8d6751b04e3d..aca9e8a075fba4056927a08b23634c8ea3872b53 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/ExperimentTypeModel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/ExperimentTypeModel.java @@ -24,7 +24,7 @@ import java.util.Set; import com.extjs.gxt.ui.client.data.BaseModelData; import com.extjs.gxt.ui.client.data.ModelData; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.renderer.EntityTypeTooltipRenderer; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.renderer.TooltipRenderer; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentTypePropertyType; @@ -43,8 +43,8 @@ public class ExperimentTypeModel extends BaseModelData { set(ModelDataPropertyNames.CODE, experimentType.getCode()); set(ModelDataPropertyNames.OBJECT, experimentType); - set(ModelDataPropertyNames.TOOLTIP, EntityTypeTooltipRenderer - .renderAsTooltip(experimentType)); + set(ModelDataPropertyNames.TOOLTIP, TooltipRenderer.renderAsTooltip(experimentType + .getCode(), experimentType.getDescription())); } public final static List<ExperimentTypeModel> convert( diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/MaterialTypeModel.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/MaterialTypeModel.java index 1ec9da71763addc02d760459981e16e2b9da9cda..f92a173bd9e6b5b5d0772e326a30db3bb8c12cb5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/MaterialTypeModel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/MaterialTypeModel.java @@ -22,7 +22,7 @@ import java.util.List; import com.extjs.gxt.ui.client.data.BaseModelData; import com.extjs.gxt.ui.client.data.ModelData; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.renderer.EntityTypeTooltipRenderer; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.renderer.TooltipRenderer; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType; /** @@ -38,7 +38,8 @@ public class MaterialTypeModel extends BaseModelData public MaterialTypeModel(final MaterialType type) { this(type.getCode(), type); - set(ModelDataPropertyNames.TOOLTIP, EntityTypeTooltipRenderer.renderAsTooltip(type)); + set(ModelDataPropertyNames.TOOLTIP, TooltipRenderer.renderAsTooltip(type.getCode(), type + .getDescription())); } private static MaterialTypeModel createNone(String label) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/SampleTypeModel.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/SampleTypeModel.java index 7e02732c1328faf53950a5724a3d7e99a417a1a9..9177862191d5c51bb812a0851f71a68c3ed7fb85 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/SampleTypeModel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/SampleTypeModel.java @@ -22,7 +22,7 @@ import java.util.List; import com.extjs.gxt.ui.client.data.BaseModelData; import com.extjs.gxt.ui.client.data.ModelData; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.renderer.EntityTypeTooltipRenderer; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.renderer.TooltipRenderer; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType; /** @@ -39,7 +39,8 @@ public class SampleTypeModel extends BaseModelData { set(ModelDataPropertyNames.CODE, sampleType.getCode()); set(ModelDataPropertyNames.OBJECT, sampleType); - set(ModelDataPropertyNames.TOOLTIP, EntityTypeTooltipRenderer.renderAsTooltip(sampleType)); + set(ModelDataPropertyNames.TOOLTIP, TooltipRenderer.renderAsTooltip(sampleType.getCode(), + sampleType.getDescription())); } public final static List<SampleTypeModel> convert(final List<SampleType> sampleTypes, diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/renderer/EntityTypeTooltipRenderer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/renderer/TooltipRenderer.java similarity index 65% rename from openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/renderer/EntityTypeTooltipRenderer.java rename to openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/renderer/TooltipRenderer.java index ba7e909adcdf15affbbe9b777c42f99f203c7840..31cb4b984ce6780ebdfd34a92bcbd034c70b43bd 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/renderer/EntityTypeTooltipRenderer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/renderer/TooltipRenderer.java @@ -16,24 +16,23 @@ package ch.systemsx.cisd.openbis.generic.client.web.client.application.model.renderer; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.StringUtils; /** - * A renderer for tooltips entity type tooltips (used in drop down lists). + * A helper used to render tooltips for entities chosen from combo-boxes. * * @author Piotr Buczek */ -public class EntityTypeTooltipRenderer +public class TooltipRenderer { - public static final String renderAsTooltip(EntityType entityType) + public static final String renderAsTooltip(String code, String descriptionOrNull) { - final String code = entityType.getCode(); - final String description = entityType.getDescription(); + assert code != null; final StringBuilder sb = new StringBuilder(); sb.append("<b>" + code + "</b>"); - if (description != null) + if (StringUtils.isEmpty(descriptionOrNull) == false) { - sb.append("<br><hr>description: <i>" + description + "</i>"); + sb.append("<br><hr>description: <i>" + descriptionOrNull + "</i>"); } return sb.toString(); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/expressions/filter/FilterModel.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/expressions/filter/FilterModel.java index 04d059153325d7a31cffd7d0ff934cc843429e03..d47a91fdc209da55bea0ad8751f99064311fb958 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/expressions/filter/FilterModel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/expressions/filter/FilterModel.java @@ -23,6 +23,7 @@ import com.extjs.gxt.ui.client.data.BaseModelData; import com.extjs.gxt.ui.client.data.ModelData; import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.ModelDataPropertyNames; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.renderer.TooltipRenderer; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GridCustomFilter; /** @@ -40,6 +41,8 @@ public class FilterModel extends BaseModelData set(ModelDataPropertyNames.NAME, filter.getName()); set(ModelDataPropertyNames.DESCRIPTION, filter.getDescription()); set(ModelDataPropertyNames.OBJECT, filter); + set(ModelDataPropertyNames.TOOLTIP, TooltipRenderer.renderAsTooltip(filter.getName(), + filter.getDescription())); } public final static List<FilterModel> convert(final List<GridCustomFilter> filters, diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/expressions/filter/FilterSelectionWidget.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/expressions/filter/FilterSelectionWidget.java index 1aaa4c9dc98ac6fc08f8e8690f3a16b72cde1d94..a930ca5643327415181a04e1754a2a1988808e30 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/expressions/filter/FilterSelectionWidget.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/expressions/filter/FilterSelectionWidget.java @@ -26,6 +26,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewConte import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.ModelDataPropertyNames; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisplayTypeIDProvider; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.DropDownList; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.GWTUtils; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GridCustomFilter; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind.ObjectKind; @@ -35,7 +36,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKin * * @author Izabela Adamczyk */ -public final class FilterSelectionWidget extends DropDownList<FilterModel, GridCustomFilter> +public final class FilterSelectionWidget extends DropDownList<FilterModel, GridCustomFilter> { private static final String LIST_ITEMS_CALLBACK = "ListItemsCallback"; @@ -57,6 +58,8 @@ public final class FilterSelectionWidget extends DropDownList<FilterModel, GridC this.withStandard = true; setAutoSelectFirst(withStandard); setCallbackId(createCallbackId()); + setTemplate(GWTUtils.getTooltipTemplate(ModelDataPropertyNames.NAME, + ModelDataPropertyNames.TOOLTIP)); } public static String createCallbackId()