// unit's context and incorporated into the generated IFlexBootstrap
// derivative.
Map<String, Object> swfvarmap = new TreeMap<String, Object>();
Attribute frameRate = getSpecialAttribute(node, specialAttrFrameRate);
if (frameRate != null)
{
Object value = rootAttributeParser.parseUInt((String)frameRate.getValue(),
frameRate.getLine(),
specialAttrFrameRate);
if (value != null)
{
swfvarmap.put(specialAttrFrameRate, value.toString());
}
}
Attribute scriptRecursionLimit = getSpecialAttribute(node, specialAttrScriptRecursionLimit);
if (scriptRecursionLimit != null)
{
Object value = rootAttributeParser.parseUInt((String)scriptRecursionLimit.getValue(),
scriptRecursionLimit.getLine(),
specialAttrScriptRecursionLimit);
if (value != null)
{
swfvarmap.put(specialAttrScriptRecursionLimit, value.toString());
}
}
Attribute scriptTimeLimit = getSpecialAttribute(node, specialAttrScriptTimeLimit);
if (scriptTimeLimit != null)
{
Object value = rootAttributeParser.parseUInt((String)scriptTimeLimit.getValue(),
scriptTimeLimit.getLine(),
specialAttrScriptTimeLimit);
if (value != null)
{
swfvarmap.put(specialAttrScriptTimeLimit, value.toString());
}
}
Attribute bgcolor = node.getAttribute(DEFAULT_NAMESPACE, rootAttrBackgroundColor);
if (bgcolor != null)
{
Object value = rootAttributeParser.parseColor((String)bgcolor.getValue(),
bgcolor.getLine(),
rootAttrBackgroundColor);
if (value != null)
{
swfvarmap.put(rootAttrBackgroundColor, value.toString());
}
}
// useDirectBlit="true|false"
Attribute useDirectBlit = node.getAttribute(DEFAULT_NAMESPACE, specialAttrUseDirectBlit);
if(useDirectBlit != null)
{
Object value = rootAttributeParser.parseBoolean(
(String) useDirectBlit.getValue(),
useDirectBlit.getLine(),
specialAttrUseDirectBlit);
if (value != null)
{
swfvarmap.put(specialAttrUseDirectBlit, value.toString());
}
}
// useGPU="true|false"
Attribute useGPU = node.getAttribute(DEFAULT_NAMESPACE, specialAttrUseGPU);
if(useGPU != null)
{
Object value = rootAttributeParser.parseBoolean(
(String) useGPU.getValue(),
useGPU.getLine(),
specialAttrUseGPU);
if (value != null)
{
swfvarmap.put(specialAttrUseGPU, value.toString());
}
}
Attribute styleName = node.getAttribute(DEFAULT_NAMESPACE, rootAttrStyleName);
if (styleName != null)
{
document.getCompilationUnit().styleName = (String) styleName.getValue();
}
Attribute title = getSpecialAttribute(node, specialAttrPageTitle);
if (title != null)
{
swfvarmap.put(specialAttrPageTitle, title.getValue());
}
// Only do the "percent" logic for Application nodes, not modules. There is no
// html wrapper for a module and the logic keeps modules from sizing
// to the ModuleLoader component, SDK-9527.
Type nodeType = nodeTypeResolver.resolveType(node, document);
boolean isApplication = StandardDefs.isApplication(nodeType);
Attribute width = node.getAttribute(DEFAULT_NAMESPACE, rootAttrWidth);
if (width != null && isApplication)
{
String widthString = width.getValue().toString();
Object value = rootAttributeParser.parseNumberOrPercentage(widthString,
width.getLine(),
rootAttrWidth);
if (value != null)
{
if (rootAttributeParser.wasPercentage())
{
if (widthString.endsWith("%"))
{
swfvarmap.put("widthPercent", widthString);
}
else
{
swfvarmap.put("widthPercent", widthString + '%');
}
// HACK for 174078: width="n%" at the root of an MXML app is a specification of the ratio of
// player to browser width, not app to player width. So we pass it through to the SWF, but strip
// it from the MXML DOM, preventing it from showing up in the property settings for the root UIC.
node.removeAttribute(new QName(width.getNamespace(), rootAttrWidth));
}
else
{
if (value instanceof Double)
{
value = new Integer(((Double) value).intValue());
}
swfvarmap.put(rootAttrWidth, value);
}
}
}
Attribute height = node.getAttribute(DEFAULT_NAMESPACE, rootAttrHeight);
if (height != null && isApplication)
{
String heightString = height.getValue().toString();
Object value = rootAttributeParser.parseNumberOrPercentage(heightString,
height.getLine(),
rootAttrHeight);
if (value != null)
{
if (rootAttributeParser.wasPercentage())
{
if (heightString.endsWith("%"))
{
swfvarmap.put("heightPercent", heightString);
}
else
{
swfvarmap.put("heightPercent", heightString + '%');
}
// HACK for 174078: as above for width
node.removeAttribute(new QName(height.getNamespace(), rootAttrHeight));
}
else
{
if (value instanceof Double)
{
value = new Integer(((Double) value).intValue());
}
swfvarmap.put(rootAttrHeight, value);
}
}
}
Attribute usePreloader = getSpecialAttribute(node, specialAttrUsePreloader);
if (usePreloader != null)
{
Object value = rootAttributeParser.parseBoolean((String)usePreloader.getValue(),
usePreloader.getLine(),
specialAttrUsePreloader);
if (value != null)
{
document.setUsePreloader(((Boolean)value).booleanValue());
}
}
Attribute preloader = getSpecialAttribute(node, specialAttrPreloader);
if (preloader != null)
{
String preloaderString = (String)preloader.getValue();
String preloaderClassName = TextParser.parseClassName(preloaderString);
if (preloaderClassName != null)
{
document.setPreloader(preloaderString);
}
else
{
log(node, new InvalidPreLoaderClassName(preloaderString));
}
}
Attribute runtimeDPIProvider = getSpecialAttribute(node, specialAttrRuntimeDPIProvider);
if (runtimeDPIProvider != null)
{
String runtimeDPIProviderString = (String)runtimeDPIProvider.getValue();
String runtimeDPIProviderClassName = TextParser.parseClassName(runtimeDPIProviderString);
if (runtimeDPIProviderClassName == null)
{
log(node, new InvalidRuntimeDPIProviderClassName(runtimeDPIProviderString));
}
}
if (swfvarmap.size() > 0)
{
String metadata = buildSwfMetadata( swfvarmap );
Script script = new Script( metadata );
document.addMetadata( script );
}
Attribute theme = getSpecialAttribute(node, specialAttrTheme);
if (theme != null)
{
log(new ThemeAttributeError());
}
Attribute rsl = getSpecialAttribute(node, specialAttrRsl);
if (rsl != null)
{
log(new RslAttributeError());
}
Attribute lib = getSpecialAttribute(node, specialAttrLib);
if (lib != null)
{
log(new LibAttributeError());
}
}