本文整理汇总了Java中com.vaadin.data.validator.RegexpValidator类的典型用法代码示例。如果您正苦于以下问题:Java RegexpValidator类的具体用法?Java RegexpValidator怎么用?Java RegexpValidator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RegexpValidator类属于com.vaadin.data.validator包,在下文中一共展示了RegexpValidator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeText
import com.vaadin.data.validator.RegexpValidator; //导入依赖的package包/类
protected void initializeText() {
//
//
//
this.textAreaDescription.setNullRepresentation("");
this.textAreaDescription.setValue(this.policySet.getDescription());
//
//
//
if (this.policySet.getVersion() == null) {
this.policySet.setVersion("1");
}
this.textFieldVersion.setRequiredError("The exact format is: ((\\d+|\\*)\\.)*(\\d+|\\*|\\+)");
this.textFieldVersion.addValidator(new RegexpValidator("((\\d+|\\*)\\.)*(\\d+|\\*|\\+)", true, "The version MUST a number optionally separated by '.' eg. 1 or 1.0 or 1.1.1 etc."));
this.textFieldVersion.setValue(this.policySet.getVersion());
}
示例2: initValidation
import com.vaadin.data.validator.RegexpValidator; //导入依赖的package包/类
private void initValidation() {
//ネットワーク選択
String message = ViewMessages.getMessage("IUI-000100");
networkSelect.setRequired(true);
networkSelect.setRequiredError(message);
//IPモード選択
message = ViewMessages.getMessage("IUI-000126");
ipModeSelect.setRequired(true);
ipModeSelect.setRequiredError(message);
//IPアドレス
message = ViewMessages.getMessage("IUI-000094", ipAddressField.getCaption());
ipAddressField.setRequired(false);
ipAddressField.setRequiredError(message);
Validator ipAddressFieldValidator = new RegexpValidator(
"^(\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])$",
ViewMessages.getMessage("IUI-000095", ipAddressField.getCaption()));
ipAddressField.addValidator(ipAddressFieldValidator);
}
示例3: initializeText
import com.vaadin.data.validator.RegexpValidator; //导入依赖的package包/类
protected void initializeText() {
//
//
//
this.textAreaDescription.setNullRepresentation("");
this.textAreaDescription.setValue(this.policy.getDescription());
//
//
//
if (this.policy.getVersion() == null) {
this.policy.setVersion("1");
}
this.textFieldVersion.setRequiredError("The exact format is: ((\\d+|\\*)\\.)*(\\d+|\\*|\\+)");
this.textFieldVersion.addValidator(new RegexpValidator("((\\d+|\\*)\\.)*(\\d+|\\*|\\+)", true, "The version MUST a number optionally separated by '.' eg. 1 or 1.0 or 1.1.1 etc."));
this.textFieldVersion.setValue(this.policy.getVersion());
}
示例4: SystemDefChoiceField
import com.vaadin.data.validator.RegexpValidator; //导入依赖的package包/类
/**
* Instantiates a new system definition choice field.
*/
public SystemDefChoiceField() {
oidType = new OptionGroup("OID Type", OPTIONS);
oidType.setNullSelectionAllowed(false);
oidType.select("Single");
oidValue = new TextField("OID Value");
oidValue.setWidth("100%");
oidValue.setNullSettingAllowed(false);
oidValue.setRequired(true);
oidValue.setImmediate(true);
oidValue.addValidator(new RegexpValidator("^\\.[.\\d]+$", "Invalid OID {0}"));
HorizontalLayout layout = new HorizontalLayout();
layout.setSpacing(true);
layout.setWidth("100%");
layout.addComponent(oidType);
layout.addComponent(oidValue);
layout.setExpandRatio(oidValue, 1);
setWriteThrough(false);
setCompositionRoot(layout);
}
示例5: AgentForm
import com.vaadin.data.validator.RegexpValidator; //导入依赖的package包/类
public AgentForm(RepositoryForm form) {
this.parent = form;
setSizeUndefined();
GridLayout formContainer = new GridLayout(2,5);
formContainer.setSpacing(true);
agentTypeCode.addItems(Agent.agentTypes);
agentTypeSpecific.addItems(Agent.specificTypes);
Validator phoneValidator = new RegexpValidator("^((\\d{3}-|\\(\\d{3}\\)\\s?)?\\d{3}-|^\\d{3}(\\.)?\\d{3}\\3)\\d{4}$", "Please enter a valid phone number.");
phoneNumber.addValidator(phoneValidator);
formContainer.addComponent(firstName);
formContainer.addComponent(lastName);
formContainer.addComponent(agentTypeCode,0,1);
formContainer.addComponent(agentTypeSpecific,1,1);
formContainer.addComponent(email,0,2);
formContainer.addComponent(affiliation,1,2);
formContainer.addComponent(orcid,0,3);
formContainer.addComponent(phoneNumber,1,3);
HorizontalLayout buttons = new HorizontalLayout();
buttons.setSpacing(true);
buttons.addComponents(save, delete);
save.setStyleName(ValoTheme.BUTTON_FRIENDLY);
delete.setStyleName(ValoTheme.BUTTON_DANGER);
save.setEnabled(false);
delete.setEnabled(false);
save.addClickListener(e->this.save());
delete.addClickListener(e->this.delete());
formContainer.addComponent(buttons, 0,4,1,4);
addComponent(formContainer);
}
示例6: initializeTextField
import com.vaadin.data.validator.RegexpValidator; //导入依赖的package包/类
protected void initializeTextField() {
this.textFieldSubdomain.setRequired(true);
this.textFieldSubdomain.setRequiredError("Please enter a valid sub domain");
//
// Validate the name entered
//
this.textFieldSubdomain.addValidator(new RegexpValidator(SUBDOMAIN_NAME_PATTERN, true, ERROR_MESSAGE) {
private static final long serialVersionUID = 1L;
});
//
// Respond to events
//
this.textFieldSubdomain.setImmediate(true);
this.textFieldSubdomain.addTextChangeListener(new TextChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void textChange(TextChangeEvent event) {
if (event.getText() != null && event.getText().length() > 0) {
self.buttonSave.setEnabled(true);
} else {
self.buttonSave.setEnabled(false);
}
}
});
}
示例7: initializeTestPanel
import com.vaadin.data.validator.RegexpValidator; //导入依赖的package包/类
private void initializeTestPanel() {
this.textFieldTestValue.setNullRepresentation("");
this.buttonTest.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event) {
String testValue = self.textFieldTestValue.getValue();
if (testValue == null || testValue.length() == 0) {
return;
}
String regExp = self.textFieldExpression.getValue();
if (regExp == null || regExp.length() == 0) {
return;
}
//
// Create a validator
//
Validator validator = new RegexpValidator(regExp, true, "Regular Expression does NOT match.");
//
// Add it
//
self.textFieldTestValue.addValidator(validator);
//
// Validate
//
try {
self.textFieldTestValue.validate();
AdminNotification.info("Success! Regular Expression Matches");
} catch (InvalidValueException e) {
AdminNotification.warn("Failed, Regular Expression does NOT match");
}
//
// Remove the validator
//
self.textFieldTestValue.removeValidator(validator);
}
});
}
示例8: createRequiredComponents
import com.vaadin.data.validator.RegexpValidator; //导入依赖的package包/类
private void createRequiredComponents() {
controllerIDTextField = createTextField("prompt.target.id", UIComponentIdProvider.TARGET_ADD_CONTROLLER_ID);
controllerIDTextField
.addValidator(new RegexpValidator("[.\\S]*", i18n.getMessage("message.target.whitespace.check")));
nameTextField = createTextField("textfield.name", UIComponentIdProvider.TARGET_ADD_NAME);
nameTextField.setRequired(false);
descTextArea = new TextAreaBuilder().caption(i18n.getMessage("textfield.description")).style("text-area-style")
.prompt(i18n.getMessage("textfield.description")).immediate(true)
.id(UIComponentIdProvider.TARGET_ADD_DESC).buildTextComponent();
descTextArea.setNullRepresentation("");
}
示例9: initValidation
import com.vaadin.data.validator.RegexpValidator; //导入依赖的package包/类
private void initValidation() {
String message = ViewMessages.getMessage("IUI-000031");
serviceNameField.setRequired(true);
serviceNameField.setRequiredError(message);
serviceNameField.addValidator(new StringLengthValidator(message, -1, 15, false));
serviceNameField.addValidator(new RegexpValidator("^[0-9a-z]|[0-9a-z][0-9a-z-]*[0-9a-z]$", true, message));
message = ViewMessages.getMessage("IUI-000003");
commentField.addValidator(new StringLengthValidator(message, -1, 100, true));
message = ViewMessages.getMessage("IUI-000032");
diskSizeField.setRequired(true);
diskSizeField.setRequiredError(message);
diskSizeField.addValidator(new RegexpValidator("^[1-9]|[1-9][0-9]{1,2}|1000$", true, message));
}
示例10: initValidation
import com.vaadin.data.validator.RegexpValidator; //导入依赖的package包/类
private void initValidation() {
String message = ViewMessages.getMessage("IUI-000002");
cloudNameField.setRequired(true);
cloudNameField.setRequiredError(message);
cloudNameField.addValidator(new StringLengthValidator(message, 1, 15, false));
cloudNameField.addValidator(new RegexpValidator("^[0-9a-z]|[0-9a-z][0-9a-z-]*[0-9a-z]$", true, message));
message = ViewMessages.getMessage("IUI-000003");
commentField.addValidator(new StringLengthValidator(message, -1, 100, true));
}
示例11: initValidation
import com.vaadin.data.validator.RegexpValidator; //导入依赖的package包/类
private void initValidation() {
String message = ViewMessages.getMessage("IUI-000022");
serverNameField.setRequired(true);
serverNameField.setRequiredError(message);
serverNameField.addValidator(new StringLengthValidator(message, -1, 15, false));
serverNameField.addValidator(new RegexpValidator("^[a-z]|[a-z][0-9a-z-]*[0-9a-z]$", true, message));
message = ViewMessages.getMessage("IUI-000003");
commentField.addValidator(new StringLengthValidator(message, -1, 100, true));
}
示例12: initValidation
import com.vaadin.data.validator.RegexpValidator; //导入依赖的package包/类
private void initValidation() {
String message;
message = ViewMessages.getMessage("IUI-000094", ipAddressField.getCaption());
Validator ipAddressFieldValidator = new RegexpValidator(
"^(\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])$",
ViewMessages.getMessage("IUI-000095", ipAddressField.getCaption()));
ipAddressField.setRequired(true);
ipAddressField.setRequiredError(message);
ipAddressField.addValidator(ipAddressFieldValidator);
message = ViewMessages.getMessage("IUI-000094", subnetMaskField.getCaption());
Validator subnetMaskFieldValidator = new RegexpValidator(
"^(\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])$",
ViewMessages.getMessage("IUI-000095", subnetMaskField.getCaption()));
subnetMaskField.setRequired(true);
subnetMaskField.setRequiredError(message);
subnetMaskField.addValidator(subnetMaskFieldValidator);
message = ViewMessages.getMessage("IUI-000094", defaultGatewayField.getCaption());
Validator defaultGatewayFieldValidator = new RegexpValidator(
"^(\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])$",
ViewMessages.getMessage("IUI-000095", defaultGatewayField.getCaption()));
defaultGatewayField.setRequired(true);
defaultGatewayField.setRequiredError(message);
defaultGatewayField.addValidator(defaultGatewayFieldValidator);
}
示例13: initValidation
import com.vaadin.data.validator.RegexpValidator; //导入依赖的package包/类
private void initValidation() {
// ディスクサイズ
String message = ViewMessages.getMessage("IUI-000032");
txtDiskSize.setRequired(true);
txtDiskSize.setRequiredError(message);
txtDiskSize.addValidator(new RegexpValidator("^[1-9]|[1-9][0-9]{1,2}|1000$", true, message));
}
示例14: initValidation
import com.vaadin.data.validator.RegexpValidator; //导入依赖的package包/类
private void initValidation() {
String message = ViewMessages.getMessage("IUI-000055");
loadBalancerNameField.setRequired(true);
loadBalancerNameField.setRequiredError(message);
loadBalancerNameField.addValidator(new StringLengthValidator(message, 1, 15, false));
loadBalancerNameField.addValidator(new RegexpValidator("^[0-9a-z]|[0-9a-z][0-9a-z-]*[0-9a-z]$", true,
message));
message = ViewMessages.getMessage("IUI-000003");
commentField.addValidator(new StringLengthValidator(message, -1, 100, true));
}
示例15: initValidation
import com.vaadin.data.validator.RegexpValidator; //导入依赖的package包/类
private void initValidation() {
String message = ViewMessages.getMessage("IUI-000003");
commentField.addValidator(new StringLengthValidator(message, -1, 100, true));
message = ViewMessages.getMessage("IUI-000032");
diskSizeField.setRequired(true);
diskSizeField.setRequiredError(message);
diskSizeField.addValidator(new RegexpValidator("^[1-9]|[1-9][0-9]{1,2}|1000$", true, message));
}