Exemple #1
0
  /**
   * Returns the scaled Image of the source Figure. If the Image needs to be updated, the
   * ThumbnailUpdater will notified.
   *
   * @return The thumbnail image
   */
  protected Image getThumbnailImage() {
    Dimension oldSize = targetSize;
    targetSize = getPreferredSize();
    targetSize.expand(new Dimension(getInsets().getWidth(), getInsets().getHeight()).negate());
    setScales(
        targetSize.width / (float) getSourceRectangle().width,
        targetSize.height / (float) getSourceRectangle().height);
    if ((isDirty()) && !updater.isRunning()) updater.start();
    else if (oldSize != null && !targetSize.equals(oldSize)) {
      revalidate();
      updater.restart();
    }

    return thumbnailImage;
  }
Exemple #2
0
 /** Deactivates this Thumbnail. */
 public void deactivate() {
   sourceFigure.getUpdateManager().removeUpdateListener(this);
   updater.deactivate();
 }