use of org.hibernate.eclipse.graph.parts.AssociationEditPart in project jbosstools-hibernate by jbosstools.
the class DirectedGraphLayoutVisitor method layoutDiagram.
/**
* Public method for reading graph nodes
*/
public void layoutDiagram(ConfigurationEditPart diagram) {
partToNodesMap = new HashMap<AbstractGraphicalEditPart, Object>();
addedAssociations = new HashSet<AssociationEditPart>();
graph = new DirectedGraph();
addNodes(diagram);
if (graph.nodes.size() > 0) {
addEdges(diagram);
new NodeJoiningDirectedGraphLayout().visit(graph);
applyResults(diagram);
}
}
use of org.hibernate.eclipse.graph.parts.AssociationEditPart in project jbosstools-hibernate by jbosstools.
the class DirectedGraphLayoutVisitor method applyResults.
// ******************* PersistentClassEditPart apply methods **********/
public void applyResults(PersistentClassEditPart pClassPart) {
Node n = (Node) partToNodesMap.get(pClassPart);
Figure classFigure = (Figure) pClassPart.getFigure();
// switched x/y to make it go left to right
Rectangle bounds = new Rectangle(n.y, n.x, classFigure.getPreferredSize().width, classFigure.getPreferredSize().height);
classFigure.setBounds(bounds);
for (int i = 0; i < pClassPart.getSourceConnections().size(); i++) {
AssociationEditPart relationship = (AssociationEditPart) pClassPart.getSourceConnections().get(i);
applyResults(relationship);
}
}
Aggregations