Titanium JIRA Archive
Alloy (ALOY)

[ALOY-127] 'alloy generate view' should generate a View not Window

GitHub Issuen/a
Resolution Date2012-08-02T09:17:33.000+0000
Affected Version/sn/a
Fix Version/s2012 Sprint 15, Release 3.0.0
ReporterTim Poulsen


Most apps have one window, or just a couple, but have many views. It would make more sense to me that 'alloy generate view view_name' would generate a View not a Window.


  1. Tony Lukasavage 2012-07-27

    Perhaps we should have something a little more robust than this to allow more power and flexibility. We could have an option or argument to the CLI that lets you specify the type of element you'd like in the generated view. Or we could even have templates for the generated views. Couple ideas:
    alloy generate view VIEW_NAME [VIEW_TYPE]
    Where VIEW_TYPE would be an optional argument that gives the top-level view type (i.e., View, Window, TabGroup, etc...)
    alloy generate view VIEW_NAME [-v TEMPLATE]
    Where TEMPLATE could be a view template we would define somewhere in Alloy. I think we probably need to define what are the useful "templates" for views before making any changes.
  2. Russell McMahon 2012-07-27

    I like the template choice. If a View is used though don't we need to wrap in window so we can use it add() and open().
  3. Tony Lukasavage 2012-07-27

    I don't understand what you mean in your last sentence. The template would dictate which elements are used. Where do add() and open() come into play?
  4. Tim Poulsen 2012-07-27

    Tony, both VIEW_TYPE and TEMPLATE would be fantastic. I still think the default (if you omit VIEW_TYPE) should be View not Window! :)
  5. Russell McMahon 2012-07-27

    If I create a View and then put a Button in it in index.xml and in the controller index.js I do $.index.open(); that will work? If so forget what what I wrote above.
  6. Tony Lukasavage 2012-07-27

    Russ, this is exactly why I brought up the concept of removing the 'view' generator and providing only the "component" one. That way your "TEMPLATE" would consist not only of the view, but also the style and controller, allowing you construct all 3 files in concert.
  7. Tony Lukasavage 2012-08-02

    now generates View by default. Initial issue is fixed. Created new issue ALOY-158 to discuss generating based on templates.

JSON Source