参考jGraphx手册:
http://jgraph.github.io/mxgraph/docs/manual_javavis.html#1.6.1
JGraphX的核心是JGraphX Model
几乎所有的修改动作,都需要调用model的方法:
下面是核心方法:
- mxGraphModel.beginUpdate() - starts a new transaction or a sub-transaction.
- mxGraphModel.endUpdate() - completes a transaction or a sub-transaction.
- mxGraph.addVertex() - Adds a new vertex to the specified parent cell.
- mxGraph.addEdge() - Adds a new edge to the specified parent cell.
- mxGraph.insertVertex(parent, id, value, x, y, width, height, style) – creates and inserts a new vertex into the model, within a begin/end update call.
- mxGraph.insertEdge(parent, id, value, source, target, style) – creates and inserts a new edge into the model, within a begin/end update call.
Model change 方法: