Пример #1
0
  public void activate() {
    super.activate();
    getEditor().startUndo("Reorder Parameters");

    DecorationMgr.addDecorator(getEditor(), BasicFigure.DECO_OVERLAY, targetDecorator);

    getView().redraw();
  }
Пример #2
0
  public void deactivate() {
    DecorationMgr.removeDecorator(getEditor(), BasicFigure.DECO_OVERLAY, targetDecorator);

    paramFigure = null;
    socketFigure = null;
    oldIndex = 0;
    regions = null;
    socketDisplayBox = null;

    super.deactivate();
  }
  /**
   * Draws the start, end and animation decorations of the spline.
   *
   * @see org.openbp.cockpit.modeler.figures.spline.PolySplineFigure#drawDecorations(Graphics g)
   */
  protected void drawDecorations(Graphics g) {
    if (isVisible() && !isMinimized()) {
      // Draw the arrows
      super.drawDecorations(g);

      if (getAnimationDecoration() != null) {
        // Draw the small circle running down the spline
        double pos = ((Double) DecorationMgr.decorate(this, DECO_ANIMATION, NAN)).doubleValue();

        if (pos >= 0d && pos <= 1d) {
          Point2D p = getPointOnCurve(pos);

          g.fillOval(CommonUtil.rnd(p.getX()) - 4, CommonUtil.rnd(p.getY()) - 4, 8, 8);
        }
      }
    }
  }