function Controller() { require("alloy/controllers/BaseController").apply(this, Array.prototype.slice.call(arguments)); this.__controllerPath = "index"; this.args = arguments[0] || {}; if (arguments[0]) { __processArg(arguments[0], "__parentSymbol"); __processArg(arguments[0], "$model"); __processArg(arguments[0], "__itemTemplate"); } var $ = this; var exports = {}; $.__views.index = Ti.UI.createWindow({ backgroundColor: "#eee", fullscreen: false, exitOnClose: true, layout: "vertical", id: "index" }); $.__views.index && $.addTopLevelView($.__views.index); $.__views.label = Ti.UI.createLabel({ color: "#222", font: { fontSize: "28dp", fontWeight: "bold" }, textAlign: "center", height: Ti.UI.SIZE, width: Ti.UI.SIZE, top: "15dp", text: "static label", id: "label" }); $.__views.index.add($.__views.label); exports.destroy = function() {}; _.extend($, $.__views); $.index.open(); var labels = []; for (var i = 0; 4 > i; i++) { var theStyle = Alloy.createStyle("index", { apiName: "Label", classes: [ "blue", "shadow" ], id: "label" + (i + 1), textAlign: "left", text: "I'm ugly, but styled dynamically!" }); var label = Ti.UI.createLabel(theStyle); labels.push(label); $.index.add(label); } try { require("specs/index")($, { labels: labels }); } catch (e) { Ti.API.warn('No unit tests for controller "index"'); } _.extend($, exports); }
function addLabels() { $.scroller.add(Ti.UI.createLabel(Alloy.createStyle("index", { apiName: "Ti.UI.Label", text: "Alloy.createStyle() + Ti.UI.createLabel()" }))); $.scroller.add(Ti.UI.createLabel($.createStyle({ apiName: "Ti.UI.Label", text: "$.createStyle() + Ti.UI.createLabel()" }))); $.scroller.add(Alloy.UI.create("index", "Ti.UI.Label", { text: "Alloy.UI.create()" })); $.scroller.add($.UI.create("Ti.UI.Label", { text: "$.UI.create()" })); $.scroller.add(Alloy.createWidget("alloy.testWidget", "labelmaker").createLabels()); }
createStyle: function(opts) { return Alloy.createStyle(getControllerParam(), opts); },
var Alloy=require("alloy"),Backbone=Alloy.Backbone,_=Alloy._,Controller=function(){function e(){return r.__widgetId?{widgetId:r.__widgetId,name:r.__controllerPath}:r.__controllerPath}var t=[],r=this;this.__iamalloy=!0,_.extend(this,Backbone.Events,{__views:{},__proxyProperties:{},setParent:function(e){var r=t.length;if(r){this.parent=e.__iamalloy?e.parent:e;for(var o=0;r>o;o++)t[o].__iamalloy?t[o].setParent(this.parent):this.parent.add(t[o])}},addTopLevelView:function(e){t.push(e)},addProxyProperty:function(e,t){this.__proxyProperties[e]=t},removeProxyProperty:function(e){delete this.__proxyProperties[e]},getTopLevelViews:function(){return t},getView:function(e){return"undefined"==typeof e||null===e?t[0]:this.__views[e]},removeView:function(e){delete this[e],delete this.__views[e]},getProxyProperty:function(e){return this.__proxyProperties[e]},getViews:function(){return this.__views},destroy:function(){},getViewEx:function(e){var t=e.recurse||!1;if(t){var r=this.getView();return r?r.__iamalloy?r.getViewEx({recurse:!0}):r:null}return this.getView()},getProxyPropertyEx:function(e,t){var r=t.recurse||!1;if(r){var o=this.getProxyProperty(e);return o?o.__iamalloy?o.getProxyProperty(e,{recurse:!0}):o:null}return this.getView(e)},createStyle:function(t){return Alloy.createStyle(e(),t)},UI:{create:function(t,r){return Alloy.UI.create(e(),t,r)}},addClass:function(t,r,o){return Alloy.addClass(e(),t,r,o)},removeClass:function(t,r,o){return Alloy.removeClass(e(),t,r,o)},resetClass:function(t,r,o){return Alloy.resetClass(e(),t,r,o)}})};module.exports=Controller;
createStyle: function(opts) { return Alloy.createStyle(self.__widgetId ? { widgetId: self.__widgetId, name: self.__controllerPath } : self.__controllerPath, opts); },