Example usage for com.jgoodies.validation ValidationMessage formattedText

List of usage examples for com.jgoodies.validation ValidationMessage formattedText

Introduction

In this page you can find the example usage for com.jgoodies.validation ValidationMessage formattedText.

Prototype

String formattedText();

Source Link

Document

Returns a formatted text that describes the validation issue this message represents.

Usage

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

License:BSD License

public void toggleGenerateButton() {
    //if (this.validationModel.hasErrors() || (this.isDirty) || (mainTabbedPane.getSelectedIndex() != GENERATE_TAB_INDEX) ) {
    if (this.isDirty || (mainTabbedPane.getSelectedIndex() != GENERATE_TAB_INDEX) || (!this.isPropsLoaded)) {
        log.debug("Generate Button is disabled; required conditions have not been met");
        generateButton.setEnabled(false);
    } else {/*  www  .j  ava2 s .  com*/
        log.debug("* * * Validation model has errors? " + this.validationModel.hasErrors());
        if (this.validationModel.hasErrors()) {

            ValidationResult results = validationModel.getResult();
            List<com.jgoodies.validation.ValidationMessage> errors = results.getErrors();

            //debug error results
            for (ValidationMessage errorMessage : results.getErrors()) {
                log.debug("* * * * Validation Error Message key: " + errorMessage.key()
                        + "; Validation Error Message: " + errorMessage.formattedText());
            }

            if (errors != null && errors.size() == 1) {
                for (ValidationMessage errorMessage : results.getErrors()) {
                    if (((String) (errorMessage.key()))
                            .equalsIgnoreCase(CacoreWorkbenchConstants.LOG_FILE_VALIDATION_KEY)) {
                        log.debug("Generate Button is enabled; required conditions have been met");
                        generateButton.setEnabled(true);
                        return;
                    }
                }

            }
            log.debug("Generate Button is disabled; Validation errors have been found");
            generateButton.setEnabled(false);
            return;
        }

        log.debug("Generate Button is enabled; required conditions have been met");
        generateButton.setEnabled(true);

    }
}

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

License:BSD License

public void toggleDeployButton() {
    if ((this.isDirty) || (mainTabbedPane.getSelectedIndex() != DEPLOY_TAB_INDEX) || (!this.isPropsLoaded)) {

        log.debug("Deploy Button is disabled; here's why: ");
        log.debug("* * * Viewer is 'Dirty' (properties need to be saved)? " + this.isDirty);
        log.debug("* * * Not on Deploy Tab? " + (mainTabbedPane.getSelectedIndex() != DEPLOY_TAB_INDEX));

        if (mainTabbedPane.getSelectedIndex() != DEPLOY_TAB_INDEX)
            log.debug("* * * Tabbed Panel Index: " + mainTabbedPane.getSelectedIndex() + ";  DEPLOY_TAB_INDEX: "
                    + DEPLOY_TAB_INDEX);
        log.debug("* * * Have the properties been loaded? " + this.isPropsLoaded);

        deployButton.setEnabled(false);//w ww  . j a va 2  s.  c  om
    } else {
        log.debug("* * * Validation model has errors? " + this.validationModel.hasErrors());
        if (this.validationModel.hasErrors()) {

            ValidationResult results = validationModel.getResult();
            List<com.jgoodies.validation.ValidationMessage> errors = results.getErrors();

            //debug error results
            for (ValidationMessage errorMessage : results.getErrors()) {
                log.debug("* * * * Validation Error Message key: " + errorMessage.key()
                        + "; Validation Error Message: " + errorMessage.formattedText());
            }

            if (errors != null && errors.size() == 1) {
                for (ValidationMessage errorMessage : results.getErrors()) {
                    if (((String) (errorMessage.key()))
                            .equalsIgnoreCase(CacoreWorkbenchConstants.LOG_FILE_VALIDATION_KEY)) {
                        log.debug("Deploy Button is enabled; required conditions have been met");
                        deployButton.setEnabled(true);
                        return;
                    }
                }

            }
            deployButton.setEnabled(false);
            return;
        }

        log.debug("Deploy Button is enabled; required conditions have been met");
        deployButton.setEnabled(true);
    }
}