protected void applyLayoutInternal(InternalNode[] entitiesToLayout, InternalRelationship[] relationshipsToConsider, double boundsX, double boundsY, double boundsWidth, double boundsHeight) {
HashMap mapping = new HashMap(entitiesToLayout.length);
DirectedGraph graph = new DirectedGraph();
for (int i = 0; i < entitiesToLayout.length; i++) {
InternalNode internalNode = entitiesToLayout[i];
Node node = new Node(internalNode);
node.setSize(new Dimension(10, 10));
mapping.put(internalNode, node);
graph.nodes.add(node);
}
for (int i = 0; i < relationshipsToConsider.length; i++) {
InternalRelationship relationship = relationshipsToConsider[i];
Node source = (Node) mapping.get(relationship.getSource());
Node dest = (Node) mapping.get(relationship.getDestination());
Edge edge = new Edge(relationship, source, dest);
graph.edges.add(edge);
}
DirectedGraphLayout directedGraphLayout = new ExtendedDirectedGraphLayout();
directedGraphLayout.visit(graph);
for (Iterator iterator = graph.nodes.iterator(); iterator.hasNext();) {
Node node = (Node) iterator.next();
InternalNode internalNode = (InternalNode) node.data;
internalNode.setInternalLocation(node.x, node.y);
}
updateLayoutLocations(entitiesToLayout);
}