.getName());\r
\r
private Item itemDataSource;\r
- private boolean fieldsBuffered = true;\r
+ private boolean buffered = true;\r
\r
- private boolean fieldsEnabled = true;\r
- private boolean fieldsReadOnly = false;\r
+ private boolean enabled = true;\r
+ private boolean readOnly = false;\r
\r
private HashMap<Object, Field<?>> propertyIdToField = new HashMap<Object, Field<?>>();\r
private LinkedHashMap<Field<?>, Object> fieldToPropertyId = new LinkedHashMap<Field<?>, Object>();\r
* {@link #commit()} for the item to be updated unless buffered mode has\r
* been switched off.\r
* \r
- * @see #setFieldsBuffered(boolean)\r
+ * @see #setBuffered(boolean)\r
* @see #commit()\r
* \r
* @return The item used by this FieldBinder\r
* Checks the buffered mode for the bound fields.\r
* <p>\r
* \r
- * @see #setFieldsBuffered(boolean) for more details on buffered mode\r
+ * @see #setBuffered(boolean) for more details on buffered mode\r
* \r
- * @see Field#isFieldsBuffered()\r
+ * @see Field#isBuffered()\r
* @return true if buffered mode is on, false otherwise\r
* \r
*/\r
- public boolean isFieldsBuffered() {\r
- return fieldsBuffered;\r
+ public boolean isBuffered() {\r
+ return buffered;\r
}\r
\r
/**\r
* The default is to use buffered mode.\r
* </p>\r
* \r
- * @see Field#setFieldsBuffered(boolean)\r
- * @param fieldsBuffered\r
+ * @see Field#setBuffered(boolean)\r
+ * @param buffered\r
* true to turn on buffered mode, false otherwise\r
*/\r
- public void setFieldsBuffered(boolean fieldsBuffered) {\r
- if (fieldsBuffered == this.fieldsBuffered) {\r
+ public void setBuffered(boolean buffered) {\r
+ if (buffered == this.buffered) {\r
return;\r
}\r
\r
- this.fieldsBuffered = fieldsBuffered;\r
+ this.buffered = buffered;\r
for (Field<?> field : getFields()) {\r
- field.setBuffered(fieldsBuffered);\r
+ field.setBuffered(buffered);\r
}\r
}\r
\r
* <p>\r
* Note that this will not accurately represent the enabled status of all\r
* fields if you change the enabled status of the fields through some other\r
- * method than {@link #setFieldsEnabled(boolean)}.\r
+ * method than {@link #setEnabled(boolean)}.\r
* \r
* @return true if the fields are enabled, false otherwise\r
*/\r
- public boolean isFieldsEnabled() {\r
- return fieldsEnabled;\r
+ public boolean isEnabled() {\r
+ return enabled;\r
}\r
\r
/**\r
* @param fieldsEnabled\r
* true to enable all bound fields, false to disable them\r
*/\r
- public void setFieldsEnabled(boolean fieldsEnabled) {\r
- this.fieldsEnabled = fieldsEnabled;\r
+ public void setEnabled(boolean fieldsEnabled) {\r
+ enabled = fieldsEnabled;\r
for (Field<?> field : getFields()) {\r
field.setEnabled(fieldsEnabled);\r
}\r
* <p>\r
* Note that this will not accurately represent the read only status of all\r
* fields if you change the read only status of the fields through some\r
- * other method than {@link #setFieldsReadOnly(boolean)}.\r
+ * other method than {@link #setReadOnly(boolean)}.\r
* \r
* @return true if the fields are set to read only, false otherwise\r
*/\r
- public boolean isFieldsReadOnly() {\r
- return fieldsReadOnly;\r
+ public boolean isReadOnly() {\r
+ return readOnly;\r
}\r
\r
/**\r
* true to set all bound fields to read only, false to set them\r
* to read write\r
*/\r
- public void setFieldsReadOnly(boolean fieldsReadOnly) {\r
- this.fieldsReadOnly = fieldsReadOnly;\r
+ public void setReadOnly(boolean fieldsReadOnly) {\r
+ readOnly = fieldsReadOnly;\r
}\r
\r
/**\r
* If the field is not bound by this field binder or not bound\r
* to the correct property id\r
*/\r
- public void remove(Field<?> field) throws BindException {\r
+ public void unbind(Field<?> field) throws BindException {\r
Object propertyId = fieldToPropertyId.get(field);\r
if (propertyId == null) {\r
throw new BindException(\r
* The field to update\r
*/\r
protected void configureField(Field<?> field) {\r
- field.setBuffered(isFieldsBuffered());\r
+ field.setBuffered(isBuffered());\r
\r
- field.setEnabled(isFieldsEnabled());\r
- field.setReadOnly(isFieldsReadOnly());\r
+ field.setEnabled(isEnabled());\r
+ field.setReadOnly(isReadOnly());\r
}\r
\r
/**\r
* \r
* @return A collection of property ids that have not been bound to fields\r
*/\r
- protected Collection<Object> getUnboundPropertyIds() {\r
+ public Collection<Object> getUnboundPropertyIds() {\r
if (getItemDataSource() == null) {\r
return new ArrayList<Object>();\r
}\r
* If the commit was aborted\r
*/\r
public void commit() throws CommitException {\r
- if (!isFieldsBuffered()) {\r
+ if (!isBuffered()) {\r
// Not using buffered mode, nothing to do\r
return;\r
}\r
* @return The field that is bound to the property id or null if no field is\r
* bound to that property id\r
*/\r
- public Field<?> getFieldForPropertyId(Object propertyId) {\r
+ public Field<?> getField(Object propertyId) {\r
return propertyIdToField.get(propertyId);\r
}\r
\r
* @return The property id that is bound to the field or null if the field\r
* is not bound to any property id by this FieldBinder\r
*/\r
- public Object getPropertyIdForField(Field field) {\r
+ public Object getPropertyId(Field<?> field) {\r
return fieldToPropertyId.get(field);\r
}\r
\r
* \r
* @return true if all bound fields are valid, false otherwise.\r
*/\r
- public boolean isAllFieldsValid() {\r
+ public boolean isValid() {\r
try {\r
for (Field<?> field : getFields()) {\r
field.validate();\r
* \r
* @return true if at least on field has been modified, false otherwise\r
*/\r
- public boolean isAnyFieldModified() {\r
+ public boolean isModified() {\r
for (Field<?> field : getFields()) {\r
if (field.isModified()) {\r
return true;\r