{ "id": "110087", "key": "ALOY-548", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "15271", "description": "Alloy 1.1.0, concurrent with SDK 3.1.0", "name": "Alloy 1.1.0", "archived": false, "released": true, "releaseDate": "2013-04-16" }, { "id": "14875", "description": "2013 Sprint 06", "name": "2013 Sprint 06", "archived": true, "released": true, "releaseDate": "2013-03-25" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-03-20T19:44:48.000+0000", "created": "2013-02-23T23:29:06.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "alloy", "compiler", "require", "widgets" ], "versions": [], "issuelinks": [], "assignee": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-05-14T17:58:14.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "12329", "name": "Runtime", "description": "Generic bucket for uncategorized runtime issues" }, { "id": "12326", "name": "XML", "description": "View XML and parsing" } ], "description": "Having a view like:\r\n\r\n{code}\r\n\r\n \r\n \r\n \r\n\r\n{code}\r\n\r\nand the widget's view being like:\r\n\r\n{code}\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n{code}\r\n\r\nYou get the following compile error:\r\n\r\n{code}\r\n[ERROR] : \b\b \b[ERROR] Error with at line 3\r\n[ERROR] : \b\b \b[ERROR] Child element must be on of the following: [Ti.UI.TableView.HeaderView,Ti.UI.TableView.HeaderPullView,Ti.UI.TableView.FooterView,Ti.UI.TableView.Search,Ti.UI.TableViewRow,Ti.UI.TableViewSection,Ti.UI.SearchBar]\r\n[ERROR] : \b\b \bAlloy compiler failed\r\n{code}\r\n\r\nTrying the same thing using a regular require fails even harder:\r\n\r\n{code}\r\n[ERROR] : \b\b \b/usr/local/lib/node_modules/alloy/Alloy/commands/compile/compilerUtils.js:80\r\n[ERROR] : \b\b \b\tvar name = node.nodeName,\r\n[ERROR] : \b\b \b\t ^\r\n[ERROR] : \b\b \bTypeError: Cannot read property 'nodeName' of undefined\r\n[ERROR] : \b\b \b at Object.exports.getNodeFullname (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/compilerUtils.js:80:17)\r\n[ERROR] : \b\b \b at Object.exports.validateNodeName (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/compilerUtils.js:1083:25)\r\n[ERROR] : \b\b \b at parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Alloy.Abstract._ProxyProperty.js:23:11)\r\n[ERROR] : \b\b \b at Object.exports.parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/base.js:11:17)\r\n[ERROR] : \b\b \b at Object.exports.parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Alloy.Abstract._ProxyProperty.js:13:27)\r\n[ERROR] : \b\b \b at Object.exports.parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Ti.UI.TableView._ProxyProperty.js:11:52)\r\n[ERROR] : \b\b \b at Object.exports.parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Ti.UI.TableView.HeaderPullView.js:2:53)\r\n[ERROR] : \b\b \b at Object.exports.generateNode (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/compilerUtils.js:231:48)\r\n[ERROR] : \b\b \b at /usr/local/lib/node_modules/alloy/Alloy/commands/compile/index.js:406:28\r\n[ERROR] : \b\b \b at Array.forEach (native)\r\n[ERROR] : \b\b \b at Function.T.each.T.forEach (/usr/local/lib/node_modules/alloy/Alloy/lib/alloy/underscore.js:5:625)\r\n[ERROR] : \b\b \b at parseAlloyComponent (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/index.js:398:5)\r\n[ERROR] : \b\b \b at /usr/local/lib/node_modules/alloy/Alloy/commands/compile/index.js:197:5\r\n[ERROR] : \b\b \b at Array.forEach (native)\r\n[ERROR] : \b\b \b at Function.T.each.T.forEach (/usr/local/lib/node_modules/alloy/Alloy/lib/alloy/underscore.js:5:625)\r\n[ERROR] : \b\b \b at /usr/local/lib/node_modules/alloy/Alloy/commands/compile/index.js:189:5\r\n[ERROR] : \b\b \b at Array.forEach (native)\r\n[ERROR] : \b\b \b at Function.T.each.T.forEach (/usr/local/lib/node_modules/alloy/Alloy/lib/alloy/underscore.js:5:625)\r\n[ERROR] : \b\b \b at module.exports (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/index.js:187:4)\r\n[ERROR] : \b\b \b at Object. (/usr/local/lib/node_modules/alloy/Alloy/alloy.js:87:46)\r\n[ERROR] : \b\b \b at Module._compile (module.js:449:26)\r\n[ERROR] : \b\b \b at Object.Module._extensions..js (module.js:467:10)\r\n[ERROR] : \b\b \b at Module.load (module.js:356:32)\r\n[ERROR] : \b\b \b at Function.Module._load (module.js:312:12)\r\n[ERROR] : \b\b \b at Module.require (module.js:362:17)\r\n[ERROR] : \b\b \b at require (module.js:378:17)\r\n[ERROR] : \b\b \b at Object. (/usr/local/lib/node_modules/alloy/bin/alloy:3:1)\r\n[ERROR] : \b\b \b at Module._compile (module.js:449:26)\r\n[ERROR] : \b\b \b at Object.Module._extensions..js (module.js:467:10)\r\n[ERROR] : \b\b \b at Module.load (module.js:356:32)\r\n[ERROR] : \b\b \b at Function.Module._load (module.js:312:12)\r\n[ERROR] : \b\b \b at Module.runMain (module.js:492:10)\r\n[ERROR] : \b\b \b at process.startup.processNextTick.process._tickCallback (node.js:244:9)\r\n[ERROR] : \b\b \bAlloy compiler failed\r\n{code}\r\n\r\nReplace the `headerPullView` by `TableViewRow` and the regular require works again, but the widget still produces the same error.\r\n\r\nI guess both have to do with `validateNodeName()` and `inspectRequireNode()` in Alloy's `compilerUtil.js`. I tried to do some debugging myself but couldn't fix it. I hope you guys can, since I have some interesting use cases for it :)", "attachment": [], "flagged": false, "summary": "Widget views containing valid child elements are not accepted like with require", "creator": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": "TiSDK 3.0.0GA\r\nAlloy 1.0.0GA\r\nTiStudio 3.0.2.x", "comment": { "comments": [ { "id": "242841", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "It may need to remain the same for the time being with respect to the proxy property markup elements, like headerView, footerView, etc... since they need a reference to the parent element and there's not a clean way to do that right now through and . The latter issue, though, with the TableViewRow should now be resolved as a result of ALOY-461.\n\nI will investigate both aspects of this issue more closely tomorrow.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-19T03:16:41.000+0000", "updated": "2013-03-19T03:16:41.000+0000" }, { "id": "243043", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The TableViewRow sample you cite will work with both and now, but I still need to figure out how to pass the parent to proxy properties in requires/widgets for things like headerPullView, footerView, etc...", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-19T21:57:48.000+0000", "updated": "2013-03-19T21:57:48.000+0000" }, { "id": "243119", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "It's not as easy as this?\r\n\r\n{code}\r\n$.myTable.setHeaderPullView($.myHPVwidget.getView());\r\n{code}\r\n\r\nThis would of course restrict widgets to provide proxy views as their main view only.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2013-03-20T06:49:16.000+0000", "updated": "2013-03-20T06:56:30.000+0000" }, { "id": "243134", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "That's only one part of the implementation that needs to change. The issue is that when the headerPullView is placed in its own , it has no idea who its parent is, what you're referencing as $.myTable. That $.myTable reference could be a local variable in a controller, having no meaning inside the that contains the headerPullView. The parent reference now needs to be passed into all 's and needs to be present in the generated controllers. When a has no XML parent (other than Alloy) to reference as a parent, it will use the passed in parent reference instead. ", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-20T12:12:48.000+0000", "updated": "2013-03-20T12:12:48.000+0000" }, { "id": "243165", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Also, if I'm going to take the time to dig in and solve this one, I'm gonna solve it for all abstract and proxy properties, not just the ones listed in this ticket. In theory, the changes I make for this should allow you to do the same with for Windows, for example.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-20T16:08:16.000+0000", "updated": "2013-03-20T16:08:16.000+0000" }, { "id": "243218", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "So, maybe change this issue to 'Add support to Alloy widgets for providing proxy elements to their parent' or start a new one?\r\n\r\nI don't really get your comment at 20/mrt/13 1:12PM. I don't see how adding a widget's top level view as a child view is that much different from adding it a a property view.\r\n\r\nThe only difference is that the main XML element in the widget does not translate to a Ti.UI statement. So the generated UI JavaScript would look like there was no proxy element wrapping it. But of course the compiler would know and as a result of that map the top level view to a property instead of adding it as a child view?", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2013-03-20T18:52:55.000+0000", "updated": "2013-03-20T18:52:55.000+0000" }, { "id": "243226", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This will likely be more fully explained by the final commits and you can see where I need to account for a lot more scenarios than the one presented in the initial ticket. Weren't you the one who said you coudln't fix yourself in the first place. :P", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-20T19:10:24.000+0000", "updated": "2013-03-20T19:10:24.000+0000" }, { "id": "243234", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Adding abstract and proxy properties to elements via and is now possible. It has been tested using the original examples listed in the description and I added a test app that executes a few more cases at:\r\n\r\nhttps://github.com/appcelerator/alloy/tree/master/test/apps/advanced/proxy_property_requires\r\n\r\nIt shows widgets and requires used for table rows, sections, headerView, footerView, and headerPullView. One tab also shows how you can move navbuttons for windows out to requires as well.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-20T19:44:48.000+0000", "updated": "2013-03-20T19:44:48.000+0000" }, { "id": "251854", "author": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified as working as expected with:\n Alloy 1.1.2 GA and 1.1.3-alpha\n TiSDK 3.1.0 GA and 3.1.1.v20130513131554\n\nNote: I think the test sample https://github.com/appcelerator/alloy/tree/master/test/apps/advanced/proxy_property_requires has to be updated, adding 'controllers' folder, otherwise getting the 'Error: ENOENT, no such file or directory '/Users/fcasali/Documents/Appcelerator_Studio_Workspace/alloy4Samples/app/widgets/com.foo.widget/controllers' when compiling.\n\n\nClosing. ", "updateAuthor": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-05-14T17:58:05.000+0000", "updated": "2013-05-14T17:58:05.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }