Skip to content
Snippets Groups Projects
Commit 5abfa8b1 authored by felmer's avatar felmer
Browse files

LMS-2485 done

SVN: 22790
parent f8f6a4d6
No related branches found
No related tags found
No related merge requests found
......@@ -42,7 +42,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData;
/**
* @author Franz-Josef Elmer
*/
final class DataSetUploadConfirmationDialog extends
public final class DataSetUploadConfirmationDialog extends
AbstractDataConfirmationDialog<List<ExternalData>>
{
private static final int FIELD_WIDTH_IN_UPLOAD_DIALOG = 200;
......@@ -93,7 +93,10 @@ final class DataSetUploadConfirmationDialog extends
formPanel.setBodyBorder(false);
formPanel.setHeaderVisible(false);
formPanel.add(createDataSetsRadio());
if (displayedItemsCount > 1)
{
formPanel.add(createDataSetsRadio());
}
fileNameField = new TextField<String>();
fileNameField.setFieldLabel(viewContext
......@@ -135,16 +138,17 @@ final class DataSetUploadConfirmationDialog extends
private final RadioGroup createDataSetsRadio()
{
return WidgetUtils.createAllOrSelectedRadioGroup(uploadSelectedRadio =
WidgetUtils.createRadio(viewContext.getMessage(Dict.ONLY_SELECTED_RADIO, data
.size())), WidgetUtils.createRadio(viewContext.getMessage(Dict.ALL_RADIO,
displayedItemsCount)), viewContext.getMessage(Dict.DATA_SETS_RADIO_GROUP_LABEL),
data.size());
return WidgetUtils.createAllOrSelectedRadioGroup(
uploadSelectedRadio =
WidgetUtils.createRadio(viewContext.getMessage(Dict.ONLY_SELECTED_RADIO,
data.size())), WidgetUtils.createRadio(viewContext.getMessage(
Dict.ALL_RADIO, displayedItemsCount)), viewContext
.getMessage(Dict.DATA_SETS_RADIO_GROUP_LABEL), data.size());
}
private boolean getUploadSelected()
{
return WidgetUtils.isSelected(uploadSelectedRadio);
return uploadSelectedRadio == null ? true : WidgetUtils.isSelected(uploadSelectedRadio);
}
@Override
......
......@@ -22,6 +22,9 @@ import java.util.List;
import java.util.Set;
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.widget.Component;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.MessageBox;
......@@ -42,10 +45,13 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.
import ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.ActionMenu;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.IActionMenuItem;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.AbstractViewerWithVerticalSplit;
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.data.DataSetListDeletionConfirmationDialog;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.data.DataSetUploadConfirmationDialog;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.deletion.RevertDeletionConfirmationDialog;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.SectionsPanel;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedAction;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedActionWithResult;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.DisplayedOrSelectedDatasetCriteria;
import ch.systemsx.cisd.openbis.generic.shared.basic.IIdAndCodeHolder;
......@@ -140,6 +146,24 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
private void extendToolBar()
{
Button exportButton = new Button(viewContext.getMessage(Dict.BUTTON_UPLOAD_DATASETS));
exportButton.addListener(Events.Select, new Listener<BaseEvent>()
{
public void handleEvent(BaseEvent be)
{
final List<ExternalData> dataSets = Arrays.asList(originalData);
IDelegatedActionWithResult<SelectedAndDisplayedItems> action =
new IDelegatedActionWithResult<SelectedAndDisplayedItems>()
{
public SelectedAndDisplayedItems execute()
{
return new SelectedAndDisplayedItems(dataSets, null, 1);
}
};
new DataSetUploadConfirmationDialog(dataSets, action, 1, viewContext).show();
}
});
addToolBarButton(exportButton);
if (getViewContext().isSimpleOrEmbeddedMode())
{
return;
......@@ -151,8 +175,8 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
final AsyncCallback<Void> callback =
isTrashEnabled() ? createDeletionCallback()
: createPermanentDeletionCallback();
new DataSetListDeletionConfirmationDialog(getViewContext().getCommonViewContext(),
callback, getOriginalData()).show();
new DataSetListDeletionConfirmationDialog(getViewContext()
.getCommonViewContext(), callback, getOriginalData()).show();
}
}));
......@@ -294,8 +318,8 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
setToolBarButtonsEnabled(false);
updateTitle(getOriginalDataDescription() + " (not available)");
String msg =
getViewContext().getMessage(Dict.DATASET_NOT_AVAILABLE_MSG, result.getCode(), result
.getStatus().getDescription().toLowerCase());
getViewContext().getMessage(Dict.DATASET_NOT_AVAILABLE_MSG, result.getCode(),
result.getStatus().getDescription().toLowerCase());
MessageBox.info("Data not available", msg, null);
}
......@@ -358,7 +382,8 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
/** @param data external data that will be processed */
public void setupData(final ExternalData data)
{
getViewContext().getCommonService().listDataStoreServices(DataStoreServiceKind.PROCESSING,
getViewContext().getCommonService().listDataStoreServices(
DataStoreServiceKind.PROCESSING,
new ProcessingServicesCallback(getViewContext(), getOriginalData(), button));
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment