TabContainer.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
  3. Available via Academic Free License >= 2.1 OR the modified BSD license.
  4. see: http://dojotoolkit.org/license for details
  5. */
  6. if(!dojo._hasResource["dijit.layout.TabContainer"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  7. dojo._hasResource["dijit.layout.TabContainer"] = true;
  8. dojo.provide("dijit.layout.TabContainer");
  9. dojo.require("dijit.layout._TabContainerBase");
  10. dojo.require("dijit.layout.TabController");
  11. dojo.require("dijit.layout.ScrollingTabController");
  12. dojo.declare("dijit.layout.TabContainer",
  13. dijit.layout._TabContainerBase,
  14. {
  15. // summary:
  16. // A Container with tabs to select each child (only one of which is displayed at a time).
  17. // description:
  18. // A TabContainer is a container that has multiple panes, but shows only
  19. // one pane at a time. There are a set of tabs corresponding to each pane,
  20. // where each tab has the name (aka title) of the pane, and optionally a close button.
  21. // useMenu: [const] Boolean
  22. // True if a menu should be used to select tabs when they are too
  23. // wide to fit the TabContainer, false otherwise.
  24. useMenu: true,
  25. // useSlider: [const] Boolean
  26. // True if a slider should be used to select tabs when they are too
  27. // wide to fit the TabContainer, false otherwise.
  28. useSlider: true,
  29. // controllerWidget: String
  30. // An optional parameter to override the widget used to display the tab labels
  31. controllerWidget: "",
  32. _makeController: function(/*DomNode*/ srcNode){
  33. // summary:
  34. // Instantiate tablist controller widget and return reference to it.
  35. // Callback from _TabContainerBase.postCreate().
  36. // tags:
  37. // protected extension
  38. var cls = this.baseClass + "-tabs" + (this.doLayout ? "" : " dijitTabNoLayout"),
  39. TabController = dojo.getObject(this.controllerWidget);
  40. return new TabController({
  41. id: this.id + "_tablist",
  42. dir: this.dir,
  43. lang: this.lang,
  44. tabPosition: this.tabPosition,
  45. doLayout: this.doLayout,
  46. containerId: this.id,
  47. "class": cls,
  48. nested: this.nested,
  49. useMenu: this.useMenu,
  50. useSlider: this.useSlider,
  51. tabStripClass: this.tabStrip ? this.baseClass + (this.tabStrip ? "":"No") + "Strip": null
  52. }, srcNode);
  53. },
  54. postMixInProperties: function(){
  55. this.inherited(arguments);
  56. // Scrolling controller only works for horizontal non-nested tabs
  57. if(!this.controllerWidget){
  58. this.controllerWidget = (this.tabPosition == "top" || this.tabPosition == "bottom") && !this.nested ?
  59. "dijit.layout.ScrollingTabController" : "dijit.layout.TabController";
  60. }
  61. }
  62. });
  63. }