Sequence diagrams using Graph API Follow
Hi all,
I'd like to draw a simple UML sequence diagram using the Graph API. Is there any example explaning how to do this?
My main question is about edges. In struts plugin it is possible to understand connection between nodes and edges, but how do I create a figure similar to a sequence diagram?
Thanks,
Andre
Please sign in to leave a comment.
Hi, Andre!
I think you could try to do that:
1. create DataModel, nodes - objects, edges - messages
2. implement NodeRealizer (vertical rectangles)
3. implement your own Layouter (http://www.yworks.com/products/yfiles/doc/developers-guide/layout.html).
Unfortunatly, it isn't easy.
Serega.
Hi Sergey,
Thank you for response. I'll try it!
Andre
Hi Sergey,
Ive tried your tips and implemented all classes using some examples that a have from a plugin I developed.
The problem is with Layouter. Is there any useful examples?
Thanks agains,
Andre
Hi, Andre
custom layouter example:
http://www.yworks.com/products/yfiles/doc/demo/layout/README.html
Serega.
http://www.yworks.com/products/yfiles/doc/demo/layout/DiagonalLayouter.java.html
Thank you again Sergey!
I'll try it.
Andre
Sergey,
I adapted your example and created DiagramLayouter. Now I'm encontering this error:
DiagramLayouter layouter = new DiagramLayouter();
if (graph.getNodeArray().length > 0 && layouter.canLayout(graph)) {
GraphManager graphManager = GraphManager.getGraphManager();
graphManager.createBufferedLayouter(layouter).doLayout(graph);
graph.updateViews();
}
java.lang.AssertionError: Can't unwrap interface: interface a.f.ec
at com.intellij.openapi.graph.impl.GraphBase.b(GraphBase.java:58)
at com.intellij.openapi.graph.impl.GraphBase.a(GraphBase.java:82)
at com.intellij.openapi.graph.impl.GraphBase.b(GraphBase.java:1)
at com.intellij.openapi.graph.impl.GraphBase.unwrap(GraphBase.java:80)
at com.intellij.openapi.graph.impl.GraphManagerImpl.createBufferedLayouter(GraphManagerImpl.java:344)
at org.codecompany.plugins.intelliprof.diagram.DiagramGraphDataModel.doLayout(DiagramGraphDataModel.java:115)
at org.codecompany.plugins.intelliprof.diagram.DiagramViewer.createDiagram(DiagramViewer.java:72)
at com.tivo.jipviewer.ProfilerResultViewer.initComponents(ProfilerResultViewer.java:185)
at com.tivo.jipviewer.ProfilerResultViewer.]]>(ProfilerResultViewer.java:117)
at org.codecompany.plugins.intelliprof.component.IntelliPROFProjectComponent.projectOpened(IntelliPROFProjectComponent.java:46)
at com.intellij.openapi.project.impl.ProjectImpl.c(ProjectImpl.java:67)
at com.intellij.openapi.project.impl.ProjectImpl.access$300(ProjectImpl.java:41)
at com.intellij.openapi.project.impl.ProjectImpl$MyProjectManagerListener.projectOpened(ProjectImpl.java:8)
at com.intellij.openapi.project.impl.ProjectManagerImpl$1.projectOpened(ProjectManagerImpl.java:4)
at com.intellij.openapi.project.impl.ProjectManagerImpl.d(ProjectManagerImpl.java:283)
at com.intellij.openapi.project.impl.ProjectManagerImpl.openProject(ProjectManagerImpl.java:60)
at com.intellij.openapi.project.impl.ProjectManagerImpl.loadAndOpenProject(ProjectManagerImpl.java:157)
at com.intellij.openapi.project.impl.ProjectManagerImpl.loadAndOpenProject(ProjectManagerImpl.java:180)
at com.intellij.ide.impl.ProjectUtil.openProject(ProjectUtil.java:92)
What to do with this error?
And where is the best place to apply layout? Override PresentationModel.getDefaultLayouter() method? Or the call below in the PresentationModel.customizeSettings() method: