Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Swing Message sequence diagram

Tags:

java

swing

I've been looking around to no avail so far for something that visualizes a message sequence in Java/Swing i.e. something that would visualize e.g.

enter image description here

Are there any swing component that could do this ?

(There are some tools that could possibly do this by running external commands, as the results from such tools are image files, they're not that suitable to update on the fly, which would be my use case)


1 Answers

My answer is just an ad hoc suggestion. There is quite a nice tool called Quick Sequence Diagram Editor. Out of the box it will supply you with required Swing component and quite a nice DSL.

enter image description here

Perhaps it may be easier for you to generate only a textual diagram form and let the logic behind diagram editor to do the rest (I think some template engine may simplify the task even more).

DSL example:

bfs:BFS[a]
/queue:FIFO
someNode:Node
node:Node
adjList:List
adj:Node
bfs:queue.new
bfs:someNode.setLevel(0)
bfs:queue.insert(someNode)
[c:loop while queue != ()]
  bfs:node=queue.remove()
  bfs:level=node.getLevel()
  bfs:adjList=node.getAdjacentNodes()
  [c:loop 0 <= i < #adjList]
    bfs:adj=adjList.get(i)
    bfs:nodeLevel=adj.getLevel()
    [c:alt nodeLevel IS NOT defined]
      bfs:adj.setLevel(level+1)
      bfs:queue.insert(adj)
      --[else]
      bfs:nothing to do
    [/c]
  [/c]
[/c]
bfs:queue.destroy() 

Please note, I'm actually suggesting to embed sdedit component into your application but not to use it as an external tool. BTW, the license is quite permissive.

like image 111
Renat Gilmanov Avatar answered Mar 12 '26 18:03

Renat Gilmanov