本文整理汇总了Java中com.vaadin.ui.PopupDateField.setImmediate方法的典型用法代码示例。如果您正苦于以下问题:Java PopupDateField.setImmediate方法的具体用法?Java PopupDateField.setImmediate怎么用?Java PopupDateField.setImmediate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.PopupDateField
的用法示例。
在下文中一共展示了PopupDateField.setImmediate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildMainLayout
import com.vaadin.ui.PopupDateField; //导入方法依赖的package包/类
@AutoGenerated
private AbsoluteLayout buildMainLayout() {
// common part: create layout
mainLayout = new AbsoluteLayout();
mainLayout.setImmediate(false);
mainLayout.setWidth("560px");
mainLayout.setHeight("300px");
mainLayout.setMargin(true);
// top-level component properties
setWidth("560px");
setHeight("300px");
// protocolTypeField
protocolTypeField = new TextField();
protocolTypeField.setCaption("Tipo Procolo");
protocolTypeField.setImmediate(false);
protocolTypeField.setWidth("340px");
protocolTypeField.setHeight("24px");
protocolTypeField.setTabIndex(1);
mainLayout.addComponent(protocolTypeField, "top:56.0px;left:20.0px;");
// fileNameField
fileNameField = new TextField();
fileNameField.setCaption("Nombre Fichero");
fileNameField.setImmediate(false);
fileNameField.setWidth("340px");
fileNameField.setHeight("-1px");
mainLayout.addComponent(fileNameField, "top:17.0px;left:20.0px;");
// protocolDateField
protocolDateField = new PopupDateField();
protocolDateField.setCaption("Fecha Protocolo");
protocolDateField.setImmediate(false);
protocolDateField.setWidth("160px");
protocolDateField.setHeight("-1px");
mainLayout.addComponent(protocolDateField, "top:20.0px;left:380.0px;");
// payloadField
payloadField = new TextArea();
payloadField.setCaption("Carga Protocolo");
payloadField.setImmediate(false);
payloadField.setWidth("520px");
payloadField.setHeight("180px");
mainLayout.addComponent(payloadField, "top:100.0px;left:20.0px;");
return mainLayout;
}
示例2: buildForm
import com.vaadin.ui.PopupDateField; //导入方法依赖的package包/类
private Component buildForm() {
HorizontalLayout form = new HorizontalLayout();
form.setWidth("100%");
// initPacksSources();
/*
* packsSelect = new ComboBox();
* packsSelect.setInputPrompt(Messages.getString(
* "Caption.Button.ChoosePack")); for (String packTitle : sortedPacks) {
* packsSelect.addItem(packTitle); }
* packsSelect.setTextInputAllowed(false);
* packsSelect.setNullSelectionAllowed(false);
* packsSelect.setRequired(true);
* packsSelect.setRequiredError(Messages.getString(
* "Message.Error.NoPackSelected"));
* packsSelect.setValidationVisible(false);
* form.addComponent(packsSelect);
*/
dateFieldFrom = new PopupDateField();
dateFieldFrom.setResolution(Resolution.SECOND);
dateFieldFrom.setDateFormat(Messages.getString("Format.DateTime"));
dateFieldFrom.setInputPrompt(Messages.getString("Caption.Field.DateFrom"));
dateFieldFrom.setImmediate(true);
dateFieldFrom.setValidationVisible(false);
form.addComponent(dateFieldFrom);
dateFieldTo = new PopupDateField();
dateFieldTo.setResolution(Resolution.SECOND);
dateFieldTo.setDateFormat(Messages.getString("Format.DateTime"));
dateFieldTo.setInputPrompt(Messages.getString("Caption.Field.DateTo"));
dateFieldTo.setImmediate(true);
dateFieldTo.setValidationVisible(false);
form.addComponent(dateFieldTo);
Validator dateValidator = new Validator() {
@Override
public void validate(Object value) throws InvalidValueException {
if (dateFieldFrom.getValue() == null && dateFieldTo.getValue() == null) {
throw new InvalidValueException(Messages.getString("Message.Error.NoDateSelected"));
}
}
};
dateFieldFrom.addValidator(dateValidator);
dateFieldTo.addValidator(dateValidator);
Button selectionButton = new Button(Messages.getString("Caption.Button.ShowTests"));
selectionButton.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
// packsSelect.validate();
dateFieldFrom.validate();
dateFieldTo.validate();
// Pack pack = packMap.get(packsSelect.getValue());
Date dateFrom = (Date) dateFieldFrom.getValue();
Date dateTo = (Date) dateFieldTo.getValue();
showTests(dateFrom, dateTo);
} catch (InvalidValueException e) {
// packsSelect.setValidationVisible(!packsSelect.isValid());
dateFieldFrom.setValidationVisible(!dateFieldFrom.isValid());
dateFieldTo.setValidationVisible(!dateFieldTo.isValid());
Notification.show(e.getMessage(), Type.WARNING_MESSAGE);
}
}
});
form.addComponent(selectionButton);
return form;
}