Search in sources :

Example 1 with AssociationEditPart

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);
    }
}
Also used : DirectedGraph(org.eclipse.draw2d.graph.DirectedGraph) AbstractGraphicalEditPart(org.eclipse.gef.editparts.AbstractGraphicalEditPart) AssociationEditPart(org.hibernate.eclipse.graph.parts.AssociationEditPart)

Example 2 with AssociationEditPart

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);
    }
}
Also used : Node(org.eclipse.draw2d.graph.Node) Rectangle(org.eclipse.draw2d.geometry.Rectangle) AssociationEditPart(org.hibernate.eclipse.graph.parts.AssociationEditPart) AbsoluteBendpoint(org.eclipse.draw2d.AbsoluteBendpoint) Figure(org.eclipse.draw2d.Figure)

Aggregations

AssociationEditPart (org.hibernate.eclipse.graph.parts.AssociationEditPart)2 AbsoluteBendpoint (org.eclipse.draw2d.AbsoluteBendpoint)1 Figure (org.eclipse.draw2d.Figure)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1 DirectedGraph (org.eclipse.draw2d.graph.DirectedGraph)1 Node (org.eclipse.draw2d.graph.Node)1 AbstractGraphicalEditPart (org.eclipse.gef.editparts.AbstractGraphicalEditPart)1