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

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


   * @param imageID2
   *
   * @since 3.0.1.5
   */
  public void setImageID(String imageID) {
    ImageLoader imageLoader = ImageLoader.getInstance();
    if (imgOver != null) {
      imageLoader.releaseImage(this.imageID + "-over");
    }
    if (imgOnRow != null) {
      imageLoader.releaseImage(this.imageID + "-mouseonrow");
    }
    if (imgOffRow != null) {
      imageLoader.releaseImage(this.imageID);
    }

    this.imageID = imageID;
    if (imageID == null) {
      imgOffRow = null;
      imgOnRow = null;
    } else {
      imgOnRow = imageLoader.getImage(imageID + "-mouseonrow");
      imgOver = imageLoader.getImage(imageID + "-over");
      imgOffRow = imageLoader.getImage(imageID);
      if (!ImageLoader.isRealImage(imgOnRow)) {
        imgOnRow = imgOffRow;
      }
      if (!ImageLoader.isRealImage(imgOver)) {
        imgOver = imgOffRow;
View Full Code Here


  public SWTSkinObjectSlider(SWTSkin skin, SWTSkinProperties skinProperties,
      String sID, String sConfigID, String[] typeParams, SWTSkinObject parent) {
    super(skin, skinProperties, sID, sConfigID, "slider", parent);

    String sSuffix = ".complete";
    final ImageLoader imageLoader = skin.getImageLoader(properties);
   
    String imagePrefix = sConfigID + sSuffix;
    Image[] images = imageLoader.getImages(imagePrefix);
    imagesToRelease.add(imagePrefix);
    if (images.length == 1 && ImageLoader.isRealImage(images[0])) {
      imageFG = images[0];
      imageFGLeft = imageLoader.getImage(imagePrefix + "-left");
      imageFGRight = imageLoader.getImage(imagePrefix + "-right");
      imagesToRelease.add(imagePrefix + "-left");
      imagesToRelease.add(imagePrefix + "-right");
    } else if (images.length == 3 && ImageLoader.isRealImage(images[2])) {
      imageFGLeft = images[0];
      imageFG = images[1];
      imageFGRight = images[2];
    }

    if (imageFG != null) {
      imageFGbounds = imageFG.getBounds();
    }

    sSuffix = ".incomplete";
    imagePrefix = sConfigID + sSuffix;
    images = imageLoader.getImages(imagePrefix);
    imagesToRelease.add(imagePrefix);
    if (images.length == 1 && ImageLoader.isRealImage(images[0])) {
      imageBG = images[0];
      imageBGLeft = imageLoader.getImage(imagePrefix + "-left");
      imageBGRight = imageLoader.getImage(imagePrefix + "-right");
      imagesToRelease.add(imagePrefix + "-left");
      imagesToRelease.add(imagePrefix + "-right");
    } else if (images.length == 3 && ImageLoader.isRealImage(images[2])) {
      imageBGLeft = images[0];
      imageBG = images[1];
      imageBGRight = images[2];
    }

    if (imageBG != null) {
      imageBGbounds = imageBG.getBounds();
    }

    sSuffix = ".thumb";
    imagePrefix = sConfigID + sSuffix;
    images = imageLoader.getImages(imagePrefix);
    imagesToRelease.add(imagePrefix);
    if (images.length == 1) {
      imageThumb = images[0];
      imageThumbLeft = imageLoader.getImage(imagePrefix + "-left");
      imageThumbRight = imageLoader.getImage(imagePrefix + "-right");
      imagesToRelease.add(imagePrefix + "-left");
      imagesToRelease.add(imagePrefix + "-right");
    } else if (images.length == 3 && ImageLoader.isRealImage(images[2])) {
      imageThumbLeft = images[0];
      imageThumb = images[1];
      imageThumbRight = images[2];
    }

    if (imageThumb != null) {
      imageThumbBounds = imageThumb.getBounds();
    }

    maxSize = buildMaxSize(new Rectangle[] {
      imageThumbBounds,
      imageBGbounds,
      imageFGbounds
    });

    if (skinProperties.getStringValue(sConfigID + ".width", "").equalsIgnoreCase(
        "auto")) {
      maxSize.x = 0;
    }

    int style = SWT.NONE;

    if (skinProperties.getIntValue(sConfigID + ".border", 0) == 1) {
      style |= SWT.BORDER;
    }

    Composite createOn;
    if (parent == null) {
      createOn = skin.getShell();
    } else {
      createOn = (Composite) parent.getControl();
    }

    canvas = new Canvas(createOn, style);
    canvas.setLayoutData(new FormData(maxSize.x == 0 ? SWT.DEFAULT
        : maxSize.x, maxSize.y));
    canvas.setSize(SWT.DEFAULT, maxSize.y);
    setControl(canvas);
   
    canvas.addDisposeListener(new DisposeListener() {
      public void widgetDisposed(DisposeEvent e) {
        try {
          for (String key : imagesToRelease) {
            imageLoader.releaseImage(key);
          }
        } catch (Exception ex) {
          Debug.out(ex);
        }
      }
View Full Code Here

    });
    gridData = new GridData(GridData.FILL_VERTICAL);
    gridData.heightHint = 50;
    gridData.widthHint = 100;
    if (iconURL != null) {
      ImageLoader imageLoader = ImageLoader.getInstance();
      Image image = imageLoader.getUrlImage(iconURL,
          new ImageDownloaderListener() {
            public void imageDownloaded(Image image, boolean returnedImmediately) {
              if (!returnedImmediately) {
                if (lblImage.isDisposed()) {
                  return;
View Full Code Here

    if (isShare) {
      image_name += "_shared";
    }

    ImageLoader imageLoader = ImageLoader.getInstance();
    Image img = imageLoader.getImage(image_name);

    try {
      Rectangle cellBounds = cell.getBounds();
 
      if (img != null && !img.isDisposed()) {
        Rectangle imgBounds = img.getBounds();
        gc.drawImage(img, cellBounds.x
            + ((cellBounds.width - imgBounds.width) / 2), cellBounds.y
            + ((cellBounds.height - imgBounds.height) / 2));
      }
    } finally {
      imageLoader.releaseImage(image_name);
    }
  }
View Full Code Here

    } catch (NoSuchFieldError e) {
      /* Ignore for Pre 3.0 SWT.. */
    }
    shell.setLayout(layout);
   
    ImageLoader imageLoader = ImageLoader.getInstance();
    Image popup_image = imageLoader.getImage("popup");

    // this code is here to ensure that we can still show error messages even if images
    // are failing to load (e.g. coz there's a ! in AZ install dir... )

    GC gcImage = null;
    if (ImageLoader.isRealImage(popup_image)) {
      shellImg = new Image(display, popup_image, SWT.IMAGE_COPY);
      popupWidth = popup_image.getBounds().width;
      popupHeight = popup_image.getBounds().height;
    } else {
      shellImg = new Image(display,
          new Rectangle(0, 0, popupWidth, popupHeight));
    }
    imageLoader.releaseImage("popup");

    shell.setSize(popupWidth, popupHeight);

    gcImage = new GC(shellImg);

    Image imgIcon = imageLoader.getImage(icon);
    int iconWidth = 0;
    int iconHeight = 15;
    if (ImageLoader.isRealImage(imgIcon)) {
      gcImage.drawImage(imgIcon, 5, 5);
      iconWidth = imgIcon.getBounds().width;
      iconHeight = imgIcon.getBounds().height;
    }
    imageLoader.releaseImage(icon);
     

    Font tempFont = shell.getFont();
    FontData[] fontDataMain = tempFont.getFontData();
    for (int i = 0; i < fontDataMain.length; i++) {
View Full Code Here

    //}
   
    final Display display = Display.getDefault();
    final Shell shell = new Shell(display, SWT.SHELL_TRIM);

    ImageLoader imageLoader = ImageLoader.getInstance();
   
    final Image[] images = {
      imageLoader.getImage("azureus32"),
      imageLoader.getImage("azureus64"),
      imageLoader.getImage("azureus"),
      imageLoader.getImage("azureus128"),
    };

    //final String text = "Opil Wrir, Na Poys Iysk, Yann Only. test of the string printer averlongwordthisisyesindeed";
    final String text = "Apple <A HREF=\"aa\">Banana</a>, Cow <A HREF=\"ss\">Dug Ergo</a>, Flip Only. test of the string printer averlongwordthisisyesindeed " + Constants.INFINITY_STRING;
    //final String text = "Apple, Cow sfjkhsd %1 f, Flip Only. test of %0 the string printer averlongwordthisisyesindeed";
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.