コード例 #1
0
  private ConstraintHitData findHit(MouseEvent e) {
    Vector<GraphComponent> graphComponents = _desktopPane.getGraphComponents();

    for (int i = 0; i < graphComponents.size(); i++) {
      GraphComponent graphComponent = graphComponents.elementAt(i);

      if (graphComponent instanceof ConstraintView) {
        ConstraintView constraintView = (ConstraintView) graphComponents.elementAt(i);
        ConstraintHit constraintHit = constraintView.hitMe(e);
        if (ConstraintHit.NONE != constraintHit) {
          return new ConstraintHitData(constraintView, constraintHit);
        }
      }
    }
    return new ConstraintHitData(null, ConstraintHit.NONE);
  }
コード例 #2
0
  private void refreshSelection(ConstraintView hitOne, boolean allowDeselect) {
    if (allowDeselect) {
      hitOne.setSelected(!hitOne.isSelected());
    } else if (false == hitOne.isSelected()) {
      hitOne.setSelected(true);
    }

    Vector<GraphComponent> graphComponents = _desktopPane.getGraphComponents();

    for (int i = 0; i < graphComponents.size(); i++) {
      if (false == graphComponents.elementAt(i) instanceof ConstraintView) {
        continue;
      }

      ConstraintView constraintView = (ConstraintView) graphComponents.elementAt(i);
      if (false == constraintView.equals(hitOne)) {
        constraintView.setSelected(false);
      }
    }
  }