Search in sources :

Example 1 with Subscription

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) {
        }
    }
}
Also used : SubscriptionResult(com.biglybt.core.subs.SubscriptionResult) Subscription(com.biglybt.core.subs.Subscription) WebEngine(com.biglybt.core.metasearch.impl.web.WebEngine) Engine(com.biglybt.core.metasearch.Engine) WebEngine(com.biglybt.core.metasearch.impl.web.WebEngine)

Example 2 with Subscription

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));
    }
}
Also used : Rectangle(org.eclipse.swt.graphics.Rectangle) Subscription(com.biglybt.core.subs.Subscription)

Example 3 with Subscription

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();
}
Also used : Subscription(com.biglybt.core.subs.Subscription)

Example 4 with Subscription

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);
}
Also used : Subscription(com.biglybt.core.subs.Subscription)

Example 5 with Subscription

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;
}
Also used : Subscription(com.biglybt.core.subs.Subscription)

Aggregations

Subscription (com.biglybt.core.subs.Subscription)34 WebEngine (com.biglybt.core.metasearch.impl.web.WebEngine)7 Engine (com.biglybt.core.metasearch.Engine)5 SubscriptionException (com.biglybt.core.subs.SubscriptionException)5 VuzeFile (com.biglybt.core.vuzefile.VuzeFile)4 URL (java.net.URL)4 Rectangle (org.eclipse.swt.graphics.Rectangle)4 PluginEngine (com.biglybt.core.metasearch.impl.plugin.PluginEngine)3 SubscriptionHistory (com.biglybt.core.subs.SubscriptionHistory)3 SubscriptionResult (com.biglybt.core.subs.SubscriptionResult)3 AERunnable (com.biglybt.core.util.AERunnable)3 TableCellAddedListener (com.biglybt.pif.ui.tables.TableCellAddedListener)3 TableCellRefreshListener (com.biglybt.pif.ui.tables.TableCellRefreshListener)3 TableColumnCreationListener (com.biglybt.pif.ui.tables.TableColumnCreationListener)3 MultipleDocumentInterface (com.biglybt.ui.mdi.MultipleDocumentInterface)3 TableCellSWTPaintListener (com.biglybt.ui.swt.views.table.TableCellSWTPaintListener)3 FormAttachment (org.eclipse.swt.layout.FormAttachment)3 FormData (org.eclipse.swt.layout.FormData)3 FormLayout (org.eclipse.swt.layout.FormLayout)3 Event (org.eclipse.swt.widgets.Event)3