de.mguennewig.pobjform
Class AbstractRecordElement

java.lang.Object
  extended by de.mguennewig.pobjform.AbstractFormElement
      extended by de.mguennewig.pobjform.AbstractValueElement
          extended by de.mguennewig.pobjform.AbstractRecordElement
All Implemented Interfaces:
FormElement, RecordElement, ValueElement, java.lang.Iterable<java.lang.String>
Direct Known Subclasses:
HtmlRecordElement, SwingRecordElement

public abstract class AbstractRecordElement
extends AbstractValueElement
implements RecordElement, java.lang.Iterable<java.lang.String>

Abstract implementation of an record element.

Author:
Michael Günnewig

Constructor Summary
AbstractRecordElement(PObjForm form, RecordEntry entry)
          Creates a new AbstractRecordElement.
 
Method Summary
 void appendToList(java.util.List<FormElement> list)
          
 java.lang.String getCurrentString()
          Returns the string representation of the current object.
 FormElement getElement(java.lang.String name)
          Returns the element with the specified name.
 java.util.Map<java.lang.String,java.lang.Object> getInitialObject()
          Returns the initial object.
 java.lang.String getInitialString()
          Returns the string representation of the initial object.
 int getNumElement()
          Returns the number of form elements belonging to this record.
 java.util.Map<java.lang.String,java.lang.Object> getObject()
          Returns the current object.
 boolean hasChanged()
          Tests whether the data for this element has been changed.
 boolean isMandatory()
          Tests whether data for this element must be entered.
 java.util.Iterator<java.lang.String> iterator()
          Returns an iterator over the names of the child elements.
 void setCurrentAsInitialState()
          Copies the current state to the initial state.
 void setObject(java.util.Map<java.lang.String,java.lang.Object> map)
          Sets the current object to the new values from the map for all children.
 void setObject(java.lang.Object obj)
          Sets the current object to the new value.
 void setProperty(java.lang.String property)
          Sets the property to a new value, and propagates the change to all child elements.
 void setVisible(boolean visible)
          Sets whether this element will be written visibly.
 void validate()
          Checks for a valid value in this form element and any possible children.
 
Methods inherited from class de.mguennewig.pobjform.AbstractFormElement
getContainer, getEntry, getForm, getLabel, getProperty, getPullInPrefix, isPulledIn, omitRowHeader, setLabel, setPullInPrefix, startsNewCell
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.mguennewig.pobjform.FormElement
getContainer, getEntry, getForm, getLabel, getProperty, getPullInPrefix, isPulledIn, isVisible, omitRowHeader, setLabel, setPullInPrefix, startsNewCell
 

Constructor Detail

AbstractRecordElement

public AbstractRecordElement(PObjForm form,
                             RecordEntry entry)
Creates a new AbstractRecordElement.

Method Detail

appendToList

public void appendToList(java.util.List<FormElement> list)

Specified by:
appendToList in interface FormElement
Overrides:
appendToList in class AbstractFormElement

isMandatory

public final boolean isMandatory()
Tests whether data for this element must be entered.

Specified by:
isMandatory in interface FormElement

setVisible

public void setVisible(boolean visible)
Sets whether this element will be written visibly.

Specified by:
setVisible in interface FormElement

setProperty

public void setProperty(java.lang.String property)
Sets the property to a new value, and propagates the change to all child elements.

Specified by:
setProperty in interface FormElement
Overrides:
setProperty in class AbstractFormElement

hasChanged

public boolean hasChanged()
Tests whether the data for this element has been changed.

Specified by:
hasChanged in interface FormElement

validate

public void validate()
Checks for a valid value in this form element and any possible children.

Specified by:
validate in interface FormElement

getObject

public java.util.Map<java.lang.String,java.lang.Object> getObject()
Returns the current object.

Specified by:
getObject in interface ValueElement

setObject

public final void setObject(java.lang.Object obj)
Sets the current object to the new value.

Specified by:
setObject in interface ValueElement

setObject

public void setObject(java.util.Map<java.lang.String,java.lang.Object> map)
Description copied from interface: RecordElement
Sets the current object to the new values from the map for all children.

Specified by:
setObject in interface RecordElement
See Also:
ValueElement.setObject(Object)

getInitialObject

public java.util.Map<java.lang.String,java.lang.Object> getInitialObject()
Returns the initial object.

Specified by:
getInitialObject in interface ValueElement

setCurrentAsInitialState

public void setCurrentAsInitialState()
Copies the current state to the initial state.

Specified by:
setCurrentAsInitialState in interface ValueElement

getInitialString

public final java.lang.String getInitialString()
Returns the string representation of the initial object.

Specified by:
getInitialString in interface ValueElement

getCurrentString

public final java.lang.String getCurrentString()
Returns the string representation of the current object.

Specified by:
getCurrentString in interface ValueElement

getElement

public final FormElement getElement(java.lang.String name)
Returns the element with the specified name.

Specified by:
getElement in interface RecordElement

getNumElement

public final int getNumElement()
Returns the number of form elements belonging to this record.

Specified by:
getNumElement in interface RecordElement

iterator

public java.util.Iterator<java.lang.String> iterator()
Returns an iterator over the names of the child elements.

Specified by:
iterator in interface RecordElement
Specified by:
iterator in interface java.lang.Iterable<java.lang.String>