From ee23f4e14884000fa40b73d0565cd0fa06b766ca Mon Sep 17 00:00:00 2001 From: buczekp <buczekp> Date: Fri, 1 Apr 2011 12:00:42 +0000 Subject: [PATCH] [LMS-2096] added plugin widgets to data set search grid (reports are not yet invoking any action) SVN: 20622 --- .../ui/data/DataSetSearchHitGrid.java | 9 +- .../ui/sample/SampleSearchHitGrid.java | 15 +++- .../search/DetailedDataSetSearchToolbar.java | 86 +++++++++++++++++++ .../ui/search/DetailedSearchToolbar.java | 6 +- .../ui/search/IDetailedSearchHitGrid.java | 4 + 5 files changed, 111 insertions(+), 9 deletions(-) create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/search/DetailedDataSetSearchToolbar.java 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 c53c020dc78..c3358afbfab 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 @@ -29,6 +29,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework. 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.DisposableEntityChooser; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.search.DetailedDataSetSearchToolbar; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.search.DetailedSearchToolbar; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.search.DetailedSearchWindow; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.search.IDetailedSearchHitGrid; @@ -61,8 +62,8 @@ public class DataSetSearchHitGrid extends AbstractExternalDataGrid implements final DetailedSearchWindow searchWindow = new DetailedSearchWindow(viewContext, EntityKind.DATA_SET); final DetailedSearchToolbar toolbar = - new DetailedSearchToolbar(grid, viewContext.getMessage(Dict.BUTTON_CHANGE_QUERY), - searchWindow); + new DetailedDataSetSearchToolbar(viewContext, grid, + viewContext.getMessage(Dict.BUTTON_CHANGE_QUERY), searchWindow); searchWindow.setUpdateListener(toolbar); return grid.asDisposableWithToolbar(toolbar); } @@ -83,8 +84,8 @@ public class DataSetSearchHitGrid extends AbstractExternalDataGrid implements searchWindow.setInitialSearchCriteria(searchCriteria); final DetailedSearchToolbar toolbar = - new DetailedSearchToolbar(grid, viewContext.getMessage(Dict.BUTTON_CHANGE_QUERY), - searchWindow, true); + new DetailedDataSetSearchToolbar(viewContext, grid, + viewContext.getMessage(Dict.BUTTON_CHANGE_QUERY), searchWindow, true); searchWindow.setUpdateListener(toolbar); return grid.asDisposableWithToolbar(toolbar); } 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 c27ce2994f2..993298ea6f0 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 @@ -31,10 +31,12 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericCon import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ShowResultSetCutInfo; import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.DisplayTypeIDGenerator; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.data.AbstractExternalDataGrid.SelectedAndDisplayedItems; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.search.DetailedSearchToolbar; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.search.DetailedSearchWindow; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.search.IDetailedSearchHitGrid; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedActionWithResult; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DefaultResultSetConfig; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ListSampleDisplayCriteria; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TypedTableResultSet; @@ -117,7 +119,8 @@ public class SampleSearchHitGrid extends SampleBrowserGrid implements IDetailedS { // TODO, 2010-12-13, FJE, show related data sets isn't easy because // TableModelRowWithObject doesn't implement IEntityInformationHolder. - // Changing the code is relatively easy but the method showRelatedDataSets() + // Changing the code is relatively easy but the method + // showRelatedDataSets() // is also used by MatchingEntitiesPanel. showRelatedDataSets(viewContext, SampleSearchHitGrid.this); } @@ -162,10 +165,16 @@ public class SampleSearchHitGrid extends SampleBrowserGrid implements IDetailedS { if (callback instanceof AbstractAsyncCallback) { - AbstractAsyncCallback<TypedTableResultSet<Sample>> asc = (AbstractAsyncCallback<TypedTableResultSet<Sample>>) callback; - asc.addOnSuccessAction(new ShowResultSetCutInfo<TypedTableResultSet<Sample>>(viewContext)); + AbstractAsyncCallback<TypedTableResultSet<Sample>> asc = + (AbstractAsyncCallback<TypedTableResultSet<Sample>>) callback; + asc.addOnSuccessAction(new ShowResultSetCutInfo<TypedTableResultSet<Sample>>( + viewContext)); } super.listTableRows(resultSetConfig, callback); } + public IDelegatedActionWithResult<SelectedAndDisplayedItems> getSelectedAndDisplayedItemsAction() + { + throw new UnsupportedOperationException(); + } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/search/DetailedDataSetSearchToolbar.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/search/DetailedDataSetSearchToolbar.java new file mode 100644 index 00000000000..7e718a50698 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/search/DetailedDataSetSearchToolbar.java @@ -0,0 +1,86 @@ +package ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.search; + +import java.util.List; + +import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem; + +import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.data.AbstractExternalDataGrid; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.data.DataSetProcessingMenu; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.data.DataSetSearchHitGrid; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.data.ReportingPluginSelectionWidget; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.report.ReportGeneratedCallback.IOnReportComponentGeneratedAction; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataStoreServiceKind; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatastoreServiceDescription; + +/** + * Extension of {@link DetailedSearchWindow} adding widgets for reporting and processing plugins. + * + * @author Piotr Buczek + */ +public class DetailedDataSetSearchToolbar extends DetailedSearchToolbar +{ + private final ReportingPluginSelectionWidget reportSelectionWidget; + + private final IOnReportComponentGeneratedAction reportGeneratedAction; + + public DetailedDataSetSearchToolbar(final IViewContext<?> viewContext, + final DataSetSearchHitGrid grid, String buttonName, + final DetailedSearchWindow searchWindow) + { + this(viewContext, grid, buttonName, searchWindow, false); + } + + public DetailedDataSetSearchToolbar(final IViewContext<?> viewContext, + final DataSetSearchHitGrid grid, String buttonName, + final DetailedSearchWindow searchWindow, boolean initializeDescriptionFromSearchWindow) + { + super(grid, buttonName, searchWindow, initializeDescriptionFromSearchWindow); + this.reportSelectionWidget = new ReportingPluginSelectionWidget(viewContext, null); + this.reportGeneratedAction = new IOnReportComponentGeneratedAction() + { + public void execute(IDisposableComponent gridComponent) + { + // TODO + // replaceContent(gridComponent); + } + }; + add(reportSelectionWidget); + if (viewContext.isSimpleOrEmbeddedMode() == false) + { + // processing plugins should be hidden in simple view mode + viewContext.getCommonService().listDataStoreServices(DataStoreServiceKind.PROCESSING, + new LoadProcessingPluginsCallback(viewContext, grid)); + } + } + + public final class LoadProcessingPluginsCallback extends + AbstractAsyncCallback<List<DatastoreServiceDescription>> + { + private final AbstractExternalDataGrid browser; + + public LoadProcessingPluginsCallback(final IViewContext<?> viewContext, + AbstractExternalDataGrid browser) + { + super(viewContext); + this.browser = browser; + } + + @Override + protected void process(List<DatastoreServiceDescription> result) + { + if (result.isEmpty() == false) + { + + DataSetProcessingMenu menu = + new DataSetProcessingMenu(viewContext.getCommonViewContext(), + browser.getSelectedAndDisplayedItemsAction(), result); + add(new SeparatorToolItem()); + add(menu); + } + } + } + +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/search/DetailedSearchToolbar.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/search/DetailedSearchToolbar.java index 1b5edc76e40..a6c8c3e0ba8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/search/DetailedSearchToolbar.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/search/DetailedSearchToolbar.java @@ -8,6 +8,7 @@ import com.extjs.gxt.ui.client.event.SelectionListener; import com.extjs.gxt.ui.client.widget.Component; import com.extjs.gxt.ui.client.widget.toolbar.FillToolItem; 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.ToolBar; import com.google.gwt.user.client.Element; @@ -47,8 +48,6 @@ public class DetailedSearchToolbar extends ToolBar implements IDisposableCompone this.shouldShowSearchWindowOnRender = !initializeDescriptionFromSearchWindow; this.grid = grid; this.searchWindow = searchWindow; - add(description = new LabelToolItem()); - add(new FillToolItem()); add(new TextToolItem(buttonName, new SelectionListener<ButtonEvent>() { @Override @@ -57,6 +56,9 @@ public class DetailedSearchToolbar extends ToolBar implements IDisposableCompone searchWindow.show(); } })); + add(new SeparatorToolItem()); + add(description = new LabelToolItem()); + add(new FillToolItem()); if (initializeDescriptionFromSearchWindow) { updateDescription(searchWindow.getCriteriaDescription()); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/search/IDetailedSearchHitGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/search/IDetailedSearchHitGrid.java index 2563ad5ea09..5f768e006e4 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/search/IDetailedSearchHitGrid.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/search/IDetailedSearchHitGrid.java @@ -18,6 +18,8 @@ package ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.search import java.util.List; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.data.AbstractExternalDataGrid.SelectedAndDisplayedItems; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedActionWithResult; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DetailedSearchCriteria; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; @@ -32,4 +34,6 @@ public interface IDetailedSearchHitGrid /** refreshes grid with new criteria and properties */ void refresh(DetailedSearchCriteria newCriteria, List<PropertyType> propertyTypes); + IDelegatedActionWithResult<SelectedAndDisplayedItems> getSelectedAndDisplayedItemsAction(); + } -- GitLab