Search in sources :

Example 31 with TimePicker

use of com.vaadin.flow.component.timepicker.TimePicker in project flow-components by vaadin.

the class TimePickerPage method createTimePickerFromRenderer.

private void createTimePickerFromRenderer() {
    ComponentRenderer<TimePicker, TimePickerPage> renderer = new ComponentRenderer<>(() -> {
        TimePicker timePicker = new TimePicker();
        timePicker.setValue(LocalTime.now());
        return timePicker;
    });
    renderer.render(getElement(), null);
}
Also used : TimePicker(com.vaadin.flow.component.timepicker.TimePicker) ComponentRenderer(com.vaadin.flow.data.renderer.ComponentRenderer)

Example 32 with TimePicker

use of com.vaadin.flow.component.timepicker.TimePicker in project flow-components by vaadin.

the class TimePickerPage method createDefaultTimePicker.

private void createDefaultTimePicker() {
    Div message = createMessageDiv("simple-picker-message");
    TimePicker timePicker = new TimePicker();
    timePicker.setId("simple-picker");
    timePicker.setLabel("Default TimePicker");
    timePicker.addValueChangeListener(event -> updateMessage(message, timePicker));
    add(timePicker, message);
}
Also used : Div(com.vaadin.flow.component.html.Div) TimePicker(com.vaadin.flow.component.timepicker.TimePicker)

Example 33 with TimePicker

use of com.vaadin.flow.component.timepicker.TimePicker in project flow-components by vaadin.

the class TimePickerPage method createHelperText.

private void createHelperText() {
    TimePicker timePickerHelperText = new TimePicker();
    timePickerHelperText.setId("time-picker-helper-text");
    timePickerHelperText.setHelperText("Helper text");
    NativeButton clearHelper = new NativeButton("Clear helper text", e -> {
        timePickerHelperText.setHelperText(null);
    });
    clearHelper.setId("button-clear-helper-text");
    add(timePickerHelperText, clearHelper);
}
Also used : TimePicker(com.vaadin.flow.component.timepicker.TimePicker) NativeButton(com.vaadin.flow.component.html.NativeButton)

Example 34 with TimePicker

use of com.vaadin.flow.component.timepicker.TimePicker in project flow-components by vaadin.

the class TimePickerPage method createTimePickerWithMinAndMaxSetting.

private void createTimePickerWithMinAndMaxSetting() {
    Div message = createMessageDiv("time-picker-min-max-message");
    TimePicker timePicker = new TimePicker();
    timePicker.setLabel("TimePicker Min & Max");
    timePicker.setMin(LocalTime.of(5, 0));
    timePicker.setMax(LocalTime.of(18, 0));
    timePicker.addValueChangeListener(event -> updateMessage(message, timePicker));
    timePicker.setId("time-picker-min-max");
    add(timePicker, message);
}
Also used : Div(com.vaadin.flow.component.html.Div) TimePicker(com.vaadin.flow.component.timepicker.TimePicker)

Example 35 with TimePicker

use of com.vaadin.flow.component.timepicker.TimePicker in project flow-components by vaadin.

the class TimePickerPage method createDisabledTimePicker.

private void createDisabledTimePicker() {
    Div message = createMessageDiv("disabled-picker-message");
    TimePicker timePicker = new TimePicker();
    timePicker.setEnabled(false);
    timePicker.setLabel("Disabled TimePicker");
    timePicker.addValueChangeListener(event -> message.setText("This event should not have happened"));
    timePicker.setId("disabled-picker");
    add(timePicker, message);
}
Also used : Div(com.vaadin.flow.component.html.Div) TimePicker(com.vaadin.flow.component.timepicker.TimePicker)

Aggregations

TimePicker (com.vaadin.flow.component.timepicker.TimePicker)35 Test (org.junit.Test)23 GeneratedVaadinTimePicker (com.vaadin.flow.component.timepicker.GeneratedVaadinTimePicker)20 Div (com.vaadin.flow.component.html.Div)5 NativeButton (com.vaadin.flow.component.html.NativeButton)3 LocalTime (java.time.LocalTime)3 Checkbox (com.vaadin.flow.component.checkbox.Checkbox)2 DatePicker (com.vaadin.flow.component.datepicker.DatePicker)2 Span (com.vaadin.flow.component.html.Span)2 TextField (com.vaadin.flow.component.textfield.TextField)2 Duration (java.time.Duration)2 Locale (java.util.Locale)2 HasLabel (com.vaadin.flow.component.HasLabel)1 ComboBox (com.vaadin.flow.component.combobox.ComboBox)1 FormLayout (com.vaadin.flow.component.formlayout.FormLayout)1 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)1 RichTextEditor (com.vaadin.flow.component.richtexteditor.RichTextEditor)1 Select (com.vaadin.flow.component.select.Select)1 IntegerField (com.vaadin.flow.component.textfield.IntegerField)1 Binder (com.vaadin.flow.data.binder.Binder)1