de.mguennewig.pobjform
Interface PObjForm

All Known Subinterfaces:
PClassSearchForm, SearchForm
All Known Implementing Classes:
AbstractPObjForm, HtmlSearchForm, PClassHtmlSearchForm, PClassSwingSearchForm, PObjHtmlForm, PObjSwingForm, SwingSearchForm

public interface PObjForm

Abstract base class for rendering forms based on meta-data from the PObject library.

Author:
Michael Günnewig
See Also:
FormDecl, Messages

Method Summary
 void addErrorMessage(java.lang.String messageId, java.lang.Object... params)
          Adds an error message to the set of global messages.
 void addInvalidValueMessage(java.lang.String property, java.lang.Object... params)
          Adds an error message for the specified property that the value invalid.
 void addMandatoryMessage(java.lang.String property)
          Adds an error message for the specified property that the value is mandatory.
 void addMessage(java.lang.String property, Message msg)
          Add a message to the set of messages for the specified property.
 void addSuccessMessage(java.lang.String messageId, java.lang.Object... params)
          Adds a success message to the set of global messages.
 void clearMessage(java.lang.String property, java.lang.String msgKey)
          Removes a specific message for the given property.
 void clearMessages()
          Clear all messages recorded by this object.
 FormElement createFormElement(FormEntry entry)
          Creates a FormElement for one specified FormEntry.
 Container getContainer()
          Returns the database connection which the form uses.
 FormElement getElement(FormEntry entry)
          Returns the FormElement for the specified FormEntry.
 java.util.List<FormElement> getElements()
           
 FormDecl getFormDecl()
          Returns the form declaration that this form is based on.
 int getMessageCount()
          Return the number of messages recorded for all properties (including global messages).
 int getMessageCount(java.lang.String property)
          Return the number of messages associated with the specified property.
 java.util.Iterator<java.lang.String> getMessageProperties()
          Return the set of property names for which at least one message has been recorded.
 Messages getMessages()
           
 java.util.Iterator<Message> getMessages(java.lang.String property)
          Return the set of messages related to a specific property.
 boolean hasChanged()
          Tests whether any element in the form has been changed.
 boolean hasChanged(FormEntry entry)
          Tests whether the value of the element for the given entry has changed.
 boolean hasChanged(java.lang.String entryName)
          Tests whether the value of the element with the given name has changed.
 boolean hasMessages()
          Return true if there are no messages recorded in this object, or false otherwise.
 void populateForm(Record record, FormEntry[] entries)
          Populates the specified form entries with the data from the record.
 void populateForm(Record record, FormEntry[] entries, boolean setCurrentAsInitial)
          Populates the specified form entries with the data from the record.
 void populateObject(FormEntry[] entries, Record record)
          Populates the record with the data from the form elements of the corresponding form entries.
 void populateObject(FormEntry[] entries, Record record, boolean transferUnchangedValues)
          Populates the record with the data from the form elements of the corresponding form entries.
 void setContainer(Container container)
           
 void setCurrentAsInitialState()
           
 void validate()
           
 

Method Detail

addMessage

void addMessage(java.lang.String property,
                Message msg)
Add a message to the set of messages for the specified property.


addInvalidValueMessage

void addInvalidValueMessage(java.lang.String property,
                            java.lang.Object... params)
Adds an error message for the specified property that the value invalid.

See Also:
addMessage(String,Message)

addMandatoryMessage

void addMandatoryMessage(java.lang.String property)
Adds an error message for the specified property that the value is mandatory.

See Also:
addMessage(String,Message)

addErrorMessage

void addErrorMessage(java.lang.String messageId,
                     java.lang.Object... params)
Adds an error message to the set of global messages.


addSuccessMessage

void addSuccessMessage(java.lang.String messageId,
                       java.lang.Object... params)
Adds a success message to the set of global messages.


clearMessages

void clearMessages()
Clear all messages recorded by this object.


clearMessage

void clearMessage(java.lang.String property,
                  java.lang.String msgKey)
Removes a specific message for the given property.


getMessageCount

int getMessageCount()
Return the number of messages recorded for all properties (including global messages).


getMessageCount

int getMessageCount(java.lang.String property)
Return the number of messages associated with the specified property.


getMessageProperties

java.util.Iterator<java.lang.String> getMessageProperties()
Return the set of property names for which at least one message has been recorded.


getMessages

Messages getMessages()

getMessages

java.util.Iterator<Message> getMessages(java.lang.String property)
Return the set of messages related to a specific property.


hasMessages

boolean hasMessages()
Return true if there are no messages recorded in this object, or false otherwise.


getFormDecl

FormDecl getFormDecl()
Returns the form declaration that this form is based on.


createFormElement

FormElement createFormElement(FormEntry entry)
Creates a FormElement for one specified FormEntry.


getContainer

Container getContainer()
Returns the database connection which the form uses.


setContainer

void setContainer(Container container)

getElement

FormElement getElement(FormEntry entry)
Returns the FormElement for the specified FormEntry.


getElements

java.util.List<FormElement> getElements()

hasChanged

boolean hasChanged()
Tests whether any element in the form has been changed.


hasChanged

boolean hasChanged(java.lang.String entryName)
Tests whether the value of the element with the given name has changed.


hasChanged

boolean hasChanged(FormEntry entry)
Tests whether the value of the element for the given entry has changed.

See Also:
hasChanged(String)

populateForm

void populateForm(Record record,
                  FormEntry[] entries,
                  boolean setCurrentAsInitial)
Populates the specified form entries with the data from the record.

For the current value of the corresponding form element for each form entry will the set to the value of the column with the same name within the record.

Parameters:
record - The record which should be populated into the form.
entries - The form entries whose current values will be set to the data read from the record.
setCurrentAsInitial - if true the new current value of the changed form elements will also be used as the initial one.
Throws:
java.lang.IllegalArgumentException - if for a form entry no column with the same name exists in the record.
See Also:
getElement(FormEntry)

populateForm

void populateForm(Record record,
                  FormEntry[] entries)
Populates the specified form entries with the data from the record.

This method ensures that the new value is also used as initial one.

Parameters:
record - The record which should be populated into the form.
entries - The form entries whose current values will be set to the data read from the record.
Throws:
java.lang.IllegalArgumentException - if for a form entry no column with the same name exists in the record.
See Also:
populateForm(Record,FormEntry[],boolean)

populateObject

void populateObject(FormEntry[] entries,
                    Record record,
                    boolean transferUnchangedValues)
Populates the record with the data from the form elements of the corresponding form entries.

For each specified form entry the current value of the corresponding form element will be written to the column with the same name in the record.

Parameters:
record - The record which should be populated into the form.
entries - The form entries whose current values will be set to the data read from the record.
transferUnchangedValues - if false only the values of form elements that have been changed are copied into the record.
Throws:
java.lang.IllegalArgumentException - if for a form entry no column with the same name exists in the record.
See Also:
getElement(FormEntry)

populateObject

void populateObject(FormEntry[] entries,
                    Record record)
Populates the record with the data from the form elements of the corresponding form entries.

This method only transfers changed values into the record.

Parameters:
record - The record which should be populated into the form.
entries - The form entries whose current values will be set to the data read from the record.
Throws:
java.lang.IllegalArgumentException - if for a form entry no column with the same name exists in the record.
See Also:
populateObject(FormEntry[],Record,boolean)

setCurrentAsInitialState

void setCurrentAsInitialState()

validate

void validate()