refs 5870: TDM - adding new functionalities to portlets

Task-Url: https://support.d4science.org/issues/5870

Updated to support SDMX Dataset export

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-csv-import-widget@142045 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-02-02 10:13:54 +00:00
parent 2e21a632af
commit 7a7c8ca651
1 changed files with 17 additions and 18 deletions

View File

@ -37,13 +37,12 @@ import com.sencha.gxt.widget.core.client.grid.RowNumberer;
*/
public class CSVGrid extends Grid<CSVRow> {
//private static final String csvImportFileServlet = "CSVImportFileServlet";
// private static final String csvImportFileServlet =
// "CSVImportFileServlet";
private CSVGridView gridViewSample;
private CSVGridMessages msgs;
private CommonMessages msgsCommon;
public CSVGrid() {
super(new ListStore<CSVRow>(new CSVRowKeyProvider()),
new ColumnModel<CSVRow>(
@ -62,13 +61,11 @@ public class CSVGrid extends Grid<CSVRow> {
setBorders(true);
}
protected void initMessages() {
msgs = GWT.create(CSVGridMessages.class);
msgsCommon = GWT.create(CommonMessages.class);
}
public void configureColumns(ArrayList<String> columnNames) {
ColumnModel<CSVRow> columnModel = createColumnModel(columnNames);
ListStore<CSVRow> store = createStore(columnNames);
@ -80,7 +77,10 @@ public class CSVGrid extends Grid<CSVRow> {
ListStore<CSVRow> store = null;
try {
String path = GWT.getModuleBaseURL() + Constants.CSV_IMPORT_FILE_SERVLET;
String path = GWT.getModuleBaseURL()
+ Constants.CSV_IMPORT_FILE_SERVLET + "?"
+ Constants.CURR_GROUP_ID + "="
+ GCubeClientContext.getCurrentContextId();
Log.info("CSVImportFileServlet path:" + path);
// use a http proxy to get the data
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,
@ -98,16 +98,15 @@ public class CSVGrid extends Grid<CSVRow> {
final ListLoader<ListLoadConfig, ListLoadResult<CSVRow>> loader = new ListLoader<ListLoadConfig, ListLoadResult<CSVRow>>(
proxy, reader);
store = new ListStore<CSVRow>(
new CSVRowKeyProvider());
store = new ListStore<CSVRow>(new CSVRowKeyProvider());
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, CSVRow, ListLoadResult<CSVRow>>(
store));
loader.load();
} catch (Exception e) {
UtilsGXT3.alert(msgsCommon.error(),msgs.errorCreatingTheStore(e.getLocalizedMessage()));
UtilsGXT3.alert(msgsCommon.error(),
msgs.errorCreatingTheStore(e.getLocalizedMessage()));
Log.error("Error in creating the store: " + e.getLocalizedMessage());
e.printStackTrace();