Representing a network diagram using SVG and JAVA
Hello all,
Wow this forum is exactly what I was looking for!
Am kinda new to design paterns and have stumbled upon a design problem....
I am trying to add SVG based graphics support to an existing Struts/JSP/Servlet based web application. Basically I wanted to display a network diagram comprising of 4 different type of elements.
I am using 'Recursive Composition' for my basic 4 elements and an additional group element.
So I have an super-class called Element and then 5 sub-classes of it , one for each of the basic elements and 1 called Groupd which aggragates all the 4 basic elements.
Now these elements are to be represented as network diagram. For this I am using the 'Composite Structural Pattern'. However, currently the diagram is in the form of a tree such that on run time - object element1 may be connected to element2 and element 3..element2 may be inturn connected to elemet4 and 5 and so on and so forth....
Could you help me decide and suggest me a design pattern (if one exist) on how should I have a class which encapsulates how the elements are connected to each other. So this class would contain information on how elements are connected to each other on run-time - as a Graph, as a tree or something else.
I was thinking of then using the class and passing it to the Compositor class which generates the SVG XML (by in-turn calling draw() on each of the basic elements)
I hope my email does not sounds confusing.
Any help will be much appreciated.
Thanks,
Vishal

