01: /*
02: * Created on 20 Aug 2007
03: */
04: package uk.org.ponder.rsf.renderer.html;
05:
06: import java.util.Map;
07:
08: import uk.org.ponder.rsf.content.ContentTypeInfoRegistry;
09: import uk.org.ponder.rsf.template.ContentTypedTPI;
10: import uk.org.ponder.rsf.template.XMLLump;
11: import uk.org.ponder.rsf.util.SplitID;
12:
13: /** In order to main a consistent designer-facing semantic, HTML form tags
14: * must be written without colon, since they do not cause branching. However,
15: * the interpretation to the template parser of the colon tag is to form
16: * a containment scope for resolution, which also agrees with the component
17: * tree since UIForm is a container.
18: * @author Antranig Basman (antranig@caret.cam.ac.uk)
19: *
20: */
21:
22: public class FormRelabellingTPI implements ContentTypedTPI {
23:
24: public String[] getInterceptedContentTypes() {
25: return new String[] { ContentTypeInfoRegistry.HTML,
26: ContentTypeInfoRegistry.HTML_FRAGMENT };
27: }
28:
29: public void adjustAttributes(String tag, Map attributes) {
30: String id = (String) attributes.get(XMLLump.ID_ATTRIBUTE);
31: if (tag.equals("form") && id != null) {
32: if (!SplitID.isSplit(id)) {
33: attributes.put(XMLLump.ID_ATTRIBUTE, id
34: + SplitID.SEPARATOR);
35: }
36: }
37: }
38: }
|