views:

550

answers:

1

HI,

I started implementing a HTML Browser in Swing. I want to use the Lobo Cobra toolkit because this toolkit inclused a renderer and parser for CSS and JavaScript. The pages are looking very nice and it is easy to use (one class implementation to show a html page).

I want to show HTML pages in swing which can show javascript generated and modified objects, like a flashing circle. As far as i know, the cobra toolkit can show static javascript commands like 'document.write' or closwWindow() implementations, but not updating the GUI from a JavaScript.

Did someone works with Lobo Cobra Toolkit before and give me some sample code or tips for showing HTML pages with animated JavaScript objects inside.

+1  A: 

I'm under the impression that, as long as you set yourself up for notifications, your code will be called for all changes to the DOM whether done on page load or dynamically by Javascript following the page load.

I would initially set up an object (X) implementing the DocumentNotificationListener interface and log a message for every method called. Then set that up as a listener with Y.addDocumentNotificationListener(X) [where Y is your HTMLDocumentImpl object] and load up your page to see which methods are actually called.

Worst case is that you'll have to re-render your HTML page on every method call, but you should be able to optimize most of them. For example, changing colors of a node (DOM object), which results in the X.lookInvalidated(...) being called, wouldn't require re-rendering of the whole page as the node size doesn't change.

paxdiablo