private void addToAllValidIfNeeded(E element) { if (allValid != null) { if (element instanceof Property<?>) { allValid.add((Property<?>) element); } else if (element instanceof Model) { allValid.add(((Model) element).allValid()); } } }
/** * @return a property that, if we contain properties or models, will be true if all contains * properties/models (as well as ourself) are valid. */ public Property<Boolean> allValid() { if (allValid == null) { allValid = new PropertyGroup(getValueObject().getName() + ".allValid"); allValid.add(this); for (E element : getDirect()) { addToAllValidIfNeeded(element); } } return allValid; }