Package com.aelitis.azureus.ui.swt.imageloader

Examples of com.aelitis.azureus.ui.swt.imageloader.ImageLoader


   * @since 4.0.0.5
   */
  private void disposeSkin() {
    numSkins--;
    for (Iterator<ImageLoader> iter = mapImageLoaders.values().iterator(); iter.hasNext();) {
      ImageLoader loader = iter.next();
      loader.unLoadImages();
    }
    if (ourSkinProperties) {
      //skinProperties.dispose();
    }
  }
View Full Code Here


    }

    final Canvas drawable = new Canvas(createOn, SWT.NO_BACKGROUND);
    drawable.setVisible(false);

    final ImageLoader imageLoader = getImageLoader(properties);
    Image image = imageLoader.getImage(sConfigID);
    if (ImageLoader.isRealImage(image)) {
      imageLoader.releaseImage(sConfigID);
      image = imageLoader.getImage(sConfigID + ".image");
      drawable.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
          imageLoader.releaseImage(sConfigID + ".image");
        }
      });
    } else {
      drawable.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
          imageLoader.releaseImage(sConfigID);
        }
      });
    }
    drawable.setData("image", image);
View Full Code Here

    }
    return fgText;
  }

  public void widgetDisposed(DisposeEvent e) {
    ImageLoader imageLoader = ImageLoader.getInstance();
    imageLoader.releaseImage("image.sidebar.closeitem");
    imageLoader.releaseImage("image.sidebar.closeitem-selected");

    final TreeItem treeItem = (TreeItem) e.widget;
    if (treeItem != swtItem) {
      Debug.out("Warning: TreeItem changed for sidebar " + id);
      return;
View Full Code Here

    this.mdiEntry = mdiEntry;

    mdiEntry.addListener(new MdiCloseListener() {

      public void mdiEntryClosed(MdiEntry entry, boolean userClosed) {
        ImageLoader imageLoader = ImageLoader.getInstance();
        if (fullImageID != null) {
          imageLoader.releaseImage(fullImageID);
        }
      }
    });

    setImageID(imageID);
View Full Code Here

  private synchronized void createTimerEvent() {
    if (timerEvent != null) {
      timerEvent.cancel();
    }
    if (images != null && images.length > 1) {
      ImageLoader imageLoader = ImageLoader.getInstance();
      int delay = delayTime == -1 ? imageLoader.getAnimationDelay(imageID)
          : delayTime;

      if (performer == null) {
        performer = new TimerEventPerformer() {
          private boolean exec_pending = false;
View Full Code Here

  }

  public void setImageID(final String id) {
    Utils.execSWTThread(new AERunnable() {
      public void runSupport() {
        ImageLoader imageLoader = ImageLoader.getInstance();
        String newFullImageID = id + suffix;
        if (newFullImageID.equals(fullImageID)) {
          return;
        }
        if (fullImageID != null) {
          imageLoader.releaseImage(fullImageID);
        }
        imageID = id;
        images = imageLoader.getImages(newFullImageID);
        if (images == null || images.length == 0) {
          imageLoader.releaseImage(newFullImageID);
          newFullImageID = id;
          images = imageLoader.getImages(id);
        }
        fullImageID = newFullImageID;
        currentAnimationIndex = 0;
        if (isVisible()) {
          createTimerEvent();
View Full Code Here

    //    }
    canvas.addDisposeListener(new DisposeListener() {
      public void widgetDisposed(DisposeEvent e) {
        String oldImageID = (String) canvas.getData("ImageID");
        if (oldImageID != null && canvas.getData("image") != null) {
          ImageLoader imageLoader = skin.getImageLoader(properties);
          imageLoader.releaseImage(oldImageID);
        }
      }
    });

    // needed to set paint listener and canvas size
View Full Code Here

        String oldImageID = (String) canvas.getData("ImageID");
        if (sImageID != null && sImageID.equals(oldImageID)) {
          return null;
        }

        ImageLoader imageLoader = skin.getImageLoader(properties);

        if (oldImageID != null && canvas.getData("image") != null) {
          imageLoader.releaseImage(oldImageID);
        }
       
        int hpadding = properties.getIntValue(sConfigID + ".h-padding", 0);
        canvas.setData("hpadding", new Long(hpadding));


        Image[] images = sImageID == null || sImageID.length() == 0 ? null
            : imageLoader.getImages(sImageID);

        String sDrawMode = properties.getStringValue(sConfigID + ".drawmode");
        if (sDrawMode == null) {
          sDrawMode = properties.getStringValue(
              SWTSkinObjectImage.this.sConfigID + ".drawmode", "");
        }

        Long drawMode;
        if (sDrawMode.equals("scale")) {
          drawMode = DRAW_SCALE;
        } else if (sDrawMode.equals("stretch")) {
          drawMode = DRAW_STRETCH;
        } else if (sDrawMode.equals("center")) {
          drawMode = DRAW_CENTER;
        } else if (sDrawMode.equals("h-center")) {
          drawMode = DRAW_HCENTER;
        } else if (sDrawMode.equalsIgnoreCase("tile")) {
          drawMode = DRAW_TILE;
        } else if (sDrawMode.equalsIgnoreCase("animate")
            || (sDrawMode.length() == 0 && images != null && images.length > 3)) {
          drawMode = DRAW_ANIMATE;
        } else if (sDrawMode.equalsIgnoreCase("left")) {
          drawMode = DRAW_LEFT;
        } else {
          drawMode = DRAW_NORMAL;
        }
        canvas.setData("drawmode", drawMode);

        Image image = null;

        boolean hasExistingDelay = canvas.getData("delay") != null;
        canvas.setData("delay", null);
        if (images == null) {
          canvas.setData("images", null);
          image = null;
        } else if (drawMode == DRAW_ANIMATE) {
          int animationDelay = ImageLoader.getInstance().getAnimationDelay(sImageID);

          canvas.setData("images", images);
          canvas.setData("ImageIndex", Long.valueOf(0));
          canvas.setData("delay", new Long(animationDelay));
          image = images[0];

          if (!hasExistingDelay) {
            setupAnimationTrigger(animationDelay);
          }
        } else if (images.length == 3) {
          Image imageLeft = images[0];
          if (ImageLoader.isRealImage(imageLeft)) {
            canvas.setData("image-left", imageLeft);
          }

          image = images[1];

          Image imageRight = images[2];
          if (ImageLoader.isRealImage(imageRight)) {
            canvas.setData("image-right", imageRight);
          }
        } else if (images.length > 0) {
          image = images[0];
        }

        if (image == null) {
          image = ImageLoader.noImage;
        }


        //allowImageDimming = sDrawMode.equalsIgnoreCase("dim");
        Rectangle imgBounds = image.getBounds();
        if (drawMode != DRAW_CENTER && drawMode != DRAW_HCENTER
            && drawMode != DRAW_STRETCH) {
          canvas.setSize(imgBounds.width + hpadding, imgBounds.height);
          canvas.setData("oldSize", canvas.getSize());
        }
        //canvas.setData("image", image);

        if (drawMode == DRAW_TILE || drawMode == DRAW_NORMAL || drawMode == DRAW_LEFT
            || drawMode == DRAW_ANIMATE) {
          // XXX Huh? A tile of one? :)
          FormData fd = (FormData) canvas.getLayoutData();
          if (fd == null) {
            fd = new FormData(imgBounds.width  + hpadding, imgBounds.height);
          } else {
            fd.width = imgBounds.width + hpadding;
            fd.height = imgBounds.height;
          }
          canvas.setData("oldSize", new Point(fd.width, fd.height));
          canvas.setLayoutData(fd);
          Utils.relayout(canvas);
        }
       
        // remove in case already added
        canvas.removePaintListener(paintListener);

        canvas.addPaintListener(paintListener);
        canvas.setData("ImageID", sImageID);

        canvas.redraw();

        SWTSkinUtils.addMouseImageChangeListeners(canvas);
        if (drawMode != DRAW_ANIMATE) {
          imageLoader.releaseImage(sImageID);
        }
        return null;
      }
    });
  }
View Full Code Here

  protected void swt_reallySetImage() {
    if (currentImageID == null || customImage) {
      return;
    }
   
    ImageLoader imageLoader = skin.getImageLoader(properties);
    boolean imageExists = imageLoader.imageExists(currentImageID);
    if (!imageExists && imageLoader.imageExists(currentImageID + ".image")) {
      currentImageID = sConfigID + ".image";
      imageExists = true;
    }
    if (!imageExists && suffixes != null) {
      for (int i = suffixes.length - 1; i >= 0; i--) {
        String suffixToRemove = suffixes[i];
        if (suffixToRemove != null) {
          currentImageID = currentImageID.substring(0, currentImageID.length()
              - suffixToRemove.length());
          if (imageLoader.imageExists(currentImageID)) {
            imageExists = true;
            break;
          }
        }
      }
View Full Code Here

    }

    Utils.execSWTThread(new AERunnable() {
      public void runSupport() {
        String fullImageID = imageID + getSuffix();
        ImageLoader imageLoader = skin.getImageLoader(properties);
        Image image = imageLoader.getImage(fullImageID);
        if (ImageLoader.isRealImage(image)) {
          setCanvasImage(sConfigID, fullImageID, callback);
        } else {
          setCanvasImage(sConfigID, imageID, callback);
        }
        imageLoader.releaseImage(fullImageID);
      }
    });
  }
View Full Code Here

TOP

Related Classes of com.aelitis.azureus.ui.swt.imageloader.ImageLoader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.