102 lines
2.5 KiB
Java
102 lines
2.5 KiB
Java
package org.gcube.portlets.user.td.unionwizardwidget.client;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.union.UnionColumnsMapping;
|
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.union.UnionSession;
|
|
import org.gcube.portlets.user.td.unionwizardwidget.client.utils.UtilsGXT3;
|
|
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
|
|
|
import com.allen_sauer.gwt.log.client.Log;
|
|
import com.google.gwt.user.client.Command;
|
|
|
|
public class ColumnMappingCard extends WizardCard {
|
|
protected UnionSession unionSession;
|
|
protected ColumnMappingCard thisCard;
|
|
protected ColumnMappingPanel columnMappingPanel;
|
|
|
|
public ColumnMappingCard(final UnionSession unionSession) {
|
|
super("Column Mapping", "");
|
|
Log.debug("ColumnMappingCard");
|
|
this.unionSession = unionSession;
|
|
thisCard = this;
|
|
|
|
columnMappingPanel = new ColumnMappingPanel(thisCard,res);
|
|
|
|
setContent(columnMappingPanel);
|
|
|
|
}
|
|
|
|
@Override
|
|
public void setup() {
|
|
Log.debug("ColumnMappingCard Call Setup ");
|
|
Command sayNextCard = new Command() {
|
|
|
|
public void execute() {
|
|
Log.debug("ColumnMappingCard Call sayNextCard");
|
|
setMapping();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
getWizardWindow().setNextButtonCommand(sayNextCard);
|
|
|
|
Command sayPreviousCard = new Command() {
|
|
public void execute() {
|
|
try {
|
|
getWizardWindow().previousCard();
|
|
getWizardWindow().removeCard(thisCard);
|
|
Log.debug("Remove ColumnMappingCard");
|
|
} catch (Exception e) {
|
|
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
|
}
|
|
}
|
|
};
|
|
|
|
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
|
getWizardWindow().setEnableNextButton(false);
|
|
getWizardWindow().setEnableBackButton(true);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
protected void setMapping() {
|
|
getWizardWindow().setEnableNextButton(false);
|
|
getWizardWindow().setEnableBackButton(false);
|
|
|
|
ArrayList<UnionColumnsMapping> mapMatch=columnMappingPanel.getSelectedMap();
|
|
if(mapMatch==null){
|
|
Log.debug("No column match created: "
|
|
+mapMatch);
|
|
UtilsGXT3
|
|
.info("Attentions",
|
|
"Creates a valid map");
|
|
getWizardWindow().setEnableNextButton(true);
|
|
getWizardWindow().setEnableBackButton(true);
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
protected void goNext() {
|
|
try {
|
|
Log.info("NextCard ColumnSelectionCard");
|
|
UnionOperationInProgressCard progressCard = new UnionOperationInProgressCard(
|
|
unionSession);
|
|
getWizardWindow().addCard(
|
|
progressCard);
|
|
getWizardWindow().nextCard();
|
|
} catch (Throwable e) {
|
|
Log.error("goNext: " + e.getLocalizedMessage());
|
|
}
|
|
}
|
|
|
|
}
|