Package pl.tecna.gwt.connectors.client

Examples of pl.tecna.gwt.connectors.client.Point


  public Point endPoint;
  public boolean vertical;

  public SectionData(int startX, int startY, int endX, int endY, boolean vertical) {

    this.startPoint = new Point(startX, startY);
    this.endPoint = new Point(endX, endY);
    this.vertical = vertical;
  }
View Full Code Here


        // to draw new lines to connectionPoint
        try {
          if (Section.this.startPointIsGluedToConnectionPoint() || Section.this.endPointIsGluedToConnectionPoint()) {
            // Calculate new CornerPoints
            ArrayList<CornerPoint> newCornerPoints = new ArrayList<CornerPoint>();
            Point sp = Section.this.startPoint;
            Point ep = Section.this.endPoint;
            CornerPoint cp1 =
                new CornerPoint(sp.getLeft() + (ep.getLeft() - sp.getLeft()) / 2, sp.getTop()
                    + (ep.getTop() - sp.getTop()) / 2);
            CornerPoint cp2 =
                new CornerPoint(sp.getLeft() + (ep.getLeft() - sp.getLeft()) / 2, sp.getTop()
                    + (ep.getTop() - sp.getTop()) / 2);
            newCornerPoints.add(cp1);
            newCornerPoints.add(cp2);
            // Split Section
            Section.this.splitSection(newCornerPoints);
          }
View Full Code Here

    xOffset = xOffset - diagram.boundaryPanel.getAbsoluteLeft();
    yOffset = yOffset - diagram.boundaryPanel.getAbsoluteTop();

    for (int i = 0; i < sections.size(); i++) {

      Point sectionTopLeft = null;
      if (savedSectionsData.get(i).startPoint.getLeft() <= savedSectionsData.get(i).endPoint.getLeft()
          && savedSectionsData.get(i).startPoint.getTop() <= savedSectionsData.get(i).endPoint.getTop()) {
        sectionTopLeft = savedSectionsData.get(i).startPoint;
      } else {
        sectionTopLeft = savedSectionsData.get(i).endPoint;
      }

      diagram.boundaryPanel.setWidgetPosition(sections.get(i), sectionTopLeft.getLeft() + xOffset, sectionTopLeft
          .getTop()
          + yOffset);

      sections.get(i).startPoint.setLeft(savedSectionsData.get(i).startPoint.getLeft() + xOffset);
      sections.get(i).startPoint.setTop(savedSectionsData.get(i).startPoint.getTop() + yOffset);
View Full Code Here

      return -1;
    }
  }

  public Point getCPPosition(ConnectionPoint cp) {
    Point point = null;

    if (connectionPoints.contains(cp)) {
      if (this.getParent() != null) {
        int left = cp.getAbsoluteLeft() - this.diagram.boundaryPanel.getAbsoluteLeft();
        int top = cp.getAbsoluteTop() - this.diagram.boundaryPanel.getAbsoluteTop();
        point = new Point(left, top);
        return point;
      }
    }
    return null;
  }
View Full Code Here

   * Determines whether given {@link Section} is on this Shape's containing widget
   *
   * @return <code>true</code>, if section is on current shape
   */
  public boolean isOnThisShape(Section section) {
    Point startPoint = section.startPoint;
    Point endPoint = section.endPoint;

    int direction;
    if (section.isHorizontal()) {
      direction = Section.HORIZONTAL;
    } else if (section.isVertical()) {
      direction = Section.VERTICAL;
    } else {
      LOG.severe("isOnThisShape -> direction = -1");
      direction = -1;
    }

    if (this.getParent() != null) {

      int shapeLeft = this.getRelativeShapeLeft();
      int shapeTop = this.getRelativeShapeTop();
      int shapeRight = shapeLeft + this.getOffsetWidth();
      int shapeBottom = shapeTop + this.getOffsetHeight();

      if (direction == Section.HORIZONTAL) {
        if (shapeTop <= startPoint.getTop() && shapeBottom >= startPoint.getTop()) {
          if ((startPoint.getLeft() >= shapeLeft && startPoint.getLeft() <= shapeRight)
              || (endPoint.getLeft() >= shapeLeft && endPoint.getLeft() <= shapeRight)
              || (startPoint.getLeft() <= shapeLeft && endPoint.getLeft() >= shapeRight)
              || (startPoint.getLeft() >= shapeLeft && endPoint.getLeft() <= shapeRight)) {
            return true;
          }
        }
      } else if (direction == Section.VERTICAL) {
        if (shapeLeft <= startPoint.getLeft() && shapeRight >= startPoint.getLeft()) {
          if ((startPoint.getTop() >= shapeTop && startPoint.getTop() <= shapeBottom)
              || (endPoint.getTop() >= shapeTop && endPoint.getTop() <= shapeBottom)
              || (startPoint.getTop() <= shapeTop && endPoint.getTop() >= shapeBottom)
              || (startPoint.getTop() >= shapeTop && endPoint.getTop() <= shapeBottom)) {
            return true;
          }
        }
      }
    }
View Full Code Here

    endPointsShowTimer.cancel();
    if (endPoints.isEmpty()) {
      AbsolutePanel boundaryPanel = diagram.boundaryPanel;
      for (ConnectionPoint cp : connectionPoints) {
        if (cp.gluedEndPoints.size() == 0) {
          Point cpPoint = getCPPosition(cp);
          ShapeConnectorStart ep =
              new ShapeConnectorStart(cpPoint.getLeft(), cpPoint.getTop(), Shape.this, endPointsShowTimer, cp);
          boundaryPanel.add(ep, cpPoint.getLeft(), cpPoint.getTop());
          diagram.endPointDragController.makeDraggable(ep);
          endPoints.add(ep);
        }
      }
    }
View Full Code Here

TOP

Related Classes of pl.tecna.gwt.connectors.client.Point

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.