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