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/mediaQueryLayoutApp/controllers/CssLayout |
---|
7 | // summary: |
---|
8 | // Will layout an application with a BorderContainer. |
---|
9 | // Each view to be shown in a region of the BorderContainer will be wrapped in a StackContainer and a ContentPane. |
---|
10 | // |
---|
11 | |
---|
12 | return declare("dojox/app/tests/mediaQueryLayoutApp/controllers/CssLayout", 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/CssLayout.initLayout event.view.name=[",event.view.name,"] event.view.parent.name=[",event.view.parent.name,"]"); |
---|
26 | |
---|
27 | |
---|
28 | this.app.log("in app/controllers/CssLayout.initLayout event.view.constraint=",event.view.constraint); |
---|
29 | var constraint = event.view.constraint; // constraint holds the region for this view, center, top etc. |
---|
30 | |
---|
31 | // if(event.view.parent.id == this.app.id){ // If the parent of this view is the app we are working with the BorderContainer |
---|
32 | // var reg = dom.byId(event.view.parent.id+"-"+constraint); |
---|
33 | // if(reg){ // already has a wrapperNode, just add to it. |
---|
34 | // reg.appendChild(event.view.domNode); |
---|
35 | // }else{ // need a wrapperNode |
---|
36 | // var container; |
---|
37 | // event.view.parent.domNode.appendChild(container = domConstruct.create("div")); |
---|
38 | // container.appendChild(event.view.domNode); |
---|
39 | // domAttr.set(container, "id", event.view.parent.id+"-"+constraint); |
---|
40 | // domClass.add(event.view.domNode, constraint); // set the class to the constraint |
---|
41 | // } |
---|
42 | // }else{ // Not a top level page transition, so not changing a page in the BorderContainer, so handle it like Layout. |
---|
43 | event.view.parent.domNode.appendChild(event.view.domNode); |
---|
44 | domClass.add(event.view.domNode, constraint); // set the class to the constraint |
---|
45 | // } |
---|
46 | |
---|
47 | this.inherited(arguments); |
---|
48 | }, |
---|
49 | |
---|
50 | onResize: function(){ |
---|
51 | // do nothing on resize |
---|
52 | }, |
---|
53 | |
---|
54 | hideView: function(view){ |
---|
55 | domStyle.set(view.domNode, "display", "none"); |
---|
56 | //var sc = registry.byId(view.parent.id+"-"+view.constraint); |
---|
57 | //if(sc){ |
---|
58 | // sc.removedFromBc = true; |
---|
59 | // sc.removeChild(view.domNode); |
---|
60 | //} |
---|
61 | }, |
---|
62 | |
---|
63 | showView: function(view){ |
---|
64 | domStyle.set(view.domNode, "display", ""); |
---|
65 | |
---|
66 | //var sc = registry.byId(view.parent.id+"-"+view.constraint); |
---|
67 | //if(sc){ |
---|
68 | // if(sc.removedFromBc){ |
---|
69 | // sc.removedFromBc = false; |
---|
70 | // registry.byId(this.app.id+"-BC").addChild(sc); |
---|
71 | // domStyle.set(view.domNode, "display", ""); |
---|
72 | // } |
---|
73 | // domStyle.set(cp.domNode, "display", ""); |
---|
74 | // sc.selectChild(cp); |
---|
75 | // sc.resize(); |
---|
76 | //} |
---|
77 | } |
---|
78 | }); |
---|
79 | }); |
---|