adapforms.runtime.events
Interface FormHook

All Known Implementing Classes:
AbstractFormHook

public interface FormHook

Defines a form hook, that may be registered with one or more paths in a form instance. See FormInstance.addHook(java.lang.String, adapforms.runtime.events.FormHook).

Each hook can be registered for multiple paths or even instances at once, since each event carries information about the instance and path trigger.

Author:
Henrik Gammelmark, geemark@cs.au.dk
See Also:
AbstractFormHook

Method Summary
 void onRepeatEntryAdd(FormInstance instance, FormPath path, int entryID)
          A repeat entry has been added to the form.
 void onRepeatEntryRemove(FormInstance instance, FormPath path, int entryID)
          A repeat entry has been removed from the form.
 void onValueChange(FormInstance instance, ElementState state)
          Invoked by the framework when the value of a form element changes (for each element that have had this hook added).
 

Method Detail

onValueChange

void onValueChange(FormInstance instance,
                   ElementState state)
Invoked by the framework when the value of a form element changes (for each element that have had this hook added).

The hook is invoked also if the new value causes validation errors and if the value was deleted.

Parameters:
instance - Instance in question
state - The current state of the affected element

onRepeatEntryAdd

void onRepeatEntryAdd(FormInstance instance,
                      FormPath path,
                      int entryID)
A repeat entry has been added to the form.

Parameters:
instance - Instance in question
path - Full path to the new instance (including entryID). To get the path of the actual repeat element, use FormPath.getRuntimeParent().
entryID - The ID of the entry added. This is the unique positive integer denoting this entry.

onRepeatEntryRemove

void onRepeatEntryRemove(FormInstance instance,
                         FormPath path,
                         int entryID)
A repeat entry has been removed from the form.
Notice that at this point, the associated data has already been removed from the form, and thus the given path cannot be used to look up entered data.

Parameters:
instance - Instance in question
path - Full path to the deleted instance (including entryID). To get the path of the actual repeat element, use FormPath.getRuntimeParent().
entryID - The ID of the entry added. This is the unique positive integer denoting this entry.