/** * Adds an error {@code PropertyValidationMessage} to the specified * {@code ValidationResult}. * Uses the given property and message text. * * @param result the result the message will be added to * @param property describes the validated property * @param text the message text */ public final void addError(ValidationResult result, String property, String text) { result.add(createError(property, text)); }
/** * Adds a warning {@code PropertyValidationMessage} to the specified * {@code ValidationResult}. * Uses the given property and message text. * * @param result the result the message will be added to * @param property describes the validated property * @param text the message text */ public final void addWarning(ValidationResult result, String property, String text) { result.add(createWarning(property, text)); }
/** * Adds an error <code>PropertyValidationMessage</code> to the specified * <code>ValidationResult</code>. * Uses the given property and message text. * * @param result the result the message will be added to * @param property describes the validated property * @param text the message text */ public void addError(ValidationResult result, String property, String text) { result.add(createError(property, text)); }
/** * Adds a {@code PropertyValidationMessage} to the specified * {@code ValidationResult}. Uses this object's default severity * and the given property and message text. * * @param result the result the message will be added to * @param property describes the validated property * @param text the message text */ public final void add(ValidationResult result, String property, String text) { result.add(create(property, text)); }
/** * Adds a warning <code>PropertyValidationMessage</code> to the specified * <code>ValidationResult</code>. * Uses the given property and message text. * * @param result the result the message will be added to * @param property describes the validated property * @param text the message text */ public void addWarning(ValidationResult result, String property, String text) { result.add(createWarning(property, text)); }
/** * Adds a <code>PropertyValidationMessage</code> to the specified * <code>ValidationResult</code>. Uses this object's default severity * and the given property and message text. * * @param result the result the message will be added to * @param property describes the validated property * @param text the message text */ public void add(ValidationResult result, String property, String text) { result.add(create(property, text)); }
/** * Adds a {@code PropertyValidationMessage} to the specified * {@code ValidationResult}. Uses the specified severity * and the given property and message text. * * @param result the result the message will be added to * @param severity the severity used for the created message * @param property describes the validated property * @param text the message text * * @throws IllegalArgumentException if {@code severity} is {@code OK} */ public final void add(ValidationResult result, Severity severity, String property, String text) { result.add(create(severity, property, text)); }
/** * Adds a <code>PropertyValidationMessage</code> to the specified * <code>ValidationResult</code>. Uses the specified severity * and the given property and message text. * * @param result the result the message will be added to * @param severity the severity used for the created message * @param property describes the validated property * @param text the message text * * @throws IllegalArgumentException if severity is <code>Severity.OK</code> */ public void add(ValidationResult result, Severity severity, String property, String text) { if (severity == Severity.OK) throw new IllegalArgumentException("Severity.OK must not be used in validation messages."); result.add(create(severity, property, text)); }
/** * Returns the collapsed validation result, i. e. a {@link ValidationResult} * that just consists of a single {@link ValidationMessage}; in this case * the collapsed validation message.<p> * * TODO: Consider changing the implementation to <pre> * ValidationResult wrapper = new ValidationResult(); * if (getExpandedValidationResult().hasMessages()) { * wrapper.add(collapsedMessage); * } * return wrapper; * </pre> * * @return the collapsed validation result * * @see #getExpandedValidationResult() */ public ValidationResult getCollapsedValidationResult() { ValidationResult wrapper = new ValidationResult(); wrapper.add(collapsedMessage); return wrapper; }
/** * Returns the collapsed validation result, i. e. a {@link ValidationResult} * that just consists of a single {@link ValidationMessage}; in this case * the collapsed validation message.<p> * * TODO: Consider changing the implementation to <pre> * ValidationResult wrapper = new ValidationResult(); * if (getExpandedValidationResult().hasMessages()) { * wrapper.add(collapsedMessage); * } * return wrapper; * </pre> * * @return the collapsed validation result * * @see #getExpandedValidationResult() */ public ValidationResult getCollapsedValidationResult() { ValidationResult wrapper = new ValidationResult(); wrapper.add(collapsedMessage); return wrapper; }
/** * Creates and adds an error message to the list of validation messages * using the given text. * * @param text the error text to add * * @throws NullPointerException if the message text {@code null} * @throws UnsupportedOperationException if the result is unmodifiable * * @see #add(ValidationMessage) * @see #addWarning(String) */ public void addError(String text) { assertModifiable(); if (text == null) throw new NullPointerException("The message text must not be null."); add(new SimpleValidationMessage(text, Severity.ERROR)); }
/** * Creates and adds a warning message to the list of validation messages * using the given text. * * @param text the warning text to add * * @throws NullPointerException if the message text {@code null} * @throws UnsupportedOperationException if the result is unmodifiable * * @see #add(ValidationMessage) * @see #addError(String) */ public void addWarning(String text) { assertModifiable(); if (text == null) throw new NullPointerException("The message text must not be null."); add(new SimpleValidationMessage(text)); }
@Override protected void updateValidation(ValidationResult result) { if (enumComboBox.getSelectedItem() == null) { result.add(new SimpleValidationMessage(StaticWidgetHelper.getSynaptixWidgetConstantsBundle().mandatoryField(), Severity.ERROR, enumComboBox)); } } }
private void updateValidator() { ValidationResult result = new ValidationResult(); if (ValidationUtils.isEmpty(libelleField.getText())) { result.add(new SimpleValidationMessage(StaticWidgetHelper.getSynaptixWidgetConstantsBundle().mandatoryField(), Severity.ERROR, "LIBELLE")); //$NON-NLS-1$ } else if (!ValidationUtils.hasMaximumLength(libelleField.getText(), libelleLengthMax)) { result.add(new SimpleValidationMessage(StaticWidgetHelper.getSynaptixWidgetConstantsBundle().maximumLengthCharacters(libelleLengthMax), Severity.ERROR, "LIBELLE")); //$NON-NLS-1$ } validationResultModel.setResult(result); }
/** * Creates and adds a warning message to the list of validation messages * using the given validation message key, (format) text and optional * format arguments. * * @param key the key used to associate messages and components * @param text the format text to add * @param args optional text format arguments * * * @throws NullPointerException if the message text is {@code null} * @throws IllegalArgumentException if the message text is empty or whitespace * @throws UnsupportedOperationException if the result is unmodifiable * * @see #add(ValidationMessage) * @see #addError(String) * * @since 2.6 */ private ValidationResult addWarning(Object key, String text, Object... args) { checkModifiable(); add(new SimpleValidationMessage(Strings.get(text, args), Severity.WARNING, key)); return this; }
@Override protected void updateValidation(ValidationResult result) { if (getValues() == null) { result.add(new SimpleValidationMessage(StaticWidgetHelper.getSynaptixWidgetConstantsBundle().pleaseSelectItem(), Severity.ERROR)); } }
/** * Creates and adds an info message to the list of validation messages * using the given validation message key, (format) text and optional * format arguments. * * @param key the key used to associate messages and components * @param text the format text to add * @param args optional text format arguments * * * @throws NullPointerException if the message text is {@code null} * @throws IllegalArgumentException if the message text is empty or whitespace * @throws UnsupportedOperationException if the result is unmodifiable * * @see #add(ValidationMessage) * @see #addError(String) * * @since 2.6 */ private ValidationResult addInfo(Object key, String text, Object... args) { checkModifiable(); add(new SimpleValidationMessage(Strings.get(text, args), Severity.INFO, key)); return this; }
/** * Creates and adds an error message to the list of validation messages * using the given validation message key, (format) text and optional * format arguments. * * @param key the key used to associate messages and components * @param text the format text to add * @param args optional text format arguments * * * @throws NullPointerException if the message text is {@code null} * @throws IllegalArgumentException if the message text is empty or whitespace * @throws UnsupportedOperationException if the result is unmodifiable * * @see #add(ValidationMessage) * @see #addWarning(String) * * @since 2.6 */ private ValidationResult addError(Object key, String text, Object... args) { checkModifiable(); add(new SimpleValidationMessage(Strings.get(text, args), Severity.ERROR, key)); return this; }
@Override public void updateValidation() { ValidationResult result = new ValidationResult(); boolean hasOneUnchecked = false; if ((listToList.getSelectionValues() != null) && (listToList.getSelectionValues().length > 0)) { hasOneUnchecked = true; } // Iterator<JCheckBox> ite = visibleBoxs.iterator(); // while ((ite.hasNext()) && (!hasOneUnchecked)) { // JCheckBox checkBox = ite.next(); // if (checkBox.isSelected()) { // hasOneUnchecked = true; // } // } if (!hasOneUnchecked) { result.add(new SimpleValidationMessage(StaticWidgetHelper.getSynaptixWidgetConstantsBundle().aColumnAtLeastMustBeSelected(), Severity.ERROR)); } validationResultModel.setResult(result); acceptAction.setEnabled(!result.hasErrors()); }