use of au.com.vaadinutils.jasper.scheduler.ScheduleIconBuilder in project VaadinUtils by rlsutton1.
the class JasperReportLayout method createScheduleButton.
private void createScheduleButton(String buttonHeight, HorizontalLayout buttonContainer) {
scheduleButton = new NativeButton();
JpaBaseDao<ReportEmailScheduleEntity, Long> dao = JpaBaseDao.getGenericDao(ReportEmailScheduleEntity.class);
Long count = dao.getCount(ReportEmailScheduleEntity_.JasperReportPropertiesClassName, reportProperties.getReportClass().getCanonicalName());
ScheduleIconBuilder iconBuilder = new ScheduleIconBuilder();
String baseIconFileName = "Call Calendar_32";
String path = VaadinServlet.getCurrent().getServletContext().getRealPath("templates/images/seanau/");
// then search in the /images/seanau director.
if (path == null || !new File(path).exists()) {
path = VaadinServlet.getCurrent().getServletContext().getRealPath("/images/seanau/");
}
String targetFileName = baseIconFileName + "-" + count + ".png";
iconBuilder.buildLogo(count.intValue(), new File(path), baseIconFileName + ".png", targetFileName);
scheduleButton.setIcon(new ExternalResource("images/seanau/" + targetFileName));
scheduleButton.setDescription("Schedule");
scheduleButton.setWidth("50");
scheduleButton.setHeight(buttonHeight);
scheduleButton.addClickListener(new ClickEventLogged.ClickListener() {
private static final long serialVersionUID = 7207441556779172217L;
@Override
public void clicked(ClickEvent event) {
new JasperReportSchedulerWindow(reportProperties, builder.getReportParameters());
}
});
buttonContainer.addComponent(scheduleButton);
}
Aggregations