List of usage examples for com.jgoodies.validation ValidationResult addAllFrom
public void addAllFrom(ValidationResult validationResult)
From source file:gov.nih.nci.cacore.workbench.portal.validation.CodegenPropertiesValidator.java
License:BSD License
public void validateInput() { ValidationResult result = new ValidationResult(); for (PanelValidator panelValidator : parentContainer.getPanelValidators()) { result.addAllFrom(panelValidator.validateInput()); }/* w w w .j a va 2s. c o m*/ parentContainer.getValidationModel().setResult(result); parentContainer.toggleSaveButton(); parentContainer.togglePreviousButton(); parentContainer.toggleNextButton(); parentContainer.toggleGenerateButton(); parentContainer.togglePanels(); parentContainer.updateGenerateApplicationTabContents(); parentContainer.updateComponentTreeSeverity(); }
From source file:gov.nih.nci.cacore.workbench.portal.validation.DeploymentPropertiesValidator.java
License:BSD License
public void validateInput() { ValidationResult result = new ValidationResult(); for (PanelValidator panelValidator : parentContainer.getPanelValidators()) { result.addAllFrom(panelValidator.validateInput()); }/*w ww .j a v a2 s .com*/ parentContainer.getValidationModel().setResult(result); parentContainer.toggleWritableApiFields(); parentContainer.toggleSecurityFields(); parentContainer.toggleRemoteSshFields(); parentContainer.toggleTestConnectionButton(); parentContainer.toggleClmTestConnectionButton(); parentContainer.toggleCsmTestConnectionButton(); parentContainer.toggleDbJndiNameField(); parentContainer.toggleCsmDbJndiNameField(); parentContainer.toggleSaveButton(); parentContainer.togglePreviousButton(); parentContainer.toggleNextButton(); parentContainer.toggleDeployButton(); parentContainer.togglePanels(); parentContainer.updateDeployApplicationTabContents(); parentContainer.updateComponentTreeSeverity(); }
From source file:org.metawidget.swing.widgetprocessor.validator.jgoodies.JGoodiesValidatorProcessor.java
License:LGPL
/** * Execute the given Validator against the given JComponent. *//*from w w w .j a va 2 s . c om*/ protected void validateChange(final JComponent component, final Validator<?> validator, String path, final SwingMetawidget metawidget) { final String[] names = PathUtils.parsePath(path).getNamesAsArray(); // JGoodies' API concentrates on bulk updates of sub-components in a component tree. // For example the <code>ValidationComponentUtils.updateComponentTreeXXX</code> and // <code>ValidationComponentUtils.visitComponentTree</code> methods take a top-level // component and traverse it setting all validation messages for all sub-components. // // Because of this, when updating it is important to retain previous validation // results, or their messages will be lost during the bulk update of new validation // results @SuppressWarnings("unchecked") Map<JComponent, ValidationResult> validationResults = (Map<JComponent, ValidationResult>) metawidget .getClientProperty(JGoodiesValidatorProcessor.class); if (validationResults == null) { validationResults = CollectionUtils.newHashMap(); metawidget.putClientProperty(JGoodiesValidatorProcessor.class, validationResults); } // Fetch the value... Object value = metawidget.getValue(names); // ...run it through the Validator... if (validator != null) { @SuppressWarnings("unchecked") Validator<Object> objectValidator = (Validator<Object>) validator; ValidationResult validationResult = objectValidator.validate(value); if (validationResult == null) { validationResults.remove(component); } else { validationResults.put(component, validationResult); } } // ...collate all ValidationResults... ValidationResult validationResult = new ValidationResult(); for (ValidationResult previousValidationResult : validationResults.values()) { validationResult.addAllFrom(previousValidationResult); } // ...and update the UI updateComponent(component, validationResult, metawidget); }
From source file:org.openthinclient.console.util.ChildValidator.java
License:Open Source License
public ValidationResult validate() { ValidationResult result = new ValidationResult(); for (Validator childValidator : childValidators) result.addAllFrom(childValidator.validate()); return result; }