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