001package Torello.Browser.JsonAST; 002 003import Torello.Java.Additional.Ret2; 004import Torello.Java.ReadOnly.ReadOnlyList; 005 006/** 007 * Generates HTML that is consistent for all three inheriting sub-types: 008 * {@link TypeNode}, {@link CommandNode} & {@link EventNode}. 009 */ 010@Torello.JavaDoc.Annotations.StaticFunctional 011@Torello.JavaDoc.Annotations.JDHeaderBackgroundImg(EmbedTagFileID="TOHTML_JDHBI") 012public class HTML$TCE 013{ 014 private HTML$TCE() { } 015 016 static final String DIV_TABLE_OPEN = 017 018 "<DIV CLASS=INNERLABEL>" + 019 "<B CLASS=INNERLABEL>**SUB**:</B>" + 020 "</DIV>\n" + 021 "<TABLE CLASS='INNER **SUB**'>\n" + 022 "<TR>" + 023 "<TH>Name</TH><TH>Type</TH>"+ 024 "<TH>Description</TH>" + 025 "<TH>Flags</TH>" + 026 "</TR>\n"; 027 028 static Ret2<String, String> flagsAndRedirectNote( 029 final TCE tce, 030 final String redirect 031 ) 032 { 033 final String tempFlagsStr = 034 (tce.optional ? "[OPTIONAL]<BR />\n" : "") + 035 (tce.experimental ? "[EXPERIMENTAL]<BR />\n" : "") + 036 (tce.deprecated ? "[DEPRECATED]<BR />\n" : ""); 037 038 final String flagsStr = (tempFlagsStr.length() == 0) 039 ? "-" 040 : tempFlagsStr; 041 042 final String rNote = (redirect != null) 043 ? ("<BR />REDIRECT: " + redirect) 044 : ""; 045 046 return new Ret2<>(flagsStr, rNote); 047 } 048 049 static void appendPPRs( 050 final StringBuilder sb, 051 final ReadOnlyList<PPR> pprList, 052 final String label 053 ) 054 { 055 sb.append(HTML$TCE.DIV_TABLE_OPEN.replace("**SUB**", label)); 056 for (final PPR ppr : pprList) sb.append(HTML$PPR.run(ppr)); 057 sb.append("</TABLE>\n\n"); 058 } 059}