Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-extractcodelist-widget@96118 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-05-27 09:09:26 +00:00
parent b4c1ea01a3
commit 73b0cd04fc
3 changed files with 171 additions and 11 deletions

View File

@ -2,8 +2,9 @@ package org.gcube.portlets.user.td.extractcodelistwidget.client;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession;
import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow;
import com.google.web.bindery.event.shared.EventBus;
@ -13,23 +14,24 @@ import com.google.web.bindery.event.shared.EventBus;
*/
public class ExtractCodelistWizardTD extends WizardWindow {
protected CSVExportSession exportSession;
protected ExtractCodelistSession exportSession;
/**
* The id of the {@link CSVTarget} to use.
* @param targetId
*/
/**
*
* @param title
* @param eventBus
*/
public ExtractCodelistWizardTD(String title, EventBus eventBus) {
super(title,eventBus);
exportSession= new CSVExportSession();
exportSession= new ExtractCodelistSession();
SourceColumnsSelectionCard sourceColumnsSelectionCard=new SourceColumnsSelectionCard(exportSession);
addCard(sourceColumnsSelectionCard);
sourceColumnsSelectionCard.setup();
/*CSVExportConfigCard csvExportConfigCard=new CSVExportConfigCard(exportSession);
addCard(csvExportConfigCard);
csvExportConfigCard.setup();
*/
}

View File

@ -0,0 +1,134 @@
package org.gcube.portlets.user.td.extractcodelistwidget.client;
import java.util.ArrayList;
import org.gcube.portlets.user.td.extractcodelistwidget.client.grid.ColumnDataGridPanel;
import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.user.client.Command;
import com.sencha.gxt.core.client.util.Padding;
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.event.HideEvent;
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
import com.sencha.gxt.widget.core.client.form.FormPanel;
/**
*
* @author "Giancarlo Panichi"
*
*/
public class SourceColumnsSelectionCard extends WizardCard {
protected ExtractCodelistSession extractCodelistSession;
protected ColumnDataGridPanel columnsGridPanel;
public SourceColumnsSelectionCard(final ExtractCodelistSession extractCodelistSession) {
super("Source Column", "");
if (extractCodelistSession == null) {
Log.error("ExtractCodelistSession is null");
}
this.extractCodelistSession = extractCodelistSession;
FormPanel panel = createPanel();
setContent(panel);
}
protected FormPanel createPanel() {
FormPanel panel = new FormPanel();
panel.setLabelWidth(90);
panel.getElement().setPadding(new Padding(5));
VerticalLayoutContainer content = new VerticalLayoutContainer();
panel.add(content);
columnsGridPanel = new ColumnDataGridPanel();
columnsGridPanel
.addSelectionHandler(new SelectionHandler<ColumnData>() {
public void onSelection(SelectionEvent<ColumnData> event) {
}
});
content.add(columnsGridPanel);
return panel;
}
@Override
public void setup() {
Log.debug("ColumnSourceSelectionCard Setup");
Command sayNextCard = new Command() {
public void execute() {
Log.debug("ColumnSourceSelectionCard Call sayNextCard");
checkData();
}
};
getWizardWindow().setNextButtonCommand(sayNextCard);
setEnableBackButton(false);
setEnableNextButton(true);
}
protected void checkData() {
getWizardWindow().setEnableNextButton(false);
getWizardWindow().setEnableBackButton(false);
AlertMessageBox d;
HideHandler hideHandler = new HideHandler() {
public void onHide(HideEvent event) {
getWizardWindow().setEnableNextButton(true);
getWizardWindow().setEnableBackButton(false);
}
};
ArrayList<ColumnData> columns = columnsGridPanel.getSelectedItems();
if (columns.size() == 0) {
d = new AlertMessageBox("Attention", "No columns selected");
d.addHideHandler(hideHandler);
d.setModal(false);
d.show();
} else {
extractCodelistSession.setSourceColumns(columns);
goNext();
}
}
protected void goNext() {
try {
TargetColumnsSelectionCard destCard = new TargetColumnsSelectionCard(
extractCodelistSession);
getWizardWindow().addCard(destCard);
getWizardWindow().nextCard();
} catch (Exception e) {
Log.error("sayNextCard :" + e.getLocalizedMessage());
}
}
@Override
public void dispose() {
}
}

View File

@ -0,0 +1,24 @@
package org.gcube.portlets.user.td.extractcodelistwidget.client;
import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession;
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
import com.allen_sauer.gwt.log.client.Log;
public class TargetColumnsSelectionCard extends WizardCard {
protected ExtractCodelistSession extractCodelistSession;
public TargetColumnsSelectionCard(final ExtractCodelistSession extractCodelistSession) {
super("Target Column", "");
if (extractCodelistSession == null) {
Log.error("ExtractCodelistSession is null");
}
this.extractCodelistSession = extractCodelistSession;
}
}