1 package net.trajano.twiff.renderer;
2
3 import java.util.List;
4 import java.util.Map;
5
6 /***
7 * Performs operation on a page data. Implements the Visitor pattern.
8 *
9 * @author Archimedes Trajano
10 */
11 public interface PageElementVisitor {
12 /***
13 * Visits a StringElement object.
14 *
15 * @param pageData
16 * page data.
17 * @param content
18 * content.
19 * @see PageElement#accept(PageElementVisitor)
20 */
21 void visitStringPageElement(StringElement pageData, String content);
22
23 /***
24 * Start of a simple element.
25 *
26 * @param element
27 * @param elementName
28 * @param attributes
29 * @param subElements
30 */
31 void startSimpleElement(SimpleElement element, String elementName, Map<String, String> attributes, List<PageElement> subElements);
32
33 /***
34 * Ends a simple element.
35 *
36 * @param element
37 * @param elementName
38 * @param attributes
39 * @param subElements
40 */
41 void endSimpleElement(SimpleElement element, String elementName, Map<String, String> attributes, List<PageElement> subElements);
42
43 /***
44 * Visits an element that has no body.
45 *
46 * @param element
47 * @param elementName
48 * @param attributes
49 */
50 void visitSimpleEmptyElement(SimpleElement element, String elementName, Map<String, String> attributes);
51
52 /***
53 * Visits a processing instruction element.
54 *
55 * @param element
56 * @param target
57 * @param data
58 */
59 void visitProcessingInstructionElement(ProcessingInstructionElement element, String target, String data);
60
61 /***
62 * Invoked when the document is started.
63 *
64 * @param element
65 */
66 void startDocument(DocumentElement element);
67
68 /***
69 * Invoked when the document ends.
70 *
71 * @param element
72 */
73 void endDocument(DocumentElement element);
74
75 /***
76 * @param element
77 * @param elementName
78 * @param attributes
79 */
80 void visitComponentEmptyElement(ComponentElement element, String elementName, Map<String, String> attributes);
81
82 /***
83 * @param element
84 * @param elementName
85 * @param attributes
86 * @param subElements
87 */
88 void startComponentElement(ComponentElement element, String elementName, Map<String, String> attributes, List<PageElement> subElements);
89
90 /***
91 * @param element
92 * @param elementName
93 * @param attributes
94 * @param subElements
95 */
96 void endComponentElement(ComponentElement element, String elementName, Map<String, String> attributes, List<PageElement> subElements);
97 }