[ALOY-544] Ability to define a custom namespace to enable Alloy to generate custom widgets
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2014-07-21T15:03:39.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Runtime, XML |
Labels | notable |
Reporter | Daniel Sefton |
Assignee | Unknown |
Created | 2013-03-07T01:14:43.000+0000 |
Updated | 2018-03-07T22:28:25.000+0000 |
Description
Alloy should allow the user to specify a custom namespace for each widget in XML which modifies the generated code to use the widgets within the specified namespace.
As an example, generates Ti.UI.createwindow(). The user should be able to specify , which Alloy would in turn use to generate mcd.createwindow(). This is useful if the user has their own custom framework with custom widget attributes.
For reference, this technically works now so long as the custom API matches 1 to 1 with the Titanium API, as mentioned in the ticket's description. The issue is that there are a number of validation points in Alloy right now that assert certain things about the parent/child relationships in the XML. For example, The index.xml expects Ti.UI.Window, not some other namespace. There are a bunch of these checks throughout the various XML elements in Alloy/Titanium, so hunting those down and loosening the restrictions is what really needs to be done.
I see, ok. So it works for standard built-in widgets. I'd update the description, but I can't edit this report. The customer is now saying: "Only concern is how to deal with the exceptional scenarios. Let me take a small example. Let's say I need to have a widget called 'LoginWidget'
Daniel in that case they should just create a widget
Tony, what about this situation with nested elements? Like: We're looking to build a custom form object where we can define the form elements in xml and its styles in the tss files, but do things like form.loadRecord(), form.getRecord(), form.loadValues(), form.getValues(), form.disable(), and form.enable(). (We'll probably open source this at some point.) I've thought about using a custom namespace, but is a widget sufficient? I haven't seen any examples of nesting objects in a
This ticket can be closed as this works in Alloy 1.3.1+: *views/index.xml*
*lib/mycustomnamespace.js*
You just need to make sure that
createForm
returns a TiProxy element that hasadd()
because the children will be added by calling this.Agreed, this should be closed. The module attribute can be used to override any tag and return a custom element. See an example here https://github.com/jasonkneen/com.jasonkneen.tabdemo on how this is done with a TabGroup. For iOS, you get standard TabGroup, Tab, Window components - on Android you get a custom re-created TabGroup based on views. The XML is *identical* except for the module="tabGroup" addition.
Resolving, since this functionality already exists as described by the comments.
Closing as invalid. If this is incorrect, please reopen.