Examples of mxGeometry


Examples of com.mxgraph.model.mxGeometry

  {
    mxGraph graph = graphComponent.getGraph();
    double scale = graph.getView().getScale();

    Object cell = state.getCell();
    mxGeometry geometry = graph.getModel().getGeometry(cell);

    if (geometry != null)
    {
      double dx = (e.getX() - first.x) / scale;
      double dy = (e.getY() - first.y) / scale;

      if (isLabel(index))
      {
        geometry = (mxGeometry) geometry.clone();

        if (geometry.getOffset() != null)
        {
          dx += geometry.getOffset().getX();
          dy += geometry.getOffset().getY();
        }

        if (gridEnabledEvent)
        {
          dx = graph.snap(dx);
          dy = graph.snap(dy);
        }

        geometry.setOffset(new mxPoint(dx, dy));
        graph.getModel().setGeometry(cell, geometry);
      }
      else
      {
        mxRectangle bounds = union(geometry, dx, dy, index);
View Full Code Here

Examples of com.mxgraph.model.mxGeometry

   * @param value
   */
  public void addEdgeTemplate(final String name, ImageIcon icon,
      String style, int width, int height, Object value)
  {
    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

Examples of com.mxgraph.model.mxGeometry

   * @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

Examples of com.mxgraph.model.mxGeometry

        }

        @Override
        public int compare(Revision r1, Revision r2) {
            RevisionGraphModel model = graph.getModel();
            mxGeometry g = model.getCellForRevision(reference).getGeometry();
            mxGeometry g1 = model.getCellForRevision(r1).getGeometry();
            mxGeometry g2 = model.getCellForRevision(r2).getGeometry();
            double diffX = Math.abs(g1.getX() - g.getX()) - Math.abs(g2.getX() - g.getX());
            if (Math.abs(diffX) > PRECISION) {
                return (diffX > 0) ? 1 : -1;
            }
            double diffY = Math.abs(g1.getY() - g.getY()) - Math.abs(g2.getY() - g.getY());
            if (Math.abs(diffY) > PRECISION) {
                return (diffY > 0) ? 1 : -1;
            }
            return (latestIsCloser ^ (r1.getRevisionNumber() > reference.getRevisionNumber())) ? 1 : -1;
        }
View Full Code Here

Examples of com.mxgraph.model.mxGeometry

            prevList.add(rev);
            result = neighborCell;
        } else {
            List<Revision> nodeRevisions = new ArrayList<Revision>();
            nodeRevisions.add(rev);
            result = new mxCell(new Node(nodeRevisions), new mxGeometry(), null);
            result.setVertex(true);
            result.setConnectable(true);
            result.setStyle(SVNRevisionGraph.REVISION_STYLE + ";"
                    + mxConstants.STYLE_STROKEWIDTH + "=" + ((rev == currentRevision) ? "3" : "1"+ ";"
                    + mxConstants.STYLE_DASHED + "=" + rev.isDeleted());
View Full Code Here

Examples of com.mxgraph.model.mxGeometry

   * @param value
   */
  public void addEdgeTemplate(final String name, ImageIcon icon,
      String style, int width, int height, Object value)
  {
    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

Examples of com.mxgraph.model.mxGeometry

   * @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

Examples of com.mxgraph.model.mxGeometry

      {
        // Checks if the group has a geometry and
        // creates one if one does not exist
        if (getCellGeometry(group) == null)
        {
          model.setGeometry(group, new mxGeometry());
        }

        // Adds the children into the group and moves
        int index = model.getChildCount(group);
        cellsAdded(cells, group, index, null, null, false);
View Full Code Here

Examples of com.mxgraph.model.mxGeometry

   * @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

Examples of com.mxgraph.model.mxGeometry

    model.beginUpdate();
    try
    {
      for (int i = 0; i < cells.length; i++)
      {
        mxGeometry geo = getCellGeometry(cells[i]);

        if (geo != null)
        {
          Object[] children = getChildCells(cells[i]);

          if (children != null && children.length > 0)
          {
            mxRectangle childBounds = getBoundingBoxFromGeometry(children);

            if (childBounds.getWidth() > 0
                && childBounds.getHeight() > 0)
            {
              mxRectangle size = (isSwimlane(cells[i])) ? getStartSize(cells[i])
                  : new mxRectangle();

              geo = (mxGeometry) geo.clone();

              if (moveParent)
              {
                geo.setX(geo.getX() + childBounds.getX()
                    - size.getWidth() - border);
                geo.setY(geo.getY() + childBounds.getY()
                    - size.getHeight() - border);
              }

              geo.setWidth(childBounds.getWidth()
                  + size.getWidth() + 2 * border);
              geo.setHeight(childBounds.getHeight()
                  + size.getHeight() + 2 * border);

              model.setGeometry(cells[i], geo);
              moveCells(children,
                  -childBounds.getX() + size.getWidth()
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.