- STYLE_SHAPE:図形の形を指定する
- SHAPE_ACTOR:アクターの形
- SHAPE_CLOUD:雲の形
- SHAPE_CYLINDER:シリンダーの形
import javax.swing.* import groovy.swing.* import com.mxgraph.swing.* import com.mxgraph.view.* import com.mxgraph.util.mxConstants def graph = new mxGraph() parent = graph.getDefaultParent() graph.model.beginUpdate() try { def stylesheet = graph.getStylesheet() // カスタムスタイル def style1 = [ (mxConstants.STYLE_SHAPE): mxConstants.SHAPE_ACTOR, ] stylesheet.putCellStyle("style1", style1) def style2 = [ (mxConstants.STYLE_SHAPE): mxConstants.SHAPE_CLOUD, ] stylesheet.putCellStyle("style2", style2) def style3 = [ (mxConstants.STYLE_SHAPE): mxConstants.SHAPE_CYLINDER, ] stylesheet.putCellStyle("style3", style3) def v1 = graph.insertVertex(parent, null, "SHAPE_ACTOR", 50, 20, 40, 30, "style1") def v2 = graph.insertVertex(parent, null, "SHAPE_CLOUD", 20, 100, 100, 30, "style2") def v3 = graph.insertVertex(parent, null, "SHAPE_CYLINDER", 50, 180, 40, 30, "style3") def des = stylesheet.getDefaultEdgeStyle() graph.insertEdge(parent, null, "正常終了", v1, v2) graph.insertEdge(parent, null, "正常終了", v2, v3) } finally { graph.model.endUpdate() } sb = new SwingBuilder() sb.frame( title: "JGraphX - shapes", visible: true, pack: true, resizable: true, defaultCloseOperation: WindowConstants.EXIT_ON_CLOSE ){ widget( new mxGraphComponent(graph) ) }実行結果
関連情報
JGraphxのダウンロードページ
0 件のコメント:
コメントを投稿