- STYLE_MOVABLE:図形の移動可否(0:移動不可)
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_MOVABLE): 0 // 0=移動不可 ] stylesheet.putCellStyle("style1", style1) def v1 = graph.insertVertex(parent, null, "処理1", 20, 20, 100, 30, "style1") def v2 = graph.insertVertex(parent, null, "処理2", 20, 100, 100, 30, "style1") def v3 = graph.insertVertex(parent, null, "処理3", 20, 180, 100, 30, "style1") graph.insertEdge(parent, null, "正常終了", v1, v2) graph.insertEdge(parent, null, "正常終了", v2, v3) } finally { graph.model.endUpdate() } sb = new SwingBuilder() sb.frame( title: "JGraphX - non-movable", visible: true, pack: true, resizable: true, defaultCloseOperation: WindowConstants.EXIT_ON_CLOSE ){ widget( new mxGraphComponent(graph) ) }実行結果
関連情報
JGraphxのダウンロードページ
0 件のコメント:
コメントを投稿