[jboss-cvs] jboss-seam/src/ui/org/jboss/seam/ui/resource/date ...

Shane Bryzak sbryzak at redhat.com
Mon Jun 18 05:38:59 EDT 2007


  User: sbryzak2
  Date: 07/06/18 05:38:59

  Modified:    src/ui/org/jboss/seam/ui/resource/date  calendar.js
  Log:
  JBSEAM-1319
  
  Revision  Changes    Path
  1.10      +44 -15    jboss-seam/src/ui/org/jboss/seam/ui/resource/date/calendar.js
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: calendar.js
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/ui/org/jboss/seam/ui/resource/date/calendar.js,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -b -r1.9 -r1.10
  --- calendar.js	12 Apr 2007 04:17:37 -0000	1.9
  +++ calendar.js	18 Jun 2007 09:38:59 -0000	1.10
  @@ -110,14 +110,6 @@
       return false;
   }
   
  -function __getControlDim(ctl)
  -{
  -  var width = ctl.offsetWidth;
  -  var height = ctl.offsetHeight;
  -	for (var lx = 0, ly = 0; ctl != null; lx += ctl.offsetLeft, ly += ctl.offsetTop, ctl = ctl.offsetParent);
  -	return {x:lx, y:ly, width:width, height:height};
  -}
  -
   function __CalendarFactory()
   {
     var DAYS_IN_WEEK = 7;
  @@ -166,10 +158,10 @@
       return null;
     };
   
  -  __CalendarFactory.prototype.popupCalendar = function (name, locX, locY)
  +  __CalendarFactory.prototype.popupCalendar = function (name, locX, locY, parent)
     {
       this.poppedCalendar = this.getCalendarByName(name);
  -    this.getCalendarByName(name).popup(locX, locY);
  +    this.getCalendarByName(name).popup(locX, locY, parent);
     };
   
     __CalendarFactory.prototype.depopupCalendar = function ()
  @@ -429,7 +421,7 @@
       }
     };
   
  -  __Calendar.prototype.popup = function (locX, locY)
  +  __Calendar.prototype.popup = function (locX, locY, parent)
     {
       var selectedDate = __calendarFactory.parseDateValue(getObject(this.name).value);    
       if (selectedDate)
  @@ -447,13 +439,31 @@
         popupDiv = document.createElement('div');
         popupDiv.id = POPUP_DIV;
         popupDiv.style.position = "absolute";
  -      window.document.body.appendChild(popupDiv)
  +//      window.document.body.appendChild(popupDiv)
       }
   
  +    if (parent)
  +      parent.appendChild(popupDiv)
  +    else
  +      window.document.body.appendChild(popupDiv);
  +
       popupDiv.className = this.styleClass;
       getStyleObject(POPUP_DIV).left = locX + "px";
       getStyleObject(POPUP_DIV).top = locY + "px";
   
  +    var zIndex = 0;
  +    var divs = document.getElementsByTagName("div");
  +    for (var i = 0; i < divs.length; i++)
  +    {
  +      if (divs[i] != popupDiv && divs[i].style && !/\D/(divs[i].style.zIndex))
  +      {
  +        var divZIndex = (divs[i].style.zIndex * 1);        
  +        if (divZIndex >= zIndex) zIndex = divZIndex + 1;
  +      }
  +    }
  +    
  +    popupDiv.style.zIndex = zIndex;
  +
       popupDiv.innerHTML = this.getHTML();
       changeObjectVisibility(POPUP_DIV, "visible");
       document.onmousedown = this.documentmousedown;
  @@ -810,9 +820,28 @@
       cal = __calendarFactory.createCalendar(viewCtlName);
     cal.setOnClickDate("__clickCalendar");
     
  +  var posX = 0;
  +  var posY = 0;
  +
     var ctl = getObject(viewCtlName);
  -  var ctlPos = __getControlDim(ctl);
  -  __calendarFactory.popupCalendar(calName, ctlPos.x, ctlPos.y + ctlPos.height);
  +  var ctlHeight = ctl.offsetHeight;
  +  var parent = null;
  +  
  +  while (ctl)
  +  {
  +    posX += ctl.offsetLeft;
  +    posY += ctl.offsetTop;
  +
  +    ctl = ctl.offsetParent;
  +    
  +    if (ctl && ctl.style && ctl.style.position == "absolute")    
  +    {
  +      parent = ctl;
  +      break;
  +    }
  +  }
  +  
  +  __calendarFactory.popupCalendar(calName, posX, posY + ctlHeight, parent);
   }
   
   function __clearDate(ctlName) {
  
  
  



More information about the jboss-cvs-commits mailing list