- STYLE_SHAPE:図形の指定
- SHAPE_SWIMLANE:swimlaneの表示
- STYLE_HORIZONTAL:水平方向の指定
import java.awt.* import javax.swing.* import groovy.swing.* import com.mxgraph.swing.* import com.mxgraph.view.* import com.mxgraph.util.mxConstants import com.mxgraph.layout.* def graph = new mxGraph() def mxgc = new mxGraphComponent(graph) sb = new SwingBuilder() def frm = sb.frame( title: "JGraphX - swimlane", visible: true, size: [300, 300], resizable: true, contentPane: mxgc, defaultCloseOperation: WindowConstants.EXIT_ON_CLOSE ){ parent = graph.getDefaultParent() graph.model.beginUpdate() try { def stylesheet = graph.getStylesheet() // シェイプのカスタムスタイル def style1 = [ (mxConstants.STYLE_SHAPE): mxConstants.SHAPE_SWIMLANE, (mxConstants.STYLE_HORIZONTAL): false, ] stylesheet.putCellStyle("style1", style1) def v1a = graph.insertVertex(parent, null, "Presentation Layer", 0, 0, 300, 100, "style1") def v1b = graph.insertVertex(parent, null, "Logic Layer", 0, 100, 300, 100, "style1") def v2a = graph.insertVertex(v1a, null, "Display form", 50, 35, 100, 30) def v2b = graph.insertVertex(v1b, null, "Validate form", 50, 35, 100, 30) def v2c = graph.insertVertex(v1b, null, "Save", 180, 35, 100, 30) graph.insertEdge(parent, null, "call", v2a, v2b) graph.insertEdge(parent, null, "call", v2b, v2c) } finally { graph.model.endUpdate() } }実行結果
関連情報
JGraphxのダウンロードページ
0 件のコメント:
コメントを投稿