use of com.biglybt.core.subs.Subscription in project BiglyBT by BiglySoftware.
the class BuddyPluginViewBetaChat method checkSubscriptions.
private void checkSubscriptions(boolean ftux_change) {
Subscription[] subs = SubscriptionManagerFactory.getSingleton().getSubscriptions();
for (Subscription sub : subs) {
try {
Engine e = sub.getEngine();
if (e instanceof WebEngine) {
String url = ((WebEngine) e).getSearchUrl();
if (isRSSURL(url, chat)) {
if (ftux_change) {
SubscriptionResult[] results = sub.getResults(false);
for (SubscriptionResult r : results) {
Map<Integer, Object> properties = r.toPropertyMap();
String name = (String) properties.get(SearchResult.PR_NAME);
if (name.equals(BuddyPluginBeta.RSS_ITEMS_UNAVAILABLE)) {
r.delete();
}
}
} else {
sub.getManager().getScheduler().downloadAsync(sub, true);
}
}
}
} catch (Throwable e) {
}
}
}
use of com.biglybt.core.subs.Subscription in project BiglyBT by BiglySoftware.
the class ColumnSubscriptionNew 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, TableCellSWT cell) {
Subscription sub = (Subscription) cell.getDataSource();
if (sub.getHistory().getNumUnread() > 0) {
Rectangle cellBounds = cell.getBounds();
gc.drawImage(imgNew, cellBounds.x + ((cellBounds.width - imgBounds.width) / 2), cellBounds.y + ((cellBounds.height - imgBounds.height) / 2));
}
}
use of com.biglybt.core.subs.Subscription in project BiglyBT by BiglySoftware.
the class ColumnSubscriptionNew method refresh.
// @see com.biglybt.pif.ui.tables.TableCellRefreshListener#refresh(com.biglybt.pif.ui.tables.TableCell)
@Override
public void refresh(TableCell cell) {
Subscription sub = (Subscription) cell.getDataSource();
boolean isRead = sub.getHistory().getNumUnread() > 0;
int sortVal = isRead ? 1 : 0;
if (!cell.setSortValue(sortVal) && cell.isValid()) {
return;
}
cell.invalidate();
}
use of com.biglybt.core.subs.Subscription in project BiglyBT by BiglySoftware.
the class ColumnSubscriptionParent method refresh.
@Override
public void refresh(TableCell cell) {
String parent = "";
Subscription sub = (Subscription) cell.getDataSource();
if (sub != null) {
parent = sub.getParent();
}
if (!cell.setSortValue(parent) && cell.isValid()) {
return;
}
if (!cell.isShown()) {
return;
}
cell.setText(parent);
}
use of com.biglybt.core.subs.Subscription in project BiglyBT by BiglySoftware.
the class ColumnSubscriptionSubscribers method refresh.
@Override
public void refresh(TableCell cell) {
int nbSubsribers = 0;
Subscription sub = (Subscription) cell.getDataSource();
if (sub != null) {
nbSubsribers = (int) sub.getCachedPopularity();
}
if (!cell.setSortValue(nbSubsribers) && cell.isValid()) {
return;
}
if (!cell.isShown()) {
return;
}
if (nbSubsribers < 0) {
cell.setText("");
} else {
cell.setText("" + nbSubsribers);
}
return;
}
Aggregations