List of usage examples for com.jgoodies.validation ValidationResult getErrors
public List<ValidationMessage> getErrors()
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. ja va 2 s . c o m*/ 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);/*from w w w.j ava 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); } }
From source file:org.openthinclient.console.wizards.newdirobject.ConfigurationPanel.java
License:Open Source License
public boolean isValid() { final ValidationResult validate = validator.validate(); if (!validate.hasErrors()) { if (validate.hasMessages()) { final PropertyValidationMessage m = (PropertyValidationMessage) validate.getMessages().get(0); wd.putProperty("WizardPanel_errorMessage", m.formattedText()); //$NON-NLS-1$ } else//from w w w.j av a2 s .c om wd.putProperty("WizardPanel_errorMessage", null); //$NON-NLS-1$ return true; } else { final PropertyValidationMessage m = (PropertyValidationMessage) validate.getErrors().iterator().next(); wd.putProperty("WizardPanel_errorMessage", m.formattedText()); //$NON-NLS-1$ return false; } }
From source file:ru.goodfil.catalog.ui.forms.FilterWindow.java
private static void showValidationPanel(JList list, ValidationResult result) { list.setBorder(new LineBorder(Color.BLACK)); list.setBackground(Color.YELLOW); list.setCellRenderer(new MessagesRenderer()); if (result.isEmpty()) { list.setVisibleRowCount(0);//from www . ja va2 s. c o m list.setVisible(false); } else { list.setVisibleRowCount(result.getErrors().size()); list.setModel(new ArrayListModel<ValidationMessage>(result.getErrors())); } list.repaint(); }