Debian Codegraph @

dojox/app/tests/notNestedTestApp/views/V4.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 = 'list4';
6 var backId = 'sc4back1';
7 var insert10Id = 'sc4insert10x';
8 var app = null;
9 var MODULE = "V4";
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 if(registry.byId("heading1")){
49 registry.byId("heading1").labelDivNode.innerHTML = "Long List Four";
50 }
51
52 app.list4 = registry.byId(listId);
53
54 list = app.list4;
55 if(!list.store){
56 list.setStore(app.stores.longlistStore.store);
57 }
58
59 if(dom.byId("tab1WrapperA")){
60 domStyle.set(dom.byId("tab1WrapperA"), "visibility", "visible"); // show the nav view if it being used
61 domStyle.set(dom.byId("tab1WrapperB"), "visibility", "visible"); // show the nav view if it being used
62 }
63 },
64 afterActivate: function(){
65 //console.log(MODULE+" afterActivate");
66 if(!this.app.timedAutoFlow){
67 return;
68 }
69 this.app.loopCount++;
70 //console.log(MODULE+" afterActivate this.app.loopCount="+this.app.loopCount);
71 var liWidget = null;
72 if(this.app.loopCount === 3){
73 liWidget = registry.byId("dojox_mobile_ListItem_0"); //P1,S1,V1
74 }else if(this.app.loopCount === 12) {
75 liWidget = registry.byId("dojox_mobile_ListItem_8"); //-V6
76 }
77 if(liWidget){
78 var ev = new TransitionEvent(liWidget.domNode, liWidget.params);
79 ev.dispatch();
80 }
81 },
82 beforeDeactivate: function(){
83 //console.log(MODULE+" beforeDeactivate");
84 },
85 afterDeactivate: function(){
86 //console.log(MODULE+" afterDeactivate");
87 },
88
89 destroy: function(){
90 var connectResult = _connectResults.pop();
91 while(connectResult){
92 connect.disconnect(connectResult);
93 connectResult = _connectResults.pop();
94 }
95 }
96 };
97 });