Java Code Examples for com.vaadin.ui.DateField#setValue()
The following examples show how to use
com.vaadin.ui.DateField#setValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActionTypeOptionGroupAssignmentLayout.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
private void addAutoForceItemWithLabelAndDateField() { final FlexibleOptionGroupItemComponent autoForceItem = actionTypeOptionGroup .getItemComponent(ActionTypeOption.AUTO_FORCED); autoForceItem.setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE); autoForceItem.setId(UIComponentIdProvider.ACTION_TYPE_OPTION_GROUP_SAVE_TIMEFORCED); addComponent(autoForceItem); final Label autoForceLabel = new Label(); autoForceLabel.setStyleName("statusIconPending"); autoForceLabel.setIcon(FontAwesome.HISTORY); autoForceLabel.setCaption(i18n.getMessage(UIMessageIdProvider.CAPTION_ACTION_TIME_FORCED)); autoForceLabel.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_TIMEFORCED_ITEM)); autoForceLabel.setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE); addComponent(autoForceLabel); forcedTimeDateField = new DateField(); forcedTimeDateField.setInvalidAllowed(false); forcedTimeDateField.setInvalidCommitted(false); forcedTimeDateField.setEnabled(false); forcedTimeDateField.setStyleName("dist-window-forcedtime"); final TimeZone tz = SPDateTimeUtil.getBrowserTimeZone(); forcedTimeDateField.setValue( Date.from(LocalDateTime.now().plusWeeks(2).atZone(SPDateTimeUtil.getTimeZoneId(tz)).toInstant())); forcedTimeDateField.setImmediate(true); forcedTimeDateField.setTimeZone(tz); forcedTimeDateField.setLocale(HawkbitCommonUtil.getCurrentLocale()); forcedTimeDateField.setResolution(Resolution.MINUTE); forcedTimeDateField.addStyleName(ValoTheme.DATEFIELD_SMALL); addComponent(forcedTimeDateField); }
Example 2
Source File: AutoStartOptionGroupLayout.java From hawkbit with Eclipse Public License 1.0 | 4 votes |
private void createOptionGroup() { autoStartOptionGroup = new FlexibleOptionGroup(); autoStartOptionGroup.addItem(AutoStartOption.MANUAL); autoStartOptionGroup.addItem(AutoStartOption.AUTO_START); autoStartOptionGroup.addItem(AutoStartOption.SCHEDULED); selectDefaultOption(); final FlexibleOptionGroupItemComponent manualItem = autoStartOptionGroup .getItemComponent(AutoStartOption.MANUAL); manualItem.setStyleName(STYLE_DIST_WINDOW_AUTO_START); // set Id for Forced radio button. manualItem.setId(UIComponentIdProvider.ROLLOUT_START_MANUAL_ID); addComponent(manualItem); final Label manualLabel = new Label(); manualLabel.setStyleName("statusIconPending"); manualLabel.setIcon(FontAwesome.HAND_PAPER_O); manualLabel.setCaption(i18n.getMessage("caption.rollout.start.manual")); manualLabel.setDescription(i18n.getMessage("caption.rollout.start.manual.desc")); manualLabel.setStyleName("padding-right-style"); addComponent(manualLabel); final FlexibleOptionGroupItemComponent autoStartItem = autoStartOptionGroup .getItemComponent(AutoStartOption.AUTO_START); autoStartItem.setId(UIComponentIdProvider.ROLLOUT_START_AUTO_ID); autoStartItem.setStyleName(STYLE_DIST_WINDOW_AUTO_START); addComponent(autoStartItem); final Label autoStartLabel = new Label(); autoStartLabel.setSizeFull(); autoStartLabel.setIcon(FontAwesome.PLAY); autoStartLabel.setCaption(i18n.getMessage("caption.rollout.start.auto")); autoStartLabel.setDescription(i18n.getMessage("caption.rollout.start.auto.desc")); autoStartLabel.setStyleName("padding-right-style"); addComponent(autoStartLabel); final FlexibleOptionGroupItemComponent scheduledItem = autoStartOptionGroup .getItemComponent(AutoStartOption.SCHEDULED); scheduledItem.setStyleName(STYLE_DIST_WINDOW_AUTO_START); // setted Id for Time Forced radio button. scheduledItem.setId(UIComponentIdProvider.ROLLOUT_START_SCHEDULED_ID); addComponent(scheduledItem); final Label scheduledLabel = new Label(); scheduledLabel.setStyleName("statusIconPending"); scheduledLabel.setIcon(FontAwesome.CLOCK_O); scheduledLabel.setCaption(i18n.getMessage("caption.rollout.start.scheduled")); scheduledLabel.setDescription(i18n.getMessage("caption.rollout.start.scheduled.desc")); scheduledLabel.setStyleName(STYLE_DIST_WINDOW_AUTO_START); addComponent(scheduledLabel); startAtDateField = new DateField(); startAtDateField.setInvalidAllowed(false); startAtDateField.setInvalidCommitted(false); startAtDateField.setEnabled(false); startAtDateField.setStyleName("dist-window-forcedtime"); final TimeZone tz = SPDateTimeUtil.getBrowserTimeZone(); startAtDateField.setValue( Date.from(LocalDateTime.now().plusMinutes(30).atZone(SPDateTimeUtil.getTimeZoneId(tz)).toInstant())); startAtDateField.setImmediate(true); startAtDateField.setTimeZone(tz); startAtDateField.setLocale(HawkbitCommonUtil.getCurrentLocale()); startAtDateField.setResolution(Resolution.MINUTE); startAtDateField.addStyleName(ValoTheme.DATEFIELD_SMALL); addComponent(startAtDateField); }