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-portlet@142054 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-02-02 11:03:06 +00:00
parent 42aba812e7
commit a923c96a25
1 changed files with 44 additions and 45 deletions

View File

@ -32,23 +32,23 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
public class TDMLogs extends Window {
protected static final String TDMLogsServlet = "TDLogsServlet";
protected static final String WIDTH="700px";
protected static final String HEIGHT="500px";
protected static final String CONTENTLOGSWIDTH="674px";
protected static final String CONTENTLOGSHEIGHT="410px";
protected static final String WIDTH = "700px";
protected static final String HEIGHT = "500px";
protected static final String CONTENTLOGSWIDTH = "674px";
protected static final String CONTENTLOGSHEIGHT = "410px";
protected EventBus eventBus;
protected VerticalLayoutContainer verticalContainer;
public TDMLogs(EventBus eventBus){
public TDMLogs(EventBus eventBus) {
super();
this.eventBus=eventBus;
this.eventBus = eventBus;
init();
createLogsPanel();
callLogsServlet();
}
public void init(){
public void init() {
setWidth(WIDTH);
setHeight(HEIGHT);
setHeadingText("TDM Logs");
@ -56,60 +56,60 @@ public class TDMLogs extends Window {
setClosable(true);
setResizable(false);
}
protected void createLogsPanel() {
FramedPanel logsPanel=new FramedPanel();
FramedPanel logsPanel = new FramedPanel();
logsPanel.setBodyBorder(false);
logsPanel.setHeaderVisible(false);
ToolBar toolBar = new ToolBar();
TextButton btnReload = new TextButton();
// btnReload.setText("Reload");
btnReload.addSelectHandler(new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
callLogsServlet();
}
});
btnReload.setIcon(TabularDataResources.INSTANCE.refresh());
btnReload.setToolTip("Reload");
toolBar.add(btnReload);
SimpleContainer contentLogs = new SimpleContainer();
contentLogs.setBorders(false);
contentLogs.setWidth(CONTENTLOGSWIDTH);
contentLogs.setHeight(CONTENTLOGSHEIGHT);
verticalContainer = new VerticalLayoutContainer();
verticalContainer.setScrollMode(ScrollMode.AUTO);
verticalContainer.getElement().getStyle().setBackgroundColor("white");
contentLogs.add(verticalContainer);
VerticalLayoutContainer logsPanelLayout=new VerticalLayoutContainer();
logsPanelLayout.add(toolBar, new VerticalLayoutData(1,32,new Margins(1)));
logsPanelLayout.add(contentLogs, new VerticalLayoutData(1,-1,new Margins(1)));
VerticalLayoutContainer logsPanelLayout = new VerticalLayoutContainer();
logsPanelLayout.add(toolBar, new VerticalLayoutData(1, 32, new Margins(
1)));
logsPanelLayout.add(contentLogs, new VerticalLayoutData(1, -1,
new Margins(1)));
logsPanel.add(logsPanelLayout);
add(logsPanel);
}
public void callLogsServlet() {
String path = GWT.getModuleBaseURL() + TDMLogsServlet;
String path = GWT.getModuleBaseURL() + TDMLogsServlet + "?"
+ Constants.CURR_GROUP_ID + "="
+ GCubeClientContext.getCurrentContextId();
Log.debug("TDMLogsServlet path:" + path);
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, path);
builder.setHeader(Constants.CURR_GROUP_ID,
GCubeClientContext.getCurrentContextId());
try {
builder.sendRequest(null, new RequestCallback() {
@ -129,7 +129,7 @@ public class TDMLogs extends Window {
if (408 == response.getStatusCode()) {
Log.error("Error retrienving logs. Session expired.");
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.error("Error retrienving logs. Response StatusCode: "
+ response.getStatusCode());
@ -148,25 +148,24 @@ public class TDMLogs extends Window {
}
}
protected void update(String text){
protected void update(String text) {
verticalContainer.clear();
/*int body=text.indexOf("<body>");
text=text.substring(body+6);*/
/*
* int body=text.indexOf("<body>"); text=text.substring(body+6);
*/
SafeHtmlBuilder builderLogs = new SafeHtmlBuilder();
builderLogs.appendEscapedLines(text);
SafeHtml safeLogs = builderLogs.toSafeHtml();
HTML hLogs = new HTML(safeLogs);
verticalContainer.add(hLogs, new VerticalLayoutData(1,-1,new Margins(1)));
verticalContainer.add(hLogs, new VerticalLayoutData(1, -1, new Margins(
1)));
forceLayout();
}
/**
* {@inheritDoc}
*/
@ -182,7 +181,7 @@ public class TDMLogs extends Window {
});
}
/**
*
*/