Debian Codegraph @

dojox/app/tests/swapViewTestApp/controllers/DivIdBasedLayout.js

raw symbols SCIP
1 define(["dojo/_base/declare", "dojo/dom", "dojo/dom-style",
2 "dojo/dom-class", "dojo/dom-attr", "dojo/dom-construct",
3 "dojox/app/controllers/LayoutBase"],
4 function(declare, dom, domStyle, domClass, domAttr, domConstruct, LayoutBase){
5 // module:
6 // dojox/app/tests/swapViewTestApp/controllers/DivIdBasedLayout
7 // summary:
8 // Will layout an application based upon div ids.
9 // Each view will be appended inside the div with the id that matches the value set in the constraints for the view.
10 //
11
12 return declare("dojox/app/tests/swapViewTestApp/controllers/DivIdBasedLayout", LayoutBase, {
13
14 initLayout: function(event){
15 // summary:
16 // Response to dojox/app "app-initLayout" event which is setup in LayoutBase.
17 // The initLayout event is called once when the View is being created the first time.
18 //
19 // example:
20 // Use emit to trigger "app-initLayout" event, and this function will respond to the event. For example:
21 // | this.app.emit("app-initLayout", view);
22 //
23 // event: Object
24 // | {"view": view, "callback": function(){}};
25 this.app.log("in app/controllers/DivIdBasedLayout.initLayout event.view.name=[",event.view.name,"] event.view.parent.name=[",event.view.parent.name,"]");
26
27
28 this.app.log("in app/controllers/DivIdBasedLayout.initLayout event.view.constraint=",event.view.constraint);
29 var constraint = event.view.constraint; // constraint holds the region for this view, center, top etc.
30 var parentDiv = dom.byId(constraint);
31 if(parentDiv){ // If the parentDiv is found append this views domNode to it
32 parentDiv.appendChild(event.view.domNode);
33 }else{
34 event.view.parent.domNode.appendChild(event.view.domNode);
35 }
36 domClass.add(event.view.domNode, constraint); // set the class to the constraint
37
38 this.inherited(arguments);
39 },
40
41 onResize: function(){
42 // do nothing on resize
43 },
44
45 hideView: function(view){
46 domStyle.set(view.domNode, "display", "none");
47 },
48
49 showView: function(view){
50 domStyle.set(view.domNode, "display", "");
51 }
52 });
53 });