本文整理汇总了Java中com.vaadin.ui.DateField.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java DateField.setValue方法的具体用法?Java DateField.setValue怎么用?Java DateField.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.DateField
的用法示例。
在下文中一共展示了DateField.setValue方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildEntryForm
import com.vaadin.ui.DateField; //导入方法依赖的package包/类
protected FormLayout buildEntryForm() {
FormLayout form = new FormLayout();
form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
form.setMargin(true);
nameField = new TextField("Name");
nameField.setValue(releasePackage.getName() != null ? releasePackage.getName() : "");
nameField.setReadOnly(releasePackage.isReleased());
form.addComponent(nameField);
versionLabelField = new TextField("Version");
versionLabelField.setValue(releasePackage.getVersionLabel() != null ? releasePackage.getVersionLabel() : "");
versionLabelField.setReadOnly(releasePackage.isReleased());
form.addComponent(versionLabelField);
releaseDateField = new DateField("Release Date");
releaseDateField.setValue(releasePackage.getReleaseDate() != null ? releasePackage.getReleaseDate() : null);
releaseDateField.setReadOnly(releasePackage.isReleased());
form.addComponent(releaseDateField);
return form;
}
示例2: setValueAsString
import com.vaadin.ui.DateField; //导入方法依赖的package包/类
@Override
public void setValueAsString(String value, String parameterName)
throws ReadOnlyException, ConversionException, ParseException
{
SimpleDateFormat sdf = new SimpleDateFormat(parameterFormat);
DateField field;
if (parameterName.equalsIgnoreCase(startParameterName))
{
field = startfield;
}
else
{
field = endfield;
}
field.setValue(sdf.parse(value));
}
示例3: initDueDateField
import com.vaadin.ui.DateField; //导入方法依赖的package包/类
protected void initDueDateField() {
dueDateField = new DateField();
if (task.getDueDate() != null) {
dueDateField.setValue(task.getDueDate());
} else {
dueDateField.setValue(new Date());
}
dueDateField.setWidth(125, UNITS_PIXELS);
dueDateField.setResolution(DateField.RESOLUTION_DAY);
dueDateField.setImmediate(true);
}
示例4: getCopy
import com.vaadin.ui.DateField; //导入方法依赖的package包/类
@Override
public DateIntervalFilterEditor<A> getCopy() {
DateField newStart = new DateField();
DateField newEnd = new DateField();
newStart.setValue(start.getValue());
newEnd.setValue(end.getValue());
DateIntervalFilterEditor<A> res = new DateIntervalFilterEditor<A>(
localizer);
res.end = newEnd;
res.start = newStart;
return res;
}
示例5: backgroundTab
import com.vaadin.ui.DateField; //导入方法依赖的package包/类
private void backgroundTab()
{
// Background tab
final SMMultiColumnFormLayout<Contact> background = new SMMultiColumnFormLayout<Contact>(2, this.fieldGroup);
background.setColumnLabelWidth(0, 120);
this.tabs.addTab(background, "Background");
background.setMargin(true);
background.colspan(2);
background.bindTextAreaField("Hobbies", Contact_.hobbies, 4);
background.newLine();
background.colspan(2);
background.bindDateField("Affiliated Since", Contact_.affiliatedSince, "yyyy-MM-dd", Resolution.DAY);
background.newLine();
background.colspan(2);
background.bindTextField("Current Employer", Contact_.currentEmployer);
background.newLine();
background.colspan(2);
background.bindTextField("Job Title", Contact_.jobTitle);
background.newLine();
background.bindBooleanField("License", Contact_.hasLicense);
background.newLine();
background.bindBooleanField("Has WWC", Contact_.hasWWC);
final DateField wwcExpiryDate = background.bindDateField("WWC Expiry", Contact_.wwcExpiry, "yyyy-MM-dd",
Resolution.DAY);
// WWC expiry is five years.
wwcExpiryDate.setValue(new DateTime().plusYears(5).toDate());
background.bindTextField("WWC No.", Contact_.wwcNo);
background.newLine();
background.bindBooleanField("Has Police Check", Contact_.hasPoliceCheck);
final DateField policeCheckExpiry = background.bindDateField("Police Check Expiry", Contact_.policeCheckExpiry,
"yyyy-MM-dd", Resolution.DAY);
policeCheckExpiry.setValue(new DateTime().plusYears(5).toDate());
background.newLine();
background.bindBooleanField("Has Food Handling", Contact_.hasFoodHandlingCertificate);
background.bindBooleanField("Has First Aid Certificate", Contact_.hasFirstAidCertificate);
}
示例6: createOptionGroup
import com.vaadin.ui.DateField; //导入方法依赖的package包/类
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.getLocale());
startAtDateField.setResolution(Resolution.MINUTE);
startAtDateField.addStyleName(ValoTheme.DATEFIELD_SMALL);
addComponent(startAtDateField);
}
示例7: createOptionGroup
import com.vaadin.ui.DateField; //导入方法依赖的package包/类
private void createOptionGroup() {
actionTypeOptionGroup = new FlexibleOptionGroup();
actionTypeOptionGroup.addItem(ActionTypeOption.SOFT);
actionTypeOptionGroup.addItem(ActionTypeOption.FORCED);
actionTypeOptionGroup.addItem(ActionTypeOption.AUTO_FORCED);
selectDefaultOption();
final FlexibleOptionGroupItemComponent forceItem = actionTypeOptionGroup
.getItemComponent(ActionTypeOption.FORCED);
forceItem.setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE);
// set Id for Forced radio button.
forceItem.setId("save.action.radio.forced");
addComponent(forceItem);
final Label forceLabel = new Label();
forceLabel.setStyleName("statusIconPending");
forceLabel.setIcon(FontAwesome.BOLT);
forceLabel.setCaption("Forced");
forceLabel.setDescription(i18n.getMessage("tooltip.forced.item"));
forceLabel.setStyleName("padding-right-style");
addComponent(forceLabel);
final FlexibleOptionGroupItemComponent softItem = actionTypeOptionGroup.getItemComponent(ActionTypeOption.SOFT);
softItem.setId(UIComponentIdProvider.ACTION_DETAILS_SOFT_ID);
softItem.setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE);
addComponent(softItem);
final Label softLabel = new Label();
softLabel.setSizeFull();
softLabel.setCaption("Soft");
softLabel.setDescription(i18n.getMessage("tooltip.soft.item"));
softLabel.setStyleName("padding-right-style");
addComponent(softLabel);
final FlexibleOptionGroupItemComponent autoForceItem = actionTypeOptionGroup
.getItemComponent(ActionTypeOption.AUTO_FORCED);
autoForceItem.setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE);
// setted Id for Time Forced radio button.
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("Time Forced");
autoForceLabel.setDescription(i18n.getMessage("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.getLocale());
forcedTimeDateField.setResolution(Resolution.MINUTE);
forcedTimeDateField.addStyleName(ValoTheme.DATEFIELD_SMALL);
addComponent(forcedTimeDateField);
}
示例8: initAboutSection
import com.vaadin.ui.DateField; //导入方法依赖的package包/类
protected void initAboutSection() {
// Header
HorizontalLayout header = new HorizontalLayout();
header.setWidth(100, UNITS_PERCENTAGE);
header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
infoPanelLayout.addComponent(header);
Label aboutLabel = createProfileHeader(infoPanelLayout, i18nManager.getMessage(Messages.PROFILE_ABOUT));
header.addComponent(aboutLabel);
header.setExpandRatio(aboutLabel, 1.0f);
// only show edit/save buttons if current user matches
if (isCurrentLoggedInUser) {
Button actionButton = null;
if (!editable) {
actionButton = initEditProfileButton();
} else {
actionButton = initSaveProfileButton();
}
header.addComponent(actionButton);
header.setComponentAlignment(actionButton, Alignment.MIDDLE_RIGHT);
}
// 'About' fields
GridLayout aboutLayout = createInfoSectionLayout(2, 4);
// Name
if (!editable && (isDefined(user.getFirstName()) || isDefined(user.getLastName()) )) {
addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_NAME), user.getFirstName() + " " + user.getLastName());
} else if (editable) {
firstNameField = new TextField();
firstNameField.focus();
addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_FIRST_NAME), firstNameField, user.getFirstName());
lastNameField = new TextField();
addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_LAST_NAME), lastNameField, user.getLastName());
}
// Job title
if (!editable && isDefined(jobTitle)) {
addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_JOBTITLE), jobTitle);
} else if (editable) {
jobTitleField = new TextField();
addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_JOBTITLE), jobTitleField, jobTitle);
}
// Birthdate
if (!editable && isDefined(birthDate)) {
addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_BIRTHDATE), birthDate);
} else if (editable) {
birthDateField = new DateField();
birthDateField.setDateFormat(Constants.DEFAULT_DATE_FORMAT);
birthDateField.setResolution(DateField.RESOLUTION_DAY);
try {
birthDateField.setValue(new SimpleDateFormat(Constants.DEFAULT_DATE_FORMAT).parse(birthDate));
} catch (Exception e) {} // do nothing
addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_BIRTHDATE), birthDateField, null);
}
// Location
if (!editable && isDefined(location)) {
addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_LOCATION), location);
} else if (editable) {
locationField = new TextField();
addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_LOCATION), locationField, location);
}
}
示例9: initUI
import com.vaadin.ui.DateField; //导入方法依赖的package包/类
@Override
protected void initUI(VaadinRequest request) {
final VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
layout.setSpacing(true);
setContent(layout);
english = new Button("English", new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
setLocale(Locale.ENGLISH);
}
});
layout.addComponent(english);
swedish = new Button("Svenska", new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
setLocale(new Locale("sv"));
}
});
layout.addComponent(swedish);
bigDecimalField = new TextField();
StringToBigDecimalConverter converter = new StringToBigDecimalConverter("") {
@Override
protected String getErrorMessage() {
return i18n.get("demoapp.bigDecimalTextField.caption");
}
};
Binder<TranslatedUI> binder = new Binder<>(TranslatedUI.class);
binder.forField(bigDecimalField)
.withConverter(converter)
.bind("bigDecimal");
binder.setBean(this);
layout.addComponent(bigDecimalField);
dateField = new DateField();
dateField.setValue(LocalDate.now());
layout.addComponent(dateField);
}