Search in sources :

Example 1 with NativeButton

use of com.vaadin.ui.NativeButton 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);
}
Also used : NativeButton(com.vaadin.ui.NativeButton) JasperReportSchedulerWindow(au.com.vaadinutils.jasper.scheduler.JasperReportSchedulerWindow) ClickEventLogged(au.com.vaadinutils.listener.ClickEventLogged) ScheduleIconBuilder(au.com.vaadinutils.jasper.scheduler.ScheduleIconBuilder) ClickEvent(com.vaadin.ui.Button.ClickEvent) ReportEmailScheduleEntity(au.com.vaadinutils.jasper.scheduler.entities.ReportEmailScheduleEntity) ExternalResource(com.vaadin.server.ExternalResource) File(java.io.File)

Example 2 with NativeButton

use of com.vaadin.ui.NativeButton in project VaadinUtils by rlsutton1.

the class TimePicker method addHourButtons.

protected void addHourButtons(HorizontalLayout hourButtonPanel, int rows, int cols) {
    int[] numbers = new int[] { 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
    for (int col = 0; col < cols; col++) {
        VerticalLayout rowsLayout = new VerticalLayout();
        for (int row = 0; row < rows; row++) {
            final NativeButton button = new NativeButton("" + numbers[col + (row * cols)]);
            rowsLayout.addComponent(button);
            button.setStyleName(Reindeer.BUTTON_SMALL);
            button.setWidth("30");
            button.addClickListener(new ClickListener() {

                /**
                 */
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    int hourToSet = Integer.parseInt(button.getCaption());
                    hourToSet %= 12;
                    if (dateTime.get(Calendar.HOUR_OF_DAY) >= 12) {
                        hourToSet += 12;
                    }
                    dateTime.set(Calendar.HOUR_OF_DAY, hourToSet);
                    isSet = true;
                    setNewValue();
                }
            });
        }
        hourButtonPanel.addComponent(rowsLayout);
    }
}
Also used : NativeButton(com.vaadin.ui.NativeButton) ClickEvent(com.vaadin.ui.Button.ClickEvent) VerticalLayout(com.vaadin.ui.VerticalLayout) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 3 with NativeButton

use of com.vaadin.ui.NativeButton in project VaadinUtils by rlsutton1.

the class TimePicker method addAmPmButtons.

protected void addAmPmButtons(VerticalLayout amPmButtonPanel) {
    final NativeButton am = new NativeButton("AM");
    final NativeButton pm = new NativeButton("PM");
    amPmButtonPanel.addComponent(am);
    amPmButtonPanel.addComponent(pm);
    am.setStyleName(Reindeer.BUTTON_SMALL);
    am.setWidth("35");
    am.addClickListener(new ClickListener() {

        /**
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            dateTime.set(Calendar.AM_PM, Calendar.AM);
            isSet = true;
            setNewValue();
        }
    });
    pm.setStyleName(Reindeer.BUTTON_SMALL);
    pm.setWidth("35");
    pm.addClickListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            dateTime.set(Calendar.AM_PM, Calendar.PM);
            isSet = true;
            setNewValue();
        }
    });
}
Also used : NativeButton(com.vaadin.ui.NativeButton) ClickEvent(com.vaadin.ui.Button.ClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 4 with NativeButton

use of com.vaadin.ui.NativeButton in project VaadinUtils by rlsutton1.

the class TimePicker24 method addHourButtons.

private void addHourButtons(HorizontalLayout hourButtonPanel, int rows, int cols) {
    int[] numbers = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 };
    for (int col = 0; col < cols; col++) {
        VerticalLayout rowsLayout = new VerticalLayout();
        for (int row = 0; row < rows; row++) {
            final NativeButton button = new NativeButton("" + numbers[col + (row * cols)]);
            rowsLayout.addComponent(button);
            button.setStyleName(Reindeer.BUTTON_SMALL);
            button.setWidth("30");
            // button.setHeight("15");
            // button.setAutoFit(false);
            // button.setActionType(SelectionType.RADIO);
            // button.addToRadioGroup("hourButtons");
            // if (row == 0 && col == 0)
            // {
            // zeroHourButton = button;
            // 
            // }
            button.addClickListener(new ClickListener() {

                /**
                 */
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    String title = button.getCaption();
                    hour = title;
                    isSet = true;
                    amPm = AM;
                    if (Integer.parseInt(hour) > 11) {
                        amPm = PM;
                    }
                    setNewValue();
                }
            });
        }
        hourButtonPanel.addComponent(rowsLayout);
    }
}
Also used : NativeButton(com.vaadin.ui.NativeButton) ClickEvent(com.vaadin.ui.Button.ClickEvent) VerticalLayout(com.vaadin.ui.VerticalLayout) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 5 with NativeButton

use of com.vaadin.ui.NativeButton in project VaadinUtils by rlsutton1.

the class JasperReportLayout method createEmailButton.

private void createEmailButton(String buttonHeight, HorizontalLayout buttonContainer) {
    emailButton = new NativeButton();
    emailButton.setIcon(new ExternalResource("images/seanau/Send Email_32.png"));
    emailButton.setDescription("Email");
    emailButton.setWidth("50");
    emailButton.setHeight(buttonHeight);
    emailButton.addClickListener(new ClickEventLogged.ClickListener() {

        private static final long serialVersionUID = 7207441556779172217L;

        @Override
        public void clicked(ClickEvent event) {
            new JasperReportEmailWindow(reportProperties, builder.getReportParameters());
        }
    });
    buttonContainer.addComponent(emailButton);
}
Also used : NativeButton(com.vaadin.ui.NativeButton) ClickEventLogged(au.com.vaadinutils.listener.ClickEventLogged) ClickEvent(com.vaadin.ui.Button.ClickEvent) JasperReportEmailWindow(au.com.vaadinutils.jasper.scheduler.JasperReportEmailWindow) ExternalResource(com.vaadin.server.ExternalResource)

Aggregations

NativeButton (com.vaadin.ui.NativeButton)9 ClickEvent (com.vaadin.ui.Button.ClickEvent)7 VerticalLayout (com.vaadin.ui.VerticalLayout)6 ClickListener (com.vaadin.ui.Button.ClickListener)5 ExternalResource (com.vaadin.server.ExternalResource)4 ClickEventLogged (au.com.vaadinutils.listener.ClickEventLogged)2 HorizontalLayout (com.vaadin.ui.HorizontalLayout)2 Label (com.vaadin.ui.Label)2 ExpanderComponent (au.com.vaadinutils.jasper.filter.ExpanderComponent)1 JasperReportEmailWindow (au.com.vaadinutils.jasper.scheduler.JasperReportEmailWindow)1 JasperReportSchedulerWindow (au.com.vaadinutils.jasper.scheduler.JasperReportSchedulerWindow)1 ScheduleIconBuilder (au.com.vaadinutils.jasper.scheduler.ScheduleIconBuilder)1 ReportEmailScheduleEntity (au.com.vaadinutils.jasper.scheduler.entities.ReportEmailScheduleEntity)1 InvalidValueException (com.vaadin.data.Validator.InvalidValueException)1 BeanFieldGroup (com.vaadin.data.fieldgroup.BeanFieldGroup)1 StringLengthValidator (com.vaadin.data.validator.StringLengthValidator)1 MarginInfo (com.vaadin.shared.ui.MarginInfo)1 BrowserFrame (com.vaadin.ui.BrowserFrame)1 Button (com.vaadin.ui.Button)1 CheckBox (com.vaadin.ui.CheckBox)1