diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractBrowserGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractBrowserGrid.java index ff105ec57f974b0dc1dea8b2d1f8ea58ced5d1ad..ac17125a88cf6d8e706cf2db30f82b38aacf19fe 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractBrowserGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractBrowserGrid.java @@ -265,7 +265,7 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod // - hidden paging toolbar contentPanel.syncSize(); // - no 'overflow' button when some buttons don't fit into pagingToolbar - pagingToolbar.syncSize(); // doesn't solve the problem with resize of the window + pagingToolbar.syncSize(); } }); columnListener = new ColumnListener<T, M>(grid); @@ -1008,12 +1008,13 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod ColumnDefsAndConfigs<T> defsAndConfigs = createColumnsDefinition(); // add custom columns List<GridCustomColumnInfo> customColumnsMetadata = - customColumnsMetadataProvider.tryGetCustomColumnsMetadata(); - List<IColumnDefinitionUI<T>> customColumnsDefs = - createCustomColumnDefinitions(customColumnsMetadata); - defsAndConfigs.addColumns(customColumnsDefs); - if (customColumnsMetadata != null) + customColumnsMetadataProvider.getCustomColumnsMetadata(); + if (customColumnsMetadata.size() > 0) { + List<IColumnDefinitionUI<T>> customColumnsDefs = + createCustomColumnDefinitions(customColumnsMetadata); + defsAndConfigs.addColumns(customColumnsDefs); + RealNumberRenderer renderer = new RealNumberRenderer(viewContext.getDisplaySettingsManager() .getRealNumberFormatingParameters()); @@ -1033,14 +1034,10 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod } private static <T> List<IColumnDefinitionUI<T>> createCustomColumnDefinitions( - List<GridCustomColumnInfo> customColumnsMetadataOrNull) + List<GridCustomColumnInfo> customColumnsMetadata) { List<IColumnDefinitionUI<T>> defs = new ArrayList<IColumnDefinitionUI<T>>(); - if (customColumnsMetadataOrNull == null) - { - return defs; - } - for (GridCustomColumnInfo columnMetadata : customColumnsMetadataOrNull) + for (GridCustomColumnInfo columnMetadata : customColumnsMetadata) { IColumnDefinitionUI<T> colDef = new GridCustomColumnDefinition<T>(columnMetadata); defs.add(colDef); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractEntityBrowserGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractEntityBrowserGrid.java index 515ff0933e1db76a405c759eae2d2487d6725cee..8ce76a428a7a613a9f672627d72359425b2e3657 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractEntityBrowserGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractEntityBrowserGrid.java @@ -165,13 +165,14 @@ public abstract class AbstractEntityBrowserGrid<T extends IEntityPropertiesHolde Boolean refreshColumnsNeeded = updateCriteria(); if (refreshColumnsNeeded != null && refreshColumnsNeeded.booleanValue()) { + // TODO layout of grid with filters is invoked second time here super.recreateColumnModelAndRefreshColumnsWithFilters(); } } /** - * Updates criteria, returns null if bew criteria are not yet known, otherwise a boolean which - * tells if columns definition changed. + * Updates criteria, returns null if criteria are not yet known, otherwise a boolean which tells + * if columns definition changed. */ private Boolean updateCriteria() { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/CustomColumnsMetadataProvider.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/CustomColumnsMetadataProvider.java index 08d37cb175ea43e205c9980e47be4966538c0fc7..bec78ec498ae51ab4b80872e59457983dbf57655 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/CustomColumnsMetadataProvider.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/CustomColumnsMetadataProvider.java @@ -16,6 +16,7 @@ package ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid; +import java.util.ArrayList; import java.util.List; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.GridCustomColumnInfo; @@ -28,7 +29,8 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.dto.GridCustomColumnIn class CustomColumnsMetadataProvider { // what custom columns are present in the grid. Used to build column definitions. - private List<GridCustomColumnInfo> customColumnsMetadata; + private List<GridCustomColumnInfo> customColumnsMetadata = + new ArrayList<GridCustomColumnInfo>(); // has the last setter call changed the matadata? private boolean hasChanged; @@ -41,16 +43,14 @@ class CustomColumnsMetadataProvider return result; } - public List<GridCustomColumnInfo> tryGetCustomColumnsMetadata() + public List<GridCustomColumnInfo> getCustomColumnsMetadata() { return customColumnsMetadata; } public void setCustomColumnsMetadata(List<GridCustomColumnInfo> customColumnsMetadata) { - this.hasChanged = - (this.customColumnsMetadata == null && customColumnsMetadata != null) - || this.customColumnsMetadata.equals(customColumnsMetadata) == false; + this.hasChanged = this.customColumnsMetadata.equals(customColumnsMetadata) == false; this.customColumnsMetadata = customColumnsMetadata; } }