fc.web.forms
Class FieldRefresher

java.lang.Object
  extended by fc.web.forms.FieldRefresher

public abstract class FieldRefresher
extends Object

Refreshes the value of a field (or fields) before the field is displayed to the user. Refreshed values are typically retrieved from a database.


Constructor Summary
FieldRefresher()
           
 
Method Summary
 boolean isSubmitValid(FormData fd)
          There must be a way to figure out if the client hacked/delete/modified the form before submitting it.
abstract  void refresh(FormData fd)
          Refresh the value of the field.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FieldRefresher

public FieldRefresher()
Method Detail

refresh

public abstract void refresh(FormData fd)
                      throws IOException,
                             SQLException
Refresh the value of the field. The new values are request specific (and each HTTP request handler thread will update the values for that request independent of other requests). The values should be stored in the supplied form data object by invoking field methods that look like: setValue(FormData fd,....).

It is possible for the specified form data to be null.

Parameters:
fd - the form data object, possibly null if there is no submit data.
Throws:
IOException
SQLException

isSubmitValid

public boolean isSubmitValid(FormData fd)
There must be a way to figure out if the client hacked/delete/modified the form before submitting it. Since the rendered values are different per request, we cannot rely on values that the target field was constructed with. This method is conceptually similar to a Dependency.isSubmitDataValid(fc.web.forms.FormData) method. This method can be implemented to check the submitted values and return true if the submit was valid, false otherwise.

The default implementation always returns true.


toString

public String toString()
Overrides:
toString in class Object