Iterator<StyleDef> styleDefIterator = mxmlDocument.getStylesContainer().getStyleDefs().iterator();
while (styleDefIterator.hasNext())
{
StyleDef styleDef = styleDefIterator.next();
if (styleDef.isAdvanced())
{
for (StyleDeclaration styleDeclaration : styleDef.getDeclarations().values())
{
StyleSelector selector = styleDeclaration.getSelector();
// selector = null;
ExpressionStatementNode selectorInitializer = generateNullInitializer(SELECTOR);
initFunctionStatementList = nodeFactory.statementList(initFunctionStatementList, selectorInitializer);
// conditions = null;
ExpressionStatementNode conditionsInitializer = generateNullInitializer(CONDITIONS);
initFunctionStatementList = nodeFactory.statementList(initFunctionStatementList, conditionsInitializer);
generateSelectorAncestor(selector, initFunctionStatementList);
// style = StyleManager.getStyleDeclaration("${selector.toString}");
ExpressionStatementNode expressionStatement = generateGetStyleDeclaration(selector.toString());
initFunctionStatementList = nodeFactory.statementList(initFunctionStatementList, expressionStatement);
Node nullStyleDeclarationIfStatement = generateIfNullStyleDeclaration(styleDeclaration.getSubject(), selector);
initFunctionStatementList = nodeFactory.statementList(initFunctionStatementList,
nullStyleDeclarationIfStatement);
if (styleDeclaration.hasProperties())
{
Node nullStyleFactoryIfStatement =
generateIfNullStyleFactory(styleDef, styleDeclaration);
initFunctionStatementList = nodeFactory.statementList(initFunctionStatementList,
nullStyleFactoryIfStatement);
}
if (styleDeclaration.hasEffectStyles())
{
// effects = style.mx_internal::effects;
initFunctionStatementList =
nodeFactory.statementList(initFunctionStatementList, generateEffectsInitializer());
generateIfNullEffectsAndPushes(styleDef, styleDeclaration,
initFunctionStatementList);
}
}
}
else
{
ExpressionStatementNode expressionStatement;
if (styleDef.isTypeSelector())
{
//style = StyleManager.getStyleDeclaration("${styleDef.typeName}");
expressionStatement = generateGetStyleDeclaration(styleDef.getSubject());
}
else
{
//style = StyleManager.getStyleDeclaration(".${styleDef.typeName}");
expressionStatement = generateGetStyleDeclaration("." + styleDef.getSubject());
}
initFunctionStatementList = nodeFactory.statementList(initFunctionStatementList, expressionStatement);
Node nullStyleDeclarationIfStatement = generateIfNullStyleDeclaration(styleDef);
initFunctionStatementList = nodeFactory.statementList(initFunctionStatementList,
nullStyleDeclarationIfStatement);
if (styleDef.getStyles().size() > 0)
{
Node nullStyleFactoryIfStatement =
generateIfNullStyleFactory(styleDef, null);
initFunctionStatementList = nodeFactory.statementList(initFunctionStatementList,
nullStyleFactoryIfStatement);
}
if (styleDef.getEffectStyles().size() > 0)
{
initFunctionStatementList =
nodeFactory.statementList(initFunctionStatementList, generateEffectsInitializer());
generateIfNullEffectsAndPushes(styleDef, null,