1 | define([ |
---|
2 | "dojo/_base/lang", // lang.getObject |
---|
3 | "dojo/_base/declare", // declare |
---|
4 | "./_TabContainerBase", |
---|
5 | "./TabController", |
---|
6 | "./ScrollingTabController" |
---|
7 | ], function(lang, declare, _TabContainerBase, TabController, ScrollingTabController){ |
---|
8 | |
---|
9 | /*===== |
---|
10 | var _TabContainerBase = dijit.layout._TabContainerBase; |
---|
11 | var TabController = dijit.layout.TabController; |
---|
12 | var ScrollingTabController = dijit.layout.ScrollingTabController; |
---|
13 | =====*/ |
---|
14 | |
---|
15 | // module: |
---|
16 | // dijit/layout/TabContainer |
---|
17 | // summary: |
---|
18 | // A Container with tabs to select each child (only one of which is displayed at a time). |
---|
19 | |
---|
20 | |
---|
21 | return declare("dijit.layout.TabContainer", _TabContainerBase, { |
---|
22 | // summary: |
---|
23 | // A Container with tabs to select each child (only one of which is displayed at a time). |
---|
24 | // description: |
---|
25 | // A TabContainer is a container that has multiple panes, but shows only |
---|
26 | // one pane at a time. There are a set of tabs corresponding to each pane, |
---|
27 | // where each tab has the name (aka title) of the pane, and optionally a close button. |
---|
28 | |
---|
29 | // useMenu: [const] Boolean |
---|
30 | // True if a menu should be used to select tabs when they are too |
---|
31 | // wide to fit the TabContainer, false otherwise. |
---|
32 | useMenu: true, |
---|
33 | |
---|
34 | // useSlider: [const] Boolean |
---|
35 | // True if a slider should be used to select tabs when they are too |
---|
36 | // wide to fit the TabContainer, false otherwise. |
---|
37 | useSlider: true, |
---|
38 | |
---|
39 | // controllerWidget: String |
---|
40 | // An optional parameter to override the widget used to display the tab labels |
---|
41 | controllerWidget: "", |
---|
42 | |
---|
43 | _makeController: function(/*DomNode*/ srcNode){ |
---|
44 | // summary: |
---|
45 | // Instantiate tablist controller widget and return reference to it. |
---|
46 | // Callback from _TabContainerBase.postCreate(). |
---|
47 | // tags: |
---|
48 | // protected extension |
---|
49 | |
---|
50 | var cls = this.baseClass + "-tabs" + (this.doLayout ? "" : " dijitTabNoLayout"), |
---|
51 | TabController = lang.getObject(this.controllerWidget); |
---|
52 | |
---|
53 | return new TabController({ |
---|
54 | id: this.id + "_tablist", |
---|
55 | dir: this.dir, |
---|
56 | lang: this.lang, |
---|
57 | textDir: this.textDir, |
---|
58 | tabPosition: this.tabPosition, |
---|
59 | doLayout: this.doLayout, |
---|
60 | containerId: this.id, |
---|
61 | "class": cls, |
---|
62 | nested: this.nested, |
---|
63 | useMenu: this.useMenu, |
---|
64 | useSlider: this.useSlider, |
---|
65 | tabStripClass: this.tabStrip ? this.baseClass + (this.tabStrip ? "":"No") + "Strip": null |
---|
66 | }, srcNode); |
---|
67 | }, |
---|
68 | |
---|
69 | postMixInProperties: function(){ |
---|
70 | this.inherited(arguments); |
---|
71 | |
---|
72 | // Scrolling controller only works for horizontal non-nested tabs |
---|
73 | if(!this.controllerWidget){ |
---|
74 | this.controllerWidget = (this.tabPosition == "top" || this.tabPosition == "bottom") && !this.nested ? |
---|
75 | "dijit.layout.ScrollingTabController" : "dijit.layout.TabController"; |
---|
76 | } |
---|
77 | } |
---|
78 | }); |
---|
79 | }); |
---|