Package com.mxgraph.model

Examples of com.mxgraph.model.mxCell


        insertEdge(null, null, new Node(null), source, target,
                arrow ? SVNRevisionGraph.COPY_OR_MERGE_LINK_STYLE : SVNRevisionGraph.IN_BRANCH_LINK_STYLE);
    }

    private void layoutGraph() {
        mxCell lastCell = null;
        Double nextY = null;
        int i = 0;
        for (String path : revMap.keySet()) {
            ArrayList<Revision> revsOnPath = revMap.get(path);
            if (i != 0) {
                Revision firstRev = revsOnPath.get(0);
                lastCell = getLinkedCell(firstRev);
            }
            int relativePosition = SwingConstants.BOTTOM;
            double widestY = 0;
            for (Revision rev : revsOnPath) {
                mxCell cell = cellMap.get(rev);
                if (cell != lastCell) {
                    lastCell = positionCell(lastCell, relativePosition, nextY, cell);
                    relativePosition = SwingConstants.RIGHT;
                    mxRectangle rect = lastCell.getGeometry();
                    widestY = Math.max(widestY, rect.getY() + rect.getHeight());
                }
            }
            nextY = widestY + SVNRevisionGraph.CELL_SPACING;
            i++;
        }
        //Now adjust x position in order of revision numbers
        for (i = 1; i < revisions.size(); i++) {
            Revision rev = revisions.get(i);
            Revision prevRev = revisions.get(i - 1);
            mxCell cell = cellMap.get(rev);
            mxCell prevCell = cellMap.get(prevRev);
            if (cell != prevCell) {
                Rectangle rect = cell.getGeometry().getRectangle();
                positionCell(prevCell,
                        rev.getRevisionNumber() > prevRev.getRevisionNumber() ? SwingConstants.RIGHT : SwingConstants.BOTTOM,
                        rect.getY(), cell);
View Full Code Here


    public List<Node> getSelectedNodes() {
        List<Node> nodes = new ArrayList<Node>();
        Object[] cells = getSelectionCells();
        if (cells != null) {
            for (Object cell : cells) {
                mxCell c = (mxCell) cell;
                if (c.isVertex()) {
                    nodes.add((RevisionGraphModel.Node) c.getValue());
                }
            }
        }
        return nodes;
    }
View Full Code Here

           this.graph = graph;
         }

          public void invoke(Object sender, mxEventObject evt)
            { 
                  mxCell selected = (mxCell) graph.getSelectionCell();
                  if (selected == null) {}
                  else {
                      currentCell = selected;
                      currentGraph = graph;
                  }
View Full Code Here

    mxGeometry geometry = new mxGeometry(0, 0, width, height);
    geometry.setTerminalPoint(new mxPoint(0, height), true);
    geometry.setTerminalPoint(new mxPoint(width, 0), false);
    geometry.setRelative(true);

    mxCell cell = new mxCell(value, geometry, style);
    cell.setEdge(true);

    addTemplate(name, icon, cell);
  }
View Full Code Here

   * @param value
   */
  public void addTemplate(final String name, ImageIcon icon, String style,
      int width, int height, Object value)
  {
    mxCell cell = new mxCell(value, new mxGeometry(0, 0, width, height),
        style);
    cell.setVertex(true);

    addTemplate(name, icon, cell);
  }
View Full Code Here

   * @param cells
   * @return Returns a new group cell.
   */
  public Object createGroupCell(Object[] cells)
  {
    mxCell group = new mxCell("", new mxGeometry(), null);
    group.setVertex(true);
    group.setConnectable(false);

    return group;
  }
View Full Code Here

      boolean relative)
  {
    mxGeometry geometry = new mxGeometry(x, y, width, height);
    geometry.setRelative(relative);

    mxCell vertex = new mxCell(value, geometry, style);
    vertex.setId(id);
    vertex.setVertex(true);
    vertex.setConnectable(true);

    return vertex;
  }
View Full Code Here

   * @return Returns the new edge to be inserted.
   */
  public Object createEdge(Object parent, String id, Object value,
      Object source, Object target, String style)
  {
    mxCell edge = new mxCell(value, new mxGeometry(), style);

    edge.setId(id);
    edge.setEdge(true);
    edge.getGeometry().setRelative(true);

    return edge;
  }
View Full Code Here

    public Object createEdge(Object parent, String id, Object value,
        Object source, Object target, String style)
    {
      if (edgeTemplate != null)
      {
        mxCell edge = (mxCell) cloneCells(new Object[] { edgeTemplate })[0];
        edge.setId(id);

        return edge;
      }

      return super.createEdge(parent, id, value, source, target, style);
View Full Code Here

                mxResources.get("loseChanges")) == JOptionPane.YES_OPTION)
        {
          mxGraph graph = editor.getGraphComponent().getGraph();

          // Check modified flag and display save dialog
          mxCell root = new mxCell();
          root.insert(new mxCell());
          graph.getModel().setRoot(root);

          editor.setModified(false);
          editor.setCurrentFile(null);
          editor.getGraphComponent().zoomAndCenter();
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.