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

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

Introduction

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

Prototype

public static void updateComponentTreeMandatoryAndBlankBackground(Container container) 

Source Link

Document

Traverses a component tree and sets mandatory backgrounds to text components that have blank content and have been marked as mandatory with #setMandatory(JComponent,boolean) before.

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

public void onEndBuild(SwingMetawidget metawidget) {

    ValidationComponentUtils.updateComponentTreeMandatoryAndBlankBackground(metawidget);
    ValidationComponentUtils.updateComponentTreeMandatoryBorder(metawidget);
}

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

License:LGPL

/**
 * Update the given component with the given validation result.
 * <p>/*  w w w  . j a  v  a  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);
}