/** * Resets all field values. */ public void reset() { for (Field<?> f : getFields()) { f.reset(); } }
/** * Clears all values from all fields. */ public void clear() { for (Field<?> f : getFields()) { f.clear(); } }
/** * Sets all of the panel's fields read only state. * * @param readOnly true for read only */ public void setReadOnly(boolean readOnly) { for (Field<?> f : getFields()) { f.setReadOnly(readOnly); } }
/** * Returns true if any of the form's fields are dirty. * * @return true for dirty */ public boolean isDirty() { for (Field<?> f : getFields()) { if (f.isDirty()) { return true; } } return false; }
/** * Returns the form's valid state by querying all child fields. * * @param preventMark true for silent validation (no invalid event and field * is not marked invalid) * * @return true if all fields are valid */ public boolean isValid(boolean preventMark) { boolean valid = true; for (Field<?> f : getFields()) { if (!f.isValid(preventMark)) { valid = false; } } return valid; }
/** * Resets the dirty state for all fields by setting the original value to be * equal to the current value. */ @SuppressWarnings({"unchecked", "rawtypes"}) public void clearDirtyFields() { for (Field f : getFields()) { if (f.isDirty()) { f.setOriginalValue(f.getValue()); } } }
/** * Searches the form's fields, and adds a binding to and field without a * binding. */ public void autoBind() { for (Field<?> f : panel.getFields()) { if (!bindings.containsKey(f.getId())) { String name = f.getName(); if (name != null && name.length() > 0) { FieldBinding b = new FieldBinding(f, f.getName()); bindings.put(f.getId(), b); } } } }
@Override @SuppressWarnings("rawtypes") public void autoBind() { for (Field f : panel.getFields()) { if (!bindings.containsKey(f.getId())) { String name = f.getName(); if (name != null) { FieldBinding b; // if (f.getId().equals(BeanKeyValue.REDUCED_CONTENT_UPDATE.getValue())) // b = new ReducedContentFieldBinding(f, f.getName()); // else b = new GeofenceFieldBinding(f, f.getName()); bindings.put(f.getId(), b); } } } }