Package org.jgraph.graph

Examples of org.jgraph.graph.DefaultEdge$LoopRouting


     * Post (i.e. after creation on entity cell) process of the entity
     */
    protected void postProcessEntity(Entity entity, DefaultGraphCell cell) {
        for (Relationship rel : entity.getRelationships()) {
            if (rel.getSourceEntity() != null && rel.getTargetEntity() != null) {
                DefaultEdge edge = createRelationshipCell(rel);
                if (edge != null) {
                    createdObjects.add(edge);
                }
            }
        }
View Full Code Here


        }
    }

    protected void updateRelationshipCell(Relationship rel) {
        if (rel.getSourceEntity() != null && rel.getTargetEntity() != null) {
            DefaultEdge edge = relCells.get(getQualifiedName(rel));
            if (edge != null) {
                updateRelationshipLabels(edge, rel, rel.getReverseRelationship());

                Map nested = new HashMap();
                nested.put(edge, edge.getAttributes());
                edit(nested);
            }
            else {
                insertRelationshipCell(rel);
            }
View Full Code Here

            entityCells.remove(e.getName());
        }
    }

    protected void removeRelationshipCell(Relationship rel) {
        final DefaultEdge edge = relCells.get(getQualifiedName(rel));
        if (edge != null) {
            runWithUndoDisabled(new Runnable() {

                public void run() {
                    graph.getGraphLayoutCache().remove(new Object[] {
View Full Code Here

    protected DefaultEdge createRelationshipCell(Relationship rel) {
        if (!relCells.containsKey(getQualifiedName(rel))) {
            Relationship reverse = rel.getReverseRelationship();

            DefaultEdge edge = new DefaultEdge();

            // GraphConstants.setLineStyle(edge.getAttributes(),
            // GraphConstants.STYLE_ORTHOGONAL);
            // GraphConstants.setRouting(edge.getAttributes(),
            // GraphConstants.ROUTING_SIMPLE);

            GraphConstants.setEditable(edge.getAttributes(), false);
            GraphConstants.setLabelAlongEdge(edge.getAttributes(), true);
            GraphConstants.setSelectable(edge.getAttributes(), false);
            GraphConstants.setFont(edge.getAttributes(), EDGE_FONT);

            updateRelationshipLabels(edge, rel, reverse);

            relCells.put(getQualifiedName(rel), edge);
View Full Code Here

        }
        return null;
    }

    protected void insertRelationshipCell(Relationship rel) {
        DefaultEdge edge = createRelationshipCell(rel);
        insert(edge);
    }
View Full Code Here

    gm.addPort(null, "GraphModel/Center");
    DefaultGraphCell dgm = new DefaultGraphCell("DefaultGraphModel");
    attributes.put(dgm, createBounds(new AttributeMap(), 20, 180,
        Color.blue));
    dgm.addPort(null, "DefaultGraphModel/Center");
    DefaultEdge dgmImplementsGm = new DefaultEdge("implements");
    cs.connect(dgmImplementsGm, gm.getChildAt(0), dgm.getChildAt(0));
    attributes.put(dgmImplementsGm, implementStyle);
    DefaultGraphCell modelGroup = new DefaultGraphCell("ModelGroup");
    modelGroup.add(gm);
    modelGroup.add(dgm);
    modelGroup.add(dgmImplementsGm);
    // JComponent Column
    DefaultGraphCell jc = new DefaultGraphCell("JComponent");
    attributes.put(jc, createBounds(new AttributeMap(), 180, 20,
        Color.green));
    jc.addPort(null, "JComponent/Center");
    DefaultGraphCell jg = new DefaultGraphCell("JGraph");
    attributes.put(jg, createBounds(new AttributeMap(), 180, 100,
        Color.green));
    jg.addPort(null, "JGraph/Center");
    DefaultEdge jgExtendsJc = new DefaultEdge("extends");
    cs.connect(jgExtendsJc, jc.getChildAt(0), jg.getChildAt(0));
    attributes.put(jgExtendsJc, extendStyle);
    // UI Column
    DefaultGraphCell cu = new DefaultGraphCell("ComponentUI");
    attributes
        .put(cu, createBounds(new AttributeMap(), 340, 20, Color.red));
    cu.addPort(null, "ComponentUI/Center");
    DefaultGraphCell gu = new DefaultGraphCell("GraphUI");
    attributes.put(gu,
        createBounds(new AttributeMap(), 340, 100, Color.red));
    gu.addPort(null, "GraphUI/Center");
    DefaultGraphCell dgu = new DefaultGraphCell("BasicGraphUI");
    attributes.put(dgu, createBounds(new AttributeMap(), 340, 180,
        Color.red));
    dgu.addPort(null, "BasicGraphUI/Center");
    DefaultEdge guExtendsCu = new DefaultEdge("extends");
    cs.connect(guExtendsCu, cu.getChildAt(0), gu.getChildAt(0));
    attributes.put(guExtendsCu, extendStyle);
    DefaultEdge dguImplementsDu = new DefaultEdge("implements");
    cs.connect(dguImplementsDu, gu.getChildAt(0), dgu.getChildAt(0));
    attributes.put(dguImplementsDu, implementStyle);
    DefaultGraphCell uiGroup = new DefaultGraphCell("UIGroup");
    uiGroup.add(cu);
    uiGroup.add(gu);
    uiGroup.add(dgu);
    uiGroup.add(dguImplementsDu);
    uiGroup.add(guExtendsCu);
    // Aggregations
    DefaultEdge jgAggregatesGm = new DefaultEdge("model");
    cs.connect(jgAggregatesGm, jg.getChildAt(0), gm.getChildAt(0));
    attributes.put(jgAggregatesGm, aggregateStyle);
    DefaultEdge jcAggregatesCu = new DefaultEdge("ui");
    cs.connect(jcAggregatesCu, jc.getChildAt(0), cu.getChildAt(0));
    attributes.put(jcAggregatesCu, aggregateStyle);
    // Insert Cells into model
    Object[] cells = new Object[] { jgAggregatesGm, jcAggregatesCu,
        modelGroup, jc, jg, jgExtendsJc, uiGroup };
View Full Code Here

        indent = 0;
        nodeColor = Color.GRAY;
    }

    private DefaultEdge createConnection(DefaultGraphCell cell) {
        DefaultEdge edge = new DefaultEdge();
        edge.setSource(stack.peek().getChildAt(0));
        edge.setTarget(cell);

        // Set Arrow Style for edge
        int arrow = GraphConstants.ARROW_TECHNICAL;
        GraphConstants.setLineEnd(edge.getAttributes(), arrow);
        GraphConstants.setEndFill(edge.getAttributes(), true);
        return edge;
    }
View Full Code Here

        String caption = node.toString();

        parentAddPort();

        cell = createVertex(caption, indent, depth, nodeColor, false);
        DefaultEdge edge = createConnection(cell);

        cells.add(cell);
        cells.add(edge);

        incrementPosition(cell);
View Full Code Here

  }

  // Insert a new Edge between source and target
  public void connect(Port source, Port target) {
    // Construct Edge with no label
    DefaultEdge edge = createDefaultEdge();
    if (graph.getModel().acceptsSource(edge, source) &&
        graph.getModel().acceptsTarget(edge, target)) {
      // Create a Map thath holds the attributes for the edge
      edge.getAttributes().applyMap(createEdgeAttributes());
      // Insert the Edge and its Attributes
      graph.getGraphLayoutCache().insertEdge(edge, source, target);
    }
  }
View Full Code Here

    }
  }

  // Hook for subclassers
  protected DefaultEdge createDefaultEdge() {
    return new DefaultEdge();
  }
View Full Code Here

TOP

Related Classes of org.jgraph.graph.DefaultEdge$LoopRouting

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.