A new tool for Tapestry?

A new tool for Tapestry?

Lately, while looking at those nice site-map like diagrams (like JSF Config Designer – Navigation Flow Designer in MyEclipse and others for Struts), I thought: why not have something like this in Tapestry?

Actually, I’ve never gotten to like these graphical editors, but I just thought it would be nice to have an overview of what’s going on. So, i’ve done a bit of coding on this and it seems to be achievable.

The idea is this:

  • get all .page and .jwc
  • Search for Page-Action-Direct links
  • Also look at the .html
  • For direct links, get the listener and “follow” the java code to find which page gets activated
  • Create nice graphs!

Here’s an image of what this tool creates right now:



Yellow boxes are components, white are pages and cyan are listeners.

For graph manipulation I used an old jar I had on my pc, called JHotDraw.
I don’t know if it’s still active, and I may look for some other OS library (maybe the one ArgoUML uses – can’t remember its name). I’ll also be looking
for a library to do source code parsing and another one for html parsing (I only use simple String searches in the current version of the tool).

And finally, did you know that Greece has just won the Eurovision song contest ??

Diagrams for Tapestry

During this weekend, I’ve worked on a tool that creates diagrams from Tapestry
applications. It’s been a lot of fun, since I’ve learned how to parse java source files (with ANTLR) and I’ve refreshed my memory on XML+HTML parsing.

Well, here is an even bigger image of what I have so far.

There’s now a lot of stuff in there, and I’ll need to find a way to enhance the visuals. However, you can clearly see all the pages(white) and the components(yellow) of the app, as well as the links between them. Listeners(cyan) called from pages or components are also shown but what’s nice is that you can now see where these listeners forward.

On the tech side, I’ve continued using JHotDraw for the graphs, but have now updated to version 6.0b1 (which however is over 1 year old). I’ll probably take a look at GEF during the next weekend. I now use NekoHTML for html parsing. I decided in favor of Neko due to its license and to the fact that it exposes its services as if it were a normal SAX parser which is really handy. Finally, in order to ‘see’ what the listeners do (in the java code), I had to find a way to parse java source files. No problem there however, since I’ve found a java 1.5 grammar, and created an ANTLR parser quite easily.

Of course, the generated parser is quite generic and I had to create utility methods, such as a) find methods of file, b) find usages of parameter a in method b, e.t.c. I wonder however if there’s a library out there that does such things…

On a final note, I decided that I’ll first port this to an Intellij IDEA plugin, since IDEA users are always complaining about lack of Tapestry support.