Search in sources :

Example 1 with JasperReportSchedulerWindow

use of au.com.vaadinutils.jasper.scheduler.JasperReportSchedulerWindow in project VaadinUtils by rlsutton1.

the class JasperReportLayout method createScheduleButton.

private void createScheduleButton(String buttonHeight, HorizontalLayout buttonContainer) {
    scheduleButton = new Button();
    Resource scheduleButtonIcon = reportProperties.getScheduleButtonIconResource();
    if (scheduleButtonIcon == null) {
        scheduleButtonIcon = new ExternalResource("images/seanau/Call Calendar_32.png");
    }
    // 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/");
    // 
    // // HACK: scoutmaster stores images in a different directory so if the
    // // images isn't found in the above templates directory
    // // 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.setIcon(scheduleButtonIcon);
    scheduleButton.setDescription("Schedule");
    scheduleButton.setWidth("" + BUTTON_WIDTH);
    scheduleButton.setHeight(buttonHeight);
    scheduleButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    scheduleButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    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);
}
Also used : JasperReportSchedulerWindow(au.com.vaadinutils.jasper.scheduler.JasperReportSchedulerWindow) ClickEventLogged(au.com.vaadinutils.listener.ClickEventLogged) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) ExternalResource(com.vaadin.server.ExternalResource) StreamResource(com.vaadin.server.StreamResource) Resource(com.vaadin.server.Resource) ExternalResource(com.vaadin.server.ExternalResource)

Aggregations

JasperReportSchedulerWindow (au.com.vaadinutils.jasper.scheduler.JasperReportSchedulerWindow)1 ClickEventLogged (au.com.vaadinutils.listener.ClickEventLogged)1 ExternalResource (com.vaadin.server.ExternalResource)1 Resource (com.vaadin.server.Resource)1 StreamResource (com.vaadin.server.StreamResource)1 Button (com.vaadin.ui.Button)1 ClickEvent (com.vaadin.ui.Button.ClickEvent)1