Author: tchemit Date: 2008-12-04 01:37:16 +0000 (Thu, 04 Dec 2008) New Revision: 1056 Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/Util.java Log: add setValidatorChanged util method to set changed property on some validators of an ui Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/Util.java =================================================================== --- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/Util.java 2008-12-03 16:23:49 UTC (rev 1055) +++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/Util.java 2008-12-04 01:37:16 UTC (rev 1056) @@ -461,7 +461,7 @@ } /** - * Convient method to attach a bean to all validators of an JAXXObject. + * Convinient method to attach a bean to all validators of an JAXXObject. * <p/> * It is possible to exclude some validator to be treated. * @@ -483,4 +483,28 @@ beanValidator.setBean(bean); } } + + /** + * Convinient method to set the changed property to all validators of an JAXXObject. + * <p/> + * It is possible to exclude some validator to be treated. + * + * @param ui the ui containing the validatros to treate + * @param newValue the new value to set in changed validator property + * @param excludeIds the list of validator id to exclude + */ + @SuppressWarnings({"unchecked"}) + public static void setValidatorChanged(JAXXObject ui, boolean newValue, String... excludeIds) { + List<String> validatorIds = ui.getValidatorIds(); + if (excludeIds.length > 0) { + validatorIds = new ArrayList<String>(validatorIds); + for (String excludeId : excludeIds) { + validatorIds.remove(excludeId); + } + } + for (String validatorId : validatorIds) { + BeanValidator beanValidator = ui.getValidator(validatorId); + beanValidator.setChanged(newValue); + } + } }