Uploaded image for project: 'MyFaces Tomahawk'
  1. MyFaces Tomahawk
  2. TOMAHAWK-51

Popup windows: bad position on screen (<t:popup> and <x:inputSuggest> components)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Patch Available
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Popup
    • None
    • Windows XP Pro SP2, Tomcat 4.1.30, JDK 1.4.2_09

    Description

      Error positioning the popup windows shown by the components: <t:popup> and <x:inputSuggest>

      They don't have in consideration the relative position of the component in the page, and it's a problem if you place the component inside a DIV, where the positions must be relatives and not globals.

      Solution: calculate the popup position based on component relative positions. For do that we need to assign an ID to the component in order to get the Document Element associated with it, and then we can use the HTML Object Position to calculate where to show the popup.

      Ej: Our component must generate a function like this:

      function showMenu_<COMPONENT_ID>(event) {
      var menuDiv = document.getElementById(<MENU_DIV_ID>);
      var componentElement = document.getElementById(<COMPONENT_ID>);
      if (menudiv.style.visibility == 'hidden' && event)

      { //Show menu menudiv.style.visibility = 'visible'; menudiv.style.display = 'block'; menudiv.style.zIndex = 3000; menudiv.style.top = componentElement.offsetTop + 10; var left = componentElement.offsetLeft + componentElement.offsetWidth - menudiv.offsetWidth; if (left < 0) //Move menu to the right side if it is too close to the left left += menudiv.offsetWidth; menudiv.style.left = left; }

      else

      { menudiv.style.visibility = 'hidden'; }

      }

      Attachments

        1. HtmlPopupRenderer.diff
          2 kB
          David Paterson
        2. JSPopup.diff
          5 kB
          David Paterson

        Activity

          People

            werpu Werner Punz
            xalperte Javier Alperte
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: