Changeset 13897

Show
Ignore:
Timestamp:
06/04/08 19:18:42 (6 months ago)
Author:
bill
Message:

Layout widget class changes:

  • Add class attribute to all layout widgets to control class name on domNode (dijitTabContainer, dijitBorderContainer, etc.)
  • Children of layout containers get composite classname specifying parent. ex: a ContentPane? inside of a BorderContainer? will get the class "dijitBorcontainer-dijitContentPane". This is to replace "dijitBorderContainer > dijitContentPane" type selectors which don't work on IE6.
  • refactor of addChild()/removeChild()/_setupChild() to share common code

Refs #6437, #6438 (these changes are necessary to setup CSS rules to get borders to show up correctly for various parent/child relationships)

!strict

Location:
dijit/trunk/layout
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/layout/AccordionContainer.js

    r13886 r13897  
    3131                _verticalSpace: 0, 
    3232 
     33                // class: String 
     34                //      Class name to apply to this.domNode 
     35                "class": "dijitAccordionContainer", 
     36                 
    3337                postCreate: function(){ 
    3438                        this.domNode.style.overflow = "hidden"; 
    3539                        this.inherited(arguments);  
    3640                        dijit.setWaiRole(this.domNode, "tablist"); 
    37                         dojo.addClass(this.domNode, "dijitAccordionContainer"); 
    3841                }, 
    3942 
  • dijit/trunk/layout/BorderContainer.js

    r13779 r13897  
    4747        persist: false, // Boolean 
    4848 
     49        // class: String 
     50        //      Class name to apply to this.domNode 
     51        "class": "dijitBorderContainer", 
     52 
    4953        // _splitterClass: String 
    5054        //              Optional hook to override the default Splitter widget used by BorderContainer 
     
    5660                this._splitters = {}; 
    5761                this._splitterThickness = {}; 
    58                 dojo.addClass(this.domNode, "dijitBorderContainer"); 
    5962        }, 
    6063 
     
    7578                var region = child.region; 
    7679                if(region){ 
    77 //                      dojo.addClass(child.domNode, "dijitBorderContainerPane"); 
    78                         child.domNode.style.position = "absolute"; // bill says not to set this in CSS, since we can't keep others 
    79                                 // from destroying the class list 
     80                        this.inherited(arguments); 
     81 
     82                        // set position directly; we could set a class name like dijitBorderContainerPane with 
     83                        // position:absolute but it might be overridden by (for example) a position:relative 
     84                        // in the dijitTabContainer class 
     85                        child.domNode.style.position = "absolute";  
    8086 
    8187                        var ltr = this.isLeftToRight(); 
     
    111117        addChild: function(/*Widget*/ child, /*Integer?*/ insertIndex){ 
    112118                this.inherited(arguments); 
    113                 this._setupChild(child); 
    114119                if(this._started){ 
    115120                        this._layoutChildren(); //OPT 
     
    131136                        this._layoutChildren(child.region); 
    132137                } 
     138                this.inherited(arguments); 
    133139        }, 
    134140 
  • dijit/trunk/layout/LayoutContainer.js

    r12773 r13897  
    3131        // |            <div dojoType="dijit.layout.ContentPane" layoutAlign="client">client area</div> 
    3232        // |    </div> 
    33         // | 
    34         // |    Lays out each child in the natural order the children occur in. 
    35         // |    Basically each child is laid out into the "remaining space", where "remaining space" is initially 
    36         // |    the content area of this widget, but is reduced to a smaller rectangle each time a child is added. 
    37         //       
     33        // 
     34        //      Lays out each child in the natural order the children occur in. 
     35        //      Basically each child is laid out into the "remaining space", where "remaining space" is initially 
     36        //      the content area of this widget, but is reduced to a smaller rectangle each time a child is added. 
     37 
     38        // class: String 
     39        //      Class name to apply to this.domNode 
     40        "class": "dijitLayoutContainer", 
    3841 
    3942        constructor: function(){ 
     
    4649 
    4750        addChild: function(/*Widget*/ child, /*Integer?*/ insertIndex){ 
    48                 dijit._Container.prototype.addChild.apply(this, arguments); 
     51                this.inherited(arguments); 
    4952                if(this._started){ 
    5053                        dijit.layout.layoutChildren(this.domNode, this._contentBox, this.getChildren()); 
     
    5356 
    5457        removeChild: function(/*Widget*/ widget){ 
    55                 dijit._Container.prototype.removeChild.apply(this, arguments); 
     58                this.inherited(arguments); 
    5659                if(this._started){ 
    5760                        dijit.layout.layoutChildren(this.domNode, this._contentBox, this.getChildren()); 
  • dijit/trunk/layout/SplitContainer.js

    r13182 r13897  
    4343        persist: true, 
    4444 
     45        // class: String 
     46        //      Class name to apply to this.domNode 
     47        "class": "dijitSplitContainer", 
     48 
    4549        postMixInProperties: function(){ 
    4650                this.inherited("postMixInProperties",arguments); 
     
    4953 
    5054        postCreate: function(){ 
    51                 this.inherited("postCreate",arguments); 
     55                this.inherited(arguments); 
    5256                this.sizers = []; 
    53                 dojo.addClass(this.domNode, "dijitSplitContainer"); 
     57 
    5458                // overflow has to be explicitly hidden for splitContainers using gekko (trac #1435) 
    5559                // to keep other combined css classes from inadvertantly making the overflow visible 
     
    9195                dojo.forEach(this.getChildren(), function(child, i, children){ 
    9296                        // attach the children and create the draggers 
    93                         this._injectChild(child); 
     97                        this._setupChild(child); 
    9498 
    9599                        if(i < children.length-1){ 
     
    105109        }, 
    106110 
    107         _injectChild: function(child){ 
     111        _setupChild: function(/*Widget*/ child){ 
     112                this.inherited(arguments); 
    108113                child.domNode.style.position = "absolute"; 
    109114                dojo.addClass(child.domNode, "dijitSplitPane"); 
     
    158163                // insertIndex: postion in the "stack" to add the child widget 
    159164                 
    160                 this.inherited("addChild",arguments);  
     165                this.inherited(arguments);  
    161166 
    162167                if(this._started){ 
    163168                        // Do the stuff that startup() does for each widget 
    164                         this._injectChild(child); 
    165169                        var children = this.getChildren(); 
    166170                        if(children.length > 1){ 
  • dijit/trunk/layout/StackContainer.js

    r13547 r13897  
    2222        // 
    2323        //      Can be base class for container, Wizard, Show, etc. 
    24         //  
    25         // 
     24 
    2625        // doLayout: Boolean 
    2726        //  if true, change the size of my currently displayed child to match my size 
    2827        doLayout: true, 
     28 
     29        // class: String 
     30        //      Class name to apply to this.domNode 
     31        "class": "dijitStackContainer", 
    2932 
    3033        _started: false, 
     
    7376        }, 
    7477 
    75         _setupChild: function(/*Widget*/ page){ 
     78        _setupChild: function(/*Widget*/ child){ 
    7679                // Summary: prepare the given child 
    7780 
    78                 page.domNode.style.display = "none"; 
     81                this.inherited(arguments); 
     82 
     83                child.domNode.style.display = "none"; 
    7984 
    8085                // since we are setting the width/height of the child elements, they need 
    8186                // to be position:relative, or IE has problems (See bug #2033) 
    82                 page.domNode.style.position = "relative"; 
    83  
    84                 return page; // dijit._Widget 
     87                child.domNode.style.position = "relative"; 
     88 
     89                return child; // dijit._Widget 
    8590        }, 
    8691 
     
    8893                // summary: Adds a widget to the stack 
    8994                  
    90                 dijit._Container.prototype.addChild.apply(this, arguments); 
    91                 child = this._setupChild(child); 
     95                this.inherited(arguments); 
    9296 
    9397                if(this._started){ 
     
    107111                // summary: Removes the pane from the stack 
    108112 
    109                 dijit._Container.prototype.removeChild.apply(this, arguments); 
     113                this.inherited(arguments); 
    110114 
    111115                // If we are being destroyed than don't run the code below (to select another page), because we are deleting 
  • dijit/trunk/layout/TabContainer.js

    r13696 r13897  
    1616        //      Publishes topics [widgetId]-addChild, [widgetId]-removeChild, and [widgetId]-selectChild 
    1717        //      (where [widgetId] is the id of the TabContainer itself. 
    18         // 
     18 
    1919        // tabPosition: String 
    2020        //   Defines where tabs go relative to tab content. 
    2121        //   "top", "bottom", "left-h", "right-h" 
    2222        tabPosition: "top", 
     23 
     24        // class: String 
     25        //      Class name to apply to this.domNode 
     26        "class": "dijitTabContainer", 
    2327 
    2428        templateString: null,   // override setting in StackContainer 
  • dijit/trunk/layout/templates/TabContainer.html

    r11100 r13897  
    1 <div class="dijitTabContainer"> 
     1<div> 
    22        <div dojoAttachPoint="tablistNode"></div> 
    33        <div class="dijitTabPaneWrapper" dojoAttachPoint="containerNode"></div> 
  • dijit/trunk/layout/_LayoutWidget.js

    r12336 r13897  
    1111                //              Widgets which mixin this code must define layout() to lay out the children 
    1212 
     13                // class: String 
     14                //      Class name to apply to this.domNode 
     15                "class": "dijitLayoutContainer", 
     16 
    1317                isLayoutContainer: true, 
    1418 
    1519                postCreate: function(){ 
    1620                        dojo.addClass(this.domNode, "dijitContainer"); 
     21                        dojo.addClass(this.domNode, this["class"]); 
    1722                }, 
    1823 
     
    8792                        //              This is called after startup(), and also when the widget's size has been 
    8893                        //              changed. 
     94                }, 
     95 
     96                _setupChild: function(/*Widget*/child){ 
     97                        // summary: common setup for initial children or children which are added after startup 
     98                        if(child["class"]){ 
     99                                dojo.addClass(child.domNode, this["class"]+"-"+child["class"]); 
     100                        } 
     101                }, 
     102                 
     103                addChild: function(/*Widget*/ child, /*Integer?*/ insertIndex){ 
     104                        this.inherited(arguments); 
     105                        this._setupChild(child); 
     106                }, 
     107 
     108                removeChild: function(/*Widget*/ child){ 
     109                        if(child["class"]){ 
     110                                dojo.removeClass(child.domNode, this["class"]+"-"+child["class"]); 
     111                        } 
     112                        this.inherited(arguments); 
    89113                } 
    90114        }