Debian Codegraph @

dojox/app/tests/swapViewTestApp/controllers/ObjBasedLayout.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/ObjBasedLayout
7 // summary:
8 // Will layout an application based upon constraint obj with id, and class.
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/ObjBasedLayout", 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/ObjBasedLayout.initLayout event.view.name=[",event.view.name,"] event.view.parent.name=[",event.view.parent.name,"]");
26
27
28 this.app.log("in app/controllers/ObjBasedLayout.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 parentId = constraint;
31 if(constraint.parentId){
32 parentId = constraint.parentId;
33 }
34 var parentDiv = dom.byId(parentId);
35 if(parentDiv){ // If the parentDiv is found append this views domNode to it
36 parentDiv.appendChild(event.view.domNode);
37 }else{
38 event.view.parent.domNode.appendChild(event.view.domNode);
39 }
40 if(constraint.class){
41 domClass.add(event.view.domNode, constraint.class); // set the class to the constraint
42 }
43
44 this.inherited(arguments);
45 },
46
47 onResize: function(){
48 // do nothing on resize
49 },
50
51 hideView: function(view){
52 domStyle.set(view.domNode, "display", "none");
53 },
54
55 showView: function(view){
56 domStyle.set(view.domNode, "display", "");
57 }
58 });
59 });