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 PCDataThe 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_inline E_block_content|E_inline E_misc_inline|_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 addressElement_misc_inline (del, ins, script, noscript) is not in a full copositional way.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
Auxiliary co-tuple class for putting Element_inline and pcdata into one list.protected class
This variant accepts only block content and stores it as such.protected class
This variant accepts only block content and stores it as content of Element_div.protected class
This variant wraps every accepted input into a "pre" content element.protected class
This variant wraps every accepted input into a list item content element.protected class
This variant wraps every accepted input into a "pre" content element.protected class
This variant wraps every accepted input into a table data "td" content element.protected class
A delivery context maintains a list into which the generated html elements can be stored.(package private) static enum
States of an Issue. -
Field Summary
Modifier and TypeFieldDescriptionMap 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 numberstatic final String
Class name for the css style definitions.static final String
Class name for the css style definitions.static final String
Class name for the css style definitions.static final String
Class name for the css style definitions.static final String
Class name for the css style definitions.static final String
Class name for the css style definitions.static final String
Class name for the css style definitions.static final String
Class name for the css style definitions.static final String
Class name for the css style definitions.static final String
Class name for the css style definitions.static final String
Class name for the css style definitions.static final String
Class name for the css style definitions.static final String
Class name for the css style definitions.static final String
Class name for the css style definitions.(package private) @Opt ToHtml.DeliveryContext
Global stack to deliver the html fragments.static final Element_br
static final Element_span
static final Element_hr
Input parameter, passed in from the file visitor inMain
, which collected the lablog tdom elements.static final String
Put into the footer.(package private) boolean
Whether we currently collect contens for an html paragraph elementElement_p
static final String
Separator between the names of package and issue.(package private) SortedMap<String,
Element_issue> Map of issue keys (=concat of package name,ISSUE_SEPARATOR
and issue name to the tdom element.static final String
Stub 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_SEPARATOR
and issue name to an ascending number.static final String
Value which will be encoded in the generated html to address the stylesheet.static final String
Value which will be encoded in the generated html to address the stylesheet.(package private) int
Counter 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
ConstructorDescriptionOnly constructor. -
Method Summary
Modifier and TypeMethodDescription(package private) 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.(package private) void
Auxiliary debugging procedure which dumps the current stack of accepting contexts.(package private) void
Auxiliary debugging procedure which dumps the current stack of accepting contexts.(package private) void
protected String
Visit an subtree of the d2d input and extract a list of author names.(package private) 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.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_table
makeSurveyTable
(String title, SortedMap<String, EnumMap<ToHtml.State, List<Integer>>> map) Make rendering of one survey table, i.e.protected void
renderDocmat
(String packageName, String issueName, Element_docmat data) Make the xhtml rendering of a d2d "docMat" element, which appears independent from an issue.protected void
renderIssue
(String packageName, String issueName, Element_issue data) Make the xhtml rendering of a d2d "issue" element.protected void
renderPackage
(String packagename, @Opt List<Element_issue> issues, @Opt List<Element_docmat> docmats) Make the xhtml rendering of a package header, i.e.void
visit
(Element_a_emph el) Construct an xhtml em from a d2d emph.void
visit
(Element_a_hh el) Insert character data hashmark.void
visit
(Element_a_link el) Construct an xhtml link from a d2d link.void
visit
(Element_a_list el) Construct an xhtml list from a d2d list.void
Can be overridden by the user to define particular semantic operations.void
visit
(Element_a_nl el) Construct an xhtml br from a d2d nl.void
visit
(Element_a_p el) Construct an xhtml p from a d2d p.void
visit
(Element_a_src el) Construct an xhtml tt from a d2d src.void
visit
(Element_a_SRC el) Construct an xhtml PRE from a d2d SRC.void
visit
(Element_a_table el) Construct an xhtml table from a d2d table.void
visit
(Element_a_td el) Construct an xhtml td from a d2d td.void
visit
(Element_a_tr el) Construct an xhtml tr from a d2d tr.void
visit
(Element_a_xemph el) Construct an xhtml b from a d2d xemph.void
visit
(Element_desc el) Make the xhtml rendering of a d2d "desc" element, which occurs is the main sub-element of an issue.void
visit
(Element_note el) Make the xhtml rendering of a note = a text aappended to an Issue.void
visit
(TypedPCData data) To be overridden.(package private) void
WARNING
(Location<XMLDocumentIdentifier> loc, String m) 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, visit
Methods 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 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_SEPARATOR
and issue name to the tdom element. -
numberByKey
Map of issue keys (=concat of package name,ISSUE_SEPARATOR
and 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 -
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
-
-
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
-key
- 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:BaseVisitor
To be overridden. This default implementation does nothing.- Specified by:
visit
in interfacePCDataVisitor
- Overrides:
visit
in 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: correspondig to d2d_gp toXhtml, a list without "symbol" entry is rendered by arabic numbers. -
visit
Description copied from class:Visitor
Can 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 benommen ?!?! -
visit
Construct an xhtml b from a d2d xemph. FIXME CHECK d2d emph NUR CHARACTER DATA wird benommen ?!?! -
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. -
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) Make rendering of one 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 indexes
-
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.
-