| java.lang.Object org.openlaszlo.compiler.ElementCompiler org.openlaszlo.compiler.ViewCompiler
All known Subclasses: org.openlaszlo.compiler.ClassCompiler, org.openlaszlo.compiler.DebugCompiler,
ViewCompiler | public class ViewCompiler extends ElementCompiler (Code) | | Responsible for compiling elements that compile into instances of
LzNode. This is called ViewCompiler for historical reasons; it
would more appropriately be called NodeCompiler.
Node compilation consists of these steps:
- compute text metrics
- call the XML compiler to generate bytecodes that recreate the
view template subtree and pass it to a runtime view instantiation
library
|
Method Summary | |
static void | checkUnresolvedResourceReferences(CompilationEnvironment env) | static void | checkUnsupportedMediaTypes(CompilationEnvironment env, Element elt, String url) | static void | collectElementNames(Element element, Set names) Collect the names of classes that are referenced. | static void | collectLayoutElement(Element element, Set names) | public void | compile(Element element) | static void | compileAttributes(Element elt, CompilationEnvironment env) Modify elt and its children to replace source attribute values
by runtime values. | static void | compileClickResources(Element elt, CompilationEnvironment env) | static void | compileResources(Element elt, CompilationEnvironment env) | void | compileXML(Element element, FontInfo fontInfo) Compile a XML element and generate code that binds it to a
runtime data structure named _lzViewTemplate. | protected static String | getAttributeValue(Element elt, String attrName) | protected static boolean | hasAttribute(Element elt, String attrName) | static boolean | isElement(Element element) Returns true if this node applies to the element. | protected void | mapTextMetricsCompilation(Element elt, CompilationEnvironment env, FontInfo fontInfo, Set classList) Adds in text widths for all text views below this element that
need them. | protected static void | mergeClassFontInfo(Element elt, FontInfo fontInfo, CompilationEnvironment env) Walk the whole superclass chain, starting at the root, merging fontInfo. | protected static void | mergeClassFontInfo(ClassModel classinfo, FontInfo fontInfo) Merge FontInfo from a class definition. | protected static void | mergeFontAttributes(Element elt, FontInfo fontInfo) | static void | preprocess(Element elt, CompilationEnvironment env) Modify the DOM in place, to what the runtime expects. | static void | setFontInfo(FontInfo info, Element elt) |
sConstPatStr | static String sConstPatStr(Code) | | Pattern matcher for compile-time optimizations
|
sUnsupportedServerlessFiletypes | static HashMap sUnsupportedServerlessFiletypes(Code) | | |
sUnsupportedServerlessFiletypesSWF7 | static HashMap sUnsupportedServerlessFiletypesSWF7(Code) | | |
collectElementNames | static void collectElementNames(Element element, Set names)(Code) | | Collect the names of classes that are referenced.
|
collectLayoutElement | static void collectLayoutElement(Element element, Set names)(Code) | | |
compileAttributes | static void compileAttributes(Element elt, CompilationEnvironment env)(Code) | | Modify elt and its children to replace source attribute values
by runtime values.
|
compileResources | static void compileResources(Element elt, CompilationEnvironment env)(Code) | | Compiles all resources under the current element
Parameters: env - Parameters: elt - |
compileXML | void compileXML(Element element, FontInfo fontInfo)(Code) | | Compile a XML element and generate code that binds it to a
runtime data structure named _lzViewTemplate.
Parameters: element - an element Parameters: fontInfo - font info inherited from canvas |
getAttributeValue | protected static String getAttributeValue(Element elt, String attrName)(Code) | | return value if element has an attribute named ATTRNAME in
it's attribute list, or has a child lzx element
|
hasAttribute | protected static boolean hasAttribute(Element elt, String attrName)(Code) | | return true if element has an attribute named ATTRIBUTE in
it's attribute list, or has a child lzx element
|
isElement | static boolean isElement(Element element)(Code) | | Returns true if this node applies to the element. Anything
that the interface compiler doesn't recognize is considered a
view node, so this always returns true.
Parameters: element - an element see doc |
mapTextMetricsCompilation | protected void mapTextMetricsCompilation(Element elt, CompilationEnvironment env, FontInfo fontInfo, Set classList)(Code) | | Adds in text widths for all text views below this element that
need them. This walks down into class definitions, merging
font info as it goes. We don't need to walk into class defs
for measuring text, since we have no way to pass those text
widths to the runtime, but we do need this to check if we need
to import the default bold or italic fonts.
Parameters: env - Parameters: elt - Parameters: fontInfo - the current font name/style/size |
mergeClassFontInfo | protected static void mergeClassFontInfo(Element elt, FontInfo fontInfo, CompilationEnvironment env)(Code) | | Walk the whole superclass chain, starting at the root, merging fontInfo.
|
mergeClassFontInfo | protected static void mergeClassFontInfo(ClassModel classinfo, FontInfo fontInfo)(Code) | | Merge FontInfo from a class definition.
|
mergeFontAttributes | protected static void mergeFontAttributes(Element elt, FontInfo fontInfo)(Code) | | Merges font name/size/style from an element's direct
attributes into a FontInfo
|
preprocess | static void preprocess(Element elt, CompilationEnvironment env)(Code) | | Modify the DOM in place, to what the runtime expects. This
function encapsulates the behavior that is common to root
views, and class definitions.
Preprocessing consists of compiling resources, and turning
view-specific source-format attributes into runtime format
Parameters: elt - an Element value Parameters: env - a CompilationEnvironment value |
|
|