- STYLE_ROTATION:回転角度
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 - rotation", visible: true, size: [200, 200], 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_CYLINDER, (mxConstants.STYLE_ROTATION): 45, ] stylesheet.putCellStyle("style1", style1) def style2 = [ (mxConstants.STYLE_SHAPE): mxConstants.SHAPE_CLOUD, (mxConstants.STYLE_ROTATION): 135, ] stylesheet.putCellStyle("style2", style2) 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") graph.insertEdge(parent, null, "正常終了", v1, v2) } finally { graph.model.endUpdate() } }実行結果
関連情報
JGraphxのダウンロードページ
0 件のコメント:
コメントを投稿