Re: Increase performance
Billy <florian-lindner-S0/[email protected]> Thu, 10 May 2007 22:13:29 +0000 (UTC)
| Newsgroups | gmane.comp.mozilla.jrex |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I got the idea to use jdom instead f the java dom. This should increase the
performance on a easy way. But tehre are some casting problem. Here is my method
that simulates a mousklick:
import org.jdom.Element;
import org.jdom.Document;
public static void click(FreewarBrowser fwBrowser, org.w3c.dom.Document
frame, Element link)
fwBrowser.newDoc = false;
org.w3c.dom.Element elt = frame.getDocumentElement();
EventTarget relatedEventTarget = ((JRexNodeImpl) link).getEventTarget();
DocumentEvent event = ((JRexHTMLDocumentImpl) elt.getOwnerDocument())
.getDocumentEvent();
MouseEvent clickEvent = (MouseEvent) event.createEvent("MouseEvents");
clickEvent.initMouseEvent("click", true, true, null, 1, 1, 2, 1, 2,
false, false, false, false, (short) 0, relatedEventTarget);
relatedEventTarget.dispatchEvent(clickEvent);
}
Everything works fine if the "Element link" parameter was a usual dom. But I
have to transfert that Element as jdom to increase the performance (thats why I
do this...).
My problem is:
a) The cast above from the jdom Element link to JRexNodeImpl is not working.
b) I dont know how to convert a jdom Element to a dom Element. jdom.DomOutputter
doesnt seem to work.
Do you know how I can solve this?
Best regards
Billy