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);
}
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();
}
}
}
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");
}
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;
}
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);
}
}
Aggregations