How to change the style of a group of vertices in JGRAPHX?

0

I'm working on a UML project and using JGRAPHX, or mxGraph as they prefer. In case, when I have a group of vertices, a dotted line is added to mark that vertex is a group. How can I change his style like the figures below?

When not a group of vertices:

Whenitisagroupofvertices:

    
asked by anonymous 19.02.2014 / 10:55

1 answer

0

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.

    
21.03.2014 / 04:26