Changeset 12162

Show
Ignore:
Timestamp:
01/25/08 03:07:46 (12 months ago)
Author:
bill
Message:

Fixes #5670: TooltipDialog?: can't contain layout widgets
Modifies TooltipDialog? to initialize in a visibility:hidden state rather than display:none, in order for possible child layout widgets to initialize correctly.
Since TooltipDialog? 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 TooltipDialog? itself)

Location:
dijit/trunk
Files:
1 added
5 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/Dialog.js

    r12161 r12162  
    147147                //              Don't change this parameter from the default value. 
    148148                //              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 
     149                //              is never a child of a layout container, nor can you specify the size of 
    150150                //              Dialog in order to control the size of an inner widget.  
    151151                doLayout: false, 
     
    157157                        dojo.body().appendChild(this.domNode); 
    158158                        this.inherited("postCreate",arguments); 
    159                         this.domNode.style.visibility="hidden"; 
     159                        this.domNode.style.visibility = "hidden"; 
     160                        this.domNode.style.position = "absolute"; 
     161                        this.domNode.style.top = "-9999px"; 
    160162                        this.connect(this, "onExecute", "hide"); 
    161163                        this.connect(this, "onCancel", "hide"); 
     
    378380                title: "", 
    379381 
     382                // doLayout: Boolean 
     383                //              Don't change this parameter from the default value. 
     384                //              This ContentPane parameter doesn't make sense for TooltipDialog, since TooltipDialog 
     385                //              is never a child of a layout container, nor can you specify the size of 
     386                //              TooltipDialog in order to control the size of an inner widget.  
     387                doLayout: false, 
     388 
    380389                // _firstFocusItem: DomNode 
    381390                //              The pointer to the first focusable node in the dialog 
  • dijit/trunk/form/Button.js

    r12044 r12162  
    138138                        delete this.dropDownContainer; 
    139139                } 
    140                 dojo.body().appendChild(this.dropDown.domNode); 
    141                 this.dropDown.domNode.style.display="none"; 
     140                dijit.popup.prepare(this.dropDown.domNode); 
    142141 
    143142                this.inherited(arguments); 
     
    185184                if(this.disabled || this.readOnly){ return; } 
    186185                if(e.keyCode == dojo.keys.DOWN_ARROW){ 
    187                         if(!this.dropDown || this.dropDown.domNode.style.display=="none"){ 
     186                        if(!this.dropDown || this.dropDown.domNode.style.visibility=="hidden"){ 
    188187                                dojo.stopEvent(e); 
    189188                                this._toggleDropDown(); 
  • dijit/trunk/layout/ContentPane.js

    r12161 r12162  
    178178                if(this.doLayout != "false" && this.doLayout !== false){ 
    179179                        this._checkIfSingleChild(); 
    180                         console.log("singlechild " , this._singleChild, " my content box is ", this._contentBox); 
    181180                        if(this._singleChild && this._singleChild.resize){ 
    182181                                this._singleChild.startup(); 
  • dijit/trunk/tests/test_Dialog.html

    r12161 r12162  
    8888</div> 
    8989 
    90 <div dojoType="dijit.form.DropDownButton"> 
    91         <span>Show Tooltip Dialog</span> 
    92         <div dojoType="dijit.TooltipDialog" id="tooltipDlg" title="Enter Login information" 
    93                 execute="alert('submitted w/args:\n' + dojo.toJson(arguments[0], true));"> 
    94                 <table> 
    95                         <tr> 
    96                                 <td><label for="user">User:</label></td> 
    97                                 <td><input dojoType=dijit.form.TextBox type="text" name="user" id="user"></td> 
    98                         </tr> 
    99                         <tr> 
    100                                 <td><label for="pwd">Password:</label></td> 
    101                                 <td><input dojoType=dijit.form.TextBox type="password" name="pwd" id="pwd"></td> 
    102                         </tr> 
    103                         <tr> 
    104                                 <td><label for="date2">Date:</label></td> 
    105                                 <td><input dojoType=dijit.form.DateTextBox name="date" id="date2"></td> 
    106                         </tr> 
    107                         <tr> 
    108                                 <td><label for="time2">Time:</label></td> 
    109                                 <td><input dojoType=dijit.form.TimeTextBox name="time" id="time2"></td> 
    110                         </tr> 
    111                         <tr> 
    112                                 <td><label for="combo">Pizza:</label></td> 
    113                                 <td> 
    114                                         <select dojoType=dijit.form.FilteringSelect name="combo" id="combo" hasDownArrow="true"> 
    115                                                 <option value="cheese">cheese</option> 
    116                                                 <option value="pepperoni">pepperoni</option> 
    117                                                 <option value="sausage">sausage</option> 
    118                                         </select> 
    119                                 </td> 
    120                         </tr> 
    121                         <tr> 
    122                                 <td colspan="2" align="center"> 
    123                                         <button dojoType=dijit.form.Button type="submit" name="submit">Order</button> 
    124                                 </td> 
    125                         </tr> 
    126                 </table> 
    127                 <div style="width: 300px;">Note: This tooltip dialog has a bunch of nested drop downs for testing keyboard and click handling</div> 
    128         </div> 
    129 </div> | 
    13090 
    13191<button dojoType="dijit.form.Button" onclick="createDialog()" title="shows after 3 second delay, with blue background">Programatic Dialog (3 second delay)</button> | 
     
    191151<button dojoType="dijit.form.Button" onclick="dijit.byId('fifthDlg').show();">Test slow loading HREF Dialog</button> 
    192152 
    193 <div dojoType="dijit.Dialog" id="fifthDlg" href="layout/getResponse.php?delay=3000&messId=3" title="From HREF (slow network emulated)"></div> 
    194  
    195 <div dojoType="dijit.form.DropDownButton"> 
    196         <span>Test slowloading HREF Tooltip Dialog</span> 
    197         <div dojoType="dijit.TooltipDialog" href="layout/getResponse.php?delay=500&messId=2" title="tooltip dialog with no focusable items"> 
    198         </div> 
    199 </div> | 
     153<div dojoType="dijit.Dialog" id="fifthDlg" href="layout/getResponse.php?delay=3000&messId=3" title="From HREF (slow network simulated)"></div> 
    200154 
    201155<p><b><i>(scroll down to see more links to click, for testing positioning / scroll handling)</i></b></p> 
     
    266220consectetuer dapibus eros. Aliquam nisl. 
    267221</p> 
    268 <div style="float:right;clear:right;" dojoType="dijit.form.DropDownButton"> 
    269         <span>dropdown at right</span> 
    270 <div dojoType="dijit.TooltipDialog" id="dialogright"> 
    271                 <div style="white-space:nowrap;">Aliquam vitae enim. Duis scelerisque metus auctor est venenatis</div> 
    272 </div> 
    273 </div> 
    274222<p> 
    275223Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean 
     
    293241tortor pharetra congue. Suspendisse pulvinar. 
    294242</p> 
    295  
    296 <div dojoType="dijit.form.DropDownButton" title="Enter Login information2"> 
    297         <span>Show Tooltip Dialog pointing upwards, with links</span> 
    298         <div dojoType="dijit.TooltipDialog" title="General Information Dialog"> 
    299                 <p>Vestibulum convallis eros ac justo. Proin dolor. Etiam aliquam. Nam 
    300                 ornare elit vel augue. Suspendisse potenti. Etiam sed mauris eu neque 
    301                 nonummy mollis. <a href="http://www.lipsum.com/">Vestibulum</a> vel purus ac pede semper accumsan. Vivamus 
    302                 lobortis, sem vitae nonummy lacinia, nisl est gravida magna, non cursus 
    303                 est quam sed urna. Phasellus adipiscing justo in <a href="http://www.lipsum.com/">ipsum</a>. Duis sagittis 
    304                 dolor sit amet magna. Suspendisse suscipit, neque eu dictum auctor, 
    305                 nisi augue tincidunt arcu, non lacinia magna purus nec magna. Praesent 
    306                 pretium sollicitudin sapien. <a href="http://www.lipsum.com/">Suspendisse imperdiet</a>. Class aptent taciti 
    307                 sociosqu ad litora torquent per conubia nostra, per inceptos 
    308                 hymenaeos. 
    309                 </p> 
    310         </div>   
    311 </div> 
    312 (will go up if there isn't enough space on the bottom of the screen) 
    313  
    314243<p>Vestibulum convallis eros ac justo. Proin dolor. Etiam aliquam. Nam 
    315244ornare elit vel augue. Suspendisse potenti. Etiam sed mauris eu neque 
  • dijit/trunk/_base/popup.js

    r11113 r12162  
    1313                beginZIndex=1000, 
    1414                idGen = 1; 
     15 
     16        this.prepare = function(/*DomNode*/ node){ 
     17                // summary: 
     18                //              Prepares a node to be used as a popup 
     19                // 
     20                // description: 
     21                //              Attaches node to document.body, and 
     22                //              positions it off screen, but not display:none, so that 
     23                //              the widget doesn't appear in the page flow and/or cause a blank 
     24                //              area at the bottom of the viewport (making scrollbar longer), but 
     25                //              initialization of contained widgets works correctly 
     26         
     27                dojo.body().appendChild(node); 
     28                var s = node.style; 
     29                if(s.display == "none"){ 
     30                        s.display=""; 
     31                } 
     32                s.visibility = "hidden";        // not needed for hiding, but used as flag that node is off-screen 
     33                s.position = "absolute"; 
     34                s.top = "-9999px"; 
     35        }; 
    1536 
    1637        this.open = function(/*Object*/ args){ 
     
    6485                dojo.body().appendChild(wrapper); 
    6586 
    66                 widget.domNode.style.display=""; 
     87                var s = widget.domNode.style; 
     88                s.display = ""; 
     89                s.visibility = ""; 
     90                s.position = ""; 
    6791                wrapper.appendChild(widget.domNode); 
    6892 
     
    81105                // Compute the closest ancestor popup that's *not* a child of another popup. 
    82106                // Ex: For a TooltipDialog with a button that spawns a tree of menus, find the popup of the button. 
    83                 function getTopPopup(){ 
    84                         for(var pi=stack.length-1; pi > 0 && stack[pi].parent === stack[pi-1].widget; pi--); 
     107                var getTopPopup = function(){ 
     108                        for(var pi=stack.length-1; pi > 0 && stack[pi].parent === stack[pi-1].widget; pi--){ 
     109                                /* do nothing, just trying to get right value for pi */ 
     110                        } 
    85111                        return stack[pi]; 
    86112                } 
     
    148174                        // #2685: check if the widget still has a domNode so ContentPane can change its URL without getting an error 
    149175                        if(!widget||!widget.domNode){ return; } 
    150                         dojo.style(widget.domNode, "display", "none"); 
    151                         dojo.body().appendChild(widget.domNode); 
     176                         
     177                        this.prepare(widget.domNode); 
     178 
    152179                        iframe.destroy(); 
    153180                        dojo._destroyElement(wrapper); 
     
    176203                                iframe = dojo.doc.createElement(html); 
    177204                        }else{ 
    178                                 var iframe = dojo.doc.createElement("iframe"); 
     205                                iframe = dojo.doc.createElement("iframe"); 
    179206                                iframe.src = 'javascript:""'; 
    180207                                iframe.className = "dijitBackgroundIframe";