- STYLE_EDGE:線のスタイル指定
- EDGESTYLE_SIDETOSIDE:左右で接続
- EDGESTYLE_TOPTOBOTTOM:上下で接続
- EDGESTYLE_ENTITY_RELATION:リレーションで接続
import java.awt.* import javax.swing.* import groovy.swing.* import com.mxgraph.swing.* import com.mxgraph.view.* import com.mxgraph.util.mxConstants def graph = new mxGraph() sb = new SwingBuilder() def frm = sb.frame( title: "JGraphX - line styles", visible: true, size: [400, 400], resizable: true, contentPane: new mxGraphComponent(graph), defaultCloseOperation: WindowConstants.EXIT_ON_CLOSE ){ parent = graph.getDefaultParent() graph.model.beginUpdate() try { def stylesheet = graph.getStylesheet() // カスタムスタイル def style1 = [ (mxConstants.STYLE_EDGE):mxConstants.EDGESTYLE_SIDETOSIDE ] stylesheet.putCellStyle("style1", style1) def v1a = graph.insertVertex(parent, null, "処理1A", 20, 90, 100, 30) def v1b = graph.insertVertex(parent, null, "処理1B", 220, 20, 100, 30) graph.insertEdge(parent, null, "正常終了", v1a, v1b, "style1") def style2 = [ (mxConstants.STYLE_EDGE):mxConstants.EDGESTYLE_TOPTOBOTTOM ] stylesheet.putCellStyle("style2", style2) def v2a = graph.insertVertex(parent, null, "処理2A", 20, 200, 100, 30) def v2b = graph.insertVertex(parent, null, "処理2B", 220, 130, 100, 30) graph.insertEdge(parent, null, "正常終了", v2a, v2b, "style2") def style3 = [ (mxConstants.STYLE_EDGE):mxConstants.EDGESTYLE_ENTITY_RELATION ] stylesheet.putCellStyle("style3", style3) def v3a = graph.insertVertex(parent, null, "処理3A", 20, 310, 100, 30) def v3b = graph.insertVertex(parent, null, "処理3B", 220, 240, 100, 30) graph.insertEdge(parent, null, "正常終了", v3a, v3b, "style3") } finally { graph.model.endUpdate() } }実行結果
関連情報
JGraphxのダウンロードページ
0 件のコメント:
コメントを投稿