//>>built
define("dojox/mobile/app/SceneController",["dojo","dijit","dojox","dojo/require!dojox/mobile/_base"],function(b,l,c){b.provide("dojox.mobile.app.SceneController");b.experimental("dojox.mobile.app.SceneController");b.require("dojox.mobile._base");(function(){var h=c.mobile.app,g={};b.declare("dojox.mobile.app.SceneController",c.mobile.View,{stageController:null,keepScrollPos:!1,init:function(a,d){this.sceneName=a;this.params=d;var c=h.resolveTemplate(a);this._deferredInit=new b.Deferred;g[a]?this._setContents(g[a]):
b.xhrGet({url:c,handleAs:"text"}).addCallback(b.hitch(this,this._setContents));return this._deferredInit},_setContents:function(a){g[this.sceneName]=a;this.domNode.innerHTML="\x3cdiv\x3e"+a+"\x3c/div\x3e";var d="";a=this.sceneName.split("-");for(var f=0;f<a.length;f++)d+=a[f].substring(0,1).toUpperCase()+a[f].substring(1);this.sceneAssistantName=d+="Assistant";var e=this;c.mobile.app.loadResourcesForScene(this.sceneName,function(){console.log("All resources for ",e.sceneName," loaded");if("undefined"!=
typeof b.global[d])e._initAssistant();else{var a=h.resolveAssistant(e.sceneName);b.xhrGet({url:a,handleAs:"text"}).addCallback(function(a){try{b.eval(a)}catch(k){throw console.log("Error initializing code for scene "+e.sceneName+". Please check for syntax errors"),k;}e._initAssistant()})}})},_initAssistant:function(){console.log("Instantiating the scene assistant "+this.sceneAssistantName);var a=b.getObject(this.sceneAssistantName);if(!a)throw Error("Unable to resolve scene assistant "+this.sceneAssistantName);
this.assistant=new a(this.params);this.assistant.controller=this;this.assistant.domNode=this.domNode.firstChild;this.assistant.setup();this._deferredInit.callback()},query:function(a,d){return b.query(a,d||this.domNode)},parse:function(a){a=this._widgets=c.mobile.parser.parse(a||this.domNode,{controller:this});for(var b=0;b<a.length;b++)a[b].set("controller",this)},getWindowSize:function(){return{w:b.global.innerWidth,h:b.global.innerHeight}},showAlertDialog:function(a){b.marginBox(this.assistant.domNode);
a=new c.mobile.app.AlertDialog(b.mixin(a,{controller:this}));this.assistant.domNode.appendChild(a.domNode);console.log("Appended ",a.domNode," to ",this.assistant.domNode);a.show()},popupSubMenu:function(a){var b=new c.mobile.app.ListSelector({controller:this,destroyOnHide:!0,onChoose:a.onChoose});this.assistant.domNode.appendChild(b.domNode);b.set("data",a.choices);b.show(a.fromNode)}})})()});