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> {
|
public class CSVGrid extends Grid<CSVRow> {
|
||||||
|
|
||||||
//private static final String csvImportFileServlet = "CSVImportFileServlet";
|
// private static final String csvImportFileServlet =
|
||||||
|
// "CSVImportFileServlet";
|
||||||
private CSVGridView gridViewSample;
|
private CSVGridView gridViewSample;
|
||||||
private CSVGridMessages msgs;
|
private CSVGridMessages msgs;
|
||||||
private CommonMessages msgsCommon;
|
private CommonMessages msgsCommon;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public CSVGrid() {
|
public CSVGrid() {
|
||||||
super(new ListStore<CSVRow>(new CSVRowKeyProvider()),
|
super(new ListStore<CSVRow>(new CSVRowKeyProvider()),
|
||||||
new ColumnModel<CSVRow>(
|
new ColumnModel<CSVRow>(
|
||||||
|
@ -62,13 +61,11 @@ public class CSVGrid extends Grid<CSVRow> {
|
||||||
setBorders(true);
|
setBorders(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void initMessages() {
|
protected void initMessages() {
|
||||||
msgs = GWT.create(CSVGridMessages.class);
|
msgs = GWT.create(CSVGridMessages.class);
|
||||||
msgsCommon = GWT.create(CommonMessages.class);
|
msgsCommon = GWT.create(CommonMessages.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void configureColumns(ArrayList<String> columnNames) {
|
public void configureColumns(ArrayList<String> columnNames) {
|
||||||
ColumnModel<CSVRow> columnModel = createColumnModel(columnNames);
|
ColumnModel<CSVRow> columnModel = createColumnModel(columnNames);
|
||||||
ListStore<CSVRow> store = createStore(columnNames);
|
ListStore<CSVRow> store = createStore(columnNames);
|
||||||
|
@ -77,18 +74,21 @@ public class CSVGrid extends Grid<CSVRow> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ListStore<CSVRow> createStore(ArrayList<String> columnNames) {
|
protected ListStore<CSVRow> createStore(ArrayList<String> columnNames) {
|
||||||
ListStore<CSVRow> store=null;
|
ListStore<CSVRow> store = null;
|
||||||
|
|
||||||
try {
|
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);
|
Log.info("CSVImportFileServlet path:" + path);
|
||||||
// use a http proxy to get the data
|
// use a http proxy to get the data
|
||||||
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,
|
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,
|
||||||
path);
|
path);
|
||||||
|
|
||||||
builder.setHeader(Constants.CURR_GROUP_ID,
|
builder.setHeader(Constants.CURR_GROUP_ID,
|
||||||
GCubeClientContext.getCurrentContextId());
|
GCubeClientContext.getCurrentContextId());
|
||||||
|
|
||||||
HttpProxy<ListLoadConfig> proxy = new HttpProxy<ListLoadConfig>(
|
HttpProxy<ListLoadConfig> proxy = new HttpProxy<ListLoadConfig>(
|
||||||
builder);
|
builder);
|
||||||
|
|
||||||
|
@ -98,21 +98,20 @@ public class CSVGrid extends Grid<CSVRow> {
|
||||||
final ListLoader<ListLoadConfig, ListLoadResult<CSVRow>> loader = new ListLoader<ListLoadConfig, ListLoadResult<CSVRow>>(
|
final ListLoader<ListLoadConfig, ListLoadResult<CSVRow>> loader = new ListLoader<ListLoadConfig, ListLoadResult<CSVRow>>(
|
||||||
proxy, reader);
|
proxy, reader);
|
||||||
|
|
||||||
store = new ListStore<CSVRow>(
|
store = new ListStore<CSVRow>(new CSVRowKeyProvider());
|
||||||
new CSVRowKeyProvider());
|
|
||||||
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, CSVRow, ListLoadResult<CSVRow>>(
|
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, CSVRow, ListLoadResult<CSVRow>>(
|
||||||
store));
|
store));
|
||||||
|
|
||||||
loader.load();
|
loader.load();
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
UtilsGXT3.alert(msgsCommon.error(),msgs.errorCreatingTheStore(e.getLocalizedMessage()));
|
UtilsGXT3.alert(msgsCommon.error(),
|
||||||
Log.error("Error in creating the store: "+e.getLocalizedMessage());
|
msgs.errorCreatingTheStore(e.getLocalizedMessage()));
|
||||||
|
Log.error("Error in creating the store: " + e.getLocalizedMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return store;
|
return store;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue