/**
   * @todo Refactor this. Shouldn't mix localisation logic and relation mutation logic in one method
   * @todo-javadoc Write javadocs for method parameter
   * @todo-javadoc Write javadocs for method parameter
   * @todo-javadoc Write javadocs for return value
   * @todo-javadoc Write javadocs for method parameter
   * @param evt Describe what the parameter does
   * @return Describe the return value
   */
  public boolean selectMaybe(MouseEvent evt) {
    boolean multiplicity = evt.isControlDown();
    boolean cardinality = evt.isShiftDown();
    Point point = evt.getPoint();
    setSelected(_mainLine.intersects(point.getX() - 5, point.getY() - 5, 10, 10));
    if (isSelected()) {
      double distFromP1 =
          Point2D.distance(_mainLine.getX1(), _mainLine.getY1(), point.getX(), point.getY());

      boolean nearP1 = distFromP1 < _mainLength / 2;
      boolean leftChosen = (_leftIsWest && nearP1) || (!_leftIsWest && !nearP1);
      RelationshipRole role = leftChosen ? _rightRole : _leftRole;
      if (multiplicity) {
        // toggle multiplicity. Let's prevent the user from doing something stupid. Some
        // cardinalities
        // can't be changed. we know best etc.
        if (role.getRelation().isMany2Many()) {
          // don't allow to change cardinality of m:n relationships
          JOptionPane.showMessageDialog(
              null,
              "Can't change the cardinality of a many-to-many relationship",
              "Cardinality",
              JOptionPane.INFORMATION_MESSAGE);
          return false;
        }
        if (role.isFkPk()) {
          // don't allow to change cardinality of 1:1 relationships that are 1:1 because fk is also
          // pk
          JOptionPane.showMessageDialog(
              null,
              "Can't change the cardinality of a one-to-one relationship where the foreign key is also a primary key",
              "Cardinality",
              JOptionPane.INFORMATION_MESSAGE);
          return false;
        }
        if (role.isTargetPrimaryKey()) {
          JOptionPane.showMessageDialog(
              null,
              "Can't change the cardinality of a the one-side of a relationship that corresponds to a primary key",
              "Cardinality",
              JOptionPane.INFORMATION_MESSAGE);
          return false;
        }
        // All checks passed. Do the toggle
        role.setTargetMany(!role.isTargetMany());
      }
      if (cardinality) {
        // toggle between uni/bidirectional
        role.setEnabled(!role.isEnabled());
      }
      return true;
    } else {
      return false;
    }
  }