Changeset 12161

Show
Ignore:
Timestamp:
01/25/08 01:07:09 (7 months ago)
Author:
bill
Message:

Fixes #5669: Dialog can't contain layout widgets.
Modifies Dialog to initialize in a visibility:hidden state rather than display:none, in order for possible child layout widgets to initialize correctly.
As Dialog is not a layout widget itself, note that this means that the child layout widgets must have a size specified (rather than specifying a size on the Dialog itself)

Location:
dijit/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/Dialog.js

    r12144 r12161  
    144144                _lastFocusItem:null, 
    145145 
     146                // doLayout: Boolean 
     147                //              Don't change this parameter from the default value. 
     148                //              This ContentPane parameter doesn't make sense for Dialog, since Dialog 
     149                //              is never a child of a layout Container, nor can you specify the size of 
     150                //              Dialog in order to control the size of an inner widget.  
     151                doLayout: false, 
     152 
    146153                attributeMap: dojo.mixin(dojo.clone(dijit._Widget.prototype.attributeMap), 
    147154                        {title: "titleBar"}), 
     
    150157                        dojo.body().appendChild(this.domNode); 
    151158                        this.inherited("postCreate",arguments); 
    152                         this.domNode.style.display="none"; 
     159                        this.domNode.style.visibility="hidden"; 
    153160                        this.connect(this, "onExecute", "hide"); 
    154161                        this.connect(this, "onCancel", "hide"); 
     
    204211                                        duration: this.duration, 
    205212                                        onEnd: function(){ 
    206                                                 node.style.display="none"; 
     213                                                node.style.visibility="hidden"; 
    207214                                        } 
    208215                                 }), 
     
    300307 
    301308                        dojo.style(this.domNode, "opacity", 0); 
    302                         this.domNode.style.display="block"; 
     309                        this.domNode.style.visibility=""; 
    303310                        this.open = true; 
    304311                        this._loadCheck(); // lazy load trigger 
     
    343350                layout: function() { 
    344351                        // summary: position the Dialog and the underlay 
    345                         if(this.domNode.style.display == "block"){ 
     352                        if(this.domNode.style.visibility != "hidden"){ 
    346353                                this._underlay.layout(); 
    347354                                this._position(); 
  • dijit/trunk/layout/ContentPane.js

    r12160 r12161  
    7575        "class": "dijitContentPane", 
    7676 
    77         // layout: String/Boolean 
     77        // doLayout: String/Boolean 
    7878        //      false - don't adjust size of children 
    7979        //      true - looks for the first sizable child widget (ie, having resize() method) and sets it's size to 
    80         //                      however big the ContentPane is 
     80        //                      however big the ContentPane is (TODO: implement) 
    8181        //      auto - if there is a single sizable child widget (ie, having resize() method), set it's size to 
    8282        //                      however big the ContentPane is 
     
    103103        startup: function(){ 
    104104                if(this._started){ return; } 
    105                 this._checkIfSingleChild(); 
    106                 if(this._singleChild){ 
    107                         this._singleChild.startup(); 
     105                if(this.doLayout != "false" && this.doLayout !== false){ 
     106                        this._checkIfSingleChild(); 
     107                        if(this._singleChild){ 
     108                                this._singleChild.startup(); 
     109                        } 
    108110                } 
    109111                this._loadCheck(); 
     
    174176                } 
    175177 
    176 //              if(this.doLayout != "false" && this.doLayout !== false){ 
     178                if(this.doLayout != "false" && this.doLayout !== false){ 
    177179                        this._checkIfSingleChild(); 
    178180                        console.log("singlechild " , this._singleChild, " my content box is ", this._contentBox); 
     
    181183                                this._singleChild.resize(this._contentBox || dojo.contentBox(this.containerNode || this.domNode)); 
    182184                        } 
    183 //              } 
     185                } 
    184186 
    185187                this._onLoadHandler(); 
  • dijit/trunk/tests/test_Dialog.html

    r12144 r12161  
    2222                dojo.require("dijit.form.TimeTextBox"); 
    2323                dojo.require("dijit.form.FilteringSelect"); 
     24                dojo.require("dijit.layout.TabContainer"); 
    2425                dojo.require("dijit.Menu"); 
    2526                dojo.require("dojo.parser");    // scan page for widgets and instantiate them                    
     
    155156</div> 
    156157 
     158<button dojoType="dijit.form.Button" onclick="dijit.byId('tabDialog').show()">Show TabContainer Dialog</button> | 
     159 
     160<div dojoType="dijit.Dialog" id="tabDialog" title="TabContainer Dialog"> 
     161        <div dojoType="dijit.layout.TabContainer" style="width: 400px; height: 400px;"> 
     162                <div dojoType="dijit.layout.ContentPane" title="First tab"> 
     163                        <p> 
     164                                This is the first tab. 
     165                        </p> 
     166                        <p> 
     167                        Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean 
     168                        semper sagittis velit. Cras in mi. Duis porta mauris ut ligula. Proin 
     169                        porta rutrum lacus. Etiam consequat scelerisque quam. Nulla facilisi. 
     170                        Maecenas luctus venenatis nulla. In sit amet dui non mi semper iaculis. 
     171                        Sed molestie tortor at ipsum. Morbi dictum rutrum magna. Sed vitae 
     172                        risus. 
     173                        </p> 
     174                </div> 
     175                <div dojoType="dijit.layout.ContentPane" title="Second tab"> 
     176                        <p> 
     177                                This is the second tab. 
     178                        </p> 
     179                        <p> 
     180                        Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean 
     181                        semper sagittis velit. Cras in mi. Duis porta mauris ut ligula. Proin 
     182                        porta rutrum lacus. Etiam consequat scelerisque quam. Nulla facilisi. 
     183                        Maecenas luctus venenatis nulla. In sit amet dui non mi semper iaculis. 
     184                        Sed molestie tortor at ipsum. Morbi dictum rutrum magna. Sed vitae 
     185                        risus. 
     186                        </p> 
     187                </div> 
     188        </div> 
     189</div> 
    157190 
    158191<button dojoType="dijit.form.Button" onclick="dijit.byId('fifthDlg').show();">Test slow loading HREF Dialog</button>