use of com.biglybt.core.util.AERunnable in project BiglyBT by BiglySoftware.
the class SWTSkinObjectSlider method mouseDown.
// @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent)
@Override
public void mouseDown(MouseEvent e) {
if (disabled) {
return;
}
mouseDown = true;
int offset = imageThumbBounds.width / 2;
int sizeX = maxSize.x;
if (maxSize.x == 0) {
sizeX = canvas.getClientArea().width;
}
float newPercent = (e.x - offset) / (float) (sizeX - imageThumbBounds.width);
if (mouseMoveAdjusts) {
setPercent(newPercent, true);
} else {
draggingPercent = validatePercent(newPercent, true);
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
if (canvas != null && !canvas.isDisposed()) {
canvas.redraw();
canvas.update();
}
}
});
}
}
use of com.biglybt.core.util.AERunnable in project BiglyBT by BiglySoftware.
the class SWTSkinObjectSlider method mouseMove.
// @see org.eclipse.swt.events.MouseMoveListener#mouseMove(org.eclipse.swt.events.MouseEvent)
@Override
public void mouseMove(MouseEvent e) {
if (disabled) {
return;
}
if (mouseDown) {
int offset = imageThumbBounds.width / 2;
int sizeX = maxSize.x;
if (maxSize.x == 0) {
sizeX = canvas.getClientArea().width;
}
float newPercent = (e.x - offset) / (float) (sizeX - imageThumbBounds.width);
if (mouseMoveAdjusts) {
setPercent(newPercent, true);
} else {
draggingPercent = validatePercent(newPercent, true);
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
if (canvas != null && !canvas.isDisposed()) {
canvas.redraw();
canvas.update();
}
}
});
}
}
}
use of com.biglybt.core.util.AERunnable in project BiglyBT by BiglySoftware.
the class SWTSkinObjectText1 method setTextID.
@Override
public void setTextID(final String key) {
if (key == null) {
setText("");
} else if (key.equals(sKey)) {
return;
}
this.sText = MessageText.getString(key);
this.sKey = key;
bIsTextDefault = false;
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
if (label != null && !label.isDisposed()) {
Messages.setLanguageText(label, key);
Utils.relayout(label);
}
}
});
}
use of com.biglybt.core.util.AERunnable in project BiglyBT by BiglySoftware.
the class TaggingView method dataSourceChanged.
private void dataSourceChanged(Object ds) {
boolean wasNull = taggables == null;
if (ds instanceof Taggable) {
taggables = new ArrayList<>();
taggables.add((Taggable) ds);
} else if (ds instanceof Taggable[]) {
taggables = new ArrayList<>();
taggables.addAll(Arrays.asList((Taggable[]) ds));
} else if (ds instanceof Object[]) {
taggables = new ArrayList<>();
Object[] objects = (Object[]) ds;
for (Object o : objects) {
if (o instanceof Taggable) {
Taggable taggable = (Taggable) o;
if (!taggables.contains(taggable)) {
taggables.add(taggable);
}
} else if (o instanceof DiskManagerFileInfo) {
DownloadManager temp = ((DiskManagerFileInfo) o).getDownloadManager();
if (temp != null) {
if (!taggables.contains(temp)) {
taggables.add(temp);
}
}
}
}
if (taggables.size() == 0) {
taggables = null;
}
} else {
taggables = null;
}
boolean isNull = taggables == null;
if (isNull != wasNull) {
TagManager tm = TagManagerFactory.getTagManager();
TagType tagType;
/*
tagType = tm.getTagType(TagType.TT_DOWNLOAD_CATEGORY);
if (isNull) {
tagType.removeTagTypeListener(this);
} else {
tagType.addTagTypeListener(this, false);
}
*/
tagType = tm.getTagType(TagType.TT_DOWNLOAD_MANUAL);
if (isNull) {
tagType.removeTagTypeListener(this);
} else {
tagType.addTagTypeListener(this, false);
}
}
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
swt_updateFields();
}
});
}
use of com.biglybt.core.util.AERunnable in project BiglyBT by BiglySoftware.
the class TorrentOptionsView method dataSourceChanged.
private void dataSourceChanged(Object newDataSource) {
DownloadManagerOptionsHandler[] old_managers = managers;
if (old_managers != null) {
for (int i = 0; i < old_managers.length; i++) {
old_managers[i].removeListener(this);
}
}
if (newDataSource instanceof DownloadManager) {
multi_view = false;
managers = new DownloadManagerOptionsHandler[] { new DMWrapper((DownloadManager) newDataSource) };
} else if (newDataSource instanceof DownloadManagerOptionsHandler) {
multi_view = false;
managers = new DownloadManagerOptionsHandler[] { (DownloadManagerOptionsHandler) newDataSource };
} else if (newDataSource instanceof DownloadManager[]) {
multi_view = true;
Object[] objs = (Object[]) newDataSource;
managers = new DownloadManagerOptionsHandler[objs.length];
for (int i = 0; i < objs.length; i++) {
managers[i] = new DMWrapper((DownloadManager) objs[i]);
}
} else if (newDataSource instanceof Object[]) {
Object[] objs = (Object[]) newDataSource;
if (objs.length > 0) {
if (objs[0] instanceof DownloadManager) {
managers = new DownloadManagerOptionsHandler[objs.length];
for (int i = 0; i < objs.length; i++) {
managers[i] = new DMWrapper((DownloadManager) objs[i]);
}
multi_view = true;
}
}
}
if (parent != null && !parent.isDisposed()) {
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
if (!parent.isDisposed()) {
initialize(parent);
}
}
});
}
}
Aggregations