IDEMPIERE-4787 : Dashboard / Report : add Refresh button (#685)
* IDEMPIERE-4787 : Dashboard / Report : add Refresh button * IDEMPIERE-4787 : Dashboard / Report : add Refresh button - applying hengsin's advices Co-authored-by: hengsin <152246+hengsin@users.noreply.github.com>
This commit is contained in:
parent
3b4d371fb6
commit
ca556b52ba
|
@ -422,7 +422,11 @@ public class DashboardController implements EventListener<Event> {
|
||||||
if (dc.isEmbedReportContent())
|
if (dc.isEmbedReportContent())
|
||||||
{
|
{
|
||||||
String processParameters = dc.getProcessParameters();
|
String processParameters = dc.getProcessParameters();
|
||||||
embedReport(content, AD_Process_ID, processParameters);
|
|
||||||
|
Iframe iframe = new Iframe();
|
||||||
|
iframe.setSclass("dashboard-report-iframe");
|
||||||
|
content.appendChild(iframe);
|
||||||
|
iframe.setContent(generateReport(AD_Process_ID, processParameters));
|
||||||
|
|
||||||
Toolbar toolbar = new Toolbar();
|
Toolbar toolbar = new Toolbar();
|
||||||
content.appendChild(toolbar);
|
content.appendChild(toolbar);
|
||||||
|
@ -436,6 +440,17 @@ public class DashboardController implements EventListener<Event> {
|
||||||
btn.setLabel(Msg.getMsg(Env.getCtx(), "ViewReportInNewTab"));
|
btn.setLabel(Msg.getMsg(Env.getCtx(), "ViewReportInNewTab"));
|
||||||
toolbar.appendChild(new Separator("vertical"));
|
toolbar.appendChild(new Separator("vertical"));
|
||||||
toolbar.appendChild(btn);
|
toolbar.appendChild(btn);
|
||||||
|
|
||||||
|
btn = new ToolBarButton();
|
||||||
|
if (ThemeManager.isUseFontIconForImage()) {
|
||||||
|
btn.setIconSclass("z-icon-Refresh");
|
||||||
|
btn.setSclass("trash-toolbarbutton");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
btn.setImage(ThemeManager.getThemeResource("images/Refresh16.png"));
|
||||||
|
|
||||||
|
btn.addEventListener(Events.ON_CLICK, e -> iframe.setContent(generateReport(AD_Process_ID, processParameters)));
|
||||||
|
toolbar.appendChild(btn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -863,17 +878,13 @@ public class DashboardController implements EventListener<Event> {
|
||||||
return re;
|
return re;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void embedReport(Component parent, int AD_Process_ID, String parameters) throws Exception {
|
public AMedia generateReport(int AD_Process_ID, String parameters) throws Exception {
|
||||||
ReportEngine re = runReport(AD_Process_ID, parameters);
|
ReportEngine re = runReport(AD_Process_ID, parameters);
|
||||||
|
|
||||||
Iframe iframe = new Iframe();
|
|
||||||
iframe.setSclass("dashboard-report-iframe");
|
|
||||||
File file = File.createTempFile(re.getName(), ".html");
|
File file = File.createTempFile(re.getName(), ".html");
|
||||||
re.createHTML(file, false, AEnv.getLanguage(Env.getCtx()), new HTMLExtension(Executions.getCurrent().getContextPath(), "rp",
|
re.createHTML(file, false, AEnv.getLanguage(Env.getCtx()), new HTMLExtension(Executions.getCurrent().getContextPath(), "rp",
|
||||||
SessionManager.getAppDesktop().getComponent().getUuid()));
|
SessionManager.getAppDesktop().getComponent().getUuid()));
|
||||||
AMedia media = new AMedia(re.getName(), "html", "text/html", file, false);
|
return new AMedia(re.getName(), "html", "text/html", file, false);
|
||||||
iframe.setContent(media);
|
|
||||||
parent.appendChild(iframe);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void openReportInViewer(int AD_Process_ID, String parameters) {
|
protected void openReportInViewer(int AD_Process_ID, String parameters) {
|
||||||
|
|
Loading…
Reference in New Issue