Getting anchor coordinates with JRex?
| Newsgroups | gmane.comp.mozilla.devel.java |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
Hi all.
I have just started to look into this JRex thing
(http://jrex.mozdev.org/). But there is one thing I'm
trying to do now, that I can't seem to do. Getting the coordinates of
an
anchor on a rendered page.
I have read every information I could find about getting coordinates of
an node,
but I can't seem to get this to work. I can get the HTMLCollection of
links
from the HTMLDocument, no problem. In my case, that collection contains
only
one link. I check that it is a JRexHTMLAnchorElementImpl (using
instanceof),
and it is. I print out the Href (anchor.getHref()) and it tells me that
I
have the correct anchor. But getCoords() returns an empty string!
What I want to do is being able to draw some real time animation on top
of
the page, using the coordinates of some of the links.
Can this be done? I have to little knowledge of mozilla and jrex to
modify
the source code and make my own build, so I depend on the binary
release.
The method that should print the coordinates:
private void showLinks(HTMLDocument htmlDocument)
{
System.out.println("htmlDocument.getTitle() = " +
htmlDocument.getTitle());
System.out.println("htmlDocument.getURL() = " +
htmlDocument.getURL());
HTMLCollection links = htmlDocument.getLinks();
System.out.println("links.getLength() = " + links.getLength());
int len = links.getLength();
for(int i=0; i < len; i++)
{
Object o = links.item(i);
if (o instanceof JRexHTMLAnchorElementImpl)
{
JRexHTMLAnchorElementImpl anchor = (JRexHTMLAnchorElementImpl)o;
System.out.println("anchor.getCoords() = " + anchor.getCoords());
System.out.println("anchor.getHref() = " + anchor.getHref());
System.out.println("anchor.getShape() = " + anchor.getShape());
System.out.println("anchor.getTarget() = " + anchor.getTarget());
}
}
}
Regards
/Jimi