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 938eff4fe1dfdd7c58628c57819e71a08240cc44..f65147e240bed69e9632aef7280da35b6e4b50b4 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 @@ -93,7 +93,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermWithStats * unexpected exception. * </p> * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public interface ICommonClientService extends IClientService { @@ -545,9 +545,16 @@ public interface ICommonClientService extends IClientService /** Deletes the specified data set. */ public void deleteDataSet(String singleData, String reason) throws UserFailureException; - /** Deletes the specified samples. */ + /** Deletes the specified samples. NOTE: this is a stale version used only for samples with abundance. */ public void deleteSamples(List<TechId> sampleIds, String reason) throws UserFailureException; + /** Deletes the specified samples. */ + public void deleteSamples(DisplayedOrSelectedIdHolderCriteria<Sample> criteria, String reason) + throws UserFailureException; + + /** Deletes the specified sample. */ + public void deleteSample(TechId sampleId, String reason) throws UserFailureException; + /** Deletes the specified experiments. */ public void deleteExperiments(DisplayedOrSelectedIdHolderCriteria<Experiment> criteria, String reason) 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 a734b5dab2eb915afd2a35da61926d9529f464a5..400d1b228508e6c5571643df4a73b192f1edc95f 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 @@ -90,7 +90,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermWithStats /** * Asynchronous version of {@link ICommonClientService}. * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public interface ICommonClientServiceAsync extends IClientServiceAsync { @@ -471,6 +471,13 @@ public interface ICommonClientServiceAsync extends IClientServiceAsync public void deleteSamples(List<TechId> sampleIds, String value, AsyncCallback<Void> asyncCallback); + /** @see ICommonClientService#deleteSamples(DisplayedOrSelectedIdHolderCriteria, String) */ + public void deleteSamples(DisplayedOrSelectedIdHolderCriteria<Sample> criteria, String value, + AsyncCallback<Void> asyncCallback); + + /** @see ICommonClientService#deleteSample(TechId, String) */ + public void deleteSample(TechId sampleIs, String value, AsyncCallback<Void> asyncCallback); + /** @see ICommonClientService#deleteExperiments(DisplayedOrSelectedIdHolderCriteria, String) */ public void deleteExperiments(DisplayedOrSelectedIdHolderCriteria<Experiment> criteria, String value, AsyncCallback<Void> asyncCallback); 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 816c3f65d3358b717d70a0f8510bfa7577d91180..43af6d2a1f9193a4f3006e35b4ebea6659eb2f97 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 @@ -225,6 +225,17 @@ public abstract class Dict public static final String CHILDREN_DATASETS = "children_datasets"; + public static final String NO_DATASETS_SELECTED = "no_datasets_selected"; + + public static final String DATASETS_FROM_DIFFERENT_STORES_SELECTED = + "datasets_from_different_stores_selected"; + + public static final String PERFORM_COMPUTATION_ON_ALL_DATASETS_MSG_TEMPLATE = + "perform_computation_on_all_datasets_msg_template"; + + public static final String PERFORM_COMPUTATION_ON_SELECTED_OR_ALL_DATASETS_MSG_TEMPLATE = + "perform_computation_on_selected_or_all_datasets_msg_template"; + // // Entity Type Browser // @@ -778,6 +789,8 @@ public abstract class Dict public static final String EXPERIMENTS_RADIO_GROUP_LABEL = "experiments_radio_group_label"; + public static final String SAMPLES_RADIO_GROUP_LABEL = "samples_radio_group_label"; + public static final String NAME = "name"; public static final String IS_PUBLIC = "is_public"; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ShowRelatedDatasetsDialog.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ShowRelatedDatasetsDialog.java index 4229113ab277bd330c269e5dd14b742ad2f005b9..4d6f1ef0888946ef52944443cde309e44ab66ab9 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ShowRelatedDatasetsDialog.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ShowRelatedDatasetsDialog.java @@ -77,16 +77,20 @@ public final class ShowRelatedDatasetsDialog extends private final TableExportCriteria<? extends IEntityInformationHolder> displayedEntities; + private final int displayedEntitiesCount; + private Radio allOrSelectedRadio; public ShowRelatedDatasetsDialog(IViewContext<ICommonClientServiceAsync> viewContext, List<? extends IEntityInformationHolder> selectedEntities, - TableExportCriteria<? extends IEntityInformationHolder> displayedEntities) + TableExportCriteria<? extends IEntityInformationHolder> displayedEntities, + int displayedEntitiesCount) { super(viewContext, selectedEntities, viewContext .getMessage(Dict.SHOW_RELATED_DATASETS_DIALOG_TITLE)); this.viewContext = viewContext; this.displayedEntities = displayedEntities; + this.displayedEntitiesCount = displayedEntitiesCount; setWidth(LABEL_WIDTH + FIELD_WIDTH + 50); } @@ -112,7 +116,7 @@ public final class ShowRelatedDatasetsDialog extends final String radioGroupLabel = viewContext.getMessage(Dict.SHOW_RELATED_DATASETS_DIALOG_RADIO_LABEL); final String selectedLabel = viewContext.getMessage(Dict.ONLY_SELECTED_RADIO, data.size()); - final String allLabel = viewContext.getMessage(Dict.ALL_RADIO, data.size()); + final String allLabel = viewContext.getMessage(Dict.ALL_RADIO, displayedEntitiesCount); return WidgetUtils.createAllOrSelectedRadioGroup(allOrSelectedRadio = WidgetUtils.createRadio(selectedLabel), WidgetUtils.createRadio(allLabel), 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 30420adaa9d8640edf924dd2fb4176132a2a8009..d22e413a93246daa57e7e1d920fa809573626fae 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 @@ -68,7 +68,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind.ObjectKind; /** - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public abstract class AbstractExternalDataGrid extends @@ -124,7 +124,8 @@ public abstract class AbstractExternalDataGrid IBrowserGridActionInvoker invoker) { return new DataSetUploadConfirmationDialog(dataSets, - getSelectedAndDisplayedItemsAction(), viewContext); + getSelectedAndDisplayedItemsAction(), getCount(), + viewContext); } }); addButton(uploadButton); @@ -229,11 +230,14 @@ public abstract class AbstractExternalDataGrid // currently selected items private final List<ExternalData> selectedItems; - public SelectedAndDisplayedItems(TableExportCriteria<ExternalData> displayedItemsConfig, - List<ExternalData> selectedItems) + private final int displayedItemsCount; + + public SelectedAndDisplayedItems(List<ExternalData> selectedItems, + TableExportCriteria<ExternalData> displayedItemsConfig, int displayedItemsCount) { this.displayedItemsConfig = displayedItemsConfig; this.selectedItems = selectedItems; + this.displayedItemsCount = displayedItemsCount; } public TableExportCriteria<ExternalData> getDisplayedItemsConfig() @@ -241,6 +245,11 @@ public abstract class AbstractExternalDataGrid return displayedItemsConfig; } + public int getDisplayedItemsCount() + { + return displayedItemsCount; + } + public List<ExternalData> getSelectedItems() { return selectedItems; @@ -265,8 +274,8 @@ public abstract class AbstractExternalDataGrid { public SelectedAndDisplayedItems execute() { - return new SelectedAndDisplayedItems(createTableExportCriteria(), - getSelectedBaseObjects()); + return new SelectedAndDisplayedItems(getSelectedBaseObjects(), + createTableExportCriteria(), getCount()); } }; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetComputeMenu.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetComputeMenu.java index cd3d60c98db78a0edececff6b3d24a04d5cb35c8..d0328a5d079f4de2f95cb52b71a0e2bdb1579183 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetComputeMenu.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetComputeMenu.java @@ -366,30 +366,26 @@ public class DataSetComputeMenu extends TextToolItem { int size = data.getSelectedDataSets().size(); String computationName = data.getPluginTaskKind().getDescription(); - // TODO 2009-07-03, Piotr Buczek: externalize to dictionary with parameters if (size == 0) { - return "No Data Sets were selected. " - + "Select a data store service to perform " - + computationName - + " computation on all Data Sets from the grid that have type and data store " - + "appropriate to the selected service and click on a Run button."; + final String msgIntroduction = viewContext.getMessage(Dict.NO_DATASETS_SELECTED); + return viewContext.getMessage( + Dict.PERFORM_COMPUTATION_ON_ALL_DATASETS_MSG_TEMPLATE, msgIntroduction, + computationName); } else { if (isSingleDatastore()) { - return "Select between performing " + computationName + " computation only on " - + "selected Data Sets (" + size - + ") or on all Data Sets of appropriate types from the grid, " - + "then select a data store service and click on a Run button."; + return viewContext.getMessage( + Dict.PERFORM_COMPUTATION_ON_SELECTED_OR_ALL_DATASETS_MSG_TEMPLATE, + computationName, size); } else { - return "Datasets from different Data Stores have been selected, " - + "so no operation can be performed on all of them. " - + "Select a data store service to perform " - + computationName - + " computation on all Data Sets from the grid that have type " - + "and data store appropriate to the selected service and click on a Run button."; + final String msgIntroduction = + viewContext.getMessage(Dict.DATASETS_FROM_DIFFERENT_STORES_SELECTED); + return viewContext.getMessage( + Dict.PERFORM_COMPUTATION_ON_ALL_DATASETS_MSG_TEMPLATE, msgIntroduction, + computationName); } } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetListDeletionConfirmationDialog.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetListDeletionConfirmationDialog.java index 693a3804f0778b55a192849889313a3b61f35765..741dbccd0ba0050bc21098848c61f1910664a6d0 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetListDeletionConfirmationDialog.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetListDeletionConfirmationDialog.java @@ -104,7 +104,8 @@ public final class DataSetListDeletionConfirmationDialog extends { return WidgetUtils.createAllOrSelectedRadioGroup(onlySelectedRadio = WidgetUtils.createRadio(viewContext.getMessage(Dict.ONLY_SELECTED_RADIO, data - .size())), WidgetUtils.createRadio(viewContext.getMessage(Dict.ALL_RADIO)), - viewContext.getMessage(Dict.DATA_SETS_RADIO_GROUP_LABEL), data.size()); + .size())), WidgetUtils.createRadio(viewContext.getMessage(Dict.ALL_RADIO, + selectedAndDisplayedItemsOrNull.getDisplayedItemsCount())), viewContext + .getMessage(Dict.DATA_SETS_RADIO_GROUP_LABEL), data.size()); } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetUploadConfirmationDialog.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetUploadConfirmationDialog.java index 6554a06ccd94ec87a5412b9331b686b116f38d32..577b411f6533268d2a4a9487358d4078223cd92b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetUploadConfirmationDialog.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetUploadConfirmationDialog.java @@ -38,9 +38,10 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.BasicConstant; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData; /** - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ -final class DataSetUploadConfirmationDialog extends AbstractDataConfirmationDialog<List<ExternalData>> +final class DataSetUploadConfirmationDialog extends + AbstractDataConfirmationDialog<List<ExternalData>> { private static final int FIELD_WIDTH_IN_UPLOAD_DIALOG = 200; @@ -48,6 +49,8 @@ final class DataSetUploadConfirmationDialog extends AbstractDataConfirmationDial private final IViewContext<?> viewContext; + private final int displayedItemsCount; + private final IDelegatedActionWithResult<SelectedAndDisplayedItems> selectedAndDisplayedItemsAction; private String cifexURL; @@ -64,10 +67,11 @@ final class DataSetUploadConfirmationDialog extends AbstractDataConfirmationDial public DataSetUploadConfirmationDialog(List<ExternalData> dataSets, IDelegatedActionWithResult<SelectedAndDisplayedItems> selectedAndDisplayedItemsAction, - IViewContext<?> viewContext) + int displayedItemsCount, IViewContext<?> viewContext) { super(viewContext, dataSets, viewContext.getMessage(Dict.CONFIRM_DATASET_UPLOAD_TITLE)); this.viewContext = viewContext; + this.displayedItemsCount = displayedItemsCount; this.selectedAndDisplayedItemsAction = selectedAndDisplayedItemsAction; cifexURL = viewContext.getModel().getApplicationInfo().getCIFEXURL(); addText(viewContext.getMessage(Dict.CONFIRM_DATASET_UPLOAD_MSG, dataSets.size(), cifexURL)); @@ -129,8 +133,9 @@ final class DataSetUploadConfirmationDialog extends AbstractDataConfirmationDial { return WidgetUtils.createAllOrSelectedRadioGroup(uploadSelectedRadio = WidgetUtils.createRadio(viewContext.getMessage(Dict.ONLY_SELECTED_RADIO, data - .size())), WidgetUtils.createRadio(viewContext.getMessage(Dict.ALL_RADIO)), - viewContext.getMessage(Dict.DATA_SETS_RADIO_GROUP_LABEL), data.size()); + .size())), WidgetUtils.createRadio(viewContext.getMessage(Dict.ALL_RADIO, + displayedItemsCount)), viewContext.getMessage(Dict.DATA_SETS_RADIO_GROUP_LABEL), + data.size()); } private boolean getUploadSelected() 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 7b36485349a3fb6bef0f2f5bd5c98612ce1a80b4..f6c317067c79cea0b2ec3b8d90625c780f09bbfc 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 @@ -301,11 +301,14 @@ public class ExperimentBrowserGrid extends private List<Experiment> selectedItems; - public DisplayedAndSelectedExperiments( - TableExportCriteria<Experiment> displayedItemsConfig, List<Experiment> selectedItems) + private final int displayedItemsCount; + + public DisplayedAndSelectedExperiments(List<Experiment> selectedItems, + TableExportCriteria<Experiment> displayedItemsConfig, int displayedItemsCount) { - this.displayedItemsConfig = displayedItemsConfig; this.selectedItems = selectedItems; + this.displayedItemsConfig = displayedItemsConfig; + this.displayedItemsCount = displayedItemsCount; } public List<Experiment> getSelectedItems() @@ -313,6 +316,11 @@ public class ExperimentBrowserGrid extends return selectedItems; } + public int getDisplayedItemsCount() + { + return displayedItemsCount; + } + public TableExportCriteria<Experiment> getDisplayedItemsConfig() { return displayedItemsConfig; @@ -338,8 +346,8 @@ public class ExperimentBrowserGrid extends { public DisplayedAndSelectedExperiments execute() { - return new DisplayedAndSelectedExperiments(createTableExportCriteria(), - getSelectedBaseObjects()); + return new DisplayedAndSelectedExperiments(getSelectedBaseObjects(), + createTableExportCriteria(), getCount()); } }; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ExperimentListDeletionConfirmationDialog.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ExperimentListDeletionConfirmationDialog.java index b7edb6c50124e5a97aaa89539ef0241f57cdd5b9..428be9131040bbd99616feea2904bd786a59dfa2 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ExperimentListDeletionConfirmationDialog.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ExperimentListDeletionConfirmationDialog.java @@ -41,11 +41,11 @@ public final class ExperimentListDeletionConfirmationDialog extends private final AbstractAsyncCallback<Void> callback; - private Radio onlySelectedRadio; + private final DisplayedAndSelectedExperiments selectedAndDisplayedItemsOrNull; - private DisplayedAndSelectedExperiments selectedAndDisplayedItemsOrNull; + private final Experiment singleDataOrNull; - private Experiment singleDataOrNull; + private Radio onlySelectedRadio; public ExperimentListDeletionConfirmationDialog( IViewContext<ICommonClientServiceAsync> viewContext, @@ -55,7 +55,7 @@ public final class ExperimentListDeletionConfirmationDialog extends super(viewContext, selectedAndDisplayedItems.getSelectedItems()); this.viewContext = viewContext; this.callback = callback; - singleDataOrNull = null; + this.singleDataOrNull = null; this.selectedAndDisplayedItemsOrNull = selectedAndDisplayedItems; } @@ -66,7 +66,7 @@ public final class ExperimentListDeletionConfirmationDialog extends super(viewContext, Collections.singletonList(experiment)); this.viewContext = viewContext; this.callback = callback; - singleDataOrNull = experiment; + this.singleDataOrNull = experiment; this.selectedAndDisplayedItemsOrNull = null; } @@ -105,8 +105,9 @@ public final class ExperimentListDeletionConfirmationDialog extends { return WidgetUtils.createAllOrSelectedRadioGroup(onlySelectedRadio = WidgetUtils.createRadio(viewContext.getMessage(Dict.ONLY_SELECTED_RADIO, data - .size())), WidgetUtils.createRadio(viewContext.getMessage(Dict.ALL_RADIO)), - viewContext.getMessage(Dict.EXPERIMENTS_RADIO_GROUP_LABEL), data.size()); + .size())), WidgetUtils.createRadio(viewContext.getMessage(Dict.ALL_RADIO, + selectedAndDisplayedItemsOrNull.getDisplayedItemsCount())), viewContext + .getMessage(Dict.EXPERIMENTS_RADIO_GROUP_LABEL), data.size()); } } 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 09fd49efc023231a32ff51b14ac4a08c8b245721..e86c6af5959b2b56e537ec9fddda5f6c35f35804 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 @@ -1219,6 +1219,12 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod return translateSortInfo(store.getSortField(), store.getSortDir(), columnDefinitions); } + /** @return the number of all objects cached in the browser */ + public int getCount() + { + return grid.getStore().getCount(); + } + private void refreshColumnsSettings() { grid.setLoadMask(false); @@ -1534,8 +1540,8 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod } else { // > 0 entity selected - show dialog with all/selected radio - new ShowRelatedDatasetsDialog(viewContext, selectedEntities, displayedEntities).show(); + new ShowRelatedDatasetsDialog(viewContext, selectedEntities, displayedEntities, browser + .getCount()).show(); } } - } 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 100b262723265a28b5dcc464a0105a73a129b853..44409ded58ea4a82ef4c4512f17fd59efdbd542a 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 @@ -28,6 +28,7 @@ import com.extjs.gxt.ui.client.widget.Dialog; import com.extjs.gxt.ui.client.widget.LayoutContainer; import com.extjs.gxt.ui.client.widget.button.Button; import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; +import com.google.gwt.user.client.rpc.IsSerializable; import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientServiceAsync; import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback; @@ -56,7 +57,9 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.en import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.entity.PropertyTypesFilterUtil; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.listener.OpenEntityDetailsTabAction; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.IDataRefreshCallback; +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.DisplayedOrSelectedIdHolderCriteria; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ListEntityDisplayCriteriaKind; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ListSampleDisplayCriteria; import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ResultSet; @@ -367,7 +370,8 @@ public class SampleBrowserGrid extends IBrowserGridActionInvoker invoker) { return new SampleListDeletionConfirmationDialog(viewContext, samples, - createDeletionCallback(invoker)); + createDeletionCallback(invoker), + getDisplayedAndSelectedItemsAction().execute()); } })); allowMultipleSelection(); // we allow deletion of multiple samples @@ -587,4 +591,63 @@ public class SampleBrowserGrid extends return EntityKind.SAMPLE; } + // NOTE: this is quite generic code compared with DisplayedAndSelectedExperiments - refactor? + public final class DisplayedAndSelectedSamples implements IsSerializable + { + + private TableExportCriteria<Sample> displayedItemsConfig; + + private List<Sample> selectedItems; + + private final int displayedItemsCount; + + public DisplayedAndSelectedSamples(List<Sample> selectedItems, + TableExportCriteria<Sample> displayedItemsConfig, int displayedItemsCount) + { + this.selectedItems = selectedItems; + this.displayedItemsConfig = displayedItemsConfig; + this.displayedItemsCount = displayedItemsCount; + } + + public List<Sample> getSelectedItems() + { + return selectedItems; + } + + public int getDisplayedItemsCount() + { + return displayedItemsCount; + } + + public TableExportCriteria<Sample> getDisplayedItemsConfig() + { + return displayedItemsConfig; + } + + public DisplayedOrSelectedIdHolderCriteria<Sample> createCriteria(boolean selected) + { + if (selected) + { + return DisplayedOrSelectedIdHolderCriteria.createSelectedItems(getSelectedItems()); + } else + { + return DisplayedOrSelectedIdHolderCriteria + .createDisplayedItems(getDisplayedItemsConfig()); + } + } + + } + + protected final IDelegatedActionWithResult<DisplayedAndSelectedSamples> getDisplayedAndSelectedItemsAction() + { + return new IDelegatedActionWithResult<DisplayedAndSelectedSamples>() + { + public DisplayedAndSelectedSamples execute() + { + return new DisplayedAndSelectedSamples(getSelectedBaseObjects(), + createTableExportCriteria(), getCount()); + } + }; + } + } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/SampleListDeletionConfirmationDialog.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/SampleListDeletionConfirmationDialog.java index 886c7a4b451e4fa168b82bacb81e61f87a2a0ae8..35c0d7314cebdcb683f731b91e6d2624e7c518b1 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/SampleListDeletionConfirmationDialog.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/SampleListDeletionConfirmationDialog.java @@ -18,10 +18,17 @@ package ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.sample import java.util.List; +import com.extjs.gxt.ui.client.widget.form.Radio; +import com.extjs.gxt.ui.client.widget.form.RadioGroup; + 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.IViewContext; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.sample.SampleBrowserGrid.DisplayedAndSelectedSamples; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.AbstractDataListDeletionConfirmationDialog; +import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.WidgetUtils; +import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DisplayedOrSelectedIdHolderCriteria; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample; @@ -34,20 +41,50 @@ public final class SampleListDeletionConfirmationDialog extends private final AbstractAsyncCallback<Void> callback; + private final DisplayedAndSelectedSamples selectedAndDisplayedItemsOrNull; + + private final Sample singleDataOrNull; + + private Radio onlySelectedRadio; + public SampleListDeletionConfirmationDialog( IViewContext<ICommonClientServiceAsync> viewContext, List<Sample> data, - AbstractAsyncCallback<Void> callback) + AbstractAsyncCallback<Void> callback, + DisplayedAndSelectedSamples selectedAndDisplayedItems) { super(viewContext, data); this.viewContext = viewContext; this.callback = callback; + this.singleDataOrNull = null; + this.selectedAndDisplayedItemsOrNull = selectedAndDisplayedItems; + } + + public SampleListDeletionConfirmationDialog( + IViewContext<ICommonClientServiceAsync> viewContext, List<Sample> data, + AbstractAsyncCallback<Void> callback, Sample sample) + { + super(viewContext, data); + this.viewContext = viewContext; + this.callback = callback; + this.singleDataOrNull = sample; + this.selectedAndDisplayedItemsOrNull = null; } @Override protected void executeConfirmedAction() { - viewContext.getCommonService().deleteSamples(TechId.createList(data), reason.getValue(), - callback); + if (selectedAndDisplayedItemsOrNull != null) + { + final boolean onlySelected = WidgetUtils.isSelected(onlySelectedRadio); + final DisplayedOrSelectedIdHolderCriteria<Sample> uploadCriteria = + selectedAndDisplayedItemsOrNull.createCriteria(onlySelected); + viewContext.getCommonService().deleteSamples(uploadCriteria, reason.getValue(), + callback); + } else + { + viewContext.getCommonService().deleteSample(TechId.create(singleDataOrNull), + reason.getValue(), callback); + } } @Override @@ -56,4 +93,21 @@ public final class SampleListDeletionConfirmationDialog extends return EntityKind.SAMPLE.getDescription(); } + @Override + protected void extendForm() + { + super.extendForm(); + if (selectedAndDisplayedItemsOrNull != null) + formPanel.add(createRadio()); + } + + private final RadioGroup createRadio() + { + return WidgetUtils.createAllOrSelectedRadioGroup(onlySelectedRadio = + WidgetUtils.createRadio(viewContext.getMessage(Dict.ONLY_SELECTED_RADIO, data + .size())), WidgetUtils.createRadio(viewContext.getMessage(Dict.ALL_RADIO, + selectedAndDisplayedItemsOrNull.getDisplayedItemsCount())), viewContext + .getMessage(Dict.SAMPLES_RADIO_GROUP_LABEL), data.size()); + } + } 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 26b807eeb9ca9db54487229baa35213611725e36..90242a367d0a720049a147dfbe71390db2b4a7af 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 @@ -138,7 +138,7 @@ import ch.systemsx.cisd.openbis.generic.shared.translator.VocabularyTermTranslat /** * The {@link ICommonClientService} implementation. * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public final class CommonClientService extends AbstractClientService implements ICommonClientService, IDataStoreBaseURLProvider @@ -1448,6 +1448,20 @@ public final class CommonClientService extends AbstractClientService implements } } + public void deleteDataSet(String singleData, String reason) + throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException + { + try + { + final String sessionToken = getSessionToken(); + List<String> dataSetCodes = Collections.singletonList(singleData); + commonServer.deleteDataSets(sessionToken, dataSetCodes, reason); + } catch (final UserFailureException e) + { + throw UserFailureExceptionTranslator.translate(e); + } + } + public void deleteDataSets( DisplayedOrSelectedDatasetCriteria displayedOrSelectedDatasetCriteria, String reason) throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException @@ -1463,7 +1477,7 @@ public final class CommonClientService extends AbstractClientService implements } } - public void deleteSamples(List<TechId> sampleIds, String reason) + public void deleteSamples(List<TechId> sampleIds, String reason) throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException { try @@ -1476,6 +1490,33 @@ public final class CommonClientService extends AbstractClientService implements } } + public void deleteSample(TechId sampleId, String reason) + throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException + { + try + { + final String sessionToken = getSessionToken(); + commonServer.deleteSamples(sessionToken, Collections.singletonList(sampleId), reason); + } catch (final UserFailureException e) + { + throw UserFailureExceptionTranslator.translate(e); + } + } + + public void deleteSamples(DisplayedOrSelectedIdHolderCriteria<Sample> criteria, String reason) + throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException + { + try + { + final String sessionToken = getSessionToken(); + List<TechId> experimentIds = extractTechIds(criteria); + commonServer.deleteSamples(sessionToken, experimentIds, reason); + } catch (final UserFailureException e) + { + throw UserFailureExceptionTranslator.translate(e); + } + } + public void deleteExperiment(TechId experimentId, String reason) throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException { @@ -2071,21 +2112,6 @@ public final class CommonClientService extends AbstractClientService implements } - public void deleteDataSet(String singleData, String reason) - throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException - { - try - { - final String sessionToken = getSessionToken(); - List<String> dataSetCodes = Collections.singletonList(singleData); - commonServer.deleteDataSets(sessionToken, dataSetCodes, reason); - } catch (final UserFailureException e) - { - throw UserFailureExceptionTranslator.translate(e); - } - - } - private <T extends IIdHolder> List<TechId> extractTechIds( DisplayedOrSelectedIdHolderCriteria<T> displayedOrSelectedEntitiesCriteria) { @@ -2177,4 +2203,5 @@ public final class CommonClientService extends AbstractClientService implements throw UserFailureExceptionTranslator.translate(e); } } + } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java index 23fe7e6f3bd6cd4635ac68d597a77185ae097af7..b1382a6bf3df0cb0a9a0f325cd539eabd7c434fb 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java @@ -130,7 +130,8 @@ public final class GenericSampleViewer extends AbstractViewer<IGenericClientServ public void execute() { new SampleListDeletionConfirmationDialog(viewContext.getCommonViewContext(), - getOriginalDataAsSingleton(), createDeletionCallback()).show(); + getOriginalDataAsSingleton(), createDeletionCallback(), + getOriginalData()).show(); } })); } 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 81f5108098b2698708dd40b904a5412b1d8b7e2a..d3bf7a8e6f811b31f35d0d0413b6901d1a9e90f7 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 @@ -121,7 +121,7 @@ var common = { matching_field: "Matching Field", too_generic: "Query string '{0}' is too generic.", show_related_datasets: "Show Related Data Sets", - show_related_datasets_message: "Select between showing Data Sets related to selected ({0}) entities or to all entities from the grid and click on OK button.", + show_related_datasets_message: "Select between showing Data Sets related to selected ({0}) entities or to all entities from the table and click on OK button.", show_related_datasets_radio_label: "Related entities", // @@ -156,6 +156,10 @@ var common = { // children_datasets: "Children", + no_datasets_selected: "No Data Sets were selected.", + datasets_from_different_stores_selected: "Data Sets from different Data Stores were selected, so no operation can be performed on all of them.", + perform_computation_on_all_datasets_msg_template: "{0} Select a data store service to perform {1} computation on all Data Sets from the table that have type and data store appropriate to the selected service and click on a Run button.", + perform_computation_on_selected_or_all_datasets_msg_template: "Select between performing {0} computation only on selected Data Sets ({1}) or on all Data Sets of appropriate types from the table, then select a data store service and click on a Run button.", // // Entity Type Browser @@ -464,7 +468,7 @@ incorrect_experiment_syntax: "Incorrect experiment specification. Please provide // Grid Column Chooser // - GRID_COLUMN_CHOOSER_TITLE: "Configure grid columns", + GRID_COLUMN_CHOOSER_TITLE: "Configure table columns", GRID_COLUMN_NAME_HEADER: "Column", GRID_IS_COLUMN_VISIBLE_HEADER: "Visible?", GRID_COLUMN_HAS_FILTER_HEADER: "Has Filter?", @@ -488,10 +492,11 @@ incorrect_experiment_syntax: "Incorrect experiment specification. Please provide remove_persons_from_authorization_group_confirmation_message: "Do you really want to remove {0} users ({1}) from the user group '{2}'?", -all_radio: "all", -data_sets_radio_group_label: "Data Sets", +all_radio: "all ({0})", only_selected_radio: "selected ({0})", +data_sets_radio_group_label: "Data Sets", experiments_radio_group_label: "Experiments", +samples_radio_group_label: "Samples", // // Filters