You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Ganesh Ramachandran <ga...@gmail.com> on 2007/10/24 04:12:26 UTC

[TRINIDAD] How do I dynamically position a lightweight dialog

How do I position a lightweight dialog where I want it to appear, rather
than the default location rendered by Trinidad?

I am working with a snapshot build of the 1.2.3 branch from a few days ago.

I launch the dialog as follows

<tr:commandNavigationItem id="customer-lookup" partialSubmit="true"
useWindow="true"
                actionListener="#{customerBean.newCustomerListener}"
                action="dialog:customerLookupDialog"
                launchListener="#{customerLookupBean.setLaunchProperties}"

                returnListener="#{customerBean.setReturnedCustomer}"
                windowWidth="800" windowHeight="400">

  <tr:image source="/image/lookup.gif"/>

</tr:commandNavigationItem>


I tried adding some hardcoded styles to the dialogParameters map in my
launch listener but these do not take effect.
  event.getDialogParameters().put("position", "absolute");
  event.getDialogParameters().put("top", "10px");
  event.getDialogParameters().put("left", "10px");


Ultimately, I want to calculate a position for my dialog relative to the
lookup.gif image that was clicked. Is there a way to determine the
coordinates of the image as rendered, or alternatively the location where
the mouse was clicked (from the Launch event)?

Ganesh