Ejemplo n.º 1
0
  public void setAffectedObject(Object affectedObject) {
    super.setAffectedObject(affectedObject);

    if (affectedObject != null) {
      this.paramFigure = (ParamFigure) affectedObject;
      this.socketFigure = (SocketFigure) paramFigure.getParent();

      // Rebuild the parameter list, displaying all parameters
      socketFigure.reinitParams(true);

      socketDisplayBox = socketFigure.displayBox();

      // We retrieve the old index of the parameter.
      oldIndex = socketFigure.getNodeSocket().getParamList().indexOf(paramFigure.getNodeParam());

      regions = socketFigure.getParamRegions();
    } else {
      socketFigure = null;
      regions = null;
    }
  }
Ejemplo n.º 2
0
  public void mouseUp(MouseEvent e, int x, int y) {
    if (socketDisplayBox.contains(x, y)) {
      // Strategy: We determine the region over which we are right now
      for (int i = 0; i < regions.length; i++) {
        if (regions[i].contains(x, y)) {
          socketFigure.moveParameter(oldIndex, i);

          getView().setCursor(null);

          break;
        }
      }
    }

    // Rebuild the parmeter list, displaying the visible parameters only
    socketFigure.reinitParams(false);

    getView().singleSelect(paramFigure);

    getEditor().endUndo();

    super.mouseUp(e, x, y);
  }