1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package Torello.Browser.JsonAST;

import Torello.Java.Additional.Ret2;
import Torello.Java.StrIndent;

/**
 * Generates the HTML for the elements of the {@code "events"} array, which is a sub-property 
 * of a {@code "domain"} object.
 */
@Torello.JavaDoc.Annotations.StaticFunctional
@Torello.JavaDoc.Annotations.JDHeaderBackgroundImg(EmbedTagFileID="TOHTML_JDHBI")
public class HTML$EventNode
{
    private HTML$EventNode() { }

    static String run(final EventNode eventNode)
    {
        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        // FLAGS HTML, Possible 'Redirect' Note
        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

        final Ret2<String, String> r2 = HTML$TCE.flagsAndRedirectNote(eventNode, null);
        final String flagsStr = r2.a;
        final String rNote    = r2.b;

        if (eventNode.enumValsStr != null)
            throw (Error) eventNode.verifyThrow("Event Node has an EnumVals Str");


        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        // HTML Inner-Tables: 'Event
        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

        final StringBuilder sb = new StringBuilder();

        if (eventNode.parameters != null)
            HTML$TCE.appendPPRs(sb, eventNode.parameters, "PARAMETERS");

        final String innerTablesRow;

        if (sb.length() == 0) innerTablesRow = "";

        else innerTablesRow =
            "<TR><TD COLSPAN=3>\n" + 
            StrIndent.indent(sb.toString(), 4) +
            "</TD></TR>\n";


        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
        // Return the HTML
        // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

        final String descStr = eventNode.description.replace("<", "&lt;").replace(">", "&gt;");

        return 
            "<TR>\n" +
            "    <TD CLASS=MAINNAME>" +
                "<SPAN CLASS=MAINNAME>" + eventNode.name + "</SPAN>" +
                rNote + "</TD>\n" +
            "    <TD>" + descStr + "</TD>\n" +
            "    <TD>" + flagsStr + "</TD>\n" +
            "</TR>\n" +
            innerTablesRow;
    }
}