Java 类com.vaadin.server.UserError 实例源码

项目:material-theme-fw8    文件:MenusView.java   
private MDComboBox createComboBox(String label, String helper, String error, MaterialIcons icon, boolean floating, boolean light) {
    MDComboBox cb = new MDComboBox(label, light);
    if (helper != null) cb.setHelper(helper);
    if (icon != null) cb.setIcon(icon);
    if (error != null) {
        cb.addValueChangeListener(event -> {
            //TODO: please check (@Jonte) -> "event.getValue().isEmpty()" is obsolete
            // if (event.getValue() == null || event.getValue().isEmpty()) {
            if (event.getValue() == null) {
                cb.setComponentError(new UserError(error));
            } else {
                cb.setComponentError(null);
            }
        });
        cb.setComponentError(new UserError(error));
    }
    cb.setFloatingLabelEnabled(floating);
    cb.setEmptySelectionAllowed(false);
    return cb;
}
项目:material-theme-fw8    文件:MenusView.java   
private MDDateField createDateField(String label, String helper, String error, MaterialIcons icon, boolean floating, boolean light) {
    MDDateField cb = new MDDateField(label, light);
    if (helper != null) cb.setHelper(helper);
    if (icon != null) cb.setIcon(icon);
    if (error != null) {
        cb.addValueChangeListener(event -> {
            if (event.getValue() == null) {
                cb.setComponentError(new UserError(error));
            } else {
                cb.setComponentError(null);
            }
        });
        cb.setComponentError(new UserError(error));
    }
    cb.setFloatingLabelEnabled(floating);
    return cb;
}
项目:material-theme-fw8    文件:MenusView.java   
private MDDateTimeField createDateTimeField(String label, String helper, String error, MaterialIcons icon, boolean floating, boolean light) {
    MDDateTimeField cb = new MDDateTimeField(label, light);
    if (helper != null) cb.setHelper(helper);
    if (icon != null) cb.setIcon(icon);
    if (error != null) {
        cb.addValueChangeListener(event -> {
            if (event.getValue() == null) {
                cb.setComponentError(new UserError(error));
            } else {
                cb.setComponentError(null);
            }
        });
        cb.setComponentError(new UserError(error));
    }
    cb.setFloatingLabelEnabled(floating);
    return cb;
}
项目:material-theme-fw8    文件:TextFieldsView.java   
private MDTextField createTextField(String label, String helper, String error, MaterialIcons icon, boolean floating, boolean light) {
    MDTextField tf = new MDTextField(label, light);
    if (helper != null) tf.setHelper(helper);
    if (icon != null) tf.setIcon(icon);
    if (error != null) {
        tf.addValueChangeListener(event -> {
            if (event.getValue() == null || event.getValue().isEmpty()) {
                tf.setComponentError(new UserError(error));
            } else {
                tf.setComponentError(null);
            }
        });
        tf.setComponentError(new UserError(error));
    }
    tf.setFloatingLabelEnabled(floating);
    return tf;
}
项目:material-theme-fw8    文件:TextFieldsView.java   
private MDTextFieldBox createTextFieldBox(String label, String helper, String error, MaterialIcons icon, boolean light) {
    MDTextFieldBox tf = new MDTextFieldBox(label, light);
    if (helper != null) tf.setHelper(helper);
    if (icon != null) tf.setIcon(icon);
    if (error != null) {
        tf.addValueChangeListener(event -> {
            if (event.getValue() == null || event.getValue().isEmpty()) {
                tf.setComponentError(new UserError(error));
            } else {
                tf.setComponentError(null);
            }
        });
        tf.setComponentError(new UserError(error));
    }
    return tf;
}
项目:material-theme-fw8    文件:TextFieldsView.java   
private MDTextAreaBox createTextAreaBox(String label, String helper, String error, MaterialIcons icon, boolean light) {
    MDTextAreaBox tf = new MDTextAreaBox(label, light);
    if (helper != null) tf.setHelper(helper);
    if (icon != null) tf.setIcon(icon);
    if (error != null) {
        tf.addValueChangeListener(event -> {
            if (event.getValue() == null || event.getValue().isEmpty()) {
                tf.setComponentError(new UserError(error));
            } else {
                tf.setComponentError(null);
            }
        });
        tf.setComponentError(new UserError(error));
    }
    return tf;
}
项目:dungeonstory-java    文件:AbstractNumberField.java   
@Override
public void valueChange(ValueChangeEvent<String> event) {
    if (!ignoreValueChange) {
        T old = getValue();
        String newValue = event.getValue();
        if (newValue != null) {
            if (userInputToValue(newValue)) {
                fireEvent(new ValueChangeEvent<T>(AbstractNumberField.this, old, true));
            } else {
                if (isAggressive()) {
                    //do not let invalid characters in aggressive mode
                    doSetValue(old);
                } else {
                    setComponentError(new UserError(getParsingErrorMessage()));
                }
            }
        } else {
            setValue(null);
        }
    }
}
项目:enterprise-app    文件:AuthWindow.java   
@Override
public void buttonClick(ClickEvent event) {
    loginTf.setComponentError(null);
    passwordTf.setComponentError(null);
    panel.setVisible(false);

    if(loginTf.isVisible() && (loginTf.getValue() == null || loginTf.getValue().toString().isEmpty())) {
        loginTf.setComponentError(new UserError(Constants.uiRequiredField));

    } else if(passwordTf.getValue() == null || passwordTf.getValue().toString().isEmpty()) {
        passwordTf.setComponentError(new UserError(Constants.uiRequiredField));

    } else {
        try {
            buttonClicked();

        } catch(InvalidValueException e) {
            label.setCaption(e.getMessage());
            panel.setVisible(true);
        }
    }
}
项目:enterprise-app    文件:AbstractReport.java   
protected void build() {
    try {
        refreshButton.setComponentError(null);
        setObservations("");
        leftLayout.setMargin(true);
        layout.setFirstComponent(leftLayout);
        updateReport();

        if(!getObservations().isEmpty()) {
            refreshButton.setComponentError(new UserError(Constants.uiSeeObservationsOnTheReport));
        }

    } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e);
    }
}
项目:gazpachoquest    文件:NumericQuestion.java   
public boolean isValid(TextField field, String newValue) {
    boolean valid = true;

    if (StringUtils.isBlank(newValue)) {
        if (field.isRequired()) {
            valid = false;
        }
    } else {
        for (Validator v : field.getValidators()) {
            try {
                v.validate(newValue);
            } catch (InvalidValueException e) {
                valid = false;
                logger.warn(e.getMessage());
                answerField.setComponentError(new UserError(e.getMessage()));
            }
        }
    }
    if (valid) {
        answerField.setComponentError(null);
    }
    return valid;
}
项目:esup-ecandidat    文件:CustomTabSheet.java   
/**Affiche les erreur d'un sheet avec un point exclam en logo
 * @param findError
 * @param tabOrder
 */
public void displayErrorSheet(Boolean findError, Integer tabOrder){
    if (findError){
        this.getTab(tabOrder).setComponentError(new UserError(errorMessage));
        //this.getTab(tabOrder).setIcon(FontAwesome.EXCLAMATION);
    }else{
        //this.getTab(tabOrder).setIcon(null);
        this.getTab(tabOrder).setComponentError(null);      
    }
}
项目:vaadin-fluent-api    文件:FluentComponentTest.java   
@Test
public void test() {

    UserError error = new UserError("error");

    FTextField field = new FTextField().withCaption("test")
                                       .withEnabled(false)
                                       .withIcon(VaadinIcons.AIRPLANE)
                                       .withId("id")
                                       .withPrimaryStyleName("pStyle")
                                       .withStyleName("t1 t2")
                                       .withVisible(false)
                                       .withTabIndex(5)
                                       .withCaptionAsHtml(true)
                                       .withComponentError(error)
                                       .withDescription("description")
                                       .withData("data")
                                       .withLocale(Locale.CANADA)
                                       .withResponsive(true);

    assertEquals("test", field.getCaption());
    assertFalse(field.isEnabled());
    assertEquals(VaadinIcons.AIRPLANE, field.getIcon());
    assertEquals("id", field.getId());
    assertEquals("pStyle", field.getPrimaryStyleName());
    assertTrue(field.getStyleName().contains("t1"));
    assertTrue(field.getStyleName().contains("t2"));
    assertFalse(field.isVisible());
    assertEquals(5, field.getTabIndex());
    assertTrue(field.isCaptionAsHtml());
    assertEquals(error, field.getComponentError());
    assertEquals("description", field.getDescription());
    assertEquals("data", field.getData());
    assertEquals(Locale.CANADA, field.getLocale());
    assertEquals(true, field.isResponsive());
}
项目:metasfresh-procurement-webui    文件:AbstractErrorHandler.java   
private ErrorMessage createErrorMessage(final Throwable t)
{
    final ErrorMessage errorMessage = AbstractErrorMessage.getErrorMessageForException(t);

    // In case we deal with an System Error, don't show it to user because it's confusing.
    // Instead show a generic friendly error message.
    if (errorMessage instanceof SystemError)
    {
        return new UserError(i18n.get("error.default"));
    }

    return errorMessage;
}
项目:cuba    文件:WebAbstractComponent.java   
protected boolean hasValidationError() {
    if (getComposition() instanceof AbstractComponent) {
        AbstractComponent composition = (AbstractComponent) getComposition();
        return composition.getComponentError() instanceof UserError;
    }
    return false;
}
项目:cuba    文件:WebAbstractComponent.java   
protected void setValidationError(String errorMessage) {
    if (getComposition() instanceof AbstractComponent) {
        AbstractComponent composition = (AbstractComponent) getComposition();
        if (errorMessage == null) {
            composition.setComponentError(null);
        } else {
            composition.setComponentError(new UserError(errorMessage));
        }
    }
}
项目:cuba    文件:WebResizableTextArea.java   
@Override
protected CubaTextArea createTextFieldImpl() {
    return new CubaTextArea() {
        @Override
        public void setComponentError(ErrorMessage componentError) {
            if (componentError instanceof UserError) {
                super.setComponentError(componentError);
            } else {
                wrapper.setComponentError(componentError);
            }
        }
    };
}
项目:cuba    文件:WebLookupPickerField.java   
@Override
protected void createComponent() {
    super.createComponent();

    // delegate error indication
    this.componentErrorHandler = message -> {
        if (message instanceof UserError) {
            return false;
        }

        pickerField.component.setComponentError(message);
        return true;
    };

    component.setCustomValueEquals(InstanceUtils::propertyValueEquals);

    final ComboBox selectComponent = component;
    final WebPickerField.Picker picker = new WebPickerField.Picker(this, component) {
        @Override
        public void setRequired(boolean required) {
            super.setRequired(required);
            selectComponent.setNullSelectionAllowed(!required);
        }
    };
    pickerField = new WebPickerField(picker);

    // Required for custom components in fieldgroup
    initValueSync(selectComponent, picker);
}
项目:minimal-j    文件:VaadinIndication.java   
public static void setValidationMessages(List<String> validationMessages, AbstractComponent component) {
    if (validationMessages.isEmpty()) {
        component.setComponentError(null);
    } else if (validationMessages.size() == 1) {
        component.setComponentError(new UserError(validationMessages.get(0)));
    } else {
        ErrorMessage[] errorMessages = new ErrorMessage[validationMessages.size()];
        for (int i = 0; i<validationMessages.size(); i++) {
            errorMessages[i] = new UserError(validationMessages.get(i));
        }
        CompositeErrorMessage compositeErrorMessage = new CompositeErrorMessage(errorMessages);
        component.setComponentError(compositeErrorMessage);
    }
}
项目:viritin    文件:ClearableTextFieldUsage.java   
@Override
    public Component getTestComponent() {

        ClearableTextField ctf = new ClearableTextField();
        ctf.setCaption("CTF caption");
        ctf.setPlaceholder("Enter text");
        ctf.setValue("Some Text");


        ctf.addValueChangeListener(e -> {
            Notification.show("Value: " + ctf.getValue());
        });

        // TODO figure out how this works in V8
//        MButton b = new MButton("Toggle required", e -> {
//            ctf.setRequired(!ctf.isRequired());
//        });
        MButton b2 = new MButton("Toggle error", e -> {
            if (ctf.getComponentError() == null) {
                ctf.setComponentError(new UserError("Must be filled"));
            } else {
                ctf.setComponentError(null);
            }
        });

        MButton b3 = new MButton("Toggle readonly", e -> {
            ctf.setReadOnly(!ctf.isReadOnly());
        });

        MButton b4 = new MButton("Toggle enabled", e -> {
            ctf.setEnabled(!ctf.isEnabled());
        });

        return new MPanel()
                .withCaption("ClearableTextField")
                .withDescription("Click the X to clear…")
                .withFullWidth()
                .withFullHeight()
                .withContent(new MVerticalLayout(ctf, /* b,*/ b2, b3, b4));
    }
项目:viritin    文件:ClearableTextFieldUsageV7.java   
@Override
public Component getTestComponent() {

    ClearableTextField ctf = new ClearableTextField();
    ctf.setCaption("CTF caption");
    ctf.setInputPrompt("Enter text");
    ctf.setValue("Some Text");

    ctf.setImmediate(true);

    ctf.addValueChangeListener(e -> {
        Notification.show("Value: " + ctf.getValue());
    });

    MButton b = new MButton("Toggle required", e -> {
        ctf.setRequired(!ctf.isRequired());
    });
    MButton b2 = new MButton("Toggle error", e -> {
        if (ctf.getComponentError() == null) {
            ctf.setComponentError(new UserError("Must be filled"));
        } else {
            ctf.setComponentError(null);
        }
    });

    MButton b3 = new MButton("Toggle readonly", e -> {
        ctf.setReadOnly(!ctf.isReadOnly());
    });

    MButton b4 = new MButton("Toggle enabled", e -> {
        ctf.setEnabled(!ctf.isEnabled());
    });

    return new MPanel()
            .withCaption("ClearableTextField")
            .withDescription("Click the X to clear…")
            .withFullWidth()
            .withFullHeight()
            .withContent(new MVerticalLayout(ctf, b, b2, b3, b4));
}
项目:Vaadin4Spring-MVP-Sample-SpringSecurity    文件:SignUpViewImpl.java   
@Override
public void setErrorMessage(String message) {
    username.setComponentError(new UserError(message));
    username.setValidationVisible(true);
    password.setValidationVisible(true);
    firstName.setValidationVisible(true);
    lastName.setValidationVisible(true);

}
项目:Vaadin4Spring-MVP-Sample-SpringSecuritySocial    文件:SignupContent.java   
@Override
public void buttonClick(ClickEvent event) {

    try {
        binder.commit();

        SignupModel model = binder.getItemDataSource().getBean();           
        Account account = new Account(model.getUsername(), model.getPassword(), model.getFirstName(), model.getLastName());
        accountRepository.createAccount(account);

        if (account != null) {
            SignInUtils.signin(account.getUsername());

            //Create social connection              
            ProviderSignInAttempt attempt = (ProviderSignInAttempt) UI.getCurrent().getSession().getSession().getAttribute(ProviderSignInAttempt.SESSION_ATTRIBUTE);
            if (attempt != null) {
                usersConnectionRepository.createConnectionRepository(account.getUsername()).addConnection(attempt.getConnection());
                UI.getCurrent().getSession().getSession().removeAttribute(ProviderSignInAttempt.SESSION_ATTRIBUTE);
            }

            Page.getCurrent().setLocation("/ui/");
        }

    } catch (CommitException e) {
        username.setValidationVisible(true);
        password.setValidationVisible(true);
        firstName.setValidationVisible(true);
        lastName.setValidationVisible(true);

    } catch (UsernameAlreadyInUseException eu) {
        username.setComponentError(new UserError(eu.getMessage()));
        username.setValidationVisible(true);
        password.setValidationVisible(true);
        firstName.setValidationVisible(true);
        lastName.setValidationVisible(true);

    }

}
项目:enterprise-app    文件:AbstractReport.java   
public DynamicReportBuilder getReportBuilder() {

    FastReportBuilder reportBuilder = new FastReportBuilder();
    reportBuilder.setWhenNoData(Constants.uiEmptyReport, null);
    reportBuilder.setPrintBackgroundOnOddRows((Boolean) printBackgroundOnOddRowsCheckBox.getValue());
    reportBuilder.setPrintColumnNames((Boolean) printColumnNamesCheckBox.getValue());
    reportBuilder.setUseFullPageWidth(true);

    try {
        Integer top = mmToPoints(new Float(marginTopTextField.getValue().toString()));
        Integer bottom = mmToPoints(new Float(marginBottomTextField.getValue().toString()));
        Integer left = mmToPoints(new Float(marginLeftTextField.getValue().toString()));
        Integer right = mmToPoints(new Float(marginRightTextField.getValue().toString()));

        Page page = new Page();
        page.setWidth(mmToPoints(new Float(pageWidthTextField.getValue().toString())));
        page.setHeight(mmToPoints(new Float(pageHeightTextField.getValue().toString())));

        if(page.getHeight() < 140 + top + bottom || page.getWidth() < left + right || page.getHeight() < 1 || page.getWidth() < 1 || top < 0 || bottom < 0 || left < 0 || right < 0) {
            throw new NumberFormatException();
        }

        reportBuilder.setPageSizeAndOrientation(page);
        reportBuilder.setColumnsPerPage(new Integer(columnsPerPageTextField.getValue().toString()));
        reportBuilder.setMargins(top, bottom, left, right);

    } catch(NumberFormatException e) {
        refreshButton.setComponentError(new UserError(Constants.uiReportConfigurationError));
    }

    return reportBuilder;
}
项目:jdal    文件:UserErrorProcessor.java   
/**
 * {@inheritDoc}
 */
public void processError(Object control, FieldError error) {
    if (control instanceof AbstractField) {
        AbstractField<?> f = (AbstractField<?>) control;
        f.setComponentError(new UserError(StaticMessageSource.getMessage(error)));
        fieldSet.add(f);
    }
}
项目:holon-vaadin7    文件:DefaultValidationStatusHandler.java   
private static void setComponentError(ValueComponent<?> valueComponent, String error) {
    final Component c = valueComponent.getComponent();
    if (c != null && c instanceof AbstractComponent) {
        ((AbstractComponent) c).setComponentError((error == null) ? null : new UserError(error));
    }
}
项目:holon-vaadin    文件:DefaultValidationStatusHandler.java   
private static void setComponentError(ValueComponent<?> valueComponent, String error) {
    final Component c = valueComponent.getComponent();
    if (c != null && c instanceof AbstractComponent) {
        ((AbstractComponent) c).setComponentError((error == null) ? null : new UserError(error));
    }
}
项目:hawkbit    文件:DefineGroupsLayout.java   
private void markWithLastGroupError() {
    targetPercentage
            .setComponentError(new UserError(i18n.getMessage("message.rollout.remaining.targets.error")));
}
项目:zklogtool    文件:OpenTransactionLogFileDialog.java   
public OpenTransactionLogFileDialog(final TabSheet displayTabSheet,
        final Window windowHandle) {
    buildMainLayout();
    setCompositionRoot(mainLayout);

    openButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {

            File transactionLogFile = new File(transactionLogFileLabel.getValue());
            File snapshotDir = new File(snapshotDirectoryLabel.getValue());

            if (!transactionLogFile.isFile() && !transactionLogFile.isDirectory()) {

                transactionLogFileLabel.setComponentError(new UserError("IO problem"));
                return;

            }

            if (snapshotDirectoryLabel.getValue() != null && !snapshotDirectoryLabel.getValue().isEmpty() && !snapshotDir.isDirectory()) {

                snapshotDirectoryLabel.setComponentError(new UserError("IO problem"));
                return;

            }

            TransactionLogView transactionLogView = new TransactionLogView(transactionLogFile, snapshotDir,
                    followCheckbox.getValue(), startFromLastCheckbox.getValue(), displayTabSheet, nameLabel.getValue());

            HorizontalLayout horizontalLayout = new HorizontalLayout();
            horizontalLayout.setCaption(nameLabel.getValue());
            horizontalLayout.addComponent(transactionLogView);
            horizontalLayout.setWidth("100%");
            horizontalLayout.setHeight("100%");
            Tab transactionLogTab = displayTabSheet
                    .addTab(horizontalLayout);
            transactionLogTab.setClosable(true);
            displayTabSheet.setSelectedTab(transactionLogTab);

            windowHandle.close();

        }

    });

}
项目:jesterj    文件:LogIn.java   
public LogIn() {

  loginLayout.setWidth("100%");
  loginLayout.setHeight("300px");
  loginForm.setSpacing(true);
  loginLabel.setImmediate(true);
  userNameTextField.setRequired(true);
  passwordField.setRequired(true);
  loginSubmit.addClickListener(new Button.ClickListener() {
    @Override
    public void buttonClick(Button.ClickEvent event) {
      authToken.setUsername(userNameTextField.getValue());
      authToken.setPassword(passwordField.getValue().toCharArray());
      try {
        Subject currentUser = SecurityUtils.getSubject();
        currentUser.login(authToken);
        if (currentUser.isAuthenticated()) {
          User user = currentUser.getPrincipals().oneByType(User.class);
          loginLabel.setValue("Hello " + user.getDisplayName());
        }
      } catch (UnknownAccountException uae) {
        userNameTextField.setComponentError(new UserError("Unknown User"));
        loginLabel.setValue("That user does not exist");
      } catch (IncorrectCredentialsException ice) {
        loginLabel.setValue("Invalid password");
        passwordField.setComponentError(new UserError("Invalid Password"));
      } catch (LockedAccountException lae) {
        loginLabel.setValue("Account is locked. Contact your System Administrator");
        loginLabel.setComponentError(new UserError("Account locked"));
      } catch (ExcessiveAttemptsException eae) {
        loginLabel.setValue("Too many login failures.");
        loginLabel.setComponentError(new UserError("Failures Exceeded"));
      } catch (Exception e) {
        e.printStackTrace();
        loginLabel.setValue("Internal Error:" + e.getMessage());
      }
    }

  });
  loginForm.addComponent(loginLabel);
  loginForm.addComponent(userNameTextField);
  loginForm.addComponent(passwordField);
  loginForm.addComponent(loginSubmit);
  loginLayout.addComponent(loginForm, 1, 1);
  }
项目:viritin    文件:MBeanFieldGroup.java   
protected boolean jsr303ValidateBean(T bean) {
    try {
        if (javaxBeanValidator == null) {
            javaxBeanValidator = getJavaxBeanValidatorFactory().getValidator();
        }
    } catch (Throwable t) {
        // This may happen without JSR303 validation framework
        Logger.getLogger(getClass().getName()).fine(
            "JSR303 validation failed");
        return true;
    }

    boolean containsAtLeastOneBoundComponentWithError = false;
    Set<ConstraintViolation<T>> constraintViolations = new HashSet<>(
        javaxBeanValidator.validate(bean, getValidationGroups()));
    if (constraintViolations.isEmpty()) {
        return true;
    }
    Iterator<ConstraintViolation<T>> iterator = constraintViolations.
        iterator();
    while (iterator.hasNext()) {
        ConstraintViolation<T> constraintViolation = iterator.next();
        Class<? extends Annotation> annotationType = constraintViolation.
            getConstraintDescriptor().getAnnotation().
            annotationType();
        AbstractComponent errortarget = validatorToErrorTarget.get(
            annotationType);
        if (errortarget != null) {
            // user has declared a target component for this constraint
            errortarget.setComponentError(new UserError(
                constraintViolation.getMessage()));
            iterator.remove();
            containsAtLeastOneBoundComponentWithError = true;
        }
        // else leave as "bean level error"
    }
    this.jsr303beanLevelViolations = constraintViolations;
    if (!containsAtLeastOneBoundComponentWithError && isValidateOnlyBoundFields()) {
        return true;
    }
    return false;
}
项目:academ    文件:FormularioInicioSesion.java   
public void setMensajeError(String mensaje) {
    Notification.show("ACaDeM", mensaje, Type.TRAY_NOTIFICATION);
    this.labelError.setValue(mensaje);
    this.botonIniciarSesion.setComponentError(new UserError(mensaje, ContentMode.TEXT, ErrorLevel.WARNING));
}
项目:academ    文件:FormularioCrearEditarEvaluacion.java   
public void setMensajeError(String mensaje) {
    Notification.show("ACaDeM", mensaje, Type.TRAY_NOTIFICATION);
    this.labelError.setValue(mensaje);
    buttonGuardar.setComponentError(new UserError(mensaje, ContentMode.TEXT, ErrorLevel.WARNING));
}
项目:academ    文件:FormularioInicioSesion.java   
public void setMensajeError(String mensaje) {
    Notification.show("ACaDeM", mensaje, Type.TRAY_NOTIFICATION);
    this.labelError.setValue(mensaje);
    this.buttonIniciarSesion.setComponentError(new UserError(mensaje, ContentMode.TEXT, ErrorLevel.WARNING));
}
项目:academ    文件:FormularioCrearEditarEvaluacion.java   
public void setMensajeError(String mensaje) {
    Notification.show("ACaDeM", mensaje, Type.TRAY_NOTIFICATION);
    this.labelError.setValue(mensaje);
    buttonGuardar.setComponentError(new UserError(mensaje, ContentMode.TEXT, ErrorLevel.WARNING));
}
项目:zklogtool    文件:OpenSnapshotFileDialog.java   
boolean validateInputs() {

        boolean isOk = true;

        if (snapshotFileLabel.getValue().isEmpty()) {

            snapshotFileLabel.setComponentError(new UserError("File path must be provided"));
            isOk = false;

        } else {

            snapshotFileLabel.setComponentError(null);

        }

        if (tabNameLabel.getValue().isEmpty()) {

            tabNameLabel.setComponentError(new UserError("Name must be provided"));
            isOk = false;

        } else {

            tabNameLabel.setComponentError(null);

        }

        return isOk;

    }