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()); } } }
private void removeFromAllValidIfNeeded(E element) { if (allValid != null) { if (element instanceof Property<?>) { allValid.remove((Property<?>) element); } else if (element instanceof Model) { allValid.remove(((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; }