/** * Sets an empty {@link ValidationResult} as default result. * Useful at the begin of a validation sequence. */ public final void clearResult() { defaultResult = new ValidationResult(); }
/** * Sets an empty {@link ValidationResult} as default result. * Useful at the begin of a validation sequence. */ public void clearResult() { defaultResult = new ValidationResult(); }
/** * Constructs a <code>PropertyValidationSupport</code> instance for the * given validation target and its validation role. * * @param defaultSeverity the optional <code>Severity</code> used for * message creation when no severity is specified * @param target the object to be validated * @param role the validation target's role in the outer context * * @throws NullPointerException if the target or role is {@code null} * @throws IllegalArgumentException if defaultSeverity is <code>Severity.OK</code> */ public PropertyValidationSupport(Severity defaultSeverity, Object target, String role) { this(new ValidationResult(), defaultSeverity, target, role); }
/** * Constructs a {@code PropertyValidationSupport} instance for the * given validation target and its validation role. * * @param defaultSeverity the optional {@code Severity} used for * message creation when no severity is specified * @param target the object to be validated * @param role the validation target's role in the outer context * * @throws NullPointerException if the target or role is {@code null} * @throws IllegalArgumentException if defaultSeverity is {@code Severity.OK} */ public PropertyValidationSupport(Severity defaultSeverity, Object target, String role) { this(new ValidationResult(), defaultSeverity, target, role); }
/** * Returns an unmodifiable view of the given ValidationResult. * Useful to provide users with "read-only" access to internal results, * or to indicate to other validation result processors that a result * is not intended to be modified. Attempts to modify the returned * validation result throw an <code>UnsupportedOperationException</code>. * * @param validationResult the result for which an unmodifiable view is to be returned * @return an unmodifiable view of the specified validation result */ public static ValidationResult unmodifiableResult(ValidationResult validationResult) { return validationResult.modifiable ? new ValidationResult(new ArrayList<ValidationMessage>(validationResult.messageList), false) : validationResult; }
/** * Returns an unmodifiable view of the given ValidationResult. * Useful to provide users with "read-only" access to internal results, * or to indicate to other validation result processors that a result * is not intended to be modified. Attempts to modify the returned * validation result throw an {@code UnsupportedOperationException}. * * @param validationResult the result for which an unmodifiable view is to be returned * @return an unmodifiable view of the specified validation result */ public static ValidationResult unmodifiableResult(ValidationResult validationResult) { return validationResult.modifiable ? new ValidationResult(new ArrayList<ValidationMessage>(validationResult.messageList), false) : validationResult; }
/** * Returns an unmodifiable view of the portion of this result between * the specified <code>fromIndex</code>, inclusive, and <code>toIndex</code>, * exclusive. * (If <code>fromIndex</code> and <code>toIndex</code> are equal, * the returned result is empty.) The returned result is a copy, * so changes in the returned result won't affect this result, * and vice-versa. * * @param fromIndex low end point (inclusive) of the subResult * @param toIndex high end point (exclusive) of the subResult * @return a view of the specified range within this result. * * @throws IndexOutOfBoundsException for an illegal end point index value * (fromIndex < 0 || toIndex > size || fromIndex > toIndex). * * @see #subResult(Object) */ public ValidationResult subResult(int fromIndex, int toIndex) { List<ValidationMessage> messages = messageList.subList(fromIndex, toIndex); return new ValidationResult(messages, false); }
/** * 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; }
@Override public void run() { ValidationResult result = new ValidationResult(); updateValidation(result); fireUpdateValidator(result); } });
@Override public void run() { ValidationResult result = new ValidationResult(); updateValidation(result); fireUpdateValidator(result); } });
@Override public final void updateValidation() { ValidationResult result = new ValidationResult(); updateValidation(result); validationResultModel.setResult(result); acceptAction.setEnabled(!result.hasErrors()); }
/** * Returns the concatenation of all validation results that are held * by this container. * * @return the concatenation of all validation results that are held * by this container * * @see #getCollapsedValidationResult() */ public ValidationResult getExpandedValidationResult() { ValidationResult concatenation = new ValidationResult(); for (ValidationResultModel resultModel : childResultModels) { concatenation.addAllFrom(resultModel.getResult()); } return concatenation; }
/** * Returns the concatenation of all validation results that are held * by this container. * * @return the concatenation of all validation results that are held * by this container * * @see #getCollapsedValidationResult() */ public ValidationResult getExpandedValidationResult() { ValidationResult concatenation = new ValidationResult(); for (ValidationResultModel resultModel : childResultModels) { concatenation.addAllFrom(resultModel.getResult()); } return concatenation; }
protected abstract void updateValidation(ValidationResult result);
private void updateValidator() { ValidationResult result = new ValidationResult(); for (ValidationResult r : validatorMap.values()) { result.addAllFrom(r); } validationResultModel.setResult(result); acceptAction.setEnabled(!result.hasErrors()); for (Action a : getOthersActions()) { a.setEnabled(!result.hasErrors()); } }
protected abstract void updateValidation(ValidationResult result);
protected abstract void updateValidation(ValidationResult result);
private void updateValidator() { ValidationResult result = new ValidationResult(); for (ValidationResult r : validatorMap.values()) { result.addAllFrom(r); } validationResultModel.setResult(result); getAcceptAction().setEnabled(!result.hasErrors()); for (Action a : getOthersActions()) { a.setEnabled(!result.hasErrors()); } }
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); }
@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()); }