Search in sources :

Example 51 with ImageLoader

use of com.biglybt.ui.swt.imageloader.ImageLoader in project BiglyBT by BiglySoftware.

the class ProgressReporterPanel method initControls.

/**
 * Initialize the controls with information from the given <code>IProgressReport</code>
 * @param pReport
 */
private void initControls(IProgressReport pReport) {
    /*
		 * Image
		 */
    if (null != pReport.getImage()) {
        imageLabel.setImage(pReport.getImage());
    } else {
        imageLabel.setImage(getDisplay().getSystemImage(SWT.ICON_INFORMATION));
    }
    /*
		 * Name label
		 */
    nameLabel.setText(formatForDisplay(pReport.getName()));
    /*
		 * Action labels
		 */
    ImageLoader imageLoader = ImageLoader.getInstance();
    imageLoader.setLabelImage(actionLabel_cancel, "progress_cancel");
    imageLoader.setLabelImage(actionLabel_remove, "progress_remove");
    imageLoader.setLabelImage(actionLabel_retry, "progress_retry");
    Utils.setTT(actionLabel_cancel, MessageText.getString("Progress.reporting.action.label.cancel.tooltip"));
    Utils.setTT(actionLabel_remove, MessageText.getString("Progress.reporting.action.label.remove.tooltip"));
    Utils.setTT(actionLabel_retry, MessageText.getString("Progress.reporting.action.label.retry.tooltip"));
    /* ========================================
		 * Catch up on any messages we might have missed
		 */
    {
        if (pReport.isInErrorState()) {
            updateStatusLabel(MessageText.getString("Progress.reporting.default.error"), true);
        } else if (pReport.isDone()) {
            updateStatusLabel(MessageText.getString("Progress.reporting.status.finished"), false);
        } else if (pReport.isCanceled()) {
            updateStatusLabel(MessageText.getString("Progress.reporting.status.canceled"), false);
        } else if (pReport.isIndeterminate()) {
            updateStatusLabel(Constants.INFINITY_STRING, false);
        } else {
            updateStatusLabel(pReport.getPercentage() + "%", false);
        }
    }
    /*
		 * Synch the progress bar
		 */
    synchProgressBar(pReport);
    /*
		 * Synch the action label according to existing properties of the ProgressReport
		 */
    synchActionLabels(pReport);
}
Also used : ImageLoader(com.biglybt.ui.swt.imageloader.ImageLoader)

Example 52 with ImageLoader

use of com.biglybt.ui.swt.imageloader.ImageLoader in project BiglyBT by BiglySoftware.

the class UISWTStatusEntryImpl method releaseOldImages.

/**
 * @since 4.0.0.5
 */
private void releaseOldImages() {
    if (imageIDstoDispose.size() > 0) {
        ImageLoader imageLoader = ImageLoader.getInstance();
        for (Iterator iter = imageIDstoDispose.iterator(); iter.hasNext(); ) {
            String id = (String) iter.next();
            imageLoader.releaseImage(id);
            iter.remove();
        }
    }
}
Also used : Iterator(java.util.Iterator) ImageLoader(com.biglybt.ui.swt.imageloader.ImageLoader)

Example 53 with ImageLoader

use of com.biglybt.ui.swt.imageloader.ImageLoader in project BiglyBT by BiglySoftware.

the class ConfigSectionPluginsSWT method deleteConfigSection.

@Override
public void deleteConfigSection() {
    super.deleteConfigSection();
    ImageLoader imageLoader = ImageLoader.getInstance();
    imageLoader.releaseImage("redled");
    imageLoader.releaseImage("greenled");
}
Also used : ImageLoader(com.biglybt.ui.swt.imageloader.ImageLoader)

Example 54 with ImageLoader

use of com.biglybt.ui.swt.imageloader.ImageLoader in project BiglyBT by BiglySoftware.

the class ColumnImageClickArea method setImageID.

/**
 * @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;
        }
    }
    this.image = null;
}
Also used : ImageLoader(com.biglybt.ui.swt.imageloader.ImageLoader)

Example 55 with ImageLoader

use of com.biglybt.ui.swt.imageloader.ImageLoader in project BiglyBT by BiglySoftware.

the class ColumnActivityType method cellPaint.

// @see com.biglybt.ui.swt.views.table.TableCellSWTPaintListener#cellPaint(org.eclipse.swt.graphics.GC, com.biglybt.pif.ui.tables.TableCell)
@Override
public void cellPaint(GC gc, final TableCellSWT cell) {
    ActivitiesEntry entry = (ActivitiesEntry) cell.getDataSource();
    Image imgIcon;
    String iconID = entry.getIconID();
    if (iconID != null) {
        ImageLoader imageLoader = ImageLoader.getInstance();
        if (iconID.startsWith("http")) {
            imgIcon = imageLoader.getUrlImage(iconID, new ImageDownloaderListener() {

                @Override
                public void imageDownloaded(Image image, String key, boolean returnedImmediately) {
                    if (returnedImmediately) {
                        return;
                    }
                    cell.invalidate();
                }
            });
            if (imgIcon == null) {
                return;
            }
        } else {
            imgIcon = imageLoader.getImage(iconID);
        }
        if (ImageLoader.isRealImage(imgIcon)) {
            Rectangle cellBounds = cell.getBounds();
            Rectangle imgBounds = imgIcon.getBounds();
            gc.drawImage(imgIcon, cellBounds.x + ((cellBounds.width - imgBounds.width) / 2), cellBounds.y + ((cellBounds.height - imgBounds.height) / 2));
        }
        imageLoader.releaseImage(iconID);
    }
}
Also used : ActivitiesEntry(com.biglybt.activities.ActivitiesEntry) Rectangle(org.eclipse.swt.graphics.Rectangle) ImageDownloaderListener(com.biglybt.ui.swt.imageloader.ImageLoader.ImageDownloaderListener) Image(org.eclipse.swt.graphics.Image) ImageLoader(com.biglybt.ui.swt.imageloader.ImageLoader)

Aggregations

ImageLoader (com.biglybt.ui.swt.imageloader.ImageLoader)78 Image (org.eclipse.swt.graphics.Image)20 GridData (org.eclipse.swt.layout.GridData)16 GridLayout (org.eclipse.swt.layout.GridLayout)16 Rectangle (org.eclipse.swt.graphics.Rectangle)6 MessageText (com.biglybt.core.internat.MessageText)5 AERunnable (com.biglybt.core.util.AERunnable)5 UIFunctions (com.biglybt.ui.UIFunctions)5 UserPrompterResultListener (com.biglybt.ui.UserPrompterResultListener)5 File (java.io.File)5 ArrayList (java.util.ArrayList)5 Core (com.biglybt.core.Core)4 CoreRunningListener (com.biglybt.core.CoreRunningListener)4 MessageBoxShell (com.biglybt.ui.swt.shells.MessageBoxShell)4 MouseAdapter (org.eclipse.swt.events.MouseAdapter)4 MouseEvent (org.eclipse.swt.events.MouseEvent)4 Point (org.eclipse.swt.graphics.Point)4 Subscription (com.biglybt.core.subs.Subscription)3 MenuItem (com.biglybt.pif.ui.menus.MenuItem)3 TableColumnCreationListener (com.biglybt.pif.ui.tables.TableColumnCreationListener)3