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:
parent
2e21a632af
commit
7a7c8ca651
|
@ -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);
|
||||
|
@ -77,18 +74,21 @@ public class CSVGrid extends Grid<CSVRow> {
|
|||
}
|
||||
|
||||
protected ListStore<CSVRow> createStore(ArrayList<String> columnNames) {
|
||||
ListStore<CSVRow> store=null;
|
||||
|
||||
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,
|
||||
path);
|
||||
|
||||
|
||||
builder.setHeader(Constants.CURR_GROUP_ID,
|
||||
GCubeClientContext.getCurrentContextId());
|
||||
|
||||
|
||||
HttpProxy<ListLoadConfig> proxy = new HttpProxy<ListLoadConfig>(
|
||||
builder);
|
||||
|
||||
|
@ -98,21 +98,20 @@ 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()));
|
||||
Log.error("Error in creating the store: "+e.getLocalizedMessage());
|
||||
UtilsGXT3.alert(msgsCommon.error(),
|
||||
msgs.errorCreatingTheStore(e.getLocalizedMessage()));
|
||||
Log.error("Error in creating the store: " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue