Looking for guidance on NodesGroups

Is the current API for NodesGroups working? I can't figure out either how to bind a node into a group or bind a group into a graph data model. Is there something I'm missing or is the API just incomplete?

--Dave Griffith

3 comments

Hi Dave,

you should implement getGroup(N n) method in your GraphDataModel

for example,

public class MyDataModel implements GraphDataModel {

NodesGroup white;
NodesGroup black;

public MyDataModel() {
white= new BasicNodesGroup("white");
black = new BasicNodesGroup("black", white); // "black" group is inside
"white" group
}

public NodesGroup getGroup(NodeInfo n) {
if(n.isWhite()) {
return white;
} else if(n.isBlack()) {
return black;
}

return null; }
}

Is the current API for NodesGroups working? I can't figure out either
how to bind a node into a group or bind a group into a graph data
model. Is there something I'm missing or is the API just incomplete?

--Dave Griffith



0

Any chance JB will provide a nice tutorial for GraphAPI like it was done for DOM-API? Or at least some javadoc?

0

Well that worked, sort of. If I don't call "setClosed(false)" on the BasicNodesGroup when I create it, I eventually get an NPE later, on layout. However, the more disturbing thing is that the layout engine doesn't seem to understand about grouping, It looks as though the individual nodes are layed out first, and then grouping applied later. This means that nodes can appear visually to be in groups to which they don't belong. This makes grouping useless for my purposes. YFiles seems to have some ways of making the layout engine understand grouping, but I have no idea how to make that work with GraphDataModel and such. Any thoughts?

--Dave Griffith

0

Please sign in to leave a comment.