Package org.jgraph.graph

Examples of org.jgraph.graph.DefaultEdge


    if(wcCell==null||wsCell==null
      return;
   
    DefaultPort zeroChild = (DefaultPort)wcCell.getChildAt(0);
    Set edges = zeroChild.getEdges();
    DefaultEdge edge1=(DefaultEdge)edges.iterator().next();

    DefaultGraphModel model = (DefaultGraphModel)jGraphMain.getModel();
    model.remove(new Object[]{edge1});
   
    // Create Edge
      DefaultEdge edge = new DefaultEdge();
    int arrow = GraphConstants.ARROW_CLASSIC;
    GraphConstants.setLineEnd(edge.getAttributes(), arrow);
    GraphConstants.setEndFill(edge.getAttributes(), true);
    setLineAttribs(edge);

      // Create ConnectionSet for Insertion
      ConnectionSet cs = new ConnectionSet(edge, wcCell.getChildAt(0), wsCell.getChildAt(0));
View Full Code Here


    }
   
    private DefaultEdge createGraphEdge(String text,
      List<Point2D> controlPoints, double lx, double ly)
    {
      DefaultEdge edge = new DefaultEdge();
      Object[] labels = {
        text
      };
      Point2D[] labelPositions = {
        new Point2D.Double(lx, ly)
      };
     
      GraphConstants.setLineEnd(edge.getAttributes(), GraphConstants.ARROW_CLASSIC);
      GraphConstants.setEndFill(edge.getAttributes(), true);
      GraphConstants.setExtraLabelPositions(edge.getAttributes(),
        labelPositions);
      GraphConstants.setExtraLabels(edge.getAttributes(), labels);
      GraphConstants.setPoints(edge.getAttributes(), controlPoints);

      return edge;
    }
View Full Code Here

    }
   
    private DefaultEdge createGraphEdge(String text, DefaultGraphCell source,
      DefaultGraphCell target, double lx, double ly)
    {
      DefaultEdge edge = new DefaultEdge();
      Object[] labels = {
        text
      };
     
      Point2D[] labelPositions = {
        new Point2D.Double(lx, ly)
      };
     
      GraphConstants.setLineEnd(edge.getAttributes(), GraphConstants.ARROW_CLASSIC);
      GraphConstants.setEndFill(edge.getAttributes(), true);
      GraphConstants.setExtraLabelPositions(edge.getAttributes(),
        labelPositions);
      GraphConstants.setExtraLabels(edge.getAttributes(), labels);
     
      edge.setSource(source.getChildAt(0));
      edge.setTarget(target.getChildAt(0));
     
      return edge;
    }
View Full Code Here

    // Create World Vertex
    cells[1] = createVertex("World", 140, 140, 40, 20, Color.ORANGE, true);

    // Create Edge
    DefaultEdge edge = new DefaultEdge();
    // Fetch the ports from the new vertices, and connect them with the edge
    edge.setSource(cells[0].getChildAt(0));
    edge.setTarget(cells[1].getChildAt(0));
    cells[2] = edge;

    // Set Arrow Style for edge
    int arrow = GraphConstants.ARROW_CLASSIC;
    GraphConstants.setLineEnd(edge.getAttributes(), arrow);
    GraphConstants.setEndFill(edge.getAttributes(), true);

    // Insert the cells via the cache, so they get selected
    graph.getGraphLayoutCache().insert(cells);

    // Show in Frame
View Full Code Here

        key.setLevel(referenceCalling.getLevelCalled());
        DefaultGraphCell cellcalled =
          (DefaultGraphCell) hashMethods.get(key);

                if (cellcallee!=null && cellcalled!=null) {
          DefaultEdge relationship =
            new DefaultEdge(
              numberFormat.format(
                referenceCalling.getPercentageCPU())
                + "%");
          elements[currentElement++] = relationship;
View Full Code Here

        key.setMethodId(referenceCalling.getMethodCalled());
        key.setLevel(referenceCalling.getLevelCalled());
        DefaultGraphCell cellcalled =
          (DefaultGraphCell) hashMethods.get(key);

        DefaultEdge relationship =
          new DefaultEdge(
            numberFormat.format(
              referenceCalling.getInstancesCreated())
              + " instances");
        elements[currentElement++] = relationship;
View Full Code Here

        return new DbEntityCellMetadata(this, e.getName());
    }

    @Override
    protected DefaultEdge createRelationshipCell(Relationship rel) {
        DefaultEdge edge = super.createRelationshipCell(rel);
        if (edge != null) {
            GraphConstants.setDashPattern(edge.getAttributes(), new float[] {
                    10, 3
            });
        }
        return edge;
    }
View Full Code Here

        super.postProcessEntity(entity, cell);

        GraphConstants.setBackground(cell.getAttributes(), ENTITY_COLOR);
        GraphConstants.setOpaque(cell.getAttributes(), true);

        DefaultEdge edge = createInheritanceEdge((ObjEntity) entity);
        if (edge != null) {
            createdObjects.add(edge);
        }
    }
View Full Code Here

            ObjEntity superEntity = entity.getSuperEntity();
            if (superEntity != null) {
                DefaultGraphCell sourceCell = entityCells.get(entity.getName());
                DefaultGraphCell targetCell = entityCells.get(superEntity.getName());

                DefaultEdge edge = new DefaultEdge();
                edge.setSource(sourceCell.getChildAt(0));
                edge.setTarget(targetCell.getChildAt(0));

                GraphConstants.setDashPattern(edge.getAttributes(), new float[] {
                        5, 5
                });
                GraphConstants.setLineEnd(
                        edge.getAttributes(),
                        GraphConstants.ARROW_TECHNICAL);
                GraphConstants.setSelectable(edge.getAttributes(), false);

                inheritanceEdges.put(entity, edge);

                return edge;
            }
View Full Code Here

        updateEntityCell(e.getEntity());

        // maybe super entity was changed
        ObjEntity entity = (ObjEntity) e.getEntity();
        DefaultEdge inheritanceEdge = inheritanceEdges.get(entity);
        if (inheritanceEdge != null) {
            if (entity.getSuperEntity() == null) {
                graph.getGraphLayoutCache().remove(new Object[] {
                    inheritanceEdge
                });
                inheritanceEdges.remove(entity);
            }
            else {
                inheritanceEdge.setTarget(entityCells.get(
                        entity.getSuperEntity().getName()).getChildAt(0));

                Map nested = new HashMap();
                nested.put(inheritanceEdge, inheritanceEdge.getAttributes());

                graph.getGraphLayoutCache().edit(nested);
            }
        }
        else {
            if (entity.getSuperEntity() != null) {
                DefaultEdge edge = createInheritanceEdge(entity);
                graph.getGraphLayoutCache().insert(edge);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.jgraph.graph.DefaultEdge

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.