dijit/layout/StackContainer.js

  • Provides:

    • dijit.layout.StackContainer
  • dijit.layout.StackContainer

    • type
      Function
    • chains:
      • dijit.layout._LayoutWidget: (prototype)
      • dijit.layout._LayoutWidget: (call)
    • summary
      A container that has multiple children, but shows only
      one child at a time
    • description
      A container for widgets (ContentPanes, for example) That displays
      only one Widget at a time.
      
      Publishes topics [widgetId]-addChild, [widgetId]-removeChild, and [widgetId]-selectChild
      
      Can be base class for container, Wizard, Show, etc.
  • dijit.layout.StackContainer.doLayout

    • type
      Boolean
    • summary
      If true, change the size of my currently displayed child to match my size
  • dijit.layout.StackContainer.persist

    • type
      Boolean
    • summary
      Remembers the selected child across sessions
  • dijit.layout.StackContainer.baseClass

    • summary
  • dijit.layout.StackContainer.selectedChildWidget

    • tags: readonly
    • type
      dijit._Widget
    • summary
      References the currently selected child widget, if any.
      Adjust selected child with selectChild() method.
  • dijit.layout.StackContainer.buildRendering

    • type
      Function
    • source: [view]
        this.inherited(arguments);
        dojo.addClass(this.domNode, "dijitLayoutContainer");
        dijit.setWaiRole(this.containerNode, "tabpanel");
    • summary
  • dijit.layout.StackContainer.postCreate

    • type
      Function
    • source: [view]
        this.inherited(arguments);
        this.connect(this.domNode, "onkeypress", this._onKeyPress);
    • summary
  • dijit.layout.StackContainer.startup

    • type
      Function
    • source: [view]
        if(this._started){ return; }


        var children = this.getChildren();


        // Setup each page panel to be initially hidden
        dojo.forEach(children, this._setupChild, this);


        // Figure out which child to initially display, defaulting to first one
        if(this.persist){
         this.selectedChildWidget = dijit.byId(dojo.cookie(this.id + "_selectedChild"));
        }else{
         dojo.some(children, function(child){
          if(child.selected){
           this.selectedChildWidget = child;
          }
          return child.selected;
         }, this);
        }
        var selected = this.selectedChildWidget;
        if(!selected && children[0]){
         selected = this.selectedChildWidget = children[0];
         selected.selected = true;
        }


        // Publish information about myself so any StackControllers can initialize.
        // This needs to happen before this.inherited(arguments) so that for
        // TabContainer, this._contentBox doesn't include the space for the tab labels.
        dojo.publish(this.id+"-startup", [{children: children, selected: selected}]);


        // Startup each child widget, and do initial layout like setting this._contentBox,
        // then calls this.resize() which does the initial sizing on the selected child.
        this.inherited(arguments);
    • summary
  • dijit.layout.StackContainer.resize

    • type
      Function
    • source: [view]
      define("dijit/layout/StackContainer", ["dojo", "dijit", "dijit/_Templated", "dijit/layout/_LayoutWidget", "i18n!dijit/nls/common", "dojo/cookie", "dijit/layout/StackController"], function(dojo, dijit) {


      dojo.declare(
       "dijit.layout.StackContainer",
       dijit.layout._LayoutWidget,
       {
       // summary:
       //  A container that has multiple children, but shows only
       //  one child at a time
       //
       // description:
       //  A container for widgets (ContentPanes, for example) That displays
       //  only one Widget at a time.
       //
       //  Publishes topics [widgetId]-addChild, [widgetId]-removeChild, and [widgetId]-selectChild
       //
       //  Can be base class for container, Wizard, Show, etc.


       // doLayout: Boolean
       //  If true, change the size of my currently displayed child to match my size
       doLayout: true,


       // persist: Boolean
       //  Remembers the selected child across sessions
       persist: false,


       baseClass: "dijitStackContainer",




       // selectedChildWidget: [readonly] dijit._Widget
       //  References the currently selected child widget, if any.
       //  Adjust selected child with selectChild() method.
       selectedChildWidget: null,




       buildRendering: function(){
        this.inherited(arguments);
        dojo.addClass(this.domNode, "dijitLayoutContainer");
        dijit.setWaiRole(this.containerNode, "tabpanel");
       },


       postCreate: function(){
        this.inherited(arguments);
        this.connect(this.domNode, "onkeypress", this._onKeyPress);
       },


       startup: function(){
        if(this._started){ return; }


        var children = this.getChildren();


        // Setup each page panel to be initially hidden
        dojo.forEach(children, this._setupChild, this);


        // Figure out which child to initially display, defaulting to first one
        if(this.persist){
         this.selectedChildWidget = dijit.byId(dojo.cookie(this.id + "_selectedChild"));
        }else{
         dojo.some(children, function(child){
          if(child.selected){
           this.selectedChildWidget = child;
          }
          return child.selected;
         }, this);
        }
        var selected = this.selectedChildWidget;
        if(!selected && children[0]){
         selected = this.selectedChildWidget = children[0];
         selected.selected = true;
        }


        // Publish information about myself so any StackControllers can initialize.
        // This needs to happen before this.inherited(arguments) so that for
        // TabContainer, this._contentBox doesn't include the space for the tab labels.
        dojo.publish(this.id+"-startup", [{children: children, selected: selected}]);


        // Startup each child widget, and do initial layout like setting this._contentBox,
        // then calls this.resize() which does the initial sizing on the selected child.
        this.inherited(arguments);
       },


       resize: function(){
        // Resize is called when we are first made visible (it's called from startup()
        // if we are initially visible). If this is the first time we've been made
        // visible then show our first child.
        var selected = this.selectedChildWidget;
        if(selected && !this._hasBeenShown){
         this._hasBeenShown = true;
         this._showChild(selected);
        }
        this.inherited(arguments);
    • summary
  • dijit.layout.StackContainer._setupChild

    • type
      Function
    • parameters:
      • child: (typeof dijit._Widget)
    • source: [view]
      define("dijit/layout/StackContainer", ["dojo", "dijit", "dijit/_Templated", "dijit/layout/_LayoutWidget", "i18n!dijit/nls/common", "dojo/cookie", "dijit/layout/StackController"], function(dojo, dijit) {


      dojo.declare(
       "dijit.layout.StackContainer",
       dijit.layout._LayoutWidget,
       {
       // summary:
       //  A container that has multiple children, but shows only
       //  one child at a time
       //
       // description:
       //  A container for widgets (ContentPanes, for example) That displays
       //  only one Widget at a time.
       //
       //  Publishes topics [widgetId]-addChild, [widgetId]-removeChild, and [widgetId]-selectChild
       //
       //  Can be base class for container, Wizard, Show, etc.


       // doLayout: Boolean
       //  If true, change the size of my currently displayed child to match my size
       doLayout: true,


       // persist: Boolean
       //  Remembers the selected child across sessions
       persist: false,


       baseClass: "dijitStackContainer",




       // selectedChildWidget: [readonly] dijit._Widget
       //  References the currently selected child widget, if any.
       //  Adjust selected child with selectChild() method.
       selectedChildWidget: null,




       buildRendering: function(){
        this.inherited(arguments);
        dojo.addClass(this.domNode, "dijitLayoutContainer");
        dijit.setWaiRole(this.containerNode, "tabpanel");
       },


       postCreate: function(){
        this.inherited(arguments);
        this.connect(this.domNode, "onkeypress", this._onKeyPress);
       },


       startup: function(){
        if(this._started){ return; }


        var children = this.getChildren();


        // Setup each page panel to be initially hidden
        dojo.forEach(children, this._setupChild, this);


        // Figure out which child to initially display, defaulting to first one
        if(this.persist){
         this.selectedChildWidget = dijit.byId(dojo.cookie(this.id + "_selectedChild"));
        }else{
         dojo.some(children, function(child){
          if(child.selected){
           this.selectedChildWidget = child;
          }
          return child.selected;
         }, this);
        }
        var selected = this.selectedChildWidget;
        if(!selected && children[0]){
         selected = this.selectedChildWidget = children[0];
         selected.selected = true;
        }


        // Publish information about myself so any StackControllers can initialize.
        // This needs to happen before this.inherited(arguments) so that for
        // TabContainer, this._contentBox doesn't include the space for the tab labels.
        dojo.publish(this.id+"-startup", [{children: children, selected: selected}]);


        // Startup each child widget, and do initial layout like setting this._contentBox,
        // then calls this.resize() which does the initial sizing on the selected child.
        this.inherited(arguments);
       },


       resize: function(){
        // Resize is called when we are first made visible (it's called from startup()
        // if we are initially visible). If this is the first time we've been made
        // visible then show our first child.
        var selected = this.selectedChildWidget;
        if(selected && !this._hasBeenShown){
         this._hasBeenShown = true;
         this._showChild(selected);
        }
        this.inherited(arguments);
       },


       _setupChild: function(/*dijit._Widget*/ child){
        // Overrides _LayoutWidget._setupChild()


        this.inherited(arguments);


        dojo.replaceClass(child.domNode, "dijitHidden", "dijitVisible");


        // remove the title attribute so it doesn't show up when i hover
        // over a node
        child.domNode.title = "";
    • summary
  • dijit.layout.StackContainer.addChild

    • type
      Function
    • parameters:
      • child: (typeof dijit._Widget)
      • insertIndex: (typeof Integer)
    • source: [view]
      define("dijit/layout/StackContainer", ["dojo", "dijit", "dijit/_Templated", "dijit/layout/_LayoutWidget", "i18n!dijit/nls/common", "dojo/cookie", "dijit/layout/StackController"], function(dojo, dijit) {


      dojo.declare(
       "dijit.layout.StackContainer",
       dijit.layout._LayoutWidget,
       {
       // summary:
       //  A container that has multiple children, but shows only
       //  one child at a time
       //
       // description:
       //  A container for widgets (ContentPanes, for example) That displays
       //  only one Widget at a time.
       //
       //  Publishes topics [widgetId]-addChild, [widgetId]-removeChild, and [widgetId]-selectChild
       //
       //  Can be base class for container, Wizard, Show, etc.


       // doLayout: Boolean
       //  If true, change the size of my currently displayed child to match my size
       doLayout: true,


       // persist: Boolean
       //  Remembers the selected child across sessions
       persist: false,


       baseClass: "dijitStackContainer",




       // selectedChildWidget: [readonly] dijit._Widget
       //  References the currently selected child widget, if any.
       //  Adjust selected child with selectChild() method.
       selectedChildWidget: null,




       buildRendering: function(){
        this.inherited(arguments);
        dojo.addClass(this.domNode, "dijitLayoutContainer");
        dijit.setWaiRole(this.containerNode, "tabpanel");
       },


       postCreate: function(){
        this.inherited(arguments);
        this.connect(this.domNode, "onkeypress", this._onKeyPress);
       },


       startup: function(){
        if(this._started){ return; }


        var children = this.getChildren();


        // Setup each page panel to be initially hidden
        dojo.forEach(children, this._setupChild, this);


        // Figure out which child to initially display, defaulting to first one
        if(this.persist){
         this.selectedChildWidget = dijit.byId(dojo.cookie(this.id + "_selectedChild"));
        }else{
         dojo.some(children, function(child){
          if(child.selected){
           this.selectedChildWidget = child;
          }
          return child.selected;
         }, this);
        }
        var selected = this.selectedChildWidget;
        if(!selected && children[0]){
         selected = this.selectedChildWidget = children[0];
         selected.selected = true;
        }


        // Publish information about myself so any StackControllers can initialize.
        // This needs to happen before this.inherited(arguments) so that for
        // TabContainer, this._contentBox doesn't include the space for the tab labels.
        dojo.publish(this.id+"-startup", [{children: children, selected: selected}]);


        // Startup each child widget, and do initial layout like setting this._contentBox,
        // then calls this.resize() which does the initial sizing on the selected child.
        this.inherited(arguments);
       },


       resize: function(){
        // Resize is called when we are first made visible (it's called from startup()
        // if we are initially visible). If this is the first time we've been made
        // visible then show our first child.
        var selected = this.selectedChildWidget;
        if(selected && !this._hasBeenShown){
         this._hasBeenShown = true;
         this._showChild(selected);
        }
        this.inherited(arguments);
       },


       _setupChild: function(/*dijit._Widget*/ child){
        // Overrides _LayoutWidget._setupChild()


        this.inherited(arguments);


        dojo.replaceClass(child.domNode, "dijitHidden", "dijitVisible");


        // remove the title attribute so it doesn't show up when i hover
        // over a node
        child.domNode.title = "";
       },


       addChild: function(/*dijit._Widget*/ child, /*Integer?*/ insertIndex){
        // Overrides _Container.addChild() to do layout and publish events


        this.inherited(arguments);


        if(this._started){
         dojo.publish(this.id+"-addChild", [child, insertIndex]);


         // in case the tab titles have overflowed from one line to two lines
         // (or, if this if first child, from zero lines to one line)
         // TODO: w/ScrollingTabController this is no longer necessary, although
         // ScrollTabController.resize() does need to get called to show/hide
         // the navigation buttons as appropriate, but that's handled in ScrollingTabController.onAddChild()
         this.layout();


         // if this is the first child, then select it
         if(!this.selectedChildWidget){
          this.selectChild(child);
         }
        }
    • summary
  • dijit.layout.StackContainer.removeChild

    • type
      Function
    • parameters:
      • page: (typeof dijit._Widget)
    • source: [view]
      define("dijit/layout/StackContainer", ["dojo", "dijit", "dijit/_Templated", "dijit/layout/_LayoutWidget", "i18n!dijit/nls/common", "dojo/cookie", "dijit/layout/StackController"], function(dojo, dijit) {


      dojo.declare(
       "dijit.layout.StackContainer",
       dijit.layout._LayoutWidget,
       {
       // summary:
       //  A container that has multiple children, but shows only
       //  one child at a time
       //
       // description:
       //  A container for widgets (ContentPanes, for example) That displays
       //  only one Widget at a time.
       //
       //  Publishes topics [widgetId]-addChild, [widgetId]-removeChild, and [widgetId]-selectChild
       //
       //  Can be base class for container, Wizard, Show, etc.


       // doLayout: Boolean
       //  If true, change the size of my currently displayed child to match my size
       doLayout: true,


       // persist: Boolean
       //  Remembers the selected child across sessions
       persist: false,


       baseClass: "dijitStackContainer",




       // selectedChildWidget: [readonly] dijit._Widget
       //  References the currently selected child widget, if any.
       //  Adjust selected child with selectChild() method.
       selectedChildWidget: null,




       buildRendering: function(){
        this.inherited(arguments);
        dojo.addClass(this.domNode, "dijitLayoutContainer");
        dijit.setWaiRole(this.containerNode, "tabpanel");
       },


       postCreate: function(){
        this.inherited(arguments);
        this.connect(this.domNode, "onkeypress", this._onKeyPress);
       },


       startup: function(){
        if(this._started){ return; }


        var children = this.getChildren();


        // Setup each page panel to be initially hidden
        dojo.forEach(children, this._setupChild, this);


        // Figure out which child to initially display, defaulting to first one
        if(this.persist){
         this.selectedChildWidget = dijit.byId(dojo.cookie(this.id + "_selectedChild"));
        }else{
         dojo.some(children, function(child){
          if(child.selected){
           this.selectedChildWidget = child;
          }
          return child.selected;
         }, this);
        }
        var selected = this.selectedChildWidget;
        if(!selected && children[0]){
         selected = this.selectedChildWidget = children[0];
         selected.selected = true;
        }


        // Publish information about myself so any StackControllers can initialize.
        // This needs to happen before this.inherited(arguments) so that for
        // TabContainer, this._contentBox doesn't include the space for the tab labels.
        dojo.publish(this.id+"-startup", [{children: children, selected: selected}]);


        // Startup each child widget, and do initial layout like setting this._contentBox,
        // then calls this.resize() which does the initial sizing on the selected child.
        this.inherited(arguments);
       },


       resize: function(){
        // Resize is called when we are first made visible (it's called from startup()
        // if we are initially visible). If this is the first time we've been made
        // visible then show our first child.
        var selected = this.selectedChildWidget;
        if(selected && !this._hasBeenShown){
         this._hasBeenShown = true;
         this._showChild(selected);
        }
        this.inherited(arguments);
       },


       _setupChild: function(/*dijit._Widget*/ child){
        // Overrides _LayoutWidget._setupChild()


        this.inherited(arguments);


        dojo.replaceClass(child.domNode, "dijitHidden", "dijitVisible");


        // remove the title attribute so it doesn't show up when i hover
        // over a node
        child.domNode.title = "";
       },


       addChild: function(/*dijit._Widget*/ child, /*Integer?*/ insertIndex){
        // Overrides _Container.addChild() to do layout and publish events


        this.inherited(arguments);


        if(this._started){
         dojo.publish(this.id+"-addChild", [child, insertIndex]);


         // in case the tab titles have overflowed from one line to two lines
         // (or, if this if first child, from zero lines to one line)
         // TODO: w/ScrollingTabController this is no longer necessary, although
         // ScrollTabController.resize() does need to get called to show/hide
         // the navigation buttons as appropriate, but that's handled in ScrollingTabController.onAddChild()
         this.layout();


         // if this is the first child, then select it
         if(!this.selectedChildWidget){
          this.selectChild(child);
         }
        }
       },


       removeChild: function(/*dijit._Widget*/ page){
        // Overrides _Container.removeChild() to do layout and publish events


        this.inherited(arguments);


        if(this._started){
         // this will notify any tablists to remove a button; do this first because it may affect sizing
         dojo.publish(this.id + "-removeChild", [page]);
        }


        // If we are being destroyed than don't run the code below (to select another page), because we are deleting
        // every page one by one
        if(this._beingDestroyed){ return; }


        // Select new page to display, also updating TabController to show the respective tab.
        // Do this before layout call because it can affect the height of the TabController.
        if(this.selectedChildWidget === page){
         this.selectedChildWidget = undefined;
         if(this._started){
          var children = this.getChildren();
          if(children.length){
           this.selectChild(children[0]);
          }
         }
        }


        if(this._started){
         // In case the tab titles now take up one line instead of two lines
         // (note though that ScrollingTabController never overflows to multiple lines),
         // or the height has changed slightly because of addition/removal of tab which close icon
         this.layout();
        }
    • summary
  • dijit.layout.StackContainer.selectChild

    • type
      Function
    • parameters:
      • page: (typeof dijit._Widget|String)
        Reference to child widget or id of child widget
      • animate: (typeof Boolean)
    • source: [view]
        page = dijit.byId(page);


        if(this.selectedChildWidget != page){
         // Deselect old page and select new one
         var d = this._transition(page, this.selectedChildWidget, animate);
         this._set("selectedChildWidget", page);
         dojo.publish(this.id+"-selectChild", [page]);


         if(this.persist){
          dojo.cookie(this.id + "_selectedChild", this.selectedChildWidget.id);
         }
        }


        return d;  // If child has an href, promise that fires when the child's href finishes loading
    • summary
      Show the given widget (which must be one of my children)
    • returns
      If child has an href, promise that fires when the child's href finishes loading
  • dijit.layout.StackContainer._transition

    • type
      Function
    • parameters:
      • newWidget: (typeof dijit._Widget)
      • oldWidget: (typeof dijit._Widget)
      • animate: (typeof Boolean)
    • source: [view]
        if(oldWidget){
         this._hideChild(oldWidget);
        }
        var d = this._showChild(newWidget);


        // Size the new widget, in case this is the first time it's being shown,
        // or I have been resized since the last time it was shown.
        // Note that page must be visible for resizing to work.
        if(newWidget.resize){
         if(this.doLayout){
          newWidget.resize(this._containerContentBox || this._contentBox);
         }else{
          // the child should pick it's own size but we still need to call resize()
          // (with no arguments) to let the widget lay itself out
          newWidget.resize();
         }
        }


        return d; // If child has an href, promise that fires when the child's href finishes loading
    • summary
      Hide the old widget and display the new widget.
      Subclasses should override this.
    • tags:
    • returns
      If child has an href, promise that fires when the child's href finishes loading
  • dijit.layout.StackContainer._adjacent

    • type
      Function
    • parameters:
      • forward: (typeof Boolean)
    • source: [view]
        var children = this.getChildren();
        var index = dojo.indexOf(children, this.selectedChildWidget);
        index += forward ? 1 : children.length - 1;
        return children[ index % children.length ]; // dijit._Widget
    • summary
      Gets the next/previous child widget in this container from the current selection.
    • returns
      dijit._Widget
  • dijit.layout.StackContainer.forward

    • type
      Function
    • source: [view]
        return this.selectChild(this._adjacent(true), true);
    • summary
      Advance to next page.
  • dijit.layout.StackContainer.back

    • type
      Function
    • source: [view]
        return this.selectChild(this._adjacent(false), true);
    • summary
      Go back to previous page.
  • dijit.layout.StackContainer._onKeyPress

    • type
      Function
    • parameters:
      • e: (typeof )
    • source: [view]
        dojo.publish(this.id+"-containerKeyPress", [{ e: e, page: this}]);
    • summary
  • dijit.layout.StackContainer.layout

    • type
      Function
    • source: [view]
      define("dijit/layout/StackContainer", ["dojo", "dijit", "dijit/_Templated", "dijit/layout/_LayoutWidget", "i18n!dijit/nls/common", "dojo/cookie", "dijit/layout/StackController"], function(dojo, dijit) {


      dojo.declare(
       "dijit.layout.StackContainer",
       dijit.layout._LayoutWidget,
       {
       // summary:
       //  A container that has multiple children, but shows only
       //  one child at a time
       //
       // description:
       //  A container for widgets (ContentPanes, for example) That displays
       //  only one Widget at a time.
       //
       //  Publishes topics [widgetId]-addChild, [widgetId]-removeChild, and [widgetId]-selectChild
       //
       //  Can be base class for container, Wizard, Show, etc.


       // doLayout: Boolean
       //  If true, change the size of my currently displayed child to match my size
       doLayout: true,


       // persist: Boolean
       //  Remembers the selected child across sessions
       persist: false,


       baseClass: "dijitStackContainer",




       // selectedChildWidget: [readonly] dijit._Widget
       //  References the currently selected child widget, if any.
       //  Adjust selected child with selectChild() method.
       selectedChildWidget: null,




       buildRendering: function(){
        this.inherited(arguments);
        dojo.addClass(this.domNode, "dijitLayoutContainer");
        dijit.setWaiRole(this.containerNode, "tabpanel");
       },


       postCreate: function(){
        this.inherited(arguments);
        this.connect(this.domNode, "onkeypress", this._onKeyPress);
       },


       startup: function(){
        if(this._started){ return; }


        var children = this.getChildren();


        // Setup each page panel to be initially hidden
        dojo.forEach(children, this._setupChild, this);


        // Figure out which child to initially display, defaulting to first one
        if(this.persist){
         this.selectedChildWidget = dijit.byId(dojo.cookie(this.id + "_selectedChild"));
        }else{
         dojo.some(children, function(child){
          if(child.selected){
           this.selectedChildWidget = child;
          }
          return child.selected;
         }, this);
        }
        var selected = this.selectedChildWidget;
        if(!selected && children[0]){
         selected = this.selectedChildWidget = children[0];
         selected.selected = true;
        }


        // Publish information about myself so any StackControllers can initialize.
        // This needs to happen before this.inherited(arguments) so that for
        // TabContainer, this._contentBox doesn't include the space for the tab labels.
        dojo.publish(this.id+"-startup", [{children: children, selected: selected}]);


        // Startup each child widget, and do initial layout like setting this._contentBox,
        // then calls this.resize() which does the initial sizing on the selected child.
        this.inherited(arguments);
       },


       resize: function(){
        // Resize is called when we are first made visible (it's called from startup()
        // if we are initially visible). If this is the first time we've been made
        // visible then show our first child.
        var selected = this.selectedChildWidget;
        if(selected && !this._hasBeenShown){
         this._hasBeenShown = true;
         this._showChild(selected);
        }
        this.inherited(arguments);
       },


       _setupChild: function(/*dijit._Widget*/ child){
        // Overrides _LayoutWidget._setupChild()


        this.inherited(arguments);


        dojo.replaceClass(child.domNode, "dijitHidden", "dijitVisible");


        // remove the title attribute so it doesn't show up when i hover
        // over a node
        child.domNode.title = "";
       },


       addChild: function(/*dijit._Widget*/ child, /*Integer?*/ insertIndex){
        // Overrides _Container.addChild() to do layout and publish events


        this.inherited(arguments);


        if(this._started){
         dojo.publish(this.id+"-addChild", [child, insertIndex]);


         // in case the tab titles have overflowed from one line to two lines
         // (or, if this if first child, from zero lines to one line)
         // TODO: w/ScrollingTabController this is no longer necessary, although
         // ScrollTabController.resize() does need to get called to show/hide
         // the navigation buttons as appropriate, but that's handled in ScrollingTabController.onAddChild()
         this.layout();


         // if this is the first child, then select it
         if(!this.selectedChildWidget){
          this.selectChild(child);
         }
        }
       },


       removeChild: function(/*dijit._Widget*/ page){
        // Overrides _Container.removeChild() to do layout and publish events


        this.inherited(arguments);


        if(this._started){
         // this will notify any tablists to remove a button; do this first because it may affect sizing
         dojo.publish(this.id + "-removeChild", [page]);
        }


        // If we are being destroyed than don't run the code below (to select another page), because we are deleting
        // every page one by one
        if(this._beingDestroyed){ return; }


        // Select new page to display, also updating TabController to show the respective tab.
        // Do this before layout call because it can affect the height of the TabController.
        if(this.selectedChildWidget === page){
         this.selectedChildWidget = undefined;
         if(this._started){
          var children = this.getChildren();
          if(children.length){
           this.selectChild(children[0]);
          }
         }
        }


        if(this._started){
         // In case the tab titles now take up one line instead of two lines
         // (note though that ScrollingTabController never overflows to multiple lines),
         // or the height has changed slightly because of addition/removal of tab which close icon
         this.layout();
        }
       },


       selectChild: function(/*dijit._Widget|String*/ page, /*Boolean*/ animate){
        // summary:
        //  Show the given widget (which must be one of my children)
        // page:
        //  Reference to child widget or id of child widget


        page = dijit.byId(page);


        if(this.selectedChildWidget != page){
         // Deselect old page and select new one
         var d = this._transition(page, this.selectedChildWidget, animate);
         this._set("selectedChildWidget", page);
         dojo.publish(this.id+"-selectChild", [page]);


         if(this.persist){
          dojo.cookie(this.id + "_selectedChild", this.selectedChildWidget.id);
         }
        }


        return d;  // If child has an href, promise that fires when the child's href finishes loading
       },


       _transition: function(/*dijit._Widget*/ newWidget, /*dijit._Widget*/ oldWidget, /*Boolean*/ animate){
        // summary:
        //  Hide the old widget and display the new widget.
        //  Subclasses should override this.
        // tags:
        //  protected extension
        if(oldWidget){
         this._hideChild(oldWidget);
        }
        var d = this._showChild(newWidget);


        // Size the new widget, in case this is the first time it's being shown,
        // or I have been resized since the last time it was shown.
        // Note that page must be visible for resizing to work.
        if(newWidget.resize){
         if(this.doLayout){
          newWidget.resize(this._containerContentBox || this._contentBox);
         }else{
          // the child should pick it's own size but we still need to call resize()
          // (with no arguments) to let the widget lay itself out
          newWidget.resize();
         }
        }


        return d; // If child has an href, promise that fires when the child's href finishes loading
       },


       _adjacent: function(/*Boolean*/ forward){
        // summary:
        //  Gets the next/previous child widget in this container from the current selection.
        var children = this.getChildren();
        var index = dojo.indexOf(children, this.selectedChildWidget);
        index += forward ? 1 : children.length - 1;
        return children[ index % children.length ]; // dijit._Widget
       },


       forward: function(){
        // summary:
        //  Advance to next page.
        return this.selectChild(this._adjacent(true), true);
       },


       back: function(){
        // summary:
        //  Go back to previous page.
        return this.selectChild(this._adjacent(false), true);
       },


       _onKeyPress: function(e){
        dojo.publish(this.id+"-containerKeyPress", [{ e: e, page: this}]);
       },


       layout: function(){
        // Implement _LayoutWidget.layout() virtual method.
        if(this.doLayout && this.selectedChildWidget && this.selectedChildWidget.resize){
         this.selectedChildWidget.resize(this._containerContentBox || this._contentBox);
        }
    • returns
      If child has an href, promise that fires when the child's href finishes loading|dijit._Widget
    • summary
  • dijit.layout.StackContainer._showChild

    • type
      Function
    • parameters:
      • page: (typeof dijit._Widget)
    • source: [view]
        var children = this.getChildren();
        page.isFirstChild = (page == children[0]);
        page.isLastChild = (page == children[children.length-1]);
        page._set("selected", true);


        dojo.replaceClass(page.domNode, "dijitVisible", "dijitHidden");


        return page._onShow() || true;
    • summary
      Show the specified child by changing it's CSS, and call _onShow()/onShow() so
      it can do any updates it needs regarding loading href's etc.
    • return_summary
      Promise that fires when page has finished showing, or true if there's no href
  • dijit.layout.StackContainer._hideChild

    • type
      Function
    • parameters:
      • page: (typeof dijit._Widget)
    • source: [view]
        page._set("selected", false);
        dojo.replaceClass(page.domNode, "dijitHidden", "dijitVisible");


        page.onHide();
    • summary
      Hide the specified child by changing it's CSS, and call _onHide() so
      it's notified.
  • dijit.layout.StackContainer.closeChild

    • type
      Function
    • parameters:
      • page: (typeof dijit._Widget)
    • source: [view]
        var remove = page.onClose(this, page);
        if(remove){
         this.removeChild(page);
         // makes sure we can clean up executeScripts in ContentPane onUnLoad
         page.destroyRecursive();
        }
    • summary
      Callback when user clicks the [X] to remove a page.
      If onClose() returns true then remove and destroy the child.
    • tags:
  • dijit.layout.StackContainer.destroyDescendants

    • type
      Function
    • parameters:
      • preserveDom: (typeof Boolean)
    • source: [view]
        dojo.forEach(this.getChildren(), function(child){
         this.removeChild(child);
         child.destroyRecursive(preserveDom);
        }, this);
    • summary
  • dijit.layout.StackContainer._hasBeenShown

    • summary
  • dijit._Widget.selected

    • summary
  • dijit._Widget.closable

    • summary
  • dijit._Widget.iconClass

    • summary
  • dijit._Widget.showTitle

    • summary
  • dijit.layout

    • type
      Object
    • summary
  • dijit

    • type
      Object
    • summary