com.vaadin.v7.ui.TextField.addValidator()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(172)

本文整理了Java中com.vaadin.v7.ui.TextField.addValidator()方法的一些代码示例,展示了TextField.addValidator()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextField.addValidator()方法的具体详情如下:
包路径:com.vaadin.v7.ui.TextField
类名称:TextField
方法名:addValidator

TextField.addValidator介绍

暂无

代码示例

代码示例来源:origin: OpenNMS/opennms

@Override
public void addValidator(final Validator validator) {
  this.textField.addValidator(validator);
}

代码示例来源:origin: OpenNMS/opennms

/**
 * Sets the validator to be used.
 * @param validator the validator
 * @return the instance itself
 */
public StringInputDialogWindow withValidator(Validator validator) {
  m_inputField.addValidator(validator);
  return this;
}

代码示例来源:origin: OpenNMS/opennms

/**
 * Sets the key validator to be used.
 *
 * @param validator the validator
 * @return the instance itself
 */
public KeyValueInputDialogWindow withKeyValidator(Validator validator) {
  m_keyInputField.addValidator(validator);
  return this;
}

代码示例来源:origin: OpenNMS/opennms

/**
 * Sets the value validator to be used.
 *
 * @param validator the validator
 * @return the instance itself
 */
public KeyValueInputDialogWindow withValueValidator(Validator validator) {
  m_valueInputField.addValidator(validator);
  return this;
}

代码示例来源:origin: OpenNMS/opennms

/**
 * Instantiates a new system definition choice field.
 *
 * @param caption the caption
 */
public SystemDefChoiceField(String caption) {
  setCaption(caption);
  oidType.setNullSelectionAllowed(false);
  oidType.select("Single");
  oidValue.setWidth("100%");
  oidValue.setNullSettingAllowed(false);
  oidValue.setRequired(true);
  oidValue.setImmediate(true);
  oidValue.addValidator(new RegexpValidator("^\\.[.\\d]+$", "Invalid OID {0}"));
}

代码示例来源:origin: OpenNMS/opennms

field.setRequired(true);
field.setImmediate(true);
field.addValidator(new RegexpValidator("^\\.[.\\d]+$", "Invalid OID {0}"));
return field;
field.setRequired(true);
field.setImmediate(true);
field.addValidator(new StringLengthValidator("Invalid alias. It should not contain more than 19 characters.", 1, 19, false));
return field;
field.setRequired(true);
field.setImmediate(true);
field.addValidator(new RegexpValidator("^(?i)(counter|gauge|timeticks|integer|octetstring|string)?\\d*$", // Based on NumericAttributeType and StringAttributeType
    "Invalid type {0}. Valid types are: counter, gauge, timeticks, integer, octetstring, string"));
return field;

代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework-compatibility

@Test
public void validationSuccedsIfSubFieldValidatorPasses() throws Exception {
  // GIVEN
  createField();
  // add text field with valid email text
  TextField textField = new TextField();
  textField.addValidator(EMAIL_VALIDATOR);
  textField.setValue("foo@magnolia-cms.com");
  addSubField(textField);
  // WHEN
  boolean isValid = multiField.isValid();
  // THEN
  assertTrue(isValid);
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework-compatibility

@Test
public void validationFailsIfSubFieldValidatorFails() throws Exception {
  // GIVEN
  createField();
  // add required text field with invalid email text
  TextField textField = new TextField();
  textField.setRequired(true);
  textField.addValidator(EMAIL_VALIDATOR);
  textField.setValue("foo");
  addSubField(textField);
  // WHEN
  boolean isValid = multiField.isValid();
  // THEN
  assertFalse(isValid);
}

代码示例来源:origin: OpenNMS/opennms

numberOfRequestsField.setNullRepresentation("");
numberOfRequestsField.setWidth(FIELD_WIDTH, Unit.PIXELS);
numberOfRequestsField.addValidator((Validator) value -> {
  if (value != null) {
    if (((Integer) value).intValue() <= 0) {
timeoutField.addValidator(new NullValidator("Must be given", false));
timeoutField.addValidator((Validator) value -> {
  if (value != null) {
    if (((Long) value).intValue() <= 0) {

代码示例来源:origin: OpenNMS/opennms

m_weightField.setRequired(true);
m_weightField.setWidth(100.0f, Unit.PERCENTAGE);
m_weightField.addValidator(value -> {
  try {
    int intValue = Integer.parseInt((String) value);

代码示例来源:origin: OpenNMS/opennms

priorityField.setDescription("Priority of this dashlet");
priorityField.addValidator(new AbstractStringValidator("Only numbers allowed here") {
  @Override
  protected boolean isValidValue(String s) {
boostPriorityField.setDescription("Boost priority of this dashlet");
boostPriorityField.addValidator(new AbstractStringValidator("Only numbers allowed here") {
  @Override
  protected boolean isValidValue(String s) {
durationField.setDescription("Duration for this dashlet");
durationField.addValidator(new AbstractStringValidator("Only numbers allowed here") {
  @Override
  protected boolean isValidValue(String s) {
boostDurationField.setDescription("Boost duration for this dashlet");
boostDurationField.addValidator(new AbstractStringValidator("Only numbers allowed here") {
  @Override
  protected boolean isValidValue(String s) {

代码示例来源:origin: OpenNMS/opennms

editableField.setBuffered(false);
editableField.setImmediate(true);
editableField.addValidator(nameValidator);
editableField.addValueChangeListener(new Property.ValueChangeListener() {
  @Override

代码示例来源:origin: OpenNMS/opennms

m_nameTextField.setRequired(true);
m_nameTextField.focus();
m_nameTextField.addValidator(new AbstractStringValidator("Name must be unique") {
  private static final long serialVersionUID = 1L;
  @Override
m_thresholdTextField.setWidth(100.0f, Unit.PERCENTAGE);
m_thresholdTextField.setValue("0.0");
m_thresholdTextField.addValidator(v -> {
  if (m_thresholdTextField.isEnabled()) {
    try {
m_exponentialPropagationBaseTextField.setWidth(100.0f, Unit.PERCENTAGE);
m_exponentialPropagationBaseTextField.setValue("2.0");
m_exponentialPropagationBaseTextField.addValidator(v -> {
  if (m_exponentialPropagationBaseTextField.isEnabled()) {
    try {

代码示例来源:origin: OpenNMS/opennms

labelField.addValidator(new AbstractStringValidator("Please use an unique name for this column/row definition") {
  @Override
  protected boolean isValidValue(String s) {

代码示例来源:origin: OpenNMS/opennms

serviceNameField.setRequired(true);
serviceNameField.setRequiredError("required");
serviceNameField.addValidator(new RegexpValidator("^[A-Za-z0-9_-]+$",
    "You must specify a valid name. Allowed characters: (A-Za-z0-9_-)"));
serviceNameField.setDescription("The service name of the JMX data collection config, e.g. cassandra, jboss, tomcat");

代码示例来源:origin: OpenNMS/opennms

titleField.setValue(wallboard.getTitle());
titleField.setImmediate(true);
titleField.addValidator(new AbstractStringValidator("Title must be unique") {
  @Override
  protected boolean isValidValue(String s) {

代码示例来源:origin: OpenNMS/opennms

titleField.addValidator(new AbstractStringValidator("Please use an unique name for the surveillance view") {
  @Override
  protected boolean isValidValue(String string) {
refreshSecondsField.setDescription("Refresh duration in seconds");
refreshSecondsField.addValidator(new AbstractStringValidator("Only numbers allowed here") {
  @Override
  protected boolean isValidValue(String s) {

代码示例来源:origin: OpenNMS/opennms

m_columnCountBoardTextField.addValidator(new AbstractStringValidator("Number greater zero expected") {
  @Override
  protected boolean isValidValue(String value) {
m_columnCountPanelTextField.addValidator(new AbstractStringValidator("Number greater zero expected") {
  @Override
  protected boolean isValidValue(String value) {
m_columnCountPanelTextField.setValue(String.valueOf(columnCountPanel));
m_limitTextField.addValidator(new AbstractStringValidator("Number greater or equal zero expected") {
  @Override
  protected boolean isValidValue(String value) {

相关文章