com.vaadin.data.validator.RegexpValidator Java Examples
The following examples show how to use
com.vaadin.data.validator.RegexpValidator.
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: WinServerNetworkConfig.java From primecloud-controller with GNU General Public License v2.0 | 6 votes |
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); }
Example #2
Source File: PolicyEditorWindow.java From XACML with MIT License | 6 votes |
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()); }
Example #3
Source File: PolicySetEditorWindow.java From XACML with MIT License | 6 votes |
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()); }
Example #4
Source File: AgentForm.java From doecode with BSD 3-Clause "New" or "Revised" License | 5 votes |
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); }
Example #5
Source File: TargetAddUpdateWindowLayout.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
private void createRequiredComponents() { controllerIDTextField = new TextFieldBuilder(Target.CONTROLLER_ID_MAX_SIZE) .caption(i18n.getMessage("prompt.target.id")).required(true, i18n) .id(UIComponentIdProvider.TARGET_ADD_CONTROLLER_ID).buildTextComponent(); controllerIDTextField .addValidator(new RegexpValidator("[.\\S]*", i18n.getMessage("message.target.whitespace.check"))); nameTextField = new TextFieldBuilder(Target.NAME_MAX_SIZE).caption(i18n.getMessage("textfield.name")) .id(UIComponentIdProvider.TARGET_ADD_NAME).buildTextComponent(); nameTextField.setRequired(false); descTextArea = new TextAreaBuilder(Target.DESCRIPTION_MAX_SIZE) .caption(i18n.getMessage("textfield.description")).style("text-area-style") .id(UIComponentIdProvider.TARGET_ADD_DESC).buildTextComponent(); }
Example #6
Source File: WinServiceAdd.java From primecloud-controller with GNU General Public License v2.0 | 5 votes |
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)); }
Example #7
Source File: MyCloudAdd.java From primecloud-controller with GNU General Public License v2.0 | 5 votes |
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)); }
Example #8
Source File: WinServerAdd.java From primecloud-controller with GNU General Public License v2.0 | 5 votes |
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)); }
Example #9
Source File: WinServerEdit.java From primecloud-controller with GNU General Public License v2.0 | 5 votes |
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); }
Example #10
Source File: WinServerDataDiskConfig.java From primecloud-controller with GNU General Public License v2.0 | 5 votes |
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)); }
Example #11
Source File: WinLoadBalancerAdd.java From primecloud-controller with GNU General Public License v2.0 | 5 votes |
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)); }
Example #12
Source File: WinServiceEdit.java From primecloud-controller with GNU General Public License v2.0 | 5 votes |
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)); }
Example #13
Source File: WinServiceEdit.java From primecloud-controller with GNU General Public License v2.0 | 5 votes |
private void initValidation() { String message = ViewMessages.getMessage("IUI-000113"); customParam1Field.addValidator(new StringLengthValidator(message, -1, 200, true)); customParam1Field.addValidator(new RegexpValidator("^[0-9a-zA-Z-,._ ]*$", true, message)); message = ViewMessages.getMessage("IUI-000114"); customParam2Field.addValidator(new StringLengthValidator(message, -1, 200, true)); customParam2Field.addValidator(new RegexpValidator("^[0-9a-zA-Z-,._ ]*$", true, message)); message = ViewMessages.getMessage("IUI-000115"); customParam3Field.addValidator(new StringLengthValidator(message, -1, 200, true)); customParam3Field.addValidator(new RegexpValidator("^[0-9a-zA-Z-,._ ]*$", true, message)); }
Example #14
Source File: SubDomainEditorWindow.java From XACML with MIT License | 5 votes |
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); } } }); }
Example #15
Source File: RegexpEditorComponent.java From XACML with MIT License | 5 votes |
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); } }); }
Example #16
Source File: WinServerEdit.java From primecloud-controller with GNU General Public License v2.0 | 4 votes |
private void initValidation() { String message; message = ViewMessages.getMessage("IUI-000027"); sizeSelect.setRequired(true); sizeSelect.setRequiredError(message); message = ViewMessages.getMessage("IUI-000028"); keySelect.setRequired(true); keySelect.setRequiredError(message); message = ViewMessages.getMessage("IUI-000029"); grpSelect.setRequired(true); grpSelect.setRequiredError(message); if (BooleanUtils.isTrue(platform.getPlatformAws().getEuca())) { // Eucalyptus の場合は入力必須 message = ViewMessages.getMessage("IUI-000050"); zoneSelect.setRequired(true); zoneSelect.setRequiredError(message); } if (BooleanUtils.isTrue(platform.getPlatformAws().getVpc())) { // VPCの場合 message = ViewMessages.getMessage("IUI-000108"); subnetSelect.setRequired(true); subnetSelect.setRequiredError(message); privateIpField.setRequired(false); Validator privateIpFieldValidator = 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", privateIpField.getCaption())); privateIpField.addValidator(privateIpFieldValidator); } if (BooleanUtils.isTrue(image.getImageAws().getEbsImage()) && image.getImageAws().getRootSize() != null) { int maxRootSize = NumberUtils.toInt(Config.getProperty("aws.maxRootSize"), 1024); message = ViewMessages.getMessage("IUI-000135", image.getImageAws().getRootSize(), maxRootSize); rootSizeField.setRequired(false); rootSizeField.addValidator( new IntegerRangeValidator(image.getImageAws().getRootSize(), maxRootSize, message)); } if (elasticIpSelect != null) { message = ViewMessages.getMessage("IUI-000063"); elasticIpSelect.setRequired(true); elasticIpSelect.setRequiredError(message); } }