vertexjgraphx

JGRAPHX: How to change the style of a group of vertices


In my project, when I do a grouping of vertices, by default is adding a dotted shape in my edge. I wish I could add a picture on this ledge where the User can interact.

For example:

not expanded:

enter image description here

expanded:

enter image description here


Solution

  • Solution:

     mxIGraphModel model = graph.getModel();
    // start to change model
    model.beginUpdate();
    mxGeometry geo = new mxGeometry(0, 0.5, PORT_DIAMETER,
                            PORT_DIAMETER);
    // Because the origin is at upper left corner, need to translate to
    // position the center of port correctly
    geo.setOffset(new mxPoint(-PORT_RADIUS, -PORT_RADIUS));
    geo.setRelative(true);
    
    mxCell port = new mxCell(cell.getAttribute("label"), geo,
                            style);
    port.setVertex(true);
    //is not a port!!!!!!!!
    port.setConnectable(false);
    graph.addCell(port, cell);
    //send to back! 
    graph.cellsOrdered(new Object[]{cell}, true);
    // end changes, generate the events and     update UndoManager
                    model.endUpdate();
    

    Att, Alexandre.