简体   繁体   中英

Java Swing Message sequence diagram

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

在此处输入图片说明

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)

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.

在此处输入图片说明

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM