Search in sources :

Example 6 with NativeButton

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

the class JasperReportLayout method getOptionsPanel.

private Component getOptionsPanel() {
    VerticalLayout layout = new VerticalLayout();
    layout.setId("OptionsPanel");
    // layout.setMargin(new MarginInfo(false, false, false, false));
    // layout.setSpacing(true);
    layout.setSizeFull();
    String buttonHeight = "" + 40;
    HorizontalLayout buttonBar = new HorizontalLayout();
    buttonBar.setSpacing(true);
    buttonBar.setStyleName(Reindeer.LAYOUT_BLUE);
    buttonBar.setWidth("100%");
    buttonBar.setHeight(buttonHeight);
    buttonBar.setMargin(new MarginInfo(false, false, false, false));
    HorizontalLayout buttonContainer = new HorizontalLayout();
    buttonContainer.setSizeFull();
    buttonContainer.setWidth("230");
    showButton = new NativeButton();
    showButton.setIcon(new ExternalResource("images/seanau/Print preview.png"));
    showButton.setDescription("Preview");
    showButton.setWidth("50");
    showButton.setHeight(buttonHeight);
    showButton.setDisableOnClick(true);
    addButtonListener(showButton, OutputFormat.HTML);
    buttonContainer.addComponent(showButton);
    printButton = new NativeButton();
    printButton.setIcon(new ExternalResource("images/seanau/Print_32.png"));
    printButton.setDescription("Print (PDF)");
    printButton.setWidth("50");
    printButton.setHeight(buttonHeight);
    printButton.setDisableOnClick(true);
    addButtonListener(printButton, OutputFormat.PDF);
    buttonContainer.addComponent(printButton);
    exportButton = new NativeButton();
    exportButton.setDescription("Export (Excel - CSV)");
    exportButton.setIcon(new ExternalResource("images/exporttoexcel.png"));
    exportButton.setWidth("50");
    exportButton.setDisableOnClick(true);
    exportButton.setHeight(buttonHeight);
    // exportButton.setStyleName(Reindeer.BUTTON_LINK);
    addButtonListener(exportButton, OutputFormat.CSV);
    buttonContainer.addComponent(exportButton);
    createEmailButton(buttonHeight, buttonContainer);
    createScheduleButton(buttonHeight, buttonContainer);
    if (reportProperties instanceof JasperReportPopUp) {
        // This is disabled because there are serious problems with
        // transient (JasperReportProperties is not aware of them)
        // parameters in drill
        // downs, these can not currently be save or represented in the
        // ReportEmailSchedule
        emailButton.setEnabled(false);
        scheduleButton.setEnabled(false);
    }
    buttonBar.addComponent(buttonContainer);
    layout.addComponent(buttonBar);
    components = builder.buildLayout(false);
    if (components.size() > 0) {
        VerticalLayout filterPanel = new VerticalLayout();
        filterPanel.setMargin(new MarginInfo(false, false, true, false));
        filterPanel.setSpacing(true);
        filterPanel.setSizeFull();
        Label filterLabel = new Label("<b>Filters</b>");
        filterLabel.setStyleName(Reindeer.LABEL_H2);
        filterLabel.setContentMode(ContentMode.HTML);
        filterPanel.addComponent(filterLabel);
        for (ExpanderComponent componet : components) {
            filterPanel.addComponent(componet.getComponent());
            if (componet.shouldExpand()) {
                filterPanel.setExpandRatio(componet.getComponent(), 1);
            }
        }
        layout.addComponent(filterPanel);
        layout.setExpandRatio(filterPanel, 1.0f);
    }
    // hidden frame for downloading csv
    csv = new BrowserFrame();
    csv.setVisible(true);
    csv.setHeight("1");
    csv.setWidth("1");
    csv.setImmediate(true);
    layout.addComponent(csv);
    return layout;
}
Also used : NativeButton(com.vaadin.ui.NativeButton) ExpanderComponent(au.com.vaadinutils.jasper.filter.ExpanderComponent) BrowserFrame(com.vaadin.ui.BrowserFrame) MarginInfo(com.vaadin.shared.ui.MarginInfo) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) ExternalResource(com.vaadin.server.ExternalResource) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 7 with NativeButton

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

the class TimePicker method addMinuteButtons.

protected void addMinuteButtons(HorizontalLayout minuteButtonPanel, int rows, int cols) {
    String[] numbers = new String[] { "00", "10", "15", "20", "30", "40", "45", "50" };
    for (int col = 0; col < cols; col++) {
        VerticalLayout rowsLayout = new VerticalLayout();
        for (int row = 0; row < rows; row++) {
            final NativeButton button = new NativeButton("" + numbers[row + (col * rows)]);
            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) {
                    String title = button.getCaption();
                    dateTime.set(Calendar.MINUTE, Integer.parseInt(title));
                    isSet = true;
                    setNewValue();
                }
            });
        }
        minuteButtonPanel.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 8 with NativeButton

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

the class TimePicker24 method addMinuteButtons.

private void addMinuteButtons(HorizontalLayout minuteButtonPanel, int rows, int cols) {
    String[] numbers = new String[] { "00", "10", "15", "20", "30", "40", "45", "50" };
    for (int col = 0; col < cols; col++) {
        VerticalLayout rowsLayout = new VerticalLayout();
        for (int row = 0; row < rows; row++) {
            final NativeButton button = new NativeButton("" + numbers[row + (col * rows)]);
            rowsLayout.addComponent(button);
            button.setStyleName(Reindeer.BUTTON_SMALL);
            button.setWidth("30");
            // button.setHeight("30");
            // button.setAutoFit(false);
            // button.setActionType(SelectionType.RADIO);
            // button.addToRadioGroup("minuteButtons");
            // if (row == 0 && col == 0)
            // {
            // zeroMinuteButton = button;
            // 
            // }
            button.addClickListener(new ClickListener() {

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

                @Override
                public void buttonClick(ClickEvent event) {
                    String title = button.getCaption();
                    minute = title;
                    isSet = true;
                    setNewValue();
                }
            });
        }
        minuteButtonPanel.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 9 with NativeButton

use of com.vaadin.ui.NativeButton in project tutorials by eugenp.

the class VaadinUI method init.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected void init(VaadinRequest vaadinRequest) {
    final VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setSpacing(true);
    verticalLayout.setMargin(true);
    final GridLayout gridLayout = new GridLayout(3, 2);
    gridLayout.setSpacing(true);
    gridLayout.setMargin(true);
    final HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setSpacing(true);
    horizontalLayout.setMargin(true);
    final FormLayout formLayout = new FormLayout();
    formLayout.setSpacing(true);
    formLayout.setMargin(true);
    final GridLayout buttonLayout = new GridLayout(3, 5);
    buttonLayout.setMargin(true);
    buttonLayout.setSpacing(true);
    final Label label = new Label();
    label.setId("Label");
    label.setValue("Label Value");
    label.setCaption("Label");
    gridLayout.addComponent(label);
    final Link link = new Link("Baeldung", new ExternalResource("http://www.baeldung.com/"));
    link.setId("Link");
    link.setTargetName("_blank");
    gridLayout.addComponent(link);
    final TextField textField = new TextField();
    textField.setId("TextField");
    textField.setCaption("TextField:");
    textField.setValue("TextField Value");
    textField.setIcon(FontAwesome.USER);
    gridLayout.addComponent(textField);
    final TextArea textArea = new TextArea();
    textArea.setCaption("TextArea");
    textArea.setId("TextArea");
    textArea.setValue("TextArea Value");
    gridLayout.addComponent(textArea);
    final DateField dateField = new DateField("DateField", new Date(0));
    dateField.setId("DateField");
    gridLayout.addComponent(dateField);
    final PasswordField passwordField = new PasswordField();
    passwordField.setId("PasswordField");
    passwordField.setCaption("PasswordField:");
    passwordField.setValue("password");
    gridLayout.addComponent(passwordField);
    final RichTextArea richTextArea = new RichTextArea();
    richTextArea.setCaption("Rich Text Area");
    richTextArea.setValue("<h1>RichTextArea</h1>");
    richTextArea.setSizeFull();
    Panel richTextPanel = new Panel();
    richTextPanel.setContent(richTextArea);
    final InlineDateField inlineDateField = new InlineDateField();
    inlineDateField.setValue(new Date(0));
    inlineDateField.setCaption("Inline Date Field");
    horizontalLayout.addComponent(inlineDateField);
    Button normalButton = new Button("Normal Button");
    normalButton.setId("NormalButton");
    normalButton.addClickListener(e -> {
        label.setValue("CLICK");
    });
    buttonLayout.addComponent(normalButton);
    Button tinyButton = new Button("Tiny Button");
    tinyButton.addStyleName("tiny");
    buttonLayout.addComponent(tinyButton);
    Button smallButton = new Button("Small Button");
    smallButton.addStyleName("small");
    buttonLayout.addComponent(smallButton);
    Button largeButton = new Button("Large Button");
    largeButton.addStyleName("large");
    buttonLayout.addComponent(largeButton);
    Button hugeButton = new Button("Huge Button");
    hugeButton.addStyleName("huge");
    buttonLayout.addComponent(hugeButton);
    Button disabledButton = new Button("Disabled Button");
    disabledButton.setDescription("This button cannot be clicked");
    disabledButton.setEnabled(false);
    buttonLayout.addComponent(disabledButton);
    Button dangerButton = new Button("Danger Button");
    dangerButton.addStyleName("danger");
    buttonLayout.addComponent(dangerButton);
    Button friendlyButton = new Button("Friendly Button");
    friendlyButton.addStyleName("friendly");
    buttonLayout.addComponent(friendlyButton);
    Button primaryButton = new Button("Primary Button");
    primaryButton.addStyleName("primary");
    buttonLayout.addComponent(primaryButton);
    NativeButton nativeButton = new NativeButton("Native Button");
    buttonLayout.addComponent(nativeButton);
    Button iconButton = new Button("Icon Button");
    iconButton.setIcon(FontAwesome.ALIGN_LEFT);
    buttonLayout.addComponent(iconButton);
    Button borderlessButton = new Button("BorderLess Button");
    borderlessButton.addStyleName("borderless");
    buttonLayout.addComponent(borderlessButton);
    Button linkButton = new Button("Link Button");
    linkButton.addStyleName("link");
    buttonLayout.addComponent(linkButton);
    Button quietButton = new Button("Quiet Button");
    quietButton.addStyleName("quiet");
    buttonLayout.addComponent(quietButton);
    horizontalLayout.addComponent(buttonLayout);
    final CheckBox checkbox = new CheckBox("CheckBox");
    checkbox.setValue(true);
    checkbox.addValueChangeListener(e -> checkbox.setValue(!checkbox.getValue()));
    formLayout.addComponent(checkbox);
    List<String> numbers = new ArrayList<String>();
    numbers.add("One");
    numbers.add("Ten");
    numbers.add("Eleven");
    ComboBox comboBox = new ComboBox("ComboBox");
    comboBox.addItems(numbers);
    formLayout.addComponent(comboBox);
    ListSelect listSelect = new ListSelect("ListSelect");
    listSelect.addItems(numbers);
    listSelect.setRows(2);
    formLayout.addComponent(listSelect);
    NativeSelect nativeSelect = new NativeSelect("NativeSelect");
    nativeSelect.addItems(numbers);
    formLayout.addComponent(nativeSelect);
    TwinColSelect twinColSelect = new TwinColSelect("TwinColSelect");
    twinColSelect.addItems(numbers);
    Grid grid = new Grid("Grid");
    grid.setColumns("Column1", "Column2", "Column3");
    grid.addRow("Item1", "Item2", "Item3");
    grid.addRow("Item4", "Item5", "Item6");
    Panel panel = new Panel("Panel");
    panel.setContent(grid);
    panel.setSizeUndefined();
    Panel serverPushPanel = new Panel("Server Push");
    FormLayout timeLayout = new FormLayout();
    timeLayout.setSpacing(true);
    timeLayout.setMargin(true);
    currentTime = new Label("No TIME...");
    timeLayout.addComponent(currentTime);
    serverPushPanel.setContent(timeLayout);
    serverPushPanel.setSizeUndefined();
    ScheduledExecutorService scheduleExecutor = Executors.newScheduledThreadPool(1);
    Runnable task = () -> {
        currentTime.setValue("Current Time : " + Instant.now());
    };
    scheduleExecutor.scheduleWithFixedDelay(task, 0, 1, TimeUnit.SECONDS);
    FormLayout dataBindingLayout = new FormLayout();
    dataBindingLayout.setSpacing(true);
    dataBindingLayout.setMargin(true);
    BindData bindData = new BindData("BindData");
    BeanFieldGroup beanFieldGroup = new BeanFieldGroup(BindData.class);
    beanFieldGroup.setItemDataSource(bindData);
    TextField bindedTextField = (TextField) beanFieldGroup.buildAndBind("BindName", "bindName");
    bindedTextField.setWidth("250px");
    dataBindingLayout.addComponent(bindedTextField);
    FormLayout validatorLayout = new FormLayout();
    validatorLayout.setSpacing(true);
    validatorLayout.setMargin(true);
    HorizontalLayout textValidatorLayout = new HorizontalLayout();
    textValidatorLayout.setSpacing(true);
    textValidatorLayout.setMargin(true);
    TextField stringValidator = new TextField();
    stringValidator.setNullSettingAllowed(true);
    stringValidator.setNullRepresentation("");
    stringValidator.addValidator(new StringLengthValidator("String must have 2-5 characters lenght", 2, 5, true));
    stringValidator.setValidationVisible(false);
    textValidatorLayout.addComponent(stringValidator);
    Button buttonStringValidator = new Button("Validate String");
    buttonStringValidator.addClickListener(e -> {
        try {
            stringValidator.setValidationVisible(false);
            stringValidator.validate();
        } catch (InvalidValueException err) {
            stringValidator.setValidationVisible(true);
        }
    });
    textValidatorLayout.addComponent(buttonStringValidator);
    validatorLayout.addComponent(textValidatorLayout);
    verticalLayout.addComponent(gridLayout);
    verticalLayout.addComponent(richTextPanel);
    verticalLayout.addComponent(horizontalLayout);
    verticalLayout.addComponent(formLayout);
    verticalLayout.addComponent(twinColSelect);
    verticalLayout.addComponent(panel);
    verticalLayout.addComponent(serverPushPanel);
    verticalLayout.addComponent(dataBindingLayout);
    verticalLayout.addComponent(validatorLayout);
    setContent(verticalLayout);
}
Also used : NativeButton(com.vaadin.ui.NativeButton) BeanFieldGroup(com.vaadin.data.fieldgroup.BeanFieldGroup) InlineDateField(com.vaadin.ui.InlineDateField) TextArea(com.vaadin.ui.TextArea) RichTextArea(com.vaadin.ui.RichTextArea) Grid(com.vaadin.ui.Grid) Label(com.vaadin.ui.Label) ArrayList(java.util.ArrayList) TwinColSelect(com.vaadin.ui.TwinColSelect) HorizontalLayout(com.vaadin.ui.HorizontalLayout) InvalidValueException(com.vaadin.data.Validator.InvalidValueException) RichTextArea(com.vaadin.ui.RichTextArea) GridLayout(com.vaadin.ui.GridLayout) NativeButton(com.vaadin.ui.NativeButton) Button(com.vaadin.ui.Button) VerticalLayout(com.vaadin.ui.VerticalLayout) TextField(com.vaadin.ui.TextField) PasswordField(com.vaadin.ui.PasswordField) FormLayout(com.vaadin.ui.FormLayout) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ComboBox(com.vaadin.ui.ComboBox) StringLengthValidator(com.vaadin.data.validator.StringLengthValidator) ListSelect(com.vaadin.ui.ListSelect) ExternalResource(com.vaadin.server.ExternalResource) Date(java.util.Date) Panel(com.vaadin.ui.Panel) CheckBox(com.vaadin.ui.CheckBox) NativeSelect(com.vaadin.ui.NativeSelect) InlineDateField(com.vaadin.ui.InlineDateField) DateField(com.vaadin.ui.DateField) Link(com.vaadin.ui.Link)

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