Class ToHtml
- All Implemented Interfaces:
PCDataVisitor
The text structure of lablog is imported from d2d_gp.basic.
One central issue is the difference in content models for the xhtml
containers
Element_p, Element_li, Element_td, etc., and the
compositional modifiers Element_em, Element_span, etc.
E.g. a visited PCData on the input side will be translated into very
different of these target contexts, and thus wrapped into different
TypedContent classes.
For this the ToHtml.DeliveryContext is introduced.
A special problem is the "hierarchy rotation" between "p" on one side and "list" and "table" on the other. In d2d_gp.basic the "p" element is the central means for organizing text (e.g. the attributes "language", "style", "accessRights"), and all other elements containing text (even images) are subordinated. In xhtml its different and not so consistent:
d2d_gp.basic: xhtml:
| |---------+--------+
p p list p
|--------+-----+ | |
PCData list PCData PCData PCData
The xhtml Tdom defines some abstract classes which make this sorting easier:
Element_body Element_p Element_li E_span Element_div
Element_td E_em etc. _inline
contains..
E_block_content E_p.Content E_li.Content E_span.Content
wraps..
E_misc_inline E_block_content E_misc_inline
| E_inline | E_inline | E_inline
which are..
|_a|_phrase |_fonstyle
|_em|_kbd |_b|_big|_i|_tt
which are..
E_form | E_form_content
E_block | E_misc
| E_misc_inline|_noscript
| _del|_ins|_script
E_div|_p|E_table
E_heading|E_blocktext
_h1|_h2..|hr pre address
Element_misc_inline (del, ins, script, noscript) is not in a full
compositional way.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classAuxiliary co-tuple class for putting Element_inline and pcdata into one list.protected classThis variant accepts only block content and stores it as such.protected classThis variant accepts only block content and stores it as content of Element_div.protected classThis variant wraps every accepted input into a "pre" content element.protected classThis variant wraps every accepted input into a "list item content" element.protected classThis variant wraps every accepted input into a "pre" content element.protected classThis variant wraps every accepted input into a table data "td" content element.protected classA delivery context maintains a list into which the generated html elements can be stored.(package private) static enumStates of an Issue. -
Field Summary
FieldsModifier and TypeFieldDescriptionControl for duplicate entries.Map author of last accepting note of an issue -> current state -> issues by numberMap author of the opening issue -> current state -> issues by numberMap package name -> current state -> issues by number.static final StringClass name for the css style definitions.static final StringClass name for the css style definitions.static final StringClass name for the css style definitions.static final StringClass name for the css style definitions.static final StringClass name for the css style definitions.static final StringClass name for the css style definitions.static final StringClass name for the css style definitions.static final StringClass name for the css style definitions.static final StringClass name for the css style definitions.static final StringClass name for the css style definitions.static final StringClass name for the css style definitions.static final StringClass name for the css style definitions.static final StringClass name for the css style definitions.static final StringClass name for the css style definitions.(package private) @Opt ToHtml.DeliveryContextGlobal stack to deliver the html fragments.static final Element_brstatic final Element_spanstatic final Element_hrInput parameter, passed in from the file visitor inMain, which collected the lablog tdom elements.static final StringPut into the footer.(package private) booleanWhether we currently collect contens for an html paragraph elementElement_p.static final StringSeparator between the names of package and issue.(package private) SortedMap<String, Element_issue> Map of issue keys (=concat of package name,ISSUE_SEPARATORand issue name to the tdom element.static final StringStub of the name of the anchor where the docmat region of a package begins.(package private) List<Element_li> Local accumulator for items, when constructing an xhtml list from a d2d list.protected MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> Map of issue keys (=concat of package name,ISSUE_SEPARATORand issue name to an ascending number.static final StringValue which will be encoded in the generated html to address the stylesheet.static final StringValue which will be encoded in the generated html to address the stylesheet.(package private) intCounter for assigning numbers to issues.(package private) List<Element_tr.Choice_1> (package private) List<Element_tr> Local accumulator for table rows, when constructing an xhtml table from a d2d table.Fields inherited from class eu.bandm.tools.tdom.runtime.BaseVisitor
validating -
Constructor Summary
ConstructorsConstructorDescriptionOnly constructor. -
Method Summary
Modifier and TypeMethodDescription(package private) voidaddToSurvey(Map<String, EnumMap<ToHtml.State, List<Integer>>> map, String key, ToHtml.State state, int issueNumber) Add the issue (given by number) into a survey map.(package private) booleancheckDuplicates(String packageName, String entryName, Element data) Check for uniqueness in common namspace for issues and docmats.(package private) StringReadable representation of type.(package private) voidAuxiliary debugging procedure which dumps the current stack of accepting contexts.(package private) voidAuxiliary debugging procedure which dumps the current stack of accepting contexts.(package private) voidprotected StringVisit an subtree of the d2d input and extract a list of author names.(package private) voidflushP()Is called when an accumulated xhtml paragraph contents must be written out, because the next input element cannot be contained in an xhtml paragraph.makeHtml(SortedMap<String, List<Element_issue>> issuesByPackage, SortedMap<String, List<Element_docmat>> docmatsByPackage, Map<Element, File> elements2file, Map<File, @Opt MessageStore<SimpleMessage<XMLDocumentIdentifier>>> files2error) Make the complete html rendering.(package private) Element_tablemakeSurveyTable(String title, SortedMap<String, EnumMap<ToHtml.State, List<Integer>>> map, boolean isByPackage) Make rendering of the survey table, i.e.protected voidrenderDocmat(String packageName, String issueName, Element_docmat data) Make the xhtml rendering of a d2d "docMat" element, which appears independent from an issue.protected voidrenderIssue(String packageName, String issueName, Element_issue data) Make the xhtml rendering of a d2d "issue" element.protected voidrenderPackage(String packagename, @Opt List<Element_issue> issues, @Opt List<Element_docmat> docmats) Make the xhtml rendering of a package header, i.e.voidvisit(Element_a_emph el) Construct an xhtml em from a d2d emph.voidvisit(Element_a_hh el) Insert character data hashmark.voidvisit(Element_a_link el) Construct an xhtml link from a d2d link.voidvisit(Element_a_list el) Construct an xhtml list from a d2d list.voidCan be overridden by the user to define particular semantic operations.voidvisit(Element_a_nl el) Construct an xhtml br from a d2d nl.voidvisit(Element_a_p el) Construct an xhtml p from a d2d p.voidvisit(Element_a_src el) Construct an xhtml tt from a d2d src.voidvisit(Element_a_SRC el) Construct an xhtml PRE from a d2d SRC.voidvisit(Element_a_table el) Construct an xhtml table from a d2d table.voidvisit(Element_a_td el) Construct an xhtml td from a d2d td.voidvisit(Element_a_tr el) Construct an xhtml tr from a d2d tr.voidvisit(Element_a_xemph el) Construct an xhtml b from a d2d xemph.voidvisit(Element_desc el) Make the xhtml rendering of a d2d "desc" element, which occurs is the main sub-element of an issue.voidvisit(Element_note el) Make the xhtml rendering of a note = a text aappended to an Issue.voidvisit(TypedPCData data) To be overridden.(package private) voidwarning(Location<XMLDocumentIdentifier> loc, String m, Object... args) Methods inherited from class eu.bandm.tools.lablog.xml.Visitor
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitMethods inherited from class eu.bandm.tools.tdom.runtime.BaseVisitor
visit
-
Field Details
-
path_to_stylesheet
Value which will be encoded in the generated html to address the stylesheet.- See Also:
-
path_to_javascript
Value which will be encoded in the generated html to address the stylesheet.- See Also:
-
ISSUE_SEPARATOR
Separator between the names of package and issue. This must be a valid XML NMTOKEN character but NOT part of a java package name- See Also:
-
href_bandm_online_docu
Put into the footer.- See Also:
-
LINK_DOCMAT
Stub of the name of the anchor where the docmat region of a package begins.- See Also:
-
CL_topHeadline
Class name for the css style definitions.- See Also:
-
CL_survey_tab
Class name for the css style definitions.- See Also:
-
CL_survey_tab_ACTIVE
Class name for the css style definitions.- See Also:
-
CL_package_header
Class name for the css style definitions.- See Also:
-
CL_issue_header
Class name for the css style definitions.- See Also:
-
CL_issue_prefix
Class name for the css style definitions.- See Also:
-
CL_td_nodecor
Class name for the css style definitions.- See Also:
-
CL_prior_N
Class name for the css style definitions.- See Also:
-
CL_costs_N
Class name for the css style definitions.- See Also:
-
CL_issueDate
Class name for the css style definitions.- See Also:
-
CL_status_N
Class name for the css style definitions.- See Also:
-
CL_authors
Class name for the css style definitions.- See Also:
-
CL_noteHeader
Class name for the css style definitions.- See Also:
-
CL_docmatHeader
Class name for the css style definitions.- See Also:
-
EL_BR
-
EL_HH
-
EL_HR
-
msg
-
issueByKey
SortedMap<String,Element_issue> issueByKeyMap of issue keys (=concat of package name,ISSUE_SEPARATORand issue name to the tdom element. Used only for ToC. -
numberByKey
Map of issue keys (=concat of package name,ISSUE_SEPARATORand issue name to an ascending number. This is used for ECAM-Script collapse/expand programming. -
byOpener
Map author of the opening issue -> current state -> issues by number -
byAcceptor
Map author of last accepting note of an issue -> current state -> issues by number -
byPackage
Map package name -> current state -> issues by number. "NoPackage" is enceoded as "". -
runningIssueNumber
int runningIssueNumberCounter for assigning numbers to issues. -
elements2file
Input parameter, passed in from the file visitor inMain, which collected the lablog tdom elements. -
deliveryContext
Global stack to deliver the html fragments. Can be set to different classes which correspond to different html construction contexts and accept different sets of html elements. -
inP
boolean inPWhether we currently collect contens for an html paragraph elementElement_p. -
listItems
List<Element_li> listItemsLocal accumulator for items, when constructing an xhtml list from a d2d list. -
trs
List<Element_tr> trsLocal accumulator for table rows, when constructing an xhtml table from a d2d table. -
tds
List<Element_tr.Choice_1> tds -
allNames
Control for duplicate entries.
-
-
Constructor Details
-
ToHtml
ToHtml(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg) Only constructor.- Parameters:
msg- Message receiver for the tool's own messages. (D2d parser errors from the files will not be printed but included at the beginning of the rendered result.)
-
-
Method Details
-
error
-
warning
-
addToSurvey
void addToSurvey(Map<String, EnumMap<ToHtml.State, List<Integer>>> map, String key, ToHtml.State state, int issueNumber) Add the issue (given by number) into a survey map. Finally the follwing html tables are generated:OPEN ACCEPTED WONTFIX ... SUMME OPENED BY author1 [13 ] [ 4 ] [ 2 ] [ 19 ] <--- show the numbers and are clickable author2 ACCEPTED BY author1 [ 1 ] [ 1 ] author2 [ 3 ] [ 3 ] package1 [ 7 ] [ 1 ] [ 2 ] [ 10 ] package2 [ 6 ] [ 3 ] [ 9 ] [a]switch all visible:[/a] [a]packagename1:issue1[/a][br/] <--- become visible or invisible according to the [a]packagename1:issue2[/a][br/] clicks in the html tables above [a]packagename1:issue3[/a][br/] ...- Parameters:
map- Output parameter key -> state -> issueNumberkey- the author or the packagename, depends on the mapstate- in which the issue currently isissueNumber-
-
dumpDelivery
Auxiliary debugging procedure which dumps the current stack of accepting contexts. -
dumpDelivery
Auxiliary debugging procedure which dumps the current stack of accepting contexts. -
visit
Description copied from class:BaseVisitorTo be overridden. This default implementation does nothing.- Specified by:
visitin interfacePCDataVisitor- Overrides:
visitin classVisitor
-
flushP
void flushP()Is called when an accumulated xhtml paragraph contents must be written out, because the next input element cannot be contained in an xhtml paragraph. -
visit
Construct an xhtml list from a d2d list. For this, a currently growing xhtml paragraph must be closed and re-opened afterwards. ATTENTION: corresponding to d2d_gp toXhtml, a list without "symbol" entry is rendered by arabic numbers. -
visit
Description copied from class:VisitorCan be overridden by the user to define particular semantic operations. Will be called whenever the default model instance traversal (as implemented by the methods in this class) reaches such an element.
This default implementation descends into the element by callingvisit(..)in turn for all PCData and all Elements in its contents. -
visit
Construct an xhtml table from a d2d table. For this, a currently growing xhtml paragraph must be closed and re-opened afterwards. -
visit
Construct an xhtml tr from a d2d tr. -
visit
Construct an xhtml td from a d2d td. -
visit
Construct an xhtml p from a d2d p. -
visit
Construct an xhtml PRE from a d2d SRC. Flush an open p iff we are the first in a "desc" -
visit
Construct an xhtml br from a d2d nl. -
visit
Insert character data hashmark. -
visit
Construct an xhtml tt from a d2d src. Can only contain "#hh". -
visit
Construct an xhtml link from a d2d link.
ATTENTION renders from the "text" input only un-decorated text. Starting "0" is replaced by "http:/" and "1" by "https:/", for ease of writing. -
visit
Construct an xhtml em from a d2d emph. FIXME CHECK d2d emph NUR CHARACTER DATA wird genommen ?!?! -
visit
Construct an xhtml b from a d2d xemph. FIXME CHECK d2d emph NUR CHARACTER DATA wird genommen ?!?! -
extractAuthors
Visit an subtree of the d2d input and extract a list of author names. -
visit
Make the xhtml rendering of a note = a text aappended to an Issue. -
visit
Make the xhtml rendering of a d2d "desc" element, which occurs is the main sub-element of an issue. Open a paragraph context in case that the "@p" alternative of its content model is chosen, andflushP()it on return, if necessary. If the "p*" alternative is chosen, this first (empty) paragraph will be flushed and the explicit/contained paragraph will also be flushed by its visitor code (thusinP==false). -
renderDocmat
Make the xhtml rendering of a d2d "docMat" element, which appears independent from an issue. -
renderIssue
Make the xhtml rendering of a d2d "issue" element.- Parameters:
packageName- "noPackage" is encoded as ""
-
classOf
Readable representation of type. -
checkDuplicates
Check for uniqueness in common namspace for issues and docmats. -
renderPackage
protected void renderPackage(String packagename, @Opt @Opt List<Element_issue> issues, @Opt @Opt List<Element_docmat> docmats) Make the xhtml rendering of a package header, i.e. a package name for which issues or docmats or both have been collected. -
makeSurveyTable
Element_table makeSurveyTable(String title, SortedMap<String, EnumMap<ToHtml.State, List<Integer>>> map, boolean isByPackage) Make rendering of the survey table, i.e. a clickable xhtml table with figures of issues by key (author or package) and state. When clicked, the following list of links to these xhtml issue entries will collapse and expand accordingly.- Parameters:
title- to be printed above the tablemap- title of the row -> states (= headers of the columns) -> list of indexesisByPackage- whether to include the key into the number code.
-
makeHtml
public Element_html makeHtml(SortedMap<String, List<Element_issue>> issuesByPackage, SortedMap<String, List<Element_docmat>> docmatsByPackage, Map<Element, File> elements2file, Map<File, @Opt MessageStore<SimpleMessage<XMLDocumentIdentifier>>> files2error) Make the complete html rendering.
-