Permalink
Browse files

All UI elements can have creation properties passed in via XML attrib…

…utes now
  • Loading branch information...
1 parent 6cce2c4 commit 72e322940e7de5762b243aeed2d3fae00a541102 @tonylukasavage tonylukasavage committed Jul 27, 2012
@@ -1,4 +1,5 @@
-var CU = require('../compilerUtils');
+var CU = require('../compilerUtils'),
+ _ = require('../../../lib/alloy/underscore')._;
exports.parse = function(node, state) {
return require('./base').parse(node, state, parse);
@@ -10,7 +11,13 @@ function parse(node, state, args) {
// Generate runtime code
code += args.symbol + " = A$(" + args.ns + "." + createFunc + "(\n";
- code += CU.generateStyleParams(state.styles, args.classes, args.id, node.nodeName, state.extraStyle) + '\n';
+ code += CU.generateStyleParams(
+ state.styles,
+ args.classes,
+ args.id,
+ node.nodeName,
+ _.defaults(state.extraStyle || {}, args.createArgs || {}) //state.extraStyle
+ ) + '\n';
code += "),'" + node.nodeName + "', " + (args.parent.symbol || 'null') + ");\n";
if (args.parent.symbol) {
code += args.parent.symbol + ".add(" + args.symbol + ");\n";
@@ -1,5 +1,5 @@
<Component>
<Window class="container">
- <Label id="t" onClick="doClick">Hello, World</Label>
+ <Label id="t" onClick="doClick" text="CLICK ME" color="#900"></Label>
</Window>
</Component>
@@ -44,9 +44,9 @@
</splash>
<theme>default</theme>
</mobileweb>
-<modules><module platform="android" version="1.0">ti.physicalSizeCategory</module>
+ <modules><module platform="android" version="1.0">ti.physicalSizeCategory</module>
</modules>
-<plugins>
+ <plugins>
<plugin version="1.0">ti.alloy</plugin>
</plugins>
</ti:app>

0 comments on commit 72e3229

Please sign in to comment.