本文整理汇总了Java中com.vaadin.data.validator.IntegerRangeValidator类的典型用法代码示例。如果您正苦于以下问题:Java IntegerRangeValidator类的具体用法?Java IntegerRangeValidator怎么用?Java IntegerRangeValidator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntegerRangeValidator类属于com.vaadin.data.validator包,在下文中一共展示了IntegerRangeValidator类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initializeText
import com.vaadin.data.validator.IntegerRangeValidator; //导入依赖的package包/类
protected void initializeText() {
//
// Add a validator
//
this.textFieldColumn.addValidator(new IntegerRangeValidator("Please enter an integer greater than or equal to 0.", 0, null));
//
// Respond to text changing to setup the button
//
this.textFieldColumn.addTextChangeListener(new TextChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void textChange(TextChangeEvent event) {
if (event.getText() != null && event.getText().isEmpty() == false) {
self.buttonSave.setEnabled(true);
} else {
self.buttonSave.setEnabled(false);
}
}
});
}
开发者ID:apache,项目名称:incubator-openaz,代码行数:22,代码来源:ColumnSelectionWindow.java
示例2: validate
import com.vaadin.data.validator.IntegerRangeValidator; //导入依赖的package包/类
@Override
public void validate(final Object value) {
if (isNoOfGroupsOrTargetFilterEmpty()) {
uiNotification
.displayValidationError(i18n.getMessage("message.rollout.noofgroups.or.targetfilter.missing"));
} else {
if (value != null) {
final int groupSize = getGroupSize();
new IntegerRangeValidator(i18n.getMessage(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, groupSize), 0,
groupSize).validate(Integer.valueOf(value.toString()));
}
}
}
开发者ID:eclipse,项目名称:hawkbit,代码行数:14,代码来源:AddUpdateRolloutWindowLayout.java
示例3: validateMandatoryPercentage
import com.vaadin.data.validator.IntegerRangeValidator; //导入依赖的package包/类
private void validateMandatoryPercentage(final Object value) {
if (value != null) {
final String message = i18n.getMessage("message.rollout.field.value.range", 0, 100);
if (value instanceof Float) {
new FloatRangeValidator(message, 0F, 100F).validate(value);
}
if (value instanceof Integer) {
new IntegerRangeValidator(message, 0, 100).validate(value);
}
} else {
throw new Validator.EmptyValueException(i18n.getMessage("message.enter.number"));
}
}
开发者ID:eclipse,项目名称:hawkbit,代码行数:14,代码来源:DefineGroupsLayout.java
示例4: buildGeneratedCountField
import com.vaadin.data.validator.IntegerRangeValidator; //导入依赖的package包/类
private void buildGeneratedCountField() {
if (generatedCountField == null) {
generatedCountField = new TextField();
generatedCountField.setConverter(new StringToIntegerConverter());
generatedCountField.setConversionError(Messages.getString("Message.Error.GeneratedCountInteger", 1, 999));
generatedCountField.setMaxLength(3);
generatedCountField.setNullRepresentation("");
generatedCountField.setWidth(3, Unit.EM);
generatedCountField.setRequired(true);
generatedCountField.setRequiredError(Messages.getString("Message.Error.GeneratedCountRequired"));
generatedCountField.addValidator(new IntegerRangeValidator(
Messages.getString("Message.Error.GeneratedCountInteger", 1, 999), 1, 999));
}
}
开发者ID:tilioteo,项目名称:hypothesis,代码行数:15,代码来源:UserWindowPresenterImpl.java
示例5: CustomIntegerRangeValidator
import com.vaadin.data.validator.IntegerRangeValidator; //导入依赖的package包/类
public CustomIntegerRangeValidator(String errorMessage, Integer minValue, Integer maxValue) {
super(errorMessage);
this.integerRangeValidator = new IntegerRangeValidator(errorMessage, minValue, maxValue);
}
开发者ID:antoniomaria,项目名称:gazpachoquest,代码行数:5,代码来源:CustomIntegerRangeValidator.java
示例6: SMTPSettingView
import com.vaadin.data.validator.IntegerRangeValidator; //导入依赖的package包/类
public SMTPSettingView()
{
setSizeFull();
final SMTPSettingsDao daoSMTPServerSetting = new DaoFactory().getSMTPSettingsDao();
final SMTPServerSetting settings = daoSMTPServerSetting.findSettings();
if (settings == null)
{
throw new IllegalStateException("The email Server Settings are missing from the database.");
}
// Create the user input field
this.smtpFQDN = new TextField("SMTP FQDN:");
this.smtpFQDN.setWidth("300px");
this.smtpFQDN.setRequired(true);
this.smtpFQDN.setDescription("SMTP Server FQDN or IP address");
this.smtpFQDN.setImmediate(true);
this.smtpFQDN.setValue(settings.getSmtpFQDN());
this.smtpPort = new TextField("SMTP Port:");
this.smtpPort.setWidth("300px");
this.smtpPort.setRequired(true);
this.smtpPort.setDescription("SMTP Server FQDN or IP address");
this.smtpPort.setImmediate(true);
this.smtpPort.setValue(settings.getSmtpPort().toString());
this.smtpPort.addValidator(new IntegerRangeValidator("The port no. must be an integer in the range 1 to 65535",
1, 65535));
this.authRequired = new CheckBox("SMTP Authentication Requried");
this.authRequired.setValue(settings.isAuthRequired());
this.authRequired.addValueChangeListener(this);
this.username = new TextField("SMTP Username:");
this.username.setWidth("300px");
this.username.setRequired(true);
this.username.setDescription("SMTP username if authentication is used");
this.username.setImmediate(true);
this.username.setValue(settings.getUsername());
// Create the password input field
this.password = new PasswordField("Password:");
this.password.setWidth("300px");
this.password.setRequired(true);
this.password.setNullRepresentation("");
this.password.setDescription("SMS Provider Password");
this.password.setValue(settings.getPassword());
// Create the user input field
this.fromEmailAddress = new TextField("From Email Address:");
this.fromEmailAddress.setWidth("300px");
this.fromEmailAddress.setRequired(true);
this.fromEmailAddress.setDescription("Default From Address to use when sending bulk emails.");
this.fromEmailAddress.setImmediate(true);
this.fromEmailAddress.addValidator(new EmailValidator("Enter a valid email address."));
this.fromEmailAddress.setValue(settings.getFromEmailAddress());
// Create login button
this.saveButton = new Button("Save", new ClickEventLogged.ClickAdaptor(this));
this.saveButton.setClickShortcut(KeyCode.ENTER);
this.saveButton.addStyleName("default");
// Add both to a panel
final VerticalLayout fields = new VerticalLayout(this.smtpFQDN, this.authRequired, this.username,
this.password, this.fromEmailAddress, this.saveButton);
fields.setCaption("Configure SMTP mail settings.");
fields.setSpacing(true);
fields.setMargin(new MarginInfo(true, true, true, false));
fields.setSizeUndefined();
// The view root layout
final VerticalLayout viewLayout = new VerticalLayout(fields);
viewLayout.setSizeFull();
viewLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER);
viewLayout.setStyleName(Reindeer.LAYOUT_BLUE);
setCompositionRoot(viewLayout);
}
开发者ID:bsutton,项目名称:scoutmaster,代码行数:78,代码来源:SMTPSettingView.java
示例7: SmtpStep
import com.vaadin.data.validator.IntegerRangeValidator; //导入依赖的package包/类
public SmtpStep(final GroupMaintenanceWizardView setupWizardView)
{
super(new DaoFactory().getSMTPSettingsDao(), SMTPServerSetting.class);
this.layout = new VerticalLayout();
this.layout.setMargin(true);
final MultiColumnFormLayout<SMTPServerSetting> formLayout = new MultiColumnFormLayout<>(1, getFieldGroup());
formLayout.setColumnFieldWidth(0, 250);
final Label label = new Label("<h1>Configure SMTP mail settings.</h1>");
label.setContentMode(ContentMode.HTML);
this.layout.addComponent(label);
this.layout.addComponent(formLayout);
// Create the user input fields
this.smtpFQDN = formLayout.bindTextField("SMTP FQDN:", SMTPServerSetting_.smtpFQDN);
this.smtpFQDN.setDescription("SMTP Server FQDN or IP address");
this.smtpPort = formLayout.bindTextField("SMTP Port:", SMTPServerSetting_.smtpPort);
this.smtpPort.setDescription("SMTP Port No.");
this.smtpPort.addValidator(
new IntegerRangeValidator("The port no. must be an integer in the range 1 to 65535", 1, 65535));
this.authRequired = formLayout.bindBooleanField("Authentication Requried", SMTPServerSetting_.authRequired);
this.authRequired.addValueChangeListener(this);
this.username = formLayout.bindTextField("Username:", SMTPServerSetting_.username);
this.username.setDescription("SMTP username if authentication is used");
this.username.setVisible(false);
// Create the password input field
this.password = formLayout.bindPasswordField("Password:", SMTPServerSetting_.password);
this.password.setDescription("SMS Provider Password");
this.password.setVisible(false);
this.useSSL = formLayout.bindBooleanField("Use SSL", SMTPServerSetting_.useSSL);
this.useSSL.setDescription("Enables an SSL connection to your SMTP server if it supports it.");
this.fromEmailAddress = formLayout.bindTextField("From Email Address:", SMTPServerSetting_.fromEmailAddress);
this.fromEmailAddress.setDescription("Default From Address to use when sending bulk emails.");
this.fromEmailAddress.addValidator(new EmailValidator("Enter a valid email address."));
this.bounceEmailAddress = formLayout.bindTextField("Bounce Email Address:",
SMTPServerSetting_.bounceEmailAddress);
this.bounceEmailAddress.setDescription("Email Address that bounced emails should be sent to.");
this.bounceEmailAddress.addValidator(new EmailValidator("Enter a valid email address."));
final Button test = new Button("Test");
this.layout.addComponent(test);
test.addClickListener(new ClickEventLogged.ClickAdaptor(this));
// focus the fqnd field when user arrives to the login view
this.smtpFQDN.focus();
}
开发者ID:bsutton,项目名称:scoutmaster,代码行数:56,代码来源:SmtpStep.java
示例8: getContent
import com.vaadin.data.validator.IntegerRangeValidator; //导入依赖的package包/类
@Override
public Component getContent()
{
final VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
this.fieldValidator = new FieldValidator();
this.formLayout = new MultiColumnFormLayout<IntegerCrudEntity>(1, null); // new
// ValidatingFieldGroup(dynamicFieldItem));
this.formLayout.setColumnLabelWidth(0, 150);
this.formLayout.setColumnFieldWidth(0, 250);
this.formLayout.setSizeFull();
final Label label = new Label("<h1>Enter the details for the group of books you want to import.</h1>",
ContentMode.HTML);
layout.addComponent(label);
layout.addComponent(this.formLayout);
this.firstTicketNoField = this.formLayout.addTextField("First Book Ticket No.");
this.noOfBooksField = this.formLayout.addTextField("No. of consecutive Books");
this.noOfBooksField
.setDescription("The no of Books to be imported. They must be in a consecutive number range!");
this.lastTicketNoField = this.formLayout.addTextField("Last Ticket No. of Last Book");
this.lastTicketNoField
.setDescription("Enter the ticket no of the 'last' ticket of the 'last' book. This is used to check that all of the details are correct.");
this.firstTicketNoField
.addValidator(new IntegerRangeValidator("First Ticket No must be an integer", 0, 6000000));
this.firstTicketNoField.setConverter(new StringToIntegerConverter());
this.firstTicketNoField.setRequired(true);
this.fieldValidator.addField(this.firstTicketNoField);
this.noOfBooksField.addValidator(new IntegerRangeValidator("No. of Books must be an integer", 1, 1000));
this.noOfBooksField.setConverter(new StringToIntegerConverter());
this.noOfBooksField.setRequired(true);
this.fieldValidator.addField(this.noOfBooksField);
this.lastTicketNoField
.addValidator(new IntegerRangeValidator("Last Ticket No. must be an integer", 1, 6000000));
this.lastTicketNoField.setConverter(new StringToIntegerConverter());
this.lastTicketNoField.setRequired(true);
this.fieldValidator.addField(this.lastTicketNoField);
final Label labelImport = new Label("<h1>Clicking Next will import the books!</h1>", ContentMode.HTML);
layout.addComponent(labelImport);
return layout;
}
开发者ID:bsutton,项目名称:scoutmaster,代码行数:51,代码来源:TicketRangeStep.java
示例9: SampleFormView
import com.vaadin.data.validator.IntegerRangeValidator; //导入依赖的package包/类
public SampleFormView() {
setMargin(true);
final FormLayout formLayout = new FormLayout();
addComponent(formLayout);
formLayout.addComponent(uuid = new TextField("UUID"));
uuid.setConverter(new UUIDToStringConverter());
formLayout.addComponent(stringField = new TextField("String"));
stringField.addValidator(new StringLengthValidator("The string must be between 10 and 30 characters", 10, 30, false));
stringField.setImmediate(true);
formLayout.addComponent(integerField = new TextField("Integer"));
integerField.addValidator(new IntegerRangeValidator("The integer must be positive", 0, Integer.MAX_VALUE));
integerField.setImmediate(true);
formLayout.addComponent(bigDecimalField = new TextField("BigDecimal"));
bigDecimalField.setConverter(new BigDecimalToStringConverter());
bigDecimalField.setImmediate(true);
formLayout.addComponent(booleanField = new CheckBox("Boolean"));
formLayout.addComponent(enumField = new ComboBox("Enum"));
for (SampleEnum sampleEnum : SampleEnum.values()) {
enumField.addItem(sampleEnum);
}
formLayout.addComponent(detailsField = new SampleDetailsField());
detailsField.setHeight("300px");
commit = new Button("Commit", new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
try {
binder.commit();
// TODO Save the bean to some backend
} catch (FieldGroup.CommitException ex) {
// Let the binder handle it
}
}
});
discard = new Button("Discard", new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
binder.discard();
}
});
HorizontalLayout buttons = new HorizontalLayout(commit, discard);
buttons.setSpacing(true);
formLayout.addComponent(buttons);
binder = new BeanFieldGroup<SampleMaster>(SampleMaster.class);
binder.bindMemberFields(this);
}
开发者ID:peholmst,项目名称:vaadin-mockapp,代码行数:49,代码来源:SampleFormView.java
注:本文中的com.vaadin.data.validator.IntegerRangeValidator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论