Package com.mxgraph.model

Examples of com.mxgraph.model.mxCell


    m_infoTextBox = infoTextBox;
  }

  public void mouseReleased(MouseEvent event)
  {
    mxCell cell = (mxCell) m_viewer.m_graphComponent.getCellAt(event.getX(), event.getY());
   
    if (cell != null)
    {
      System.out.println("cell: " + m_viewer.m_graph.getLabel(cell));
      if(event.getButton() == MouseEvent.BUTTON3)
      {
        if(cell.isVertex())
        {
         
          System.out.println(cell.getValue());
          String display = null;
          display = "Agent: " + cell.getValue();
          String agentIdString = (String) cell.getValue();
          try
          {
            int agentId = new Integer(agentIdString);
            Util.assertNotNull(m_viewer.m_graphModel);
            Set<TestbedEdge> edges = m_viewer.m_graphModel.incomingEdgesOf(new Agent(agentId));
View Full Code Here


    {
      //add vertices
      for(Object o : m_graphModel.vertexSet())
      {
        Agent a = (Agent) o;
        mxCell cell = (mxCell) m_graph.insertVertex(parent, new Integer(a.id).toString(), new Integer(a.id).toString(), 20, 20, 20, 20, "ROUNDED");
        jGraphCells.put(new Integer(a.id).toString(), cell);
      }
      //add edges
      for(Object o : m_graphModel.edgeSet())
      {
View Full Code Here

        if(srcj == null)
        {
          //if not present in our hashmap, then the cell doesnt exist in the jgraph
          //so add it and store the reference of the cell
          logger.info("Adding agent " + srcIdString + " to the view.");
          mxCell o = (mxCell) m_graph.insertVertex(parent, srcIdString, srcIdString, 20, 20, 20, 20, "ROUNDED");
          jGraphCells.put(srcIdString, o);
        }
        if(sinkj == null)
        {
          //if not present in our hashmap, then the cell doesnt exist in the jgraph
          //so add it and store the reference of the cell
          logger.info("Adding agent " + sinkIdString + " to the view.");
          mxCell o = (mxCell) m_graph.insertVertex(parent, sinkIdString, sinkIdString, 20, 20, 20, 20, "ROUNDED");
          jGraphCells.put(sinkIdString, o);
        }

        String edgeKey = srcIdString + "-"+ sinkIdString;
        if(!jGraphCells.containsKey(edgeKey))
        {
          //guaranteed jgraphVertices.get(srcIdString) and jgraphVertices.get(sinkIdString) will not be null
          //and that the cells are already present in jraph
          mxCell o = (mxCell) m_graph.insertEdge(parent, null, "", jGraphCells.get(srcIdString), jGraphCells.get(sinkIdString));
          jGraphCells.put(edgeKey, o);
        }
        else
        {
          //edge exists in graph. remove it and add it again with the updated edge info
          mxCell cell1 = jGraphCells.get(edgeKey);
          m_graph.removeCells(new Object[]{cell1});
          mxCell cell2 = (mxCell) m_graph.insertEdge(parent, null, "", jGraphCells.get(srcIdString), jGraphCells.get(sinkIdString));
          jGraphCells.remove(edgeKey);
          jGraphCells.put(edgeKey, cell2);
         
        }
        //TODO display the changed label on the edge
View Full Code Here

        mouseOver(null);
    }

    @Override
    public void mouseMoved(MouseEvent e) {
        mxCell cell = (mxCell) gc.getCellAt(e.getX(), e.getY());
        mouseOver(cell);
    }
View Full Code Here

    private static Set<mxCell> highlightEdge(RevisionGraphModel model, mxCell edge, boolean on) {
        Set<mxCell> changedCells = new HashSet<mxCell>();
        Revision targetRev = ((RevisionGraphModel.Node)edge.getTarget().getValue()).revisions.get(0);
        List<Revision> copiedOrMergedRevisions = targetRev.getCopiedOrMergedRevisions();
        for (Revision r : copiedOrMergedRevisions) {
            mxCell cell = model.getCellForRevision(r);
            if (cell != null) {
                changedCells.add(cell);
            }
        }
        for (mxCell cell : changedCells) {
            List<Revision> cellRevs = ((RevisionGraphModel.Node)cell.getValue()).revisions;
            highlightCell(cell, !on ? State.OFF : copiedOrMergedRevisions.containsAll(cellRevs) ? State.ON : State.PARTIAL);
        }

        highlightCell(edge, !on ? State.OFF : State.ON);
        changedCells.add(edge);
View Full Code Here

        _dateTF.invalidate();
        viewPort.setBackground(backgroundColor);
    }

    public void selectAndShowRevision(Revision rev) {
        mxCell cell = model.getCellForRevision(rev);
        model.setSelectionCell(cell);
        gc.scrollCellToVisible(cell);
    }
View Full Code Here

            }

            @Override
            public void mouseReleased(MouseEvent e) {
                if (gc.getGraphControl().isEnabled() && !e.isConsumed() && e.getClickCount() == 2) {
                    mxCell cell = (mxCell) gc.getCellAt(e.getX(), e.getY(), false);
                    if (!revisionHistory.isDirectory() && cell != null && cell.isEdge()) {
                        mxCell cell1 = (mxCell) cell.getSource();
                        mxCell cell2 = (mxCell) cell.getTarget();
                        List<Revision> revs1 = ((RevisionGraphModel.Node) cell1.getValue()).revisions;
                        List<Revision> revs2 = ((RevisionGraphModel.Node) cell2.getValue()).revisions;
                        Revision r1 = revs1.get(revs1.size() - 1);
                        Revision r2 = revs2.get(revs2.size() - 1);
                        if (!r1.isDeleted() && !r2.isDeleted()) {
                            compareFileRevisions(r1, r2);
                        }
                    }
                }
                maybeShowPopup(e);
            }

            private void maybeShowPopup(MouseEvent e) {
                if (e.isPopupTrigger()) {
                    mxCell cell = (mxCell) gc.getCellAt(e.getX(), e.getY());
                    if (cell != null && cell.isVertex()) {
                        viewRevisionPopup.getComponent().show(e.getComponent(), e.getX(), e.getY());
                    }
                }
            }
        });
View Full Code Here

  }
 
  void initSkelFrame(Skeleton<?,?> skeleton) {
    Object parent = graph.getDefaultParent();
   
    mxCell mainCell;
    graph.getModel().beginUpdate();
    try {
      mainCell = (mxCell) graph.insertVertex(parent,null,"",10,10,0,0,SkeletonTreeBuilder.STYLE_NOSHAPE);
      mainCell.setConnectable(false);
      SkeletonTreeBuilder builder = new SkeletonTreeBuilder(controller, graph,mainCell);
      skeleton.accept(builder);
      graph.setCellsLocked(true);
      graph.setCellsSelectable(false);     
    }
View Full Code Here

    for (Skeleton<?,?> s : strace) {
      skelHashKey += s.hashCode() + ":";
    }
    for (Where where :Where.values()) {
      if (traceVertMap.containsKey(where)) {
        mxCell traceVert = traceVertMap.get(where);
        String hashKey = skelHashKey + where.hashCode();
        TraceElement te = new TraceElement(traceVert);
        traces.put(hashKey, te);
        frame.updateTrace(traceVert, te.getInvokes(), te.getExecTime());
      }
View Full Code Here

  public <P, R> void visit(Seq<P, R> skeleton) {
    strace.add(skeleton);

    skelVert = (mxCell) graph.insertVertex(parent,null,"Seq",0,0,SKEL_SIDE,SKEL_SIDE,STYLE_SKEL);
    skelVert.setConnectable(false);
    mxCell exeVert = (mxCell) graph.insertVertex(parent,null,EXECUTE,MUS_SIDE/2,SKEL_SIDE*1.5,MUS_SIDE-2,MUS_SIDE-2,STYLE_MUS);
    exeVert.setConnectable(false);
    graph.insertEdge(parent, null, "", skelVert, exeVert, STYLE_EDGE);

    Skeleton<?,?>[] straceArray = getStraceAsArray();
    HashMap<Where,mxCell> traceMap = new HashMap<Where,mxCell>();

//    mxCell skelTraceVert = (mxCell) graph.insertVertex(parent,null,"",0,0,1.25*SKEL_SIDE,SKEL_SIDE,STYLE_NOSHAPE);
//    skelTraceVert.setConnectable(false);
//    traceMap.put(Where.SKELETON, skelTraceVert);
   
    mxCell exeTraceVert = (mxCell) graph.insertVertex(parent,null,"",MUS_SIDE/2,SKEL_SIDE*1.5+MUS_SIDE,MUS_SIDE-2,SKEL_SIDE,STYLE_NOSHAPE);
    exeTraceVert.setConnectable(false);
    traceMap.put(Where.SKELETON, exeTraceVert);

    controller.initTrace(straceArray,traceMap);
  }
View Full Code Here

TOP

Related Classes of com.mxgraph.model.mxCell

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.