I am trying to execute the report when the link on Menu is clicked.
To achieve this I am using the rptGuiMgr.printReport(r,reportParams);
in init Method of a Blank screen.
But my problem is when the report is loaded, a blank screen is displayed.
Calling close method within init is not working.
Hi Mario,
Thanks for a quick response.
I had tried extending then Runnable class. But the dataservice variable is not getting instantiated inside this class, hence i am not able to execute the printReport.
Also, since the Bean will not be able to access the web components I am not able to use the ReportGuiManager object inside the Bean.
Runnable class is not a Spring bean, so injection doesn’t work there.
If you need to get an instance of DataService (or other service or other Spring bean) in any class outside of Screen controller’s code or Spring beans’s code - you need to use AppBeans.get() method:
in the web module a class (Directreportlink.java) is created that implements Runnable:
A service method is returning the Report Object which is consumed , customService.getReport(rptName);
public class Directreportlink implements Runnable {
protected ReportGuiManager rptGuiMgr = AppBeans.get(ReportGuiManager.class);
protected CustomService customService = AppBeans.get(CustomService.class);
@Override
public void run() {
String rpt_name = "Report_Name";
fetchAndDisplayReport(rpt_name);
}
public void fetchAndDisplayReport(String rptName)
{
Map<String, Object> reportParams = new HashMap<>();
Report r = customService.getReport(rptName);
if(r!=null){
rptGuiMgr.printReport(r, reportParams);
}
else
{
System.out.println("Printing:Some Error Occured");
}
}
}