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 2276d23db3ce67bd7bbbda9e660e8bd57ccd5cf8..81c2fc975cf467c3f76298d93390486d33280270 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 @@ -68,6 +68,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MatchingEntity; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAuthorizationGroup; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewFilter; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewVocabulary; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Project; @@ -737,4 +738,22 @@ public interface ICommonClientService extends IClientService * Lists filters available for given grid. */ public List<Filter> listFilters(String gridId) throws UserFailureException; + + /** + * Returns {@link Filter}s for given criteria. + */ + public ResultSet<Filter> listFilters(String gridId, + DefaultResultSetConfig<String, Filter> resultSetConfig) throws UserFailureException; + + /** + * Returns a key which can be used be the export servlet (and eventually + * {@link #getExportTable(String, String)}) to reference the export criteria in an easy way. + */ + public String prepareExportFilters(final TableExportCriteria<Filter> criteria) + throws UserFailureException; + + /** + * Registers a new filter. + */ + public void registerFilter(NewFilter filter) throws UserFailureException; } 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 0b3eb09cd1428df94467b39f49aae16f71130ca0..f7ab8f39a06481880467db38193eebd397e07e02 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 @@ -70,6 +70,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MatchingEntity; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAuthorizationGroup; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewFilter; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewVocabulary; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Project; @@ -658,4 +659,18 @@ public interface ICommonClientServiceAsync extends IClientServiceAsync */ public void listFilters(String gridId, AsyncCallback<List<Filter>> callback); + /** + * @see ICommonClientService#listFilters(String, DefaultResultSetConfig) + */ + public void listFilters(String gridId, DefaultResultSetConfig<String, Filter> resultSetConfig, + AsyncCallback<ResultSet<Filter>> callback); + + /** + * @see ICommonClientService#prepareExportFilters(TableExportCriteria) + */ + public void prepareExportFilters(final TableExportCriteria<Filter> criteria, + AsyncCallback<String> asyncCallback); + + /** @see ICommonClientService#registerFilter(NewFilter) */ + public void registerFilter(NewFilter newFilter, AsyncCallback<Void> registrationCallback); } 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 1d09cb095c298f4282859ce9587291ef03a29062..5264232a3413e09561aa5a4d0ddf17136de3a796 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 @@ -649,7 +649,7 @@ public abstract class Dict // Grid Column Chooser // - public static final String GRID_COLUMN_CHOOSER_TITLE = "GRID_COLUMN_CHOOSER_TITLE"; + public static final String GRID_SETTINGS_TITLE = "grid_settings_title"; public static final String GRID_COLUMN_NAME_HEADER = "GRID_COLUMN_NAME_HEADER"; @@ -768,5 +768,15 @@ public abstract class Dict public static final String EXPERIMENTS_RADIO_GROUP_LABEL = "experiments_radio_group_label"; + public static final String NAME = "name"; + + public static final String IS_PUBLIC = "is_public"; + + public static final String EXPRESSION = "expression"; + + public static final String COLUMNS = "columns"; + + public static final String CUSTOM_FILTERS = "custom_filters"; + // ----- end generic ------------------ } \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/MatchingEntitiesPanel.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/MatchingEntitiesPanel.java index 39244e3f9cc4da39cbcac93626fae1e63c18086e..47f85ce1eebad17dc9eac89517119d1869e735b6 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/MatchingEntitiesPanel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/MatchingEntitiesPanel.java @@ -82,13 +82,12 @@ final class MatchingEntitiesPanel extends AbstractBrowserGrid<MatchingEntity, Ma SearchableEntity searchableEntity, String queryText) { // NOTE: refreshAutomatically is false, refreshing should be called manually - super(viewContext, GRID_ID, false, false); + super(viewContext, GRID_ID, false, false, DisplayTypeIDGenerator.SEARCH_RESULT_GRID); this.searchableEntity = searchableEntity; this.queryText = queryText; setId(createId()); updateDefaultRefreshButton(); - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.SEARCH_RESULT_GRID); registerLinkClickListenerFor(MatchingEntityColumnKind.IDENTIFIER.id(), new ICellListener<MatchingEntity>() { 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 fbb5f1aad4deedeaf9101e9b67694e5bc4171cec..cb3d825ff8fa4ae1ec2bbad5aae78ced6bf4a8c8 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 @@ -47,6 +47,8 @@ public enum DisplayTypeIDGenerator implements IDisplayTypeIDGenerator PROJECT_BROWSER_GRID("project-browser-grid"), + FILTER_BROWSER_GRID("filter-browser-grid"), + AUTHORIZATION_GROUP_BROWSER_GRID("authorization-group-browser-grid"), PERSON_BROWSER_GRID("person-browser-grid"), diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/ModelDataPropertyNames.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/ModelDataPropertyNames.java index 3531a4d46a930955017c54d2d55f00a2eafa3670..18354c8e00e1305f0053978844de1a363e1abc4f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/ModelDataPropertyNames.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/ModelDataPropertyNames.java @@ -96,6 +96,8 @@ public final class ModelDataPropertyNames public static final String PROJECT_IDENTIFIER = "projectIdentifier"; + public static final String NAME = "name"; + private ModelDataPropertyNames() { // Can not be instantiated. diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/AuthorizationGroupGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/AuthorizationGroupGrid.java index ce72ceb852e11f27efa743a0f4b6049bebe79284..6a4a54bfd144532c1d30bb6eaa27463a4b4379c3 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/AuthorizationGroupGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/AuthorizationGroupGrid.java @@ -89,8 +89,8 @@ public class AuthorizationGroupGrid extends AbstractSimpleBrowserGrid<Authorizat private AuthorizationGroupGrid(IViewContext<ICommonClientServiceAsync> viewContext) { - super(viewContext, BROWSER_ID, GRID_ID); - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.AUTHORIZATION_GROUP_BROWSER_GRID); + super(viewContext, BROWSER_ID, GRID_ID, + DisplayTypeIDGenerator.AUTHORIZATION_GROUP_BROWSER_GRID); postRegistrationCallback = createRefreshGridAction(); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/GroupGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/GroupGrid.java index 82120bfb96d427b0f6e8db80fc763824e91cd6a4..32486eb80ed053e6a753ed542409e3178d1e7fc5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/GroupGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/GroupGrid.java @@ -83,8 +83,7 @@ public class GroupGrid extends AbstractSimpleBrowserGrid<Group> private GroupGrid(IViewContext<ICommonClientServiceAsync> viewContext) { - super(viewContext, BROWSER_ID, GRID_ID); - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.PROJECT_BROWSER_GRID); + super(viewContext, BROWSER_ID, GRID_ID, DisplayTypeIDGenerator.PROJECT_BROWSER_GRID); postRegistrationCallback = createRefreshGridAction(); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/PersonGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/PersonGrid.java index 1e8837d27299b4ed53b57bb4cd48e46ad7ec8213..1691c8602e2dcf5a146e08ec22a6af288e16d045 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/PersonGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/PersonGrid.java @@ -89,9 +89,9 @@ public class PersonGrid extends AbstractSimpleBrowserGrid<Person> private PersonGrid(IViewContext<ICommonClientServiceAsync> viewContext, AuthorizationGroup groupOrNull) { - super(viewContext, createBrowserId(groupOrNull), createGridId(groupOrNull)); + super(viewContext, createBrowserId(groupOrNull), createGridId(groupOrNull), + DisplayTypeIDGenerator.PERSON_BROWSER_GRID); this.authorizationGroupOrNull = groupOrNull; - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.PERSON_BROWSER_GRID); } public static final String createBrowserId() diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/RoleAssignmentGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/RoleAssignmentGrid.java index 7f996dfdf8e12b75966e536cfe88ffaf8525cd6d..556ab3b2254938a2a0083c83bcb2d80d9ec388ec 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/RoleAssignmentGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/RoleAssignmentGrid.java @@ -71,8 +71,7 @@ public class RoleAssignmentGrid extends AbstractSimpleBrowserGrid<RoleAssignment private RoleAssignmentGrid(IViewContext<ICommonClientServiceAsync> viewContext) { - super(viewContext, BROWSER_ID, GRID_ID); - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.PROJECT_BROWSER_GRID); + super(viewContext, BROWSER_ID, GRID_ID, DisplayTypeIDGenerator.PROJECT_BROWSER_GRID); } private void extendBottomToolbar() diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/attachment/AttachmentBrowser.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/attachment/AttachmentBrowser.java index d3839ec1e89115616237559a37dd5f1acb60cb3d..0871a0712eff28d1ffadcccb338f7afebe3df7bf 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/attachment/AttachmentBrowser.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/attachment/AttachmentBrowser.java @@ -108,9 +108,9 @@ public class AttachmentBrowser extends AbstractSimpleBrowserGrid<AttachmentVersi public AttachmentBrowser(IViewContext<ICommonClientServiceAsync> viewContext, final IAttachmentHolder attachmentHolder) { - super(viewContext, createBrowserId(attachmentHolder), createGridId(attachmentHolder)); + super(viewContext, createBrowserId(attachmentHolder), createGridId(attachmentHolder), + DisplayTypeIDGenerator.ATTACHMENT_BROWSER_GRID); this.attachmentHolder = attachmentHolder; - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.ATTACHMENT_BROWSER_GRID); postRegistrationCallback = createRefreshGridAction(); extendBottomToolbar(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/FilterColDefKind.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/FilterColDefKind.java new file mode 100644 index 0000000000000000000000000000000000000000..e86ec0d6fa26b0b60cd442968b45ee403191384c --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/columns/specific/FilterColDefKind.java @@ -0,0 +1,103 @@ +/* + * 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.generic.client.web.client.application.ui.columns.specific; + +import ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.AbstractColumnDefinitionKind; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.IColumnDefinitionKind; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.renderers.SimpleYesNoRenderer; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Filter; + +/** + * Column definitions for the filters. + * + * @author Izabela Adamczyk + */ +public enum FilterColDefKind implements IColumnDefinitionKind<Filter> +{ + NAME(new AbstractColumnDefinitionKind<Filter>(Dict.NAME) + { + @Override + public String tryGetValue(Filter entity) + { + return entity.getName(); + } + }), + + DESCRIPTION(new AbstractColumnDefinitionKind<Filter>(Dict.DESCRIPTION) + { + @Override + public String tryGetValue(Filter entity) + { + return entity.getDescription(); + } + }), + + EXPRESSION(new AbstractColumnDefinitionKind<Filter>(Dict.EXPRESSION, true) + { + @Override + public String tryGetValue(Filter entity) + { + return entity.getExpression(); + } + }), + + PUBLIC(new AbstractColumnDefinitionKind<Filter>(Dict.IS_PUBLIC, true) + { + @Override + public String tryGetValue(Filter entity) + { + return SimpleYesNoRenderer.render(entity.isPublic()); + } + }), + + REGISTRATOR(new AbstractColumnDefinitionKind<Filter>(Dict.REGISTRATOR, true) + { + @Override + public String tryGetValue(Filter entity) + { + return renderRegistrator(entity); + } + }), + + REGISTRATION_DATE(new AbstractColumnDefinitionKind<Filter>(Dict.REGISTRATION_DATE, + AbstractColumnDefinitionKind.DATE_COLUMN_WIDTH, true) + { + @Override + public String tryGetValue(Filter entity) + { + return renderRegistrationDate(entity); + } + }); + + private final AbstractColumnDefinitionKind<Filter> columnDefinitionKind; + + private FilterColDefKind(AbstractColumnDefinitionKind<Filter> columnDefinitionKind) + { + this.columnDefinitionKind = columnDefinitionKind; + } + + public String id() + { + return name(); + } + + public AbstractColumnDefinitionKind<Filter> getDescriptor() + { + return columnDefinitionKind; + } +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/AbstractExternalDataGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/AbstractExternalDataGrid.java index ecdebc26bb9d3fb70701e7119b7ba05ca63b4076..7f5ed6e085851ac34772e813f6cdf481afe523af 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/AbstractExternalDataGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/AbstractExternalDataGrid.java @@ -32,6 +32,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAs 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.framework.DispatcherHelper; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DisplayTypeIDGenerator; import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.ITabItemFactory; import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.BaseEntityModel; import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.EntityGridModelFactory; @@ -88,9 +89,9 @@ public abstract class AbstractExternalDataGrid private final ICriteriaProvider<PropertyTypesCriteria> criteriaProvider; protected AbstractExternalDataGrid(final IViewContext<ICommonClientServiceAsync> viewContext, - String browserId, String gridId) + String browserId, String gridId, DisplayTypeIDGenerator displayTypeIDGenerator) { - super(viewContext, gridId, false, false); + super(viewContext, gridId, false, false, displayTypeIDGenerator); this.criteriaProvider = createCriteriaProvider(); setId(browserId); updateCriteriaProviderAndRefresh(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetReporterGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetReporterGrid.java index e1fb175e30f00299e405a0756bfbe02b8c33a787..6c1e25582d8a428c9289c8f672443792b97b6411 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetReporterGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetReporterGrid.java @@ -136,17 +136,16 @@ public class DataSetReporterGrid extends private DataSetReporterGrid(IViewContext<ICommonClientServiceAsync> viewContext, TableModelReference tableModelReference, String reportKind) { - super(viewContext, GRID_ID, false, true); + super(viewContext, GRID_ID, false, true, DisplayTypeIDGenerator.DATA_SET_REPORTING_GRID); setId(BROWSER_ID); this.tableHeader = tableModelReference.getHeader(); this.resultSetKey = tableModelReference.getResultSetKey(); this.reportKind = reportKind; updateDefaultRefreshButton(); - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.DATA_SET_REPORTING_GRID); } @Override - protected String getGridDisplayTypeID() + public String getGridDisplayTypeID() { return createGridDisplayTypeID(reportKind); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetSearchHitGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetSearchHitGrid.java index 350d8c0a7c64ee122650582083cfbf278b8d942f..32472e2456d36a0e89d5858b75f1033bd0a0634a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetSearchHitGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetSearchHitGrid.java @@ -69,8 +69,7 @@ public class DataSetSearchHitGrid extends AbstractExternalDataGrid implements private DataSetSearchHitGrid(final IViewContext<ICommonClientServiceAsync> viewContext) { - super(viewContext, BROWSER_ID, GRID_ID); - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.DATA_SET_SEARCH_RESULT_GRID); + super(viewContext, BROWSER_ID, GRID_ID, DisplayTypeIDGenerator.DATA_SET_SEARCH_RESULT_GRID); } @Override diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/FileFormatTypeGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/FileFormatTypeGrid.java index 8ca2ee7a2a5fc24dbd918e64a990882661120da7..f8128a7da96691752fa6925cefe36d59b0f686ca 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/FileFormatTypeGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/FileFormatTypeGrid.java @@ -77,8 +77,8 @@ public class FileFormatTypeGrid extends AbstractSimpleBrowserGrid<AbstractType> private FileFormatTypeGrid(IViewContext<ICommonClientServiceAsync> viewContext) { - super(viewContext, BROWSER_ID, GRID_ID); - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.FILE_FORMAT_TYPE_BROWSER_GRID); + super(viewContext, BROWSER_ID, GRID_ID, + DisplayTypeIDGenerator.FILE_FORMAT_TYPE_BROWSER_GRID); postRegistrationCallback = createRefreshGridAction(); extendBottomToolbar(); allowMultipleSelection(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/RelatedDataSetGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/RelatedDataSetGrid.java index 82564cb79eefc1afb90b2e579cd3fe5d73fe2e72..5794ca95a29c462baafa86f19e181b17a02f1707 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/RelatedDataSetGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/RelatedDataSetGrid.java @@ -58,9 +58,8 @@ public class RelatedDataSetGrid extends AbstractExternalDataGrid private RelatedDataSetGrid(final IViewContext<ICommonClientServiceAsync> viewContext, final RelatedDataSetCriteria relatedCriteria) { - super(viewContext, BROWSER_ID, GRID_ID); + super(viewContext, BROWSER_ID, GRID_ID, DisplayTypeIDGenerator.RELATED_DATA_SET_GRID); this.relatedCriteria = relatedCriteria; - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.RELATED_DATA_SET_GRID); } @Override diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/entity_type/AbstractEntityTypeGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/entity_type/AbstractEntityTypeGrid.java index de7468ad99b4dc060f41e8d20b4864419c73277d..528724e6757693a7ec84c6ae0fa5a14d2fc91a10 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/entity_type/AbstractEntityTypeGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/entity_type/AbstractEntityTypeGrid.java @@ -51,7 +51,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType; /** - * Abstarct grid displaying entity types. + * Abstract grid displaying entity types. * * @author Tomasz Pylak */ @@ -67,8 +67,7 @@ abstract public class AbstractEntityTypeGrid<T extends EntityType> extends protected AbstractEntityTypeGrid(IViewContext<ICommonClientServiceAsync> viewContext, String browserId, String gridId) { - super(viewContext, browserId, gridId); - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.TYPE_BROWSER_GRID); + super(viewContext, browserId, gridId, DisplayTypeIDGenerator.TYPE_BROWSER_GRID); postRegistrationCallback = createRefreshGridAction(); extendBottomToolbar(); @@ -76,7 +75,7 @@ abstract public class AbstractEntityTypeGrid<T extends EntityType> extends } @Override - protected String getGridDisplayTypeID() + public String getGridDisplayTypeID() { return createGridDisplayTypeID("-" + getEntityKind().toString()); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ExperimentBrowserGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ExperimentBrowserGrid.java index b9879a8022fffdf3386ce941ad4b91f58ad0e33e..7b36485349a3fb6bef0f2f5bd5c98612ce1a80b4 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ExperimentBrowserGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ExperimentBrowserGrid.java @@ -34,6 +34,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewConte import ch.systemsx.cisd.openbis.generic.client.web.client.application.SingleSectionPanel; import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.ComponentProvider; import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DispatcherHelper; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DisplayTypeIDGenerator; import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.ITabItemFactory; import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.BaseEntityModel; import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.EntityGridModelFactory; @@ -119,7 +120,7 @@ public class ExperimentBrowserGrid extends private ExperimentBrowserGrid(final IViewContext<ICommonClientServiceAsync> viewContext, ICriteriaProvider<ListExperimentsCriteria> criteriaProvider) { - super(viewContext, GRID_ID); + super(viewContext, GRID_ID, DisplayTypeIDGenerator.ENTITY_BROWSER_GRID); this.criteriaProvider = criteriaProvider; setId(BROWSER_ID); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/filter/AddFilterDialog.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/filter/AddFilterDialog.java new file mode 100644 index 0000000000000000000000000000000000000000..373cec43c8aa3330902689568fff5445fd79ab2d --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/filter/AddFilterDialog.java @@ -0,0 +1,82 @@ +/* + * 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.filter; + +import com.extjs.gxt.ui.client.widget.Window; +import com.extjs.gxt.ui.client.widget.form.TextField; +import com.google.gwt.user.client.rpc.AsyncCallback; + +import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientServiceAsync; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.field.CheckBoxField; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.field.DescriptionField; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.field.MultilineVarcharField; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.AbstractRegistrationDialog; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedAction; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewFilter; + +/** + * {@link Window} containing filter registration form. + * + * @author Izabela Adamczyk + */ +public class AddFilterDialog extends AbstractRegistrationDialog +{ + private final IViewContext<ICommonClientServiceAsync> viewContext; + + private final TextField<String> nameFiled; + + private final DescriptionField descriptionField; + + private final MultilineVarcharField expressionField; + + private final CheckBoxField publicField; + + private final String gridId; + + public AddFilterDialog(final IViewContext<ICommonClientServiceAsync> viewContext, + final IDelegatedAction postRegistrationCallback, String gridId) + { + super(viewContext, "Add a new filter", postRegistrationCallback); + this.viewContext = viewContext; + this.gridId = gridId; + addField(nameFiled = createTextField("Name", true)); + addField(descriptionField = createDescriptionField(viewContext, true)); + addField(expressionField = createExpressionField()); + addField(publicField = new CheckBoxField("Public", false)); + } + + private MultilineVarcharField createExpressionField() + { + MultilineVarcharField field = new MultilineVarcharField("Expression", true); + field.setMaxLength(2000); + return field; + } + + @Override + protected void register(AsyncCallback<Void> registrationCallback) + { + NewFilter filter = new NewFilter(); + filter.setDescription(descriptionField.getValue()); + filter.setExpression(expressionField.getValue()); + filter.setGridId(gridId); + filter.setName(nameFiled.getValue()); + filter.setPublic(publicField.getValue().booleanValue()); + viewContext.getService().registerFilter(filter, registrationCallback); + } + +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/filter/FilterGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/filter/FilterGrid.java new file mode 100644 index 0000000000000000000000000000000000000000..c34b80efbedb9f40aac55fb028a6e9e28d0257cd --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/filter/FilterGrid.java @@ -0,0 +1,150 @@ +/* + * 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.generic.client.web.client.application.ui.filter; + +import java.util.List; + +import com.extjs.gxt.ui.client.event.ComponentEvent; +import com.extjs.gxt.ui.client.event.SelectionListener; +import com.extjs.gxt.ui.client.widget.button.Button; + +import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientServiceAsync; +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.framework.DisplayTypeIDGenerator; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.renderer.LinkRenderer; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.IColumnDefinitionKind; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.specific.FilterColDefKind; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.AbstractSimpleBrowserGrid; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.ColumnDefsAndConfigs; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedAction; +import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DefaultResultSetConfig; +import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ResultSet; +import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TableExportCriteria; +import ch.systemsx.cisd.openbis.generic.shared.basic.IColumnDefinition; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Filter; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind.ObjectKind; + +/** + * Grid displaying filters. + * + * @author Izabela Adamczyk + */ +public class FilterGrid extends AbstractSimpleBrowserGrid<Filter> +{ + // AI add auto disposal on close/destroy/deattach + // browser consists of the grid and the paging toolbar + public static final String BROWSER_ID = GenericConstants.ID_PREFIX + "filter-browser"; + + public static final String GRID_ID = BROWSER_ID + "_grid"; + + public static final String EDIT_BUTTON_ID = BROWSER_ID + "-edit"; + + private final String gridId; + + public static IDisposableComponent create( + final IViewContext<ICommonClientServiceAsync> viewContext, final String gridId) + { + final FilterGrid grid = new FilterGrid(viewContext, gridId); + grid.extendBottomToolbar(); + return grid.asDisposableWithoutToolbar(); + } + + private FilterGrid(IViewContext<ICommonClientServiceAsync> viewContext, String gridId) + { + super(viewContext, BROWSER_ID, GRID_ID, DisplayTypeIDGenerator.FILTER_BROWSER_GRID); + // AI what happens with the id if two filter grids are open at the same time + this.gridId = gridId; + } + + private void extendBottomToolbar() + { + addEntityOperationsLabel(); + final Button addGroupButton = + new Button(viewContext.getMessage(Dict.BUTTON_ADD, "Filter"), + new SelectionListener<ComponentEvent>() + { + @Override + public void componentSelected(ComponentEvent ce) + { + AddFilterDialog dialog = + new AddFilterDialog(viewContext, new IDelegatedAction() + { + public void execute() + { + refresh(); + } + }, gridId); + dialog.show(); + } + }); + addButton(addGroupButton); + addEntityOperationsSeparator(); + } + + @Override + protected IColumnDefinitionKind<Filter>[] getStaticColumnsDefinition() + { + return FilterColDefKind.values(); + } + + @Override + protected ColumnDefsAndConfigs<Filter> createColumnsDefinition() + { + ColumnDefsAndConfigs<Filter> schema = super.createColumnsDefinition(); + schema + .setGridCellRendererFor(FilterColDefKind.NAME.id(), LinkRenderer + .createLinkRenderer()); + schema.setGridCellRendererFor(FilterColDefKind.DESCRIPTION.id(), + createMultilineStringCellRenderer()); + schema.setGridCellRendererFor(FilterColDefKind.EXPRESSION.id(), + createMultilineStringCellRenderer()); + return schema; + } + + @Override + protected void listEntities(DefaultResultSetConfig<String, Filter> resultSetConfig, + AbstractAsyncCallback<ResultSet<Filter>> callback) + { + viewContext.getService().listFilters(gridId, resultSetConfig, callback); + } + + @Override + protected void prepareExportEntities(TableExportCriteria<Filter> exportCriteria, + AbstractAsyncCallback<String> callback) + { + viewContext.getService().prepareExportFilters(exportCriteria, callback); + } + + @Override + protected List<IColumnDefinition<Filter>> getInitialFilters() + { + return asColumnFilters(new FilterColDefKind[] + { FilterColDefKind.NAME, FilterColDefKind.PUBLIC }); + } + + public DatabaseModificationKind[] getRelevantModifications() + { + return new DatabaseModificationKind[] + { DatabaseModificationKind.createOrDelete(ObjectKind.FILTER), + DatabaseModificationKind.edit(ObjectKind.FILTER) }; + } +} \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/filter/FilterModel.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/filter/FilterModel.java new file mode 100644 index 0000000000000000000000000000000000000000..ec8f7fee2de8c5f835e68fe21d22e862f4631c09 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/filter/FilterModel.java @@ -0,0 +1,69 @@ +/* + * 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.filter; + +import java.util.ArrayList; +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.ModelDataPropertyNames; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Filter; + +/** + * {@link ModelData} for {@link Filter}. + * + * @author Izabela Adamczyk + */ +public class FilterModel extends BaseModelData +{ + + private static final long serialVersionUID = 1L; + + public FilterModel(final Filter filter) + { + set(ModelDataPropertyNames.NAME, filter.getName()); + set(ModelDataPropertyNames.DESCRIPTION, filter.getDescription()); + set(ModelDataPropertyNames.OBJECT, filter); + } + + public final static List<FilterModel> convert(final List<Filter> filters, + final boolean withColumnFilter) + { + final List<FilterModel> result = new ArrayList<FilterModel>(); + + for (final Filter filter : filters) + { + result.add(new FilterModel(filter)); + } + if (withColumnFilter) + { + result.add(0, createColumnFilter(filters)); + } + + return result; + } + + private static FilterModel createColumnFilter(List<Filter> basicTypes) + { + final Filter allSampleType = new Filter(); + allSampleType.setName(Filter.COLUMN_FILTER); + return new FilterModel(allSampleType); + } + +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/filter/FilterSelectionWidget.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/filter/FilterSelectionWidget.java new file mode 100644 index 0000000000000000000000000000000000000000..f11ce4addd0bd3dcd88ab56ed6de7eae6ba054e8 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/filter/FilterSelectionWidget.java @@ -0,0 +1,77 @@ +/* + * 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.filter; + +import java.util.List; + +import com.extjs.gxt.ui.client.widget.form.ComboBox; + +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.IViewContext; +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.shared.basic.dto.DatabaseModificationKind; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Filter; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind.ObjectKind; + +/** + * {@link ComboBox} containing list of filters loaded from the server. + * + * @author Izabela Adamczyk + */ +public final class FilterSelectionWidget extends DropDownList<FilterModel, Filter> +{ + public static final String SUFFIX = "filter"; + + private final IViewContext<?> viewContext; + + private final boolean withStandard; + + private final IDisplayTypeIDProvider displayTypeIDProvider; + + public FilterSelectionWidget(final IViewContext<?> viewContext, final String idSuffix, + IDisplayTypeIDProvider displayTypeIDProvider) + { + super(viewContext, SUFFIX + idSuffix, Dict.FILTER, ModelDataPropertyNames.NAME, "filter", + "filters"); + this.viewContext = viewContext; + this.displayTypeIDProvider = displayTypeIDProvider; + this.withStandard = true; + setAutoSelectFirst(withStandard); + setForceSelection(true); + } + + @Override + protected List<FilterModel> convertItems(List<Filter> result) + { + return FilterModel.convert(result, withStandard); + } + + @Override + protected void loadData(AbstractAsyncCallback<List<Filter>> callback) + { + viewContext.getCommonService().listFilters(displayTypeIDProvider.getGridDisplayTypeID(), + callback); + } + + public DatabaseModificationKind[] getRelevantModifications() + { + return DatabaseModificationKind.any(ObjectKind.FILTER); + } +} \ No newline at end of file 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 88662961cb1d4e0893b40b7862b1920d0c1aa49a..3c07f88f814c0e790f1db662816d4fd58482a1f5 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 @@ -62,6 +62,7 @@ import com.extjs.gxt.ui.client.widget.layout.RowLayout; import com.extjs.gxt.ui.client.widget.toolbar.AdapterToolItem; import com.extjs.gxt.ui.client.widget.toolbar.LabelToolItem; import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem; +import com.extjs.gxt.ui.client.widget.toolbar.TextToolItem; import com.extjs.gxt.ui.client.widget.toolbar.ToolBar; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -82,6 +83,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.Base import ch.systemsx.cisd.openbis.generic.client.web.client.application.renderer.MultilineStringCellRenderer; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.BorderLayoutDataFactory; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.IColumnDefinitionKind; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.filter.FilterSelectionWidget; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.IDataRefreshCallback; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedAction; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider; @@ -104,8 +106,9 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SortInfo.SortDir; * @author Tomasz Pylak */ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityModel<T>> extends - LayoutContainer implements IDatabaseModificationObserver + LayoutContainer implements IDatabaseModificationObserver, IDisplayTypeIDProvider { + /** * Shows the detail view for the specified entity */ @@ -149,7 +152,7 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod * * @return id at which grid display settings are saved. */ - protected String getGridDisplayTypeID() + public String getGridDisplayTypeID() { return createGridDisplayTypeID(null); } @@ -178,6 +181,8 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod // used to change displayed filter widgets private final ToolBar filterToolbar; + private final IDisplayTypeIDGenerator displayTypeIDGenerator; + // --------- private non-final fields private List<PagingColumnFilter<T>> filterWidgets = new ArrayList<PagingColumnFilter<T>>(); @@ -190,12 +195,10 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod private IDataRefreshCallback refreshCallback; - private IDisplayTypeIDGenerator displayTypeIDGenerator; - protected AbstractBrowserGrid(final IViewContext<ICommonClientServiceAsync> viewContext, - String gridId) + String gridId, IDisplayTypeIDGenerator displayTypeIDGenerator) { - this(viewContext, gridId, true, false); + this(viewContext, gridId, true, false, displayTypeIDGenerator); } /** @@ -208,8 +211,10 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod * and identify the callback which fills it in. */ protected AbstractBrowserGrid(IViewContext<ICommonClientServiceAsync> viewContext, - String gridId, boolean showHeader, boolean refreshAutomatically) + String gridId, boolean showHeader, boolean refreshAutomatically, + IDisplayTypeIDGenerator displayTypeIDGenerator) { + this.displayTypeIDGenerator = displayTypeIDGenerator; this.viewContext = viewContext; this.refreshAutomatically = refreshAutomatically; this.pagingLoader = createPagingLoader(); @@ -220,7 +225,8 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod pagingToolbar.bind(pagingLoader); this.filterToolbar = new ToolBar(); - final LayoutContainer bottomToolbars = createBottomToolbars(filterToolbar, pagingToolbar); + final LayoutContainer bottomToolbars = createBottomToolbars( + /* AI new FilterToolbar(viewContext, gridId, this) */filterToolbar, pagingToolbar); this.contentPanel = createEmptyContentPanel(); contentPanel.add(grid); contentPanel.setBottomComponent(bottomToolbars); @@ -319,11 +325,6 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod return grid.getStore().getModels(); } - protected final void setDisplayTypeIDGenerator(IDisplayTypeIDGenerator displayTypeIDGenerator) - { - this.displayTypeIDGenerator = displayTypeIDGenerator; - } - private List<PagingColumnFilter<T>> createFilterWidgets( List<IColumnDefinition<T>> filteredColumns) { @@ -1159,7 +1160,7 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod List<ColumnDataModel> settingsModel = createColumnsSettingsModel(getColumnModel(), extractFilteredColumnIds(filterWidgets)); - ColumnSettingsDialog.show(viewContext, settingsModel, updater); + ColumnSettingsDialog.show(viewContext, settingsModel, updater, getGridDisplayTypeID()); } // @Private - for tests @@ -1305,6 +1306,20 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod return bottomToolbars; } + static class FilterToolbar extends ToolBar + { + + public FilterToolbar(IViewContext<ICommonClientServiceAsync> viewContext, String gridId, + IDisplayTypeIDProvider displayTypeIDProvider) + { + add(new LabelToolItem(viewContext.getMessage(Dict.FILTER) + ": ")); + add(new AdapterToolItem(new FilterSelectionWidget(viewContext, gridId, + displayTypeIDProvider))); + add(new TextToolItem("Apply"));// IA use message provider + } + + } + // Clears the filter toolbar and fills it with the specified filter widgets. private static <T> void rebuildFilterToolbar(List<PagingColumnFilter<T>> filterWidgets, List<PagingColumnFilter<T>> previousFilterWidgetsOrNull, ToolBar filterToolbar, @@ -1317,7 +1332,6 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod } filterToolbar.add(new LabelToolItem(messageProvider.getMessage(Dict.FILTERS) + ": ")); - Map<String, PagingColumnFilter<T>> previousFiltersByColumnId = new HashMap<String, PagingColumnFilter<T>>(); if (previousFilterWidgetsOrNull != null) 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 3cbf113d43809ccdd1d9601f52655cbd91f94505..ed188696bd86464a2775c373563c774a1f826e45 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 @@ -97,22 +97,21 @@ public abstract class AbstractEntityBrowserGrid<T extends IEntityPropertiesHolde } protected AbstractEntityBrowserGrid(IViewContext<ICommonClientServiceAsync> viewContext, - String gridId) + String gridId, DisplayTypeIDGenerator displayTypeIDGenerator) { - super(viewContext, gridId); - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.ENTITY_BROWSER_GRID); + super(viewContext, gridId, displayTypeIDGenerator); } protected AbstractEntityBrowserGrid(IViewContext<ICommonClientServiceAsync> viewContext, - String gridId, boolean showHeader, boolean refreshAutomatically) + String gridId, boolean showHeader, boolean refreshAutomatically, + DisplayTypeIDGenerator displayTypeIDGenerator) { - super(viewContext, gridId, showHeader, refreshAutomatically); - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.ENTITY_BROWSER_GRID); + super(viewContext, gridId, showHeader, refreshAutomatically, displayTypeIDGenerator); allowMultipleSelection(); } @Override - protected String getGridDisplayTypeID() + public String getGridDisplayTypeID() { String suffix = createDisplayIdSuffix(getEntityKind(), tryToGetEntityType()); return createGridDisplayTypeID(suffix); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractSimpleBrowserGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractSimpleBrowserGrid.java index b3131ed38aa8f6c078b50809d1c2957fcd4c58bf..4392d4828c8e69130d2c13f27159c1c59c19afd1 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractSimpleBrowserGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractSimpleBrowserGrid.java @@ -20,6 +20,7 @@ import java.util.Set; import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientServiceAsync; import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.IDisplayTypeIDGenerator; import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.BaseEntityModel; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.columns.framework.IColumnDefinitionKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind; @@ -35,15 +36,16 @@ abstract public class AbstractSimpleBrowserGrid<T/* Entity */> extends abstract protected IColumnDefinitionKind<T>[] getStaticColumnsDefinition(); protected AbstractSimpleBrowserGrid(IViewContext<ICommonClientServiceAsync> viewContext, - String browserId, String gridId) + String browserId, String gridId, IDisplayTypeIDGenerator displayTypeIDGenerator) { - this(viewContext, browserId, gridId, true); + this(viewContext, browserId, gridId, true, displayTypeIDGenerator); } - + protected AbstractSimpleBrowserGrid(IViewContext<ICommonClientServiceAsync> viewContext, - String browserId, String gridId, boolean refreshAutomatically) + String browserId, String gridId, boolean refreshAutomatically, + IDisplayTypeIDGenerator displayTypeIDGenerator) { - super(viewContext, gridId, false, refreshAutomatically); + super(viewContext, gridId, false, refreshAutomatically, displayTypeIDGenerator); setId(browserId); updateDefaultRefreshButton(); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/ColumnDataModel.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/ColumnDataModel.java index 004b32c609d23779b0ca20b2fc5f660ba4212020..d4a896aaddf8b18437cbeee1380b63c61edc8eeb 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/ColumnDataModel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/ColumnDataModel.java @@ -7,12 +7,12 @@ import com.extjs.gxt.ui.client.data.BaseModelData; * * @author Izabela Adamczyk */ -class ColumnDataModel extends BaseModelData +public class ColumnDataModel extends BaseModelData { private static final long serialVersionUID = 1L; - private static final String COLUMN_ID = "column_id"; + static final String COLUMN_ID = "column_id"; static final String HAS_FILTER = "HAS_FILTER"; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/ColumnSettingsChooser.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/ColumnSettingsChooser.java index bed6abbcf0aa850640f166d5333277cb50d41bcb..6e2441ca8dfaf20feb9449918645c956f2cd471e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/ColumnSettingsChooser.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/ColumnSettingsChooser.java @@ -45,6 +45,7 @@ class ColumnSettingsChooser public ColumnSettingsChooser(List<ColumnDataModel> list, IMessageProvider messageProvider) { List<ColumnConfig> configs = new ArrayList<ColumnConfig>(); + CheckColumnConfig isVisibleColumn = new CheckColumnConfig(ColumnDataModel.IS_VISIBLE, messageProvider .getMessage(Dict.GRID_IS_COLUMN_VISIBLE_HEADER), 55); @@ -54,9 +55,12 @@ class ColumnSettingsChooser ColumnConfig nameColumn = new ColumnConfig(ColumnDataModel.HEADER, messageProvider .getMessage(Dict.GRID_COLUMN_NAME_HEADER), 300); + // AI remove when not needed + ColumnConfig idColumn = new ColumnConfig(ColumnDataModel.COLUMN_ID, "ID", 300); configs.add(isVisibleColumn); configs.add(hasFilterColumn); configs.add(nameColumn); + configs.add(idColumn); for (ColumnConfig column : configs) { column.setSortable(false); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/ColumnSettingsDialog.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/ColumnSettingsDialog.java index 9bcc9e6ab67bdc221206e029a5828df56269ba90..2808cb7f99594545672b76021b1ecfd72fc8303c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/ColumnSettingsDialog.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/ColumnSettingsDialog.java @@ -5,11 +5,15 @@ import java.util.List; import com.extjs.gxt.ui.client.event.ComponentEvent; import com.extjs.gxt.ui.client.event.SelectionListener; import com.extjs.gxt.ui.client.widget.Dialog; +import com.extjs.gxt.ui.client.widget.TabItem; +import com.extjs.gxt.ui.client.widget.TabPanel; import com.extjs.gxt.ui.client.widget.grid.ColumnModel; import com.extjs.gxt.ui.client.widget.layout.FitLayout; +import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientServiceAsync; import ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict; -import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.filter.FilterGrid; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IResultUpdater; /** @@ -19,21 +23,25 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IResu */ class ColumnSettingsDialog extends Dialog { - private final IMessageProvider messageProvider; + private final IViewContext<ICommonClientServiceAsync> viewContext; - public static void show(IMessageProvider messageProvider, List<ColumnDataModel> columnModels, - IResultUpdater<List<ColumnDataModel>> resultUpdater) + private final String gridId; + + public static void show(IViewContext<ICommonClientServiceAsync> viewContext, + List<ColumnDataModel> columnModels, + IResultUpdater<List<ColumnDataModel>> resultUpdater, String gridId) { - new ColumnSettingsDialog(messageProvider).show(columnModels, resultUpdater); + new ColumnSettingsDialog(viewContext, gridId).show(columnModels, resultUpdater); } - private ColumnSettingsDialog(IMessageProvider messageProvider) + private ColumnSettingsDialog(IViewContext<ICommonClientServiceAsync> viewContext, String gridId) { - this.messageProvider = messageProvider; - setHeight(400); - setWidth(450); + this.viewContext = viewContext; + this.gridId = gridId; + setHeight(450); + setWidth(700); setLayout(new FitLayout()); - setHeading(messageProvider.getMessage(Dict.GRID_COLUMN_CHOOSER_TITLE)); + setHeading(viewContext.getMessage(Dict.GRID_SETTINGS_TITLE) + " [" + gridId + "]"); } /** @@ -45,8 +53,19 @@ class ColumnSettingsDialog extends Dialog assert columnModels != null : "columnModels not specified"; removeAll(); final ColumnSettingsChooser columnChooser = - new ColumnSettingsChooser(columnModels, messageProvider); - add(columnChooser.getComponent()); + new ColumnSettingsChooser(columnModels, viewContext); + final IDisposableComponent filters = FilterGrid.create(viewContext, gridId); + TabPanel panel = new TabPanel(); + TabItem columnsTab = new TabItem(viewContext.getMessage(Dict.COLUMNS)); + columnsTab.setLayout(new FitLayout()); + columnsTab.add(columnChooser.getComponent()); + panel.add(columnsTab); + // AI dont show if user is not at least power user + TabItem filtersTab = new TabItem(viewContext.getMessage(Dict.CUSTOM_FILTERS)); + filtersTab.setLayout(new FitLayout()); + filtersTab.add(filters.getComponent()); + panel.add(filtersTab); + add(panel); super.show(); getButtonBar().getButtonById("ok").addSelectionListener( new SelectionListener<ComponentEvent>() @@ -55,8 +74,10 @@ class ColumnSettingsDialog extends Dialog public void componentSelected(ComponentEvent ce) { resultUpdater.update(columnChooser.getModels()); + filters.dispose(); hide(); } }); } + } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/IDisplayTypeIDProvider.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/IDisplayTypeIDProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..29743f7003f1826d5f561700928a5e5963c8f6cd --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/IDisplayTypeIDProvider.java @@ -0,0 +1,25 @@ +/* + * 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.generic.client.web.client.application.ui.grid; + +/** + * @author Izabela Adamczyk + */ +public interface IDisplayTypeIDProvider +{ + public String getGridDisplayTypeID(); +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/material/MaterialBrowserGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/material/MaterialBrowserGrid.java index ebe5e3402e1ac6e2f565e380ba53a757aa8944ec..4bdf99f5680ed187fd1eeb6bc6544705704f5887 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/material/MaterialBrowserGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/material/MaterialBrowserGrid.java @@ -29,6 +29,7 @@ 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.framework.DispatcherHelper; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DisplayTypeIDGenerator; import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.ITabItemFactory; import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.BaseEntityModel; import ch.systemsx.cisd.openbis.generic.client.web.client.application.model.EntityGridModelFactory; @@ -145,7 +146,8 @@ public class MaterialBrowserGrid extends private MaterialBrowserGrid(final IViewContext<ICommonClientServiceAsync> viewContext, boolean refreshAutomatically, ICriteriaProvider<ListMaterialCriteria> criteriaProvider) { - super(viewContext, GRID_ID, true, refreshAutomatically); + super(viewContext, GRID_ID, true, refreshAutomatically, + DisplayTypeIDGenerator.ENTITY_BROWSER_GRID); this.criteriaProvider = criteriaProvider; setId(BROWSER_ID); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/project/ProjectGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/project/ProjectGrid.java index 97d2239e1cf213e98d76200ff7656000887525da..0c8a6414b44a3a137bb4f517d6c46dcb194afaf3 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/project/ProjectGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/project/ProjectGrid.java @@ -81,8 +81,7 @@ public class ProjectGrid extends AbstractSimpleBrowserGrid<Project> private ProjectGrid(IViewContext<ICommonClientServiceAsync> viewContext) { - super(viewContext, BROWSER_ID, GRID_ID); - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.PROJECT_BROWSER_GRID); + super(viewContext, BROWSER_ID, GRID_ID, DisplayTypeIDGenerator.PROJECT_BROWSER_GRID); } private void extendBottomToolbar() diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property_type/PropertyTypeAssignmentGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property_type/PropertyTypeAssignmentGrid.java index 4b4c01ec064e1708ff7475b57d21a339e8a700c0..8595c82b137745a33e8b8c1fe47f8c94b87ab001 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property_type/PropertyTypeAssignmentGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property_type/PropertyTypeAssignmentGrid.java @@ -174,8 +174,8 @@ public class PropertyTypeAssignmentGrid extends private PropertyTypeAssignmentGrid(final IViewContext<ICommonClientServiceAsync> viewContext) { - super(viewContext, BROWSER_ID, GRID_ID); - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.PROPERTY_TYPE_ASSIGNMENT_BROWSER_GRID); + super(viewContext, BROWSER_ID, GRID_ID, + DisplayTypeIDGenerator.PROPERTY_TYPE_ASSIGNMENT_BROWSER_GRID); extendBottomToolbar(); postRegistrationCallback = createRefreshGridAction(); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property_type/PropertyTypeGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property_type/PropertyTypeGrid.java index 0ce848cc257cf6debe4292bc448ac877d7561e30..dca30270512db371ea4074fefbf65b6a79ab6da4 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property_type/PropertyTypeGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property_type/PropertyTypeGrid.java @@ -79,8 +79,7 @@ public class PropertyTypeGrid extends AbstractSimpleBrowserGrid<PropertyType> private PropertyTypeGrid(IViewContext<ICommonClientServiceAsync> viewContext) { - super(viewContext, BROWSER_ID, GRID_ID); - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.PROPERTY_TYPE_BROWSER_GRID); + super(viewContext, BROWSER_ID, GRID_ID, DisplayTypeIDGenerator.PROPERTY_TYPE_BROWSER_GRID); extendBottomToolbar(); postRegistrationCallback = createRefreshGridAction(); } 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 550eefaa8c98ed15d9137df4151a7a5c21afd812..fe1621808c487647862c0bf1b4fab266535e1167 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 @@ -105,7 +105,7 @@ public class SampleBrowserGrid extends ISampleCriteriaProvider criteriaProvider = toolbar; final SampleBrowserGrid browserGrid = new SampleBrowserGrid(viewContext, criteriaProvider, GRID_ID, BROWSER_ID, true, - false) + false, DisplayTypeIDGenerator.ENTITY_BROWSER_GRID) { @Override protected void showEntityViewer(Sample sample, boolean editMode) @@ -124,7 +124,7 @@ public class SampleBrowserGrid extends ISampleCriteriaProvider criteriaProvider = toolbar; final SampleBrowserGrid browserGrid = new SampleBrowserGrid(viewContext, criteriaProvider, GRID_ID, BROWSER_ID, true, - false); + false, DisplayTypeIDGenerator.ENTITY_BROWSER_GRID); browserGrid.addGridRefreshListener(toolbar); browserGrid.extendBottomToolbar(); return browserGrid.asDisposableWithToolbar(toolbar); @@ -138,9 +138,9 @@ public class SampleBrowserGrid extends ListSampleDisplayCriteria.createForContainer(containerSampleId); final String entityTypeCode = sampleType.getCode(); final SampleBrowserGrid browserGrid = - createGridAsComponent(viewContext, gridId, criteria, entityTypeCode); + createGridAsComponent(viewContext, gridId, criteria, entityTypeCode, + DisplayTypeIDGenerator.SAMPLE_DETAILS_GRID); browserGrid.updateCriteriaProviderAndRefresh(); - browserGrid.setDisplayTypeIDGenerator(DisplayTypeIDGenerator.SAMPLE_DETAILS_GRID); browserGrid.extendBottomToolbar(); return browserGrid.asDisposableWithoutToolbar(); } @@ -154,16 +154,17 @@ public class SampleBrowserGrid extends final String entityTypeCode = experimentType.getCode(); final SampleBrowserGrid browserGrid = - createGridAsComponent(viewContext, gridId, criteria, entityTypeCode); + createGridAsComponent(viewContext, gridId, criteria, entityTypeCode, + DisplayTypeIDGenerator.EXPERIMENT_DETAILS_GRID); browserGrid.updateCriteriaProviderAndRefresh(); - browserGrid.setDisplayTypeIDGenerator(DisplayTypeIDGenerator.EXPERIMENT_DETAILS_GRID); browserGrid.extendBottomToolbar(); return browserGrid.asDisposableWithoutToolbar(); } private static SampleBrowserGrid createGridAsComponent( final IViewContext<ICommonClientServiceAsync> viewContext, final String gridId, - final ListSampleDisplayCriteria criteria, final String entityTypeCode) + final ListSampleDisplayCriteria criteria, final String entityTypeCode, + DisplayTypeIDGenerator displayTypeIDGenerator) { ISampleCriteriaProvider criteriaProvider = new SampleCriteriaProvider(viewContext, criteria); @@ -172,10 +173,10 @@ public class SampleBrowserGrid extends boolean refreshAutomatically = false; final SampleBrowserGrid browserGrid = new SampleBrowserGrid(viewContext, criteriaProvider, gridId, BROWSER_ID, false, - refreshAutomatically) + refreshAutomatically, displayTypeIDGenerator) { @Override - protected String getGridDisplayTypeID() + public String getGridDisplayTypeID() { return super.getGridDisplayTypeID() + "-" + entityTypeCode; } @@ -283,9 +284,10 @@ public class SampleBrowserGrid extends protected SampleBrowserGrid(final IViewContext<ICommonClientServiceAsync> viewContext, ISampleCriteriaProvider criteriaProvider, String gridId, String browserId, - boolean showHeader, boolean refreshAutomatically) + boolean showHeader, boolean refreshAutomatically, + DisplayTypeIDGenerator displayTypeIDGenerator) { - super(viewContext, gridId, showHeader, refreshAutomatically); + super(viewContext, gridId, showHeader, refreshAutomatically, displayTypeIDGenerator); this.propertyTypesAndCriteriaProvider = criteriaProvider; this.previousPropertyTypes = null; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/SampleSearchHitGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/SampleSearchHitGrid.java index c87363ff18a2e4a84aef4b87551a81e2cf25a1d9..43b131b877785166dead16fb7d913390e15cfdc9 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/SampleSearchHitGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/SampleSearchHitGrid.java @@ -71,8 +71,8 @@ public class SampleSearchHitGrid extends SampleBrowserGrid implements IDetailedS private SampleSearchHitGrid(final IViewContext<ICommonClientServiceAsync> viewContext, final ISampleCriteriaProvider criteriaProvider) { - super(viewContext, criteriaProvider, SEARCH_GRID_ID, SEARCH_BROWSER_ID, false, false); - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.SAMPLE_SEARCH_RESULT_GRID); + super(viewContext, criteriaProvider, SEARCH_GRID_ID, SEARCH_BROWSER_ID, false, false, + DisplayTypeIDGenerator.SAMPLE_SEARCH_RESULT_GRID); updateCriteriaProviderAndRefresh(); extendBottomToolbar(); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/vocabulary/VocabularyGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/vocabulary/VocabularyGrid.java index f774df3e7a677971cf97e304efdda29e3ced198b..19591daf32fbd7a0888f4be97e4b450495ea5f7b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/vocabulary/VocabularyGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/vocabulary/VocabularyGrid.java @@ -166,8 +166,7 @@ public class VocabularyGrid extends AbstractSimpleBrowserGrid<Vocabulary> private VocabularyGrid(IViewContext<ICommonClientServiceAsync> viewContext) { - super(viewContext, BROWSER_ID, GRID_ID); - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.VOCABULARY_BROWSER_GRID); + super(viewContext, BROWSER_ID, GRID_ID, DisplayTypeIDGenerator.VOCABULARY_BROWSER_GRID); postEditionCallback = new IDelegatedAction() { public void execute() diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/vocabulary/VocabularyTermGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/vocabulary/VocabularyTermGrid.java index 69f8337960d68c28cb8cdc3b5518e79c20f8872a..235a00d5ee60f2893dea9ae98342481583953fbc 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/vocabulary/VocabularyTermGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/vocabulary/VocabularyTermGrid.java @@ -113,11 +113,11 @@ public class VocabularyTermGrid extends AbstractSimpleBrowserGrid<VocabularyTerm private VocabularyTermGrid(IViewContext<ICommonClientServiceAsync> viewContext, Vocabulary vocabulary) { - super(viewContext, createBrowserId(vocabulary), createGridId(vocabulary)); + super(viewContext, createBrowserId(vocabulary), createGridId(vocabulary), + DisplayTypeIDGenerator.VOCABULARY_TERMS_GRID); this.vocabulary = vocabulary; this.postRegistrationCallback = createRefreshGridAction(); extendBottomToolbar(); - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.VOCABULARY_TERMS_GRID); } private void extendBottomToolbar() 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 5d920470d906f7f43b7df0ccb14b6ea926b16af0..a916eae0ba239a2f686f97eda5041b116ed24ae4 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 @@ -109,6 +109,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialTypePropertyType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAttachment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAuthorizationGroup; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewFilter; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewVocabulary; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Project; @@ -2111,4 +2112,37 @@ public final class CommonClientService extends AbstractClientService implements throw UserFailureExceptionTranslator.translate(e); } } + + public ResultSet<Filter> listFilters(final String gridId, + DefaultResultSetConfig<String, Filter> resultSetConfig) + throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException + { + return listEntities(resultSetConfig, new IOriginalDataProvider<Filter>() + { + public List<Filter> getOriginalData() throws UserFailureException + { + return listFilters(gridId); + } + }); + } + + public String prepareExportFilters(TableExportCriteria<Filter> criteria) + throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException + { + return prepareExportEntities(criteria); + } + + public void registerFilter(NewFilter filter) + throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException + { + assert filter != null : "Unspecified filter."; + try + { + final String sessionToken = getSessionToken(); + commonServer.registerFilter(sessionToken, filter); + } catch (final UserFailureException e) + { + throw UserFailureExceptionTranslator.translate(e); + } + } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonBusinessObjectFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonBusinessObjectFactory.java index 8d3715c939a2ccb454a93b117442f4da9a609aa8..280d0ebe761f2ceb49e0ef7e9eb77b990dbb99ae 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonBusinessObjectFactory.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonBusinessObjectFactory.java @@ -26,6 +26,7 @@ import ch.systemsx.cisd.openbis.generic.server.business.bo.ExperimentBO; import ch.systemsx.cisd.openbis.generic.server.business.bo.ExperimentTable; import ch.systemsx.cisd.openbis.generic.server.business.bo.ExternalDataBO; import ch.systemsx.cisd.openbis.generic.server.business.bo.ExternalDataTable; +import ch.systemsx.cisd.openbis.generic.server.business.bo.FilterBO; import ch.systemsx.cisd.openbis.generic.server.business.bo.GroupBO; import ch.systemsx.cisd.openbis.generic.server.business.bo.IAttachmentBO; import ch.systemsx.cisd.openbis.generic.server.business.bo.IAuthorizationGroupBO; @@ -36,6 +37,7 @@ import ch.systemsx.cisd.openbis.generic.server.business.bo.IExperimentBO; import ch.systemsx.cisd.openbis.generic.server.business.bo.IExperimentTable; import ch.systemsx.cisd.openbis.generic.server.business.bo.IExternalDataBO; import ch.systemsx.cisd.openbis.generic.server.business.bo.IExternalDataTable; +import ch.systemsx.cisd.openbis.generic.server.business.bo.IFilterBO; import ch.systemsx.cisd.openbis.generic.server.business.bo.IGroupBO; import ch.systemsx.cisd.openbis.generic.server.business.bo.IMaterialBO; import ch.systemsx.cisd.openbis.generic.server.business.bo.IMaterialTable; @@ -186,4 +188,9 @@ public final class CommonBusinessObjectFactory extends AbstractBusinessObjectFac { return new AuthorizationGroupBO(getDaoFactory(), session); } + + public IFilterBO createFilterBO(Session session) + { + return new FilterBO(getDaoFactory(), session); + } } 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 dae7024c716daad3d837d612553dab290dd65313..b800c47c5e12413a1ab4a5d379ed0349e2fd71d2 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 @@ -48,6 +48,7 @@ import ch.systemsx.cisd.openbis.generic.server.business.bo.IEntityTypePropertyTy import ch.systemsx.cisd.openbis.generic.server.business.bo.IExperimentBO; import ch.systemsx.cisd.openbis.generic.server.business.bo.IExperimentTable; import ch.systemsx.cisd.openbis.generic.server.business.bo.IExternalDataTable; +import ch.systemsx.cisd.openbis.generic.server.business.bo.IFilterBO; import ch.systemsx.cisd.openbis.generic.server.business.bo.IGroupBO; import ch.systemsx.cisd.openbis.generic.server.business.bo.IMaterialTable; import ch.systemsx.cisd.openbis.generic.server.business.bo.IProjectBO; @@ -105,6 +106,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAttachment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAuthorizationGroup; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewFilter; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewMaterial; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewVocabulary; @@ -1765,4 +1767,18 @@ public final class CommonServer extends AbstractServer<ICommonServer> implements } } + public void registerFilter(String sessionToken, NewFilter filter) + { + final Session session = getSessionManager().getSession(sessionToken); + try + { + IFilterBO bo = businessObjectFactory.createFilterBO(session); + bo.define(filter); + bo.save(); + } catch (final DataAccessException ex) + { + throw createUserFailureException(ex); + } + } + } 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 b2477835b878a1d049af9ea6bddc50f69e574f3b..6975ac2964aa2bd8bcb67eb726e5fc8753772ad7 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 @@ -59,6 +59,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAttachment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAuthorizationGroup; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewFilter; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewVocabulary; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; @@ -753,4 +754,10 @@ final class CommonServerLogger extends AbstractServerLogger implements ICommonSe return null; } + public void registerFilter(String sessionToken, NewFilter filter) + { + logTracking(sessionToken, "registerFilter", "FILTER(%s)", filter); + + } + } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/FilterBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/FilterBO.java new file mode 100644 index 0000000000000000000000000000000000000000..3e4ad83eae24bb52024c406af7151550dc9a4658 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/FilterBO.java @@ -0,0 +1,79 @@ +/* + * 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.generic.server.business.bo; + +import org.springframework.dao.DataAccessException; +import org.springframework.dao.DataRetrievalFailureException; + +import ch.systemsx.cisd.common.exceptions.UserFailureException; +import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory; +import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewFilter; +import ch.systemsx.cisd.openbis.generic.shared.dto.FilterPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.Session; + +/** + * {@link IFilterBO} implementation. + * + * @author Izabela Adamczyk + */ +public class FilterBO extends AbstractBusinessObject implements IFilterBO +{ + private FilterPE filter; + + public FilterBO(IDAOFactory daoFactory, Session session) + { + super(daoFactory, session); + } + + public void define(NewFilter newFilter) throws UserFailureException + { + filter = new FilterPE(); + filter.setDescription(newFilter.getDescription()); + filter.setExpression(newFilter.getExpression()); + filter.setGridId(newFilter.getGridId()); + filter.setName(newFilter.getName()); + filter.setPublic(newFilter.isPublic()); + filter.setRegistrator(findRegistrator()); + } + + public void loadDataByTechId(TechId id) + { + try + { + filter = getFilterDAO().getByTechId(id); + } catch (DataRetrievalFailureException exception) + { + throw new UserFailureException(exception.getMessage()); + } + + } + + // AI add tests: define, save + public void save() throws UserFailureException + { + assert filter != null : "Filter not defined"; + try + { + getFilterDAO().createFilter(filter); + } catch (final DataAccessException e) + { + throwException(e, "Filter '" + filter + "'"); + } + } + +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ICommonBusinessObjectFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ICommonBusinessObjectFactory.java index 460453b9562bf5cf326826a0d1c43e47699676b1..1155cdb3bce19ae1c0c374e5033c7eb77ac789ed 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ICommonBusinessObjectFactory.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ICommonBusinessObjectFactory.java @@ -68,6 +68,8 @@ public interface ICommonBusinessObjectFactory public IAuthorizationGroupBO createAuthorizationGroupBO(Session session); + public IFilterBO createFilterBO(final Session session); + // Fast listing operations public ISampleLister createSampleLister(Session session); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IFilterBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IFilterBO.java new file mode 100644 index 0000000000000000000000000000000000000000..a4ab8030877bc496b04b28317102dff7b2523357 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IFilterBO.java @@ -0,0 +1,37 @@ +/* + * 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.server.business.bo; + +import ch.systemsx.cisd.common.exceptions.UserFailureException; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewFilter; +import ch.systemsx.cisd.openbis.generic.shared.dto.FilterPE; + +/** + * Business object of a filter. Holds an instance of {@link FilterPE}. + * + * @author Izabela Adamczyk + */ +public interface IFilterBO extends IEntityBusinessObject +{ + + /** + * Defines a new filter. After invocation of this method {@link IBusinessObject#save()} should + * be invoked to store the new group in the <i>Data Access Layer</i>. + */ + public void define(NewFilter filter) throws UserFailureException; + +} 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 7b09291e55fd341b5646ea931a0b096de14e68fa..a422d28fb71623391acaa563bf6d758bd96924b3 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 @@ -75,6 +75,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAttachment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAuthorizationGroup; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewFilter; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewVocabulary; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Project; @@ -911,4 +912,12 @@ public interface ICommonServer extends IServer @ReturnValueFilter(validatorClass = FilterValidator.class) public List<Filter> listFilters(String sessionToken, String gridId); + /** + * Creates a new filter. + */ + @Transactional + @RolesAllowed(RoleSet.POWER_USER) + @DatabaseCreateOrDeleteModification(value = ObjectKind.FILTER) + public void registerFilter(String sessionToken, NewFilter filter); + } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DatabaseModificationKind.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DatabaseModificationKind.java index cac3d5b30fb3a9896bc2bd1a45f7ea8a4f82a3ea..d952f91845134d29ac9bc906bd321399777bb6a4 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DatabaseModificationKind.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DatabaseModificationKind.java @@ -32,24 +32,9 @@ public class DatabaseModificationKind implements IsSerializable public enum ObjectKind implements IsSerializable { - AUTHORIZATION_GROUP, - SAMPLE, - EXPERIMENT, - MATERIAL, - DATA_SET, - SAMPLE_TYPE, - EXPERIMENT_TYPE, - MATERIAL_TYPE, - DATASET_TYPE, - FILE_FORMAT_TYPE, - PROJECT, - GROUP, - PROPERTY_TYPE, - PROPERTY_TYPE_ASSIGNMENT, - VOCABULARY, - VOCABULARY_TERM, - ROLE_ASSIGNMENT, - PERSON + AUTHORIZATION_GROUP, SAMPLE, EXPERIMENT, MATERIAL, DATA_SET, SAMPLE_TYPE, EXPERIMENT_TYPE, + MATERIAL_TYPE, DATASET_TYPE, FILE_FORMAT_TYPE, PROJECT, GROUP, PROPERTY_TYPE, + PROPERTY_TYPE_ASSIGNMENT, VOCABULARY, VOCABULARY_TERM, ROLE_ASSIGNMENT, PERSON, FILTER } public enum OperationKind implements IsSerializable diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Filter.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Filter.java index 08e53b668ef5416b84f56cd4b41f167f2552e16a..e017c36f9f6461a8fed148c7b07720d4250bea2a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Filter.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Filter.java @@ -26,20 +26,18 @@ import com.google.gwt.user.client.rpc.IsSerializable; * * @author Izabela Adamczyk */ -public class Filter implements IsSerializable, Serializable +public class Filter extends AbstractRegistrationHolder implements IsSerializable, Serializable { private static final long serialVersionUID = ServiceVersionHolder.VERSION; + public static final String COLUMN_FILTER = "Column Filter"; + private String name; private String expression; private boolean isPublic; - private Person registrator; - - private Date registrationDate; - private Date modificationDate; private String description; @@ -82,26 +80,6 @@ public class Filter implements IsSerializable, Serializable this.isPublic = isPublic; } - public Person getRegistrator() - { - return registrator; - } - - public void setRegistrator(Person registrator) - { - this.registrator = registrator; - } - - public Date getRegistrationDate() - { - return registrationDate; - } - - public void setRegistrationDate(Date registrationDate) - { - this.registrationDate = registrationDate; - } - public Date getModificationDate() { return modificationDate; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewFilter.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..04007e658dfee79882b1b05d88bc1b3025360278 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewFilter.java @@ -0,0 +1,102 @@ +/* + * 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.generic.shared.basic.dto; + +import java.io.Serializable; + +import com.google.gwt.user.client.rpc.IsSerializable; + +/** + * A filter to register. + * + * @author Izabela Adamczyk + */ +public class NewFilter implements IsSerializable, Serializable +{ + private static final long serialVersionUID = ServiceVersionHolder.VERSION; + + private String name; + + private String expression; + + private boolean isPublic; + + private String description; + + private String gridId; + + public NewFilter() + { + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getExpression() + { + return expression; + } + + public void setExpression(String expression) + { + this.expression = expression; + } + + public boolean isPublic() + { + return isPublic; + } + + public void setPublic(boolean isPublic) + { + this.isPublic = isPublic; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public String getGridId() + { + return gridId; + } + + public void setGridId(String gridId) + { + this.gridId = gridId; + } + + @Override + public final String toString() + { + return "[" + getName() + "," + getGridId() + "]"; + } + +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/FilterTranslator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/FilterTranslator.java index ab21d46db68cc086072d2ce8b0cf0dd49418ce4d..f46ea8d40793c271ce8ab3eebcf9ee1da0afd3e2 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/FilterTranslator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/FilterTranslator.java @@ -63,6 +63,7 @@ public final class FilterTranslator result.setRegistrationDate(filter.getRegistrationDate()); result.setDatabaseInstance(DatabaseInstanceTranslator.translate(filter .getDatabaseInstance())); + result.setPublic(filter.isPublic()); return result; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetRelationshipBrowser.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetRelationshipBrowser.java index 0f2c4effff63bc6b1e6166d4be88517110bf024a..3b773e32297f7b1618e3cd3272d6b337438927a3 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetRelationshipBrowser.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetRelationshipBrowser.java @@ -50,7 +50,7 @@ class DataSetRelationshipBrowser extends AbstractExternalDataGrid return new DataSetRelationshipBrowser(commonViewContext, datasetId, role) { @Override - protected String getGridDisplayTypeID() + public String getGridDisplayTypeID() { return super.getGridDisplayTypeID() + "-" + datasetType.getCode() + "-" + role; } @@ -65,10 +65,10 @@ class DataSetRelationshipBrowser extends AbstractExternalDataGrid private DataSetRelationshipBrowser(IViewContext<ICommonClientServiceAsync> viewContext, TechId datasetId, DataSetRelationshipRole role) { - super(viewContext, createBrowserId(datasetId, role), createGridId(datasetId, role)); + super(viewContext, createBrowserId(datasetId, role), createGridId(datasetId, role), + DisplayTypeIDGenerator.DATA_SET_DETAILS_GRID); this.datasetId = datasetId; this.role = role; - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.DATA_SET_DETAILS_GRID); } public static final String createGridId(TechId datasetId, DataSetRelationshipRole role) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentDataSetBrowser.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentDataSetBrowser.java index 19db2680d8c137505ebc701514f0c061ade73e3f..3e3c5e66dc42fbd1776c10706494c2a5d0410eae 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentDataSetBrowser.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentDataSetBrowser.java @@ -46,7 +46,7 @@ public class ExperimentDataSetBrowser extends AbstractExternalDataGrid return new ExperimentDataSetBrowser(commonViewContext, experimentId) { @Override - protected String getGridDisplayTypeID() + public String getGridDisplayTypeID() { return super.getGridDisplayTypeID() + "-" + experimentType.getCode(); } @@ -58,9 +58,9 @@ public class ExperimentDataSetBrowser extends AbstractExternalDataGrid private ExperimentDataSetBrowser(IViewContext<ICommonClientServiceAsync> viewContext, TechId experimentId) { - super(viewContext, createBrowserId(experimentId), createGridId(experimentId)); + super(viewContext, createBrowserId(experimentId), createGridId(experimentId), + DisplayTypeIDGenerator.EXPERIMENT_DETAILS_GRID); this.experimentId = experimentId; - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.EXPERIMENT_DETAILS_GRID); } public static String createGridId(TechId experimentId) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/SampleDataSetBrowser.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/SampleDataSetBrowser.java index 026ef059409f420898f3ecc29f94231d4a6a3113..fa033ae3c596a5c5b23c7cb738a5053c7f5eaf01 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/SampleDataSetBrowser.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/SampleDataSetBrowser.java @@ -46,7 +46,7 @@ class SampleDataSetBrowser extends AbstractExternalDataGrid return new SampleDataSetBrowser(commonViewContext, sampleId) { @Override - protected String getGridDisplayTypeID() + public String getGridDisplayTypeID() { return super.getGridDisplayTypeID() + "-" + sampleType.getCode(); } @@ -56,12 +56,11 @@ class SampleDataSetBrowser extends AbstractExternalDataGrid private final TechId sampleId; - private SampleDataSetBrowser(IViewContext<ICommonClientServiceAsync> viewContext, + private SampleDataSetBrowser(IViewContext<ICommonClientServiceAsync> viewContext, TechId sampleId) { - super(viewContext, createBrowserId(sampleId), createGridId(sampleId)); + super(viewContext, createBrowserId(sampleId), createGridId(sampleId),DisplayTypeIDGenerator.SAMPLE_DETAILS_GRID); this.sampleId = sampleId; - setDisplayTypeIDGenerator(DisplayTypeIDGenerator.SAMPLE_DETAILS_GRID); } public static final String createGridId(TechId sampleId) 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 0472465dec0a355b48054dceaee5742fce3cdb96..82a89bef1e5a199295476439ed08b8c5ff7b08d8 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 @@ -70,7 +70,7 @@ var common = { button_browse: "Browse", button_view: "View", button_delete: "Delete", - button_configure: "Columns", + button_configure: "Settings", button_upload_data_via_cifex: "Upload Data", tooltip_refresh_disabled: "To activate select appropriate criteria first.", @@ -458,7 +458,7 @@ incorrect_experiment_syntax: "Incorrect experiment specification. Please provide // Grid Column Chooser // - GRID_COLUMN_CHOOSER_TITLE: "Configure grid columns", + grid_settings_title: "Table settings", GRID_COLUMN_NAME_HEADER: "Column", GRID_IS_COLUMN_VISIBLE_HEADER: "Visible?", GRID_COLUMN_HAS_FILTER_HEADER: "Has Filter?", @@ -486,7 +486,16 @@ all_radio: "all", data_sets_radio_group_label: "Data Sets", only_selected_radio: "selected ({0})", experiments_radio_group_label: "Experiments", - + +// +// Filters +// + name: "Name", + is_public: "Is Public?", + expression: "Expression", + columns: "Columns", + custom_filters: "Custom Filters", + // LAST LINE: KEEP IT AT THE END lastline: "" // we need a line without a comma }; diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java.expected b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java.expected index 7b09291e55fd341b5646ea931a0b096de14e68fa..a422d28fb71623391acaa563bf6d758bd96924b3 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java.expected +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java.expected @@ -75,6 +75,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAttachment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAuthorizationGroup; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewFilter; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewVocabulary; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Project; @@ -911,4 +912,12 @@ public interface ICommonServer extends IServer @ReturnValueFilter(validatorClass = FilterValidator.class) public List<Filter> listFilters(String sessionToken, String gridId); + /** + * Creates a new filter. + */ + @Transactional + @RolesAllowed(RoleSet.POWER_USER) + @DatabaseCreateOrDeleteModification(value = ObjectKind.FILTER) + public void registerFilter(String sessionToken, NewFilter filter); + }