/** * Returns the highest severity of this result's messages, * {@code Severity.OK} if there are no messages. * * @return the highest severity of this result's messages, * {@code Severity.OK} if there are no messages * * @see #hasMessages() * @see #hasErrors() * @see #hasWarnings() */ public Severity getSeverity() { return getSeverity(messageList); }
/** * Returns the highest severity of this result's messages, * <code>Severity.OK</code> if there are no messages. * * @return the highest severity of this result's messages, * <code>Severity.OK</code> if there are no messages * * @see #hasMessages() * @see #hasErrors() * @see #hasWarnings() */ public Severity getSeverity() { return getSeverity(messageList); }
/** * Looks up and returns the severity of the validation result, * one of error, warning, or {@code null}. * * @return the severity of the validation result */ @Override public final Severity getSeverity() { return getResult().getSeverity(); }
/** * Looks up and returns the severity of the validation result, * one of error, warning, or {@code null}. * * @return the severity of the validation result */ public final Severity getSeverity() { return getResult().getSeverity(); }
private JComponent createFeedbackComponent(ValidationResult result, Component contentComponent) { Icon icon = ValidationResultViewFactory.getSmallIcon(result.getSeverity()); JLabel label = new JLabel(icon); label.setToolTipText(getMessagesToolTipText(result)); label.setSize(label.getPreferredSize()); return label; }
/** * Sets the component's severity according to its associated * validation result, or {@code null} if the component * has no message key set. * * @param component the component to be visited * @param keyMap maps messages keys to associated validation results */ public void visit(JComponent component, Map<Object, ValidationResult> keyMap) { ValidationResult result = getAssociatedResult(component, keyMap); Severity severity = result == null ? null : result.getSeverity(); setSeverity(component, severity); } }
private static void updateText(JLabel label, ValidationResult result) { if (result.isEmpty()) { label.setText(""); return; } Severity severity = result.getSeverity(); for (ValidationMessage message : result) { if (message.severity() == severity) { label.setText(message.formattedText()); return; } } }
/** * Sets the component's severity according to its associated * validation result, or {@code null} if the component * has no message key set. * * @param component the component to be visited * @param keyMap maps messages keys to associated validation results */ @Override public void visit(JComponent component, Map<Object, ValidationResult> keyMap) { ValidationResult result = getAssociatedResult(component, keyMap); Severity severity = result == null ? null : result.getSeverity(); setSeverity(component, severity); } }
/** * Notifies all registered listeners about changes of the result itself * and the properties for severity, errors and messages. Useful to fire * all changes in a #setResult implementation. * * @param oldResult the old validation result * @param newResult the new validation result * * @throws NullPointerException if the old or new result is {@code null} * * @see #setResult(ValidationResult) * @see ValidationResultModelContainer#setResult(ValidationResult) */ protected final void firePropertyChanges( ValidationResult oldResult, ValidationResult newResult) { Severity oldSeverity = oldResult.getSeverity(); boolean oldErrors = oldResult.hasErrors(); boolean oldMessages = oldResult.hasMessages(); Severity newSeverity = newResult.getSeverity(); boolean newErrors = newResult.hasErrors(); boolean newMessages = newResult.hasMessages(); firePropertyChange(PROPERTY_RESULT, oldResult, newResult); firePropertyChange(PROPERTY_ERRORS, oldErrors, newErrors); firePropertyChange(PROPERTY_MESSAGES, oldMessages, newMessages); firePropertyChange(PROPERTY_SEVERITY, oldSeverity, newSeverity); }
/** * Notifies all registered listeners about changes of the result itself * and the properties for severity, errors and messages. Useful to fire * all changes in a #setResult implementation. * * @param oldResult the old validation result * @param newResult the new validation result * * @throws NullPointerException if the old or new result is {@code null} * * @see #setResult(ValidationResult) * @see ValidationResultModelContainer#setResult(ValidationResult) */ protected final void firePropertyChanges( ValidationResult oldResult, ValidationResult newResult) { Severity oldSeverity = oldResult.getSeverity(); boolean oldErrors = oldResult.hasErrors(); boolean oldMessages = oldResult.hasMessages(); Severity newSeverity = newResult.getSeverity(); boolean newErrors = newResult.hasErrors(); boolean newMessages = newResult.hasMessages(); firePropertyChange(PROPERTYNAME_RESULT, oldResult, newResult); firePropertyChange(PROPERTYNAME_ERRORS, oldErrors, newErrors); firePropertyChange(PROPERTYNAME_MESSAGES, oldMessages, newMessages); firePropertyChange(PROPERTYNAME_SEVERITY, oldSeverity, newSeverity); }