1 package uk.ac.cam.spectra.spectrasub.components;
2
3 import org.apache.tapestry.ITemplateComponent;
4 import org.apache.tapestry.valid.IValidationDelegate;
5
6 import uk.ac.cam.spectra.spectrasub.DataPackage;
7
8 import com.hp.hpl.jena.rdf.model.Resource;
9
10 /**
11 * Interface for components that contribute parts of the AddMetadata page
12 *
13 * @author ojd20
14 *
15 */
16 public interface Formlet extends ITemplateComponent {
17
18 /**
19 * This method gets called from the page begin render method when the form
20 * is <b>not</b>rewinding. To implement rewind functionality, implement
21 * IPageBeginRenderListener.
22 *
23 * @param p
24 */
25 public abstract void setupPage(DataPackage p);
26
27 /**
28 * Write form data out as RDF metadata.
29 *
30 * @param resource
31 */
32 public abstract void writeMetadata(Resource resource);
33
34 /**
35 * Validate formlet inputs.
36 *
37 * @param delegate
38 */
39 public abstract void validate(IValidationDelegate delegate);
40
41 public boolean allowSubmit();
42
43 /**
44 * This method will be called after the form handling has taken account of
45 * this formlets need to block submission, the formlet should clear whatever
46 * state it holds for blocking submisison.
47 */
48 public abstract void clearSubmissionBlock();
49
50 }