Last updated at 3:27 pm UTC on 10 July 2018
HVHtmlBuilder builds HTML pages and handles HTML Forms.
A HVHtmlBuilder object has a reference to the HVHttpView that created it (for various services) and to the request of that view.
Typical use is
1. to instantiate a HVHtmlBuilder object (a HVHttpView has a method #builder which creates one),
2. feed it "build messages" and
3. then finally calling #render which will stream out the resulting HTML page.
This is an example:
builder := self builder. "1"
builder h1: 'A heading'.
builder inputText: #name
During the build some of the "build messages" return objects that can be used for input and output - typically objects representing
- Submit buttons
The messages #postForm, #inputText: and #submit all returned objects in the code above but the code chose to ignore them.
The #contents message causes the builder to assemble the finished HTML document and return it as a String. Normally you just return the builder itself since HVHtmlBuilder also implements #asHttpResponseTo: which means that it can be returned as a result to Comanche/KomHttpServer from an 'url' method in a HVHttpView class.
So you do not need to call #render and actually, in order to compose pages from multiple methods it is better if you do not call #render.
elements - An OrderedCollection holding all elements that constitute the page.
elementStack - An OrderedCollection acting as a stack for certain elements like for example forms.