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

Asked

Viewed 109 times

0

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

When it’s not a vertex group:

inserir a descrição da imagem aqui

When it is a vertex group:

inserir a descrição da imagem aqui

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.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.