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