public void onDragged(InputEventInfo ev) {
    if (mouseDownPoint == null) {
      prevPoint.x = ev.getPoint().x;
      prevPoint.y = ev.getPoint().y;
      mouseDownPoint = ev.getPoint();
      CGroupController.move_start(uuid);
    }

    CGroupController.move(
        uuid, (int) (ev.getPoint().x - prevPoint.x), ev.getPoint().y - prevPoint.y);

    long smallestParent =
        CGroupController.groupdb.get(uuid).calculateParent(ev.getPoint().x, ev.getPoint().y);
    if (smallestParent != BubbleMenu.highlightedParentGroup) {
      if (BubbleMenu.highlightedParentGroup != 0l) {
        CGroupController.groupdb.get(BubbleMenu.highlightedParentGroup).highlight_off();
        CGroupController.groupdb.get(BubbleMenu.highlightedParentGroup).highlight_repaint();
      }
      if (smallestParent != 0l) {
        CGroupController.groupdb.get(smallestParent).highlight_on();
        CGroupController.groupdb.get(smallestParent).highlight_repaint();
      }
      BubbleMenu.highlightedParentGroup = smallestParent;
    }

    /*if ((smallestParent = CGroupController.groupdb.get(guuid).calculateParent(e.getPoint().x, e.getPoint().y)) != 0l)
    {
    	CGroupController.groupdb.get(smallestParent).highlight_on();
    }*/

    prevPoint.x = ev.getPoint().x;
    prevPoint.y = ev.getPoint().y;
    ev.stop();
  }
Ejemplo n.º 2
0
  public void loadPosition(int anchorType) {
    switch (anchorType) {
      case TYPE_HEAD:
        if (CGroupController.groupdb
            .get(savedAnchorHeadUUID)
            .containsPoint(savedHeadPoint.x, savedHeadPoint.y)) {
          setAnchorUUID(savedAnchorHeadUUID, anchorType);
          CGroupController.no_notify_add_connector(savedAnchorHeadUUID, this.uuid);
          setAnchorPoint(anchorType, savedHeadPoint);
        } else {
          CConnectorController.no_notify_delete(this.uuid);
        }

        savedHeadPoint = null;
        savedAnchorHeadUUID = 0l;
        break;
      case TYPE_TAIL:
        if (CGroupController.groupdb
            .get(savedAnchorTailUUID)
            .containsPoint(savedTailPoint.x, savedTailPoint.y)) {
          setAnchorUUID(savedAnchorTailUUID, anchorType);
          CGroupController.no_notify_add_connector(savedAnchorTailUUID, this.uuid);
          setAnchorPoint(anchorType, savedTailPoint);
        } else {
          CConnectorController.no_notify_delete(this.uuid);
        }

        savedTailPoint = null;
        savedAnchorTailUUID = 0l;
        break;
    }
  }
  public void onReleased(InputEventInfo ev) {
    if (CGroupController.exists(uuid)) {
      CGroupController.set_permanent(uuid, true);
    } else if (CStrokeController.exists(uuid)) {
      long new_uuid = Calico.uuid();
      CStrokeController.makeScrap(uuid, new_uuid);
      CGroupController.set_permanent(new_uuid, true);
    }

    ev.stop();

    Calico.logger.debug("CLICKED GROUP PERM BUTTON");

    isActive = false;
  }
  public void onPressed(InputEventInfo ev) {
    if (!CGroupController.exists(uuid) || isActive) {
      return;
    }

    isActive = true;

    prevPoint = new Point();

    cuuid = CGroupController.groupdb.get(uuid).getCanvasUID();

    // TranslateMouseListener resizeDragListener = new TranslateMouseListener(canvasUUID, guuid);
    // CCanvasController.canvasdb.get(canvasUUID).addMouseListener(resizeDragListener);
    // CCanvasController.canvasdb.get(canvasUUID).addMouseMotionListener(resizeDragListener);

    // pass click event on to this listener since it will miss it
    // resizeDragListener.mousePressed(ev.getPoint());

    prevPoint.x = 0;
    prevPoint.y = 0;
    mouseDownPoint = null;

    ev.stop();
    BubbleMenu.isPerformingBubbleMenuAction = true;

    System.out.println("CLICKED GROUP MOVE BUTTON");
    // CGroupController.drop(group_uuid);
  }
  public void onPressed(InputEventInfo ev) {
    if (!CGroupController.exists(uuid) || isActive) {
      return;
    }

    isActive = true;
    super.onPressed(ev);
  }
Ejemplo n.º 6
0
  public CConnector(long uuid, long cuid, Color color, float thickness, Polygon points) {
    this.uuid = uuid;
    this.canvasUID = cuid;
    this.color = color;
    this.thickness = thickness;

    pointHead = new Point(points.xpoints[points.npoints - 1], points.ypoints[points.npoints - 1]);
    pointTail = new Point(points.xpoints[0], points.ypoints[0]);
    this.anchorHeadUUID = CGroupController.get_smallest_containing_group_for_point(cuid, pointHead);
    this.anchorTailUUID = CGroupController.get_smallest_containing_group_for_point(cuid, pointTail);

    // pointHead and pointTail must already be assigned
    createDataModelFromPolygon(points);

    stroke = new BasicStroke(thickness);
    strokePaint = this.color;

    resetBounds();
    redraw();
  }
Ejemplo n.º 7
0
  public void delete() {
    // Remove all elements
    ComposableElementController.no_notify_removeAllElements(this.uuid);

    // remove from canvas
    CCanvasController.no_notify_delete_child_connector(this.canvasUID, this.uuid);

    // Remove from groups
    CGroupController.no_notify_delete_child_connector(this.getAnchorUUID(TYPE_HEAD), uuid);
    CGroupController.no_notify_delete_child_connector(this.getAnchorUUID(TYPE_TAIL), uuid);

    if (CCanvasController.canvas_has_child_connector_node(this.canvasUID, uuid)) {
      // This line is not thread safe so must invokeLater to prevent eraser artifacts.
      /*SwingUtilities.invokeLater(
      		new Runnable() { public void run() { removeFromParent(); } }
      );*/
      CalicoDraw.removeNodeFromParent(this);
      // removeFromParent();
    }
  }
  public void onReleased(InputEventInfo ev) {
    if (BubbleMenu.highlightedParentGroup != 0l) {
      CGroupController.groupdb.get(BubbleMenu.highlightedParentGroup).highlight_off();
      CGroupController.groupdb.get(BubbleMenu.highlightedParentGroup).highlight_repaint();
      BubbleMenu.highlightedParentGroup = 0l;
    }

    // This threw a null pointer exception for some reason...
    if (mouseDownPoint != null) CGroupController.move_end(this.uuid, ev.getX(), ev.getY());

    // Update the menu location in case it was dropped into a list
    // BubbleMenu.moveIconPositions(CGroupController.groupdb.get(guuid).getBounds());

    ev.stop();
    //			PieMenu.isPerformingPieMenuAction = false;

    if (!CGroupController.groupdb.get(uuid).isPermanent()) {
      // CGroupController.drop(guuid);
    }
    super.onReleased(ev);
    isActive = false;
  }
Ejemplo n.º 9
0
  public void onClick(InputEventInfo ev) {
    CGroupController.rectify(uuid);
    ev.stop();

    Calico.logger.debug("CLICKED GROUP RECTIFY BUTTON");
  }