Changeset 5940

Show
Ignore:
Timestamp:
10/02/06 02:25:05 (2 years ago)
Author:
bill
Message:

documentation. also move AccordionPane? inside of AccordionContainer?.js since AccordionPane? is just being used as an internal widget.

Location:
trunk/src
Files:
1 removed
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/namespaces/dojo.js

    r5939 r5940  
    1212                html: { 
    1313                        "accordioncontainer": "dojo.widget.AccordionContainer", 
    14                         "treerpccontroller": "dojo.widget.TreeRPCController", 
    15                         "accordionpane": "dojo.widget.AccordionPane", 
    1614                        "button": "dojo.widget.Button", 
    1715                        "chart": "dojo.widget.Chart", 
     
    9593                        "treecontrollerextension": "dojo.widget.TreeControllerExtension", 
    9694                        "treenode": "dojo.widget.TreeNode", 
     95                        "treerpccontroller": "dojo.widget.TreeRPCController", 
    9796                        "treebasiccontrollerv3": "dojo.widget.TreeBasicControllerV3", 
    9897                        "treecontextmenuv3": "dojo.widget.TreeContextMenuV3", 
  • trunk/src/widget/AccordionContainer.js

    r5910 r5940  
     1dojo.provide("dojo.widget.AccordionContainer"); 
     2 
     3dojo.require("dojo.widget.*"); 
     4dojo.require("dojo.html.*"); 
     5dojo.require("dojo.lfx.html"); 
     6dojo.require("dojo.html.selection"); 
     7dojo.require("dojo.widget.html.layout"); 
     8dojo.require("dojo.widget.PageContainer"); 
     9 
     10 
    111/** 
    2  * Holds a set of panes where every pane's title is visible, but only one pane's content is visible at a time. 
    3  * 
    4  * Front view (3 panes, pane #2 open) 
    5  * ------------------------ 
    6  * |:::Pane#1 title:::    | 
    7  * |:::Pane#2 title:::    | 
    8  * |                      | 
    9  * |    pane#2 contents   | 
    10  * |                      | 
    11  * |:::Pane#3 title:::    | 
    12  * ------------------------ 
    13  * 
    14  * Side view (showing implementation): 
     12 *summary 
     13 *      Holds a set of panes where every pane's title is visible, but only one pane's content is visible at a time, 
     14 *      and switching between panes is visualized by sliding the other panes up/down. 
     15 * 
     16 * description 
     17 *      Front view (3 panes, pane #2 open) 
     18 *      ------------------------ 
     19 *      |:::Pane#1 title:::    | 
     20 *      |:::Pane#2 title:::    | 
     21 *      |                      | 
     22 *      |    pane#2 contents   | 
     23 *      |                      | 
     24 *      |:::Pane#3 title:::    | 
     25 *      ------------------------ 
     26 * 
     27 *      Side view (showing implementation): 
    1528 * 
    1629 *         viewport    pane#3     pane#2     pane#1 
     
    1831 *            |                                = 
    1932 *            |                      =         | 
    20  * front      |                      |         | 
     33 *      front     |                      |         | 
    2134 *            |                      |         = 
    2235 *            |                      = 
     
    2639 *                       = 
    2740 * 
    28  * Panes are stacked by z-index like a stack of cards, so they can be slid correctly. 
    29  * The panes on the bottom extend past the bottom of the viewport. 
    30  * 
    31  * TODO: this class should extend PageContainer 
     41 *      Panes are stacked by z-index like a stack of cards, so they can be slid correctly. 
     42 *      The panes on the bottom extend past the bottom of the viewport (but are hidden). 
     43 * 
     44 * TODO: 
     45 *      * this widget should extend PageContainer 
     46 *      * call child.onShow(), child.onHide() so you can attach to those methods if you want 
    3247 */ 
    33  
    34 dojo.provide("dojo.widget.AccordionContainer"); 
    35  
    36 dojo.require("dojo.widget.*"); 
    37 dojo.require("dojo.html.*"); 
    38 dojo.require("dojo.lfx.html"); 
    39 dojo.require("dojo.widget.AccordionPane"); 
    40 dojo.require("dojo.widget.PageContainer"); 
    41  
    42 dojo.widget.defineWidget( 
     48 dojo.widget.defineWidget( 
    4349        "dojo.widget.AccordionContainer", 
    4450        dojo.widget.HtmlWidget, 
    4551        { 
    4652                isContainer: true, 
     53                 
     54                // String 
     55                //      CSS class name for dom node w/the title 
    4756                labelNodeClass: "label", 
     57                 
     58                // String 
     59                //      CSS class name for dom node holding the content 
    4860                containerNodeClass: "accBody", 
    4961 
     
    6274                }, 
    6375 
    64                 addChild: function(widget, overrideContainerNode, pos, ref, insertIndex){ 
     76                addChild: function(/*Widget*/ widget){ 
    6577                        var child = this._addChild(widget); 
    6678                        this._setSizes(); 
     
    99111                }, 
    100112         
    101                 removeChild: function(widget) { 
     113                removeChild: function(/*Widget*/ widget) { 
    102114                        dojo.widget.AccordionContainer.superclass.removeChild.call(this, widget); 
    103115                        this._setSizes(); 
     
    110122                _setSizes: function() { 
    111123                        // summary 
    112                         //      Move panes to right position based on current open node. 
     124                        //      Set panes' size/position based on my size, and the current open node. 
    113125 
    114126                        // get cumulative height of all the title bars, and figure out which pane is open 
     
    152164); 
    153165 
     166/** 
     167 * summary 
     168 *      AccordionPane is a box with a title that contains another widget (often a ContentPane). 
     169 *      It's a widget used internally by AccordionContainer. 
     170 */ 
     171dojo.widget.defineWidget( 
     172        "dojo.widget.AccordionPane", 
     173        dojo.widget.HtmlWidget, 
     174{ 
     175        // parameters 
     176 
     177        // String 
     178        //      label to print on top of AccordionPane 
     179        label: "", 
     180 
     181        // String 
     182        //      CSS class name for the AccordionPane's dom node 
     183        "class": "dojoAccordionPane", 
     184 
     185        // String 
     186        //      CSS class name for the AccordionPane's label node 
     187        labelNodeClass: "label", 
     188 
     189        // String 
     190        //      CSS class name for the AccordionPane's container node 
     191        containerNodeClass: "accBody", 
     192         
     193        // Boolean 
     194        //      if true, this is the open pane 
     195        selected: false, 
     196 
     197        templatePath: dojo.uri.dojoUri("src/widget/templates/AccordionPane.html"), 
     198        templateCssPath: dojo.uri.dojoUri("src/widget/templates/AccordionPane.css"), 
     199 
     200        isContainer: true, 
     201 
     202    fillInTemplate: function() { 
     203        dojo.html.addClass(this.domNode, this["class"]); 
     204                dojo.widget.AccordionPane.superclass.fillInTemplate.call(this); 
     205                dojo.html.disableSelection(this.labelNode); 
     206                this.setSelected(this.selected); 
     207        }, 
     208 
     209        setLabel: function(/*String*/ label) { 
     210                // summary: set the  title of the node 
     211                this.labelNode.innerHTML=label; 
     212        }, 
     213         
     214        resizeTo: function(width, height){ 
     215                dojo.html.setMarginBox(this.domNode, {width: width, height: height}); 
     216                var children = [ 
     217                        {domNode: this.labelNode, layoutAlign: "top"}, 
     218                        {domNode: this.containerNode, layoutAlign: "client"} 
     219                ]; 
     220                dojo.widget.html.layout(this.domNode, children); 
     221                var childSize = dojo.html.getContentBox(this.containerNode); 
     222                this.children[0].resizeTo(childSize.width, childSize.height); 
     223        }, 
     224 
     225        getLabelHeight: function() { 
     226                // summary: returns the height of the title dom node 
     227                return dojo.html.getMarginBox(this.labelNode).height; 
     228        }, 
     229 
     230        onLabelClick: function() { 
     231                // summary: callback when someone clicks my label 
     232                this.parent.selectChild(this); 
     233        }, 
     234         
     235        setSelected: function(/*Boolean*/ isSelected){ 
     236                this.selected=isSelected; 
     237                (isSelected ? dojo.html.addClass : dojo.html.removeClass)(this.domNode, this["class"]+"-selected"); 
     238 
     239                // make sure child is showing (lazy load) 
     240                if(isSelected  && this.children.length){ 
     241                        var child = this.children[0]; 
     242                        if(!child.isShowing()){ 
     243                                child.show(); 
     244                        } 
     245                } 
     246        } 
     247}); 
     248 
    154249// These arguments can be specified for the children of an AccordionContainer 
    155250// Since any widget can be specified as a child, mix them