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/mediaQuery3ColumnApp/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/mediaQuery3ColumnApp/controllers/CssLayout", LayoutBase, { |
---|
13 | |
---|
14 | constructor: function(app, events){ |
---|
15 | // summary: |
---|
16 | // bind "app-initLayout" and "app-layoutView" events on application instance. |
---|
17 | // |
---|
18 | // app: |
---|
19 | // dojox/app application instance. |
---|
20 | // events: |
---|
21 | // {event : handler} |
---|
22 | }, |
---|
23 | |
---|
24 | initLayout: function(event){ |
---|
25 | // summary: |
---|
26 | // Response to dojox/app "app-initLayout" event which is setup in LayoutBase. |
---|
27 | // The initLayout event is called once when the View is being created the first time. |
---|
28 | // |
---|
29 | // example: |
---|
30 | // Use emit to trigger "app-initLayout" event, and this function will respond to the event. For example: |
---|
31 | // | this.app.emit("app-initLayout", view); |
---|
32 | // |
---|
33 | // event: Object |
---|
34 | // | {"view": view, "callback": function(){}}; |
---|
35 | this.app.log("in app/controllers/CssLayout.initLayout event.view.name=[",event.view.name,"] event.view.parent.name=[",event.view.parent.name,"]"); |
---|
36 | |
---|
37 | |
---|
38 | this.app.log("in app/controllers/CssLayout.initLayout event.view.constraint=",event.view.constraint); |
---|
39 | var constraint = event.view.constraint; // constraint holds the region for this view, center, top etc. |
---|
40 | |
---|
41 | event.view.parent.domNode.appendChild(event.view.domNode); |
---|
42 | domClass.add(event.view.domNode, constraint); // set the class to the constraint |
---|
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 !important"); |
---|
53 | //domClass.add(view.domNode, "hide"); |
---|
54 | }, |
---|
55 | |
---|
56 | showView: function(view){ |
---|
57 | domStyle.set(view.domNode, "display", "block"); |
---|
58 | //domClass.remove(view.domNode, "hide"); |
---|
59 | } |
---|
60 | }); |
---|
61 | }); |
---|