new ContentElement(group, view, parser, renderer)
The ContentElement represents "content" parts of a view; it may itself contain one or more ContentElements.
This class holds the name of the content-field (used via the yield-tag in the layouts: content, header, footer, dialogs, ...)
and its definition as HTML-String.
Name | Type | Description |
---|---|---|
group |
Array | Object |
an array or object with properties name {String}, and content {String} |
view |
Object | the view that owns this ContentElement-element |
parser |
mmir.parser.ParserUtils |
for the the content (optional) if supplied this object must have a function parse({String}) (see templateParseUtil) |
renderer |
mmir.parser.RenderUtils |
for the the content (optional) if supplied, a parser must also be supplied; the renderer must have a function parse({String}) (see templateRenderUtil) |
Methods
-
getController(){mmir.Controller}
-
Gets the controller for this ContentElement.
Returns:
Controller of the owning view
-
getDefinition(){String}
-
- Deprecated
- use
getRawText
instead
- use
- See:
Returns:
raw text from which this content element was parsed
-
getEnd(){Number}
-
Returns:
end position for this content Element within#getRawText
-
getName(){String}
-
Gets the name of a
mmir.ContentElement
object (content, header, footer, dialogs, ...).Returns:
- used by yield tags in layout
-
getRawText(){String}
-
- See:
Returns:
raw text from which this content element was parsed
-
getStart(){Number}
-
Returns:
start position for this content Element within#getRawText
-
getView(){mmir.View}
-
Gets the owner for this ContentElement, i.e. the
mmir.View
object.Returns:
owning View
-
hasDynamicContent(){Boolean}
-
Returns:
true
if this ContentElement conatains dynamic content, i.e. if it needs to be "evaluated" for rendering (otherwise, its plain text representation can be used for rendering)
-
stringify(){String}
-
create a String representation for this content element.
Returns:
string-representation
-
toHtml(){String}
-
Gets the definition of a
mmir.ContentElement
object. TODO remove this?Returns:
HTML content.
-
toStrings(renderingBuffer, data){Array.<String>}
-
Renders this object into the renderingBuffer.
Name Type Description renderingBuffer
Array of Strings (if null
a new buffer will be created)data
Any (optional) the event data with which the rendering was invoked Returns:
Strings the renderingBuffer with the contents of this object added at the end