Added Destination

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-csv-export-widget@85621 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2013-11-18 14:59:57 +00:00
parent 1a41ddcc6e
commit 4767b9c75c
2 changed files with 24 additions and 24 deletions

View File

@ -27,7 +27,7 @@ public class CSVExportWizardTD extends WizardWindow {
exportSession= new CSVExportSession();
SourceSelectionCard sourceSelection= new SourceSelectionCard(exportSession);
DestinationSelectionCard sourceSelection= new DestinationSelectionCard(exportSession);
addCard(sourceSelection);
sourceSelection.setup();

View File

@ -6,8 +6,8 @@ package org.gcube.portlets.user.td.csvexportwidget.client;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.source.FileSource;
import org.gcube.portlets.user.td.gwtservice.shared.source.WorkspaceSource;
import org.gcube.portlets.user.td.gwtservice.shared.destination.FileDestination;
import org.gcube.portlets.user.td.gwtservice.shared.destination.WorkspaceDestination;
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
import com.allen_sauer.gwt.log.client.Log;
@ -25,44 +25,44 @@ import com.sencha.gxt.widget.core.client.form.Radio;
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class SourceSelectionCard extends WizardCard {
public class DestinationSelectionCard extends WizardCard {
protected final CSVExportSession exportSession;
final FileSource fileSource = FileSource.INSTANCE;
final WorkspaceSource workspaceSource = WorkspaceSource.INSTANCE;
final FileDestination fileDestination = FileDestination.INSTANCE;
final WorkspaceDestination workspaceDestination = WorkspaceDestination.INSTANCE;
public SourceSelectionCard(final CSVExportSession exportSession) {
public DestinationSelectionCard(final CSVExportSession exportSession) {
super("CSV destination selection", "");
this.exportSession = exportSession;
// Default
exportSession.setSource(fileSource);
exportSession.setDestination(fileDestination);
VerticalPanel sourceSelectionPanel = new VerticalPanel();
sourceSelectionPanel.setStylePrimaryName(res.wizardCSS()
VerticalPanel destinationSelectionPanel = new VerticalPanel();
destinationSelectionPanel.setStylePrimaryName(res.wizardCSS()
.getImportSelectionSources());
Radio radioFileSource = new Radio();
radioFileSource.setBoxLabel("<p style='display:inline-table;'><b>"
+ fileSource.getName() + "</b><br>"
+ fileSource.getDescription() + "</p>");
radioFileSource.setName(fileSource.getName());
+ fileDestination.getName() + "</b><br>"
+ fileDestination.getDescription() + "</p>");
radioFileSource.setName(fileDestination.getName());
radioFileSource.setStylePrimaryName(res.wizardCSS()
.getImportSelectionSource());
radioFileSource.setValue(true);
Radio radioWorkspaceSource = new Radio();
radioWorkspaceSource.setBoxLabel("<p style='display:inline-table;'><b>"
+ workspaceSource.getName() + "</b><br>"
+ workspaceSource.getDescription() + "</p>");
radioWorkspaceSource.setName(workspaceSource.getName());
+ workspaceDestination.getName() + "</b><br>"
+ workspaceDestination.getDescription() + "</p>");
radioWorkspaceSource.setName(workspaceDestination.getName());
radioWorkspaceSource.setStylePrimaryName(res.wizardCSS()
.getImportSelectionSource());
// radioWorkspaceSource.disable();
sourceSelectionPanel.add(radioFileSource);
sourceSelectionPanel.add(radioWorkspaceSource);
destinationSelectionPanel.add(radioFileSource);
destinationSelectionPanel.add(radioWorkspaceSource);
// we can set name on radios or use toggle group
ToggleGroup toggle = new ToggleGroup();
@ -77,11 +77,11 @@ public class SourceSelectionCard extends WizardCard {
ToggleGroup group = (ToggleGroup) event.getSource();
Radio radio = (Radio) group.getValue();
Log.info("Source Selected:" + radio.getName());
if (radio.getName().compareTo(workspaceSource.getName()) == 0) {
exportSession.setSource(workspaceSource);
if (radio.getName().compareTo(workspaceDestination.getName()) == 0) {
exportSession.setDestination(workspaceDestination);
} else {
if (radio.getName().compareTo(fileSource.getName()) == 0) {
exportSession.setSource(fileSource);
if (radio.getName().compareTo(fileDestination.getName()) == 0) {
exportSession.setDestination(fileDestination);
} else {
}
@ -96,7 +96,7 @@ public class SourceSelectionCard extends WizardCard {
}
});
setContent(sourceSelectionPanel);
setContent(destinationSelectionPanel);
}
@ -106,7 +106,7 @@ public class SourceSelectionCard extends WizardCard {
Command sayNextCard = new Command() {
public void execute() {
try {
String sourceId = exportSession.getSource().getId();
String sourceId = exportSession.getDestination().getId();
if (sourceId == null || sourceId.isEmpty()) {
Log.error("CSV Import Source Id: " + sourceId);
} else {