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