Search in sources :

Example 6 with ActivitiesEntry

use of com.biglybt.activities.ActivitiesEntry in project BiglyBT by BiglySoftware.

the class ColumnActivityNew 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) {
    ActivitiesEntry entry = (ActivitiesEntry) cell.getDataSource();
    Rectangle cellBounds = cell.getBounds();
    Image img = entry.getReadOn() <= 0 ? imgNew : imgOld;
    if (img != null && !img.isDisposed()) {
        Rectangle imgBounds = img.getBounds();
        gc.drawImage(img, cellBounds.x + ((cellBounds.width - imgBounds.width) / 2), cellBounds.y + ((cellBounds.height - imgBounds.height) / 2));
    }
}
Also used : ActivitiesEntry(com.biglybt.activities.ActivitiesEntry) Rectangle(org.eclipse.swt.graphics.Rectangle) Image(org.eclipse.swt.graphics.Image)

Example 7 with ActivitiesEntry

use of com.biglybt.activities.ActivitiesEntry in project BiglyBT by BiglySoftware.

the class ColumnActivityNew method cellMouseTrigger.

// @see com.biglybt.pif.ui.tables.TableCellMouseListener#cellMouseTrigger(com.biglybt.pif.ui.tables.TableCellMouseEvent)
@Override
public void cellMouseTrigger(final TableCellMouseEvent event) {
    if (event.eventType == TableRowMouseEvent.EVENT_MOUSEDOWN && event.button == 1) {
        ActivitiesEntry entry = (ActivitiesEntry) event.cell.getDataSource();
        if (entry.canFlipRead()) {
            entry.setRead(!entry.isRead());
            event.cell.invalidate();
        }
    }
}
Also used : ActivitiesEntry(com.biglybt.activities.ActivitiesEntry)

Example 8 with ActivitiesEntry

use of com.biglybt.activities.ActivitiesEntry in project BiglyBT by BiglySoftware.

the class ColumnActivityText method setupStringPrinter.

private GCStringPrinter setupStringPrinter(GC gc, TableCellSWT cell) {
    ActivitiesEntry entry = (ActivitiesEntry) cell.getDataSource();
    String text = entry.getText();
    Rectangle drawBounds = getDrawBounds(cell);
    entry.setViewed();
    if (!entry.isRead()) {
        if (font == null) {
            FontData[] fontData = gc.getFont().getFontData();
            fontData[0].setStyle(SWT.BOLD);
            font = new Font(gc.getDevice(), fontData);
        }
        gc.setFont(font);
    }
    int style = SWT.WRAP;
    GCStringPrinter sp = new GCStringPrinter(gc, text, drawBounds, true, true, style);
    sp.calculateMetrics();
    return sp;
}
Also used : GCStringPrinter(com.biglybt.ui.swt.shells.GCStringPrinter) ActivitiesEntry(com.biglybt.activities.ActivitiesEntry)

Example 9 with ActivitiesEntry

use of com.biglybt.activities.ActivitiesEntry in project BiglyBT by BiglySoftware.

the class ColumnActivityText method refresh.

// @see com.biglybt.pif.ui.tables.TableCellRefreshListener#refresh(com.biglybt.pif.ui.tables.TableCell)
@Override
public void refresh(TableCell cell) {
    ActivitiesEntry entry = (ActivitiesEntry) cell.getDataSource();
    cell.setSortValue(entry.getText());
}
Also used : ActivitiesEntry(com.biglybt.activities.ActivitiesEntry)

Example 10 with ActivitiesEntry

use of com.biglybt.activities.ActivitiesEntry in project BiglyBT by BiglySoftware.

the class PlatformVuzeActivitiesMessenger method getEntries.

public static void getEntries(final long agoMS, long maxDelayMS, String reason, final GetEntriesReplyListener replyListener) {
    PlatformMessage message = new PlatformMessage("AZMSG", reason.equals("shown") ? "vznews" : LISTENER_ID, OP_GET, new Object[] { "ago-ms", new Long(agoMS), "reason", reason }, maxDelayMS);
    PlatformMessengerListener listener = null;
    if (replyListener != null) {
        listener = new PlatformMessengerListener() {

            @Override
            public void messageSent(PlatformMessage message) {
            }

            @Override
            public void replyReceived(PlatformMessage message, String replyType, Map reply) {
                ActivitiesEntry[] entries = new ActivitiesEntry[0];
                List entriesList = (List) MapUtils.getMapObject(reply, "entries", null, List.class);
                if (entriesList != null && entriesList.size() > 0) {
                    entries = new ActivitiesEntry[entriesList.size()];
                    int i = 0;
                    for (Iterator iter = entriesList.iterator(); iter.hasNext(); ) {
                        Map platformEntry = (Map) iter.next();
                        if (platformEntry == null) {
                            continue;
                        }
                        entries[i] = ActivitiesManager.createEntryFromMap(platformEntry, false);
                        if (entries[i] != null) {
                            i++;
                        }
                    }
                }
                long refreshInMS = MapUtils.getMapLong(reply, "refresh-in-ms", DEFAULT_RETRY_MS);
                replyListener.gotVuzeNewsEntries(entries, refreshInMS);
            }
        };
    }
    PlatformMessenger.queueMessage(message, listener);
}
Also used : ActivitiesEntry(com.biglybt.activities.ActivitiesEntry) Iterator(java.util.Iterator) List(java.util.List) PlatformMessengerListener(com.biglybt.core.messenger.PlatformMessengerListener) Map(java.util.Map) PlatformMessage(com.biglybt.core.messenger.PlatformMessage)

Aggregations

ActivitiesEntry (com.biglybt.activities.ActivitiesEntry)21 GCStringPrinter (com.biglybt.ui.swt.shells.GCStringPrinter)4 SWTSkinObject (com.biglybt.ui.swt.skin.SWTSkinObject)4 List (java.util.List)4 ISelectedContent (com.biglybt.ui.selectedcontent.ISelectedContent)3 URLInfo (com.biglybt.ui.swt.shells.GCStringPrinter.URLInfo)3 Image (org.eclipse.swt.graphics.Image)3 DownloadManager (com.biglybt.core.download.DownloadManager)2 TOTorrent (com.biglybt.core.torrent.TOTorrent)2 DiskManagerFileInfo (com.biglybt.pif.disk.DiskManagerFileInfo)2 UIFunctionsSWT (com.biglybt.ui.swt.UIFunctionsSWT)2 ImageLoader (com.biglybt.ui.swt.imageloader.ImageLoader)2 TableCellSWT (com.biglybt.ui.swt.views.table.TableCellSWT)2 ArrayList (java.util.ArrayList)2 Rectangle (org.eclipse.swt.graphics.Rectangle)2 ActivitiesListener (com.biglybt.activities.ActivitiesListener)1 TranscodeFile (com.biglybt.core.devices.TranscodeFile)1 TranscodeJob (com.biglybt.core.devices.TranscodeJob)1 GlobalManager (com.biglybt.core.global.GlobalManager)1 PlatformMessage (com.biglybt.core.messenger.PlatformMessage)1