Example usage for com.jgoodies.validation.view ValidationComponentUtils updateComponentTreeSeverityBackground

List of usage examples for com.jgoodies.validation.view ValidationComponentUtils updateComponentTreeSeverityBackground

Introduction

In this page you can find the example usage for com.jgoodies.validation.view ValidationComponentUtils updateComponentTreeSeverityBackground.

Prototype

public static void updateComponentTreeSeverityBackground(Container container, ValidationResult result) 

Source Link

Document

Traverses a component tree and sets the text component backgrounds according to the severity of an associated validation result - if any.

Usage

From source file:gov.nih.nci.cacore.workbench.portal.viewer.CodegenPropertiesViewer.java

License:BSD License

public void updateComponentTreeSeverity() {
    ValidationComponentUtils.updateComponentTreeMandatoryAndBlankBackground(this);
    ValidationComponentUtils.updateComponentTreeSeverityBackground(this, this.getValidationModel().getResult());
}

From source file:org.metawidget.swing.widgetprocessor.validator.jgoodies.JGoodiesValidatorProcessor.java

License:LGPL

/**
 * Update the given component with the given validation result.
 * <p>/*from   w  w w. ja  va 2 s .c o m*/
 * Clients may override this method to integrate their own Visitors. For example
 * <p>
 * <code>ValidationComponentUtils.visitComponentTree( getMetawidget(), validationResult.keyMap(), new MyCustomVisitor() );</code>
 * </p>
 *
 * @param component
 *            the component that was validated
 * @param validationResult
 *            contains the latest ValidationResult plus any previous ValidationResults for other
 *            components (so can be used correctly with updateComponentTreeXXX)
 */

protected void updateComponent(JComponent component, ValidationResult validationResult,
        SwingMetawidget metawidget) {

    // Note: it may be nicer to only update the JComponent, not revisit the entire
    // tree, but JGoodies' built-in (private) MandatoryAndBlankBackgroundVisitor uses
    // its (private) restoreBackground, so seemingly this is the way JGoodies wants us
    // to do it

    if (ValidationComponentUtils.isMandatory(component)) {
        ValidationComponentUtils.updateComponentTreeMandatoryAndBlankBackground(metawidget);
    }

    // Do the severity background after the mandatory background, as presumably it
    // has precedence

    ValidationComponentUtils.updateComponentTreeSeverityBackground(metawidget, validationResult);
}