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