예제 #1
0
    /**
     * ************************************************************************* * * Do the
     * relocation
     */
    private DialogAndInProcessCmd stepRelocateSource() {

      //
      // Go and find if we intersect anything.
      //

      List<Intersection.AugmentedIntersection> augs =
          appState_.getGenomePresentation().intersectItem(x, y, rcxT_, true, false);
      Intersection.AugmentedIntersection ai =
          (new IntersectionChooser(true, rcxT_)).selectionRanker(augs);
      Intersection inter = ((ai == null) || (ai.intersect == null)) ? null : ai.intersect;
      //
      // If we don't intersect anything, we need to bag it.
      //

      if (inter == null) {
        return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.REJECT, this));
      }

      Object sub = inter.getSubID();
      if (sub == null) {
        return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.REJECT, this));
      }

      String id = inter.getObjectID();
      Node node = rcxT_.getGenome().getNode(id);
      if (node == null) {
        return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.REJECT, this));
      }

      if (!(sub instanceof Intersection.PadVal)) {
        return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.REJECT, this));
      }

      List<Intersection.PadVal> pads = inter.getPadCand();

      if (LinkSupport.changeLinkSource(appState_, intersect, inter, pads, id, rcxT_)) {
        return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.ACCEPT, this));
      } else {
        return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.REJECT, this));
      }
    }