Debian Codegraph @

dojox/app/tests/notNestedTestApp/views/V5.js

raw symbols SCIP
1 define(["dojo/dom", "dojo/dom-style", "dojo/_base/connect","dijit/registry", "dojo/sniff", "dojox/mobile/TransitionEvent"],
2 function(dom, domStyle, connect, registry, has, TransitionEvent){
3 var _connectResults = []; // events connect result
4 var list = null;
5 var listId = 'list5';
6 var backId = 'sc5back1';
7 var insert10Id = 'sc5insert10x';
8 var app = null;
9 var MODULE = "V5";
10
11 var loadMore = function(){
12 if(!app){
13 return;
14 }
15 if(!app.listStart){
16 app.listStart = 1;
17 app.listCount = 5;
18 }
19 setTimeout(function(){ // to simulate network latency
20 for(var i = app.listStart; i < app.listStart+5; i++){
21 var newdata = {'label': 'Item #'+i};
22 app.stores.longlistStore.store.put(newdata);
23 }
24 app.listStart += app.listCount;
25 app.listTotal = app.listStart-1;
26 return false;
27 }, 500);
28 };
29 return {
30 init: function(){
31 app = this.app;
32
33 var connectResult = connect.connect(dom.byId(insert10Id), "click", function(){
34 //Add 10 items to the end of the model
35 loadMore();
36 });
37 _connectResults.push(connectResult);
38 },
39
40
41 beforeActivate: function(){
42 // summary:
43 // view life cycle beforeActivate()
44 //console.log(MODULE+" beforeActivate");
45 if(dom.byId(backId) && !has("phone")){
46 domStyle.set(dom.byId(backId), "visibility", "hidden"); // hide the back button in tablet mode
47 }
48
49 app.list5 = registry.byId(listId);
50
51 list = app.list5;
52 if(!list.store){
53 list.setStore(app.stores.longlistStore.store);
54 }
55
56 if(dom.byId("tab1WrapperA")){
57 domStyle.set(dom.byId("tab1WrapperA"), "visibility", "visible"); // show the nav view if it being used
58 domStyle.set(dom.byId("tab1WrapperB"), "visibility", "visible"); // show the nav view if it being used
59 }
60 },
61 afterActivate: function(){
62 //console.log(MODULE+" afterActivate");
63 if(!this.app.timedAutoFlow){
64 return;
65 }
66 this.app.loopCount++;
67 //console.log(MODULE+" afterActivate this.app.loopCount="+this.app.loopCount);
68 var liWidget = null;
69 if(this.app.loopCount === 9){
70 liWidget = registry.byId("dojox_mobile_ListItem_7"); //V6
71 }else if(this.app.loopCount === 15) {
72 liWidget = registry.byId("dojox_mobile_ListItem_12"); //Test Instructions
73 }
74 if(liWidget){
75 var ev = new TransitionEvent(liWidget.domNode, liWidget.params);
76 ev.dispatch();
77 }
78 },
79 beforeDeactivate: function(){
80 //console.log(MODULE+" beforeDeactivate");
81 },
82 afterDeactivate: function(){
83 //console.log(MODULE+" afterDeactivate");
84 },
85
86 destroy: function(){
87 var connectResult = _connectResults.pop();
88 while(connectResult){
89 connect.disconnect(connectResult);
90 connectResult = _connectResults.pop();
91 }
92 }
93 };
94 });