Minor updated

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-csv-export-widget@85655 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2013-11-18 18:14:41 +00:00
parent 43b69f1939
commit da59c886d4
1 changed files with 13 additions and 25 deletions

View File

@ -5,8 +5,6 @@ package org.gcube.portlets.user.td.csvexportwidget.client;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.gcube.portlets.user.td.csvexportwidget.client.workspace.WorkspacePanel;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
@ -86,8 +84,7 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
}
}
});
p.add(new FieldLabel(wpanel, "Folder"), new VerticalLayoutData(-1,
-1));
p.add(new FieldLabel(wpanel, "Folder"), new VerticalLayoutData(-1, -1));
wpanel.loadTree();
setContent(formPanel);
@ -100,44 +97,35 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
getWizardWindow().setEnableNextButton(false);
getWizardWindow().setEnableBackButton(false);
AlertMessageBox d;
HideHandler hideHandler=new HideHandler() {
HideHandler hideHandler = new HideHandler() {
@Override
public void onHide(HideEvent event) {
wpanel.enable();
getWizardWindow().setEnableNextButton(true);
getWizardWindow().setEnableBackButton(true);
getWizardWindow().setEnableBackButton(true);
}
};
if (fileName.getCurrentValue() != null
&& !fileName.getCurrentValue().isEmpty() && fileName.validate()) {
Pattern p = Pattern.compile("[_a-zA-Z0-9\\-\\.]+");
Matcher matcher = p.matcher(fileName.getCurrentValue());
if (matcher.matches()) {
Log.debug("fileName match");
if (exportSession.getItemId() != null) {
exportSession.setFileName(fileName.getCurrentValue());
getFileFromWorkspace();
} else {
d = new AlertMessageBox("Attention", "No folder selected");
d.addHideHandler(hideHandler);
d.show();
}
if (exportSession.getItemId() != null) {
exportSession.setFileName(fileName.getCurrentValue());
getFileFromWorkspace();
} else {
Log.debug("fileName no match");
d = new AlertMessageBox("Attention", "No valid file name");
d = new AlertMessageBox("Attention", "No folder selected");
d.addHideHandler(hideHandler);
d.setModal(false);
d.show();
}
} else {
d = new AlertMessageBox("Attention", "No valid file name");
d.addHideHandler(hideHandler);
d.setModal(false);
d.show();
}
}
@Override