tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkuhn...@apache.org
Subject svn commit: r570566 - in /tapestry/tapestry4/trunk/tapestry-framework/src/js: tapestry/widget/TimePicker.js tests/widget/test_TimePicker.html
Date Tue, 28 Aug 2007 21:01:43 GMT
Author: jkuhnert
Date: Tue Aug 28 14:01:42 2007
New Revision: 570566

URL: http://svn.apache.org/viewvc?rev=570566&view=rev
Log:
absolute positioning hell fix for ie7

Modified:
    tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/widget/TimePicker.js
    tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_TimePicker.html

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/widget/TimePicker.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/widget/TimePicker.js?rev=570566&r1=570565&r2=570566&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/widget/TimePicker.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/widget/TimePicker.js Tue Aug
28 14:01:42 2007
@@ -25,6 +25,7 @@
     showing:false,
     preventBlur:false,
     hasFocus:false,
+    dropdownDim:{height:0, width:0},
 
     postCreate: function() {
         this.inputNode = dojo.byId(this.inputNodeId);
@@ -60,12 +61,15 @@
         }
 
         var m = dojo.html.getCachedFontMeasurements();
+        this.dropdownDim.width = m["1em"] * 6;
+        this.dropdownDim.height = m["1em"] * 11;
+
         var st=this.dropdownNode.style;
         st["overflow"]="auto";
         st["zIndex"]=9000;
         st["position"]="absolute";
-        st["width"]=(m["1em"] * 6) + "px"
-        st["height"]=(m["1em"] * 11) + "px";
+        st["width"]=this.dropdownDim.width + "px"
+        st["height"]=this.dropdownDim.height + "px";
 
         dojo.body().appendChild(this.dropdownNode);
 
@@ -165,8 +169,32 @@
 
     show: function(evt) {
 
-        dojo.html.placeOnScreenAroundElement(this.dropdownNode, this.inputNode,
-                null, dojo.html.boxSizing.BORDER_BOX, {'BL': 'TL', 'TL': 'BL'});
+        var oldDisplay = this.inputNode.style.display;
+        var mb = dojo.html.getElementBox(this.inputNode, dojo.html.boxSizing.BORDER_BOX);
+        var inputPos = dojo.html.getAbsolutePosition(this.inputNode, true, dojo.html.boxSizing.BORDER_BOX);
+	    this.inputNode.style.display=oldDisplay;
+
+        var view=dojo.html.getViewport();
+        var scroll=dojo.html.getScroll();
+
+        var ddX = inputPos.x + mb.width - this.dropdownDim.width;
+        if (ddX < 0){
+            ddX = inputPos.x;
+        }
+
+        var ddY;
+        if ((inputPos.y + mb.height + this.dropdownDim.height) > view.height){
+            ddY = inputPos.y - this.dropdownDim.height - 1;
+        } else {
+            ddY = inputPos.y + mb.height;
+        }
+
+        if (dojo.render.html.ie && scroll.top > 0){
+            ddY -= scroll.top;
+        }
+
+        this.dropdownNode.style["top"]=ddY+'px';
+        this.dropdownNode.style["left"]=ddX+'px';
 
         dojo.html.show(this.dropdownNode);
         

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_TimePicker.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_TimePicker.html?rev=570566&r1=570565&r2=570566&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_TimePicker.html (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_TimePicker.html Tue
Aug 28 14:01:42 2007
@@ -47,6 +47,16 @@
                     "4:00pm","4:30pm","5:00pm","5:30pm","6:00pm","6:30pm","7:00pm","7:30pm","8:00pm","8:30pm","9:00pm","9:30pm",
                     "10:00pm","10:30pm","11:00pm","11:30pm"]
         });
+
+        dojo.widget.createWidget("tapestry:TimePicker", {
+            widgetId: "test3",
+            inputNodeId:"timeInput2",
+            optionValues:["12:00am","12:30am","1:00am","1:30am","2:00am","2:30am","3:00am","3:30am","4:00am","4:30am",
+                    "5:00am","5:30am","6:00am","6:30am","7:00am","7:30am","8:00am","8:30am","9:00am","9:30am","10:00am",
+                    "10:30am","11:00am","11:30am","12:00pm","12:30pm","1:00pm","1:30pm","2:00pm","2:30pm","3:00pm","3:30pm",
+                    "4:00pm","4:30pm","5:00pm","5:30pm","6:00pm","6:30pm","7:00pm","7:30pm","8:00pm","8:30pm","9:00pm","9:30pm",
+                    "10:00pm","10:30pm","11:00pm","11:30pm"]
+        });
     });
 </script>
 
@@ -98,6 +108,22 @@
     </fieldset>
 </form>
 
+<p>
+    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut ut eros id velit laoreet
pharetra. Fusce sodales ligula vitae arcu. Quisque et neque eu massa bibendum tincidunt. Donec
felis. In quam libero, varius at, tempus eget, luctus in, orci. Praesent a leo. Etiam scelerisque
massa. Nulla odio ante, eleifend ultrices, sodales ut, volutpat vel, mauris. Vestibulum ultrices
laoreet metus. Phasellus tempus eros sit amet felis fringilla posuere. Fusce eu justo. Sed
dictum ante vel velit. Aliquam dapibus ante eget tortor.
+</p>
+<p>
+    Vestibulum mattis blandit velit. Vivamus lobortis eros vel magna. Vivamus ligula nisl,
vestibulum nec, ornare sit amet, pretium id, erat. Nulla congue. Morbi at nisl et magna mattis
pretium. Aliquam erat volutpat. In convallis. Vestibulum in felis. Nam iaculis, leo quis ornare
iaculis, diam lacus auctor metus, a aliquet leo erat vitae tellus. Etiam gravida ipsum tincidunt
velit. Curabitur auctor suscipit diam. Mauris mauris felis, gravida et, feugiat nec, sodales
ut, purus. Donec lobortis pharetra diam. Aliquam non neque. Sed mi. Morbi ornare nisi at magna.
+</p>
+    Fusce aliquet. Nunc porta, arcu sed hendrerit eleifend, erat neque lobortis nulla, eu
faucibus massa quam vel justo. Sed suscipit dolor sit amet quam. Sed vel erat. Praesent ullamcorper,
nunc consectetuer pulvinar commodo, risus ipsum suscipit leo, quis porta sapien quam eu augue.
Nunc eget diam et elit malesuada pulvinar. Donec varius magna eget purus. Suspendisse sollicitudin
tellus vitae lacus. Vestibulum purus libero, varius id, vulputate eget, fermentum quis, sem.
In libero nibh, fermentum eget, malesuada pharetra, lacinia nec, eros. Aliquam erat volutpat.
Ut egestas auctor mauris. Donec euismod venenatis leo.
+<p>
+    Maecenas ipsum. Sed vitae ipsum sit amet odio condimentum pellentesque. Aliquam eros.
Nulla facilisis, purus id lacinia condimentum, ligula metus luctus metus, vitae pharetra nibh
mi ut turpis. Aliquam condimentum urna quis mi. Nullam porta lacus nec massa. Nulla euismod
ligula vitae lectus. Fusce sit amet dolor. Sed ac augue ut augue fermentum tempus. Morbi ut
erat a est rhoncus sagittis. Maecenas justo neque, pharetra in, ullamcorper eu, egestas vitae,
eros.
+</p>
+<p>
+    Aenean sodales, arcu a iaculis tempor, tortor augue pharetra lectus, a egestas justo
diam vel est. Cras neque augue, vehicula in, luctus eget, feugiat elementum, mi. Donec feugiat.
Nam euismod porttitor elit. Cum sociis natoque penatibus et magnis dis parturient montes,
nascetur ridiculus mus. Curabitur dolor. Nunc ullamcorper viverra nunc. Morbi in purus quis
turpis egestas scelerisque. Vivamus suscipit felis vitae est ultrices sagittis. Donec vel
nulla sed est vehicula pulvinar.
+</p>
+<p>
+     <input id="timeInput2" type="text" size="7" value="8:24am" />
+</p>
 <!--
 <div id="when-st_combobox" class="CB_menu" style="overflow: auto; display: none; position:
absolute; top: 39px; left: 23px; width: 5.5em; height: 120px; z-index: 2;">
     <div>



Mime
View raw message