use of com.biglybt.ui.swt.utils.SearchSubsResultBase in project BiglyBT by BiglySoftware.
the class ColumnSearchSubResultActions method refresh.
@Override
public void refresh(TableCell cell) {
SearchSubsResultBase entry = (SearchSubsResultBase) cell.getDataSource();
if (entry == null)
return;
String link = entry.getTorrentLink();
String details = entry.getDetailsLink();
if (!cell.setSortValue(link) && cell.isValid()) {
return;
}
boolean canDL = link != null && link.length() > 0;
boolean canDetails = details != null && details.length() > 0;
StringBuilder sb = new StringBuilder();
if (canDL) {
if (sb.length() > 0) {
sb.append(" | ");
}
String action;
if (link.startsWith("chat:")) {
action = MessageText.getString("label.view");
} else if (link.startsWith("azplug:?id=subscription")) {
action = MessageText.getString("subscriptions.listwindow.subscribe");
} else {
action = MessageText.getString("label.download");
}
sb.append("<A HREF=\"download\">" + action + "</A>");
}
if (canDetails) {
if (sb.length() > 0) {
sb.append(", ");
}
sb.append("<A HREF=\"details\">" + MessageText.getString("label.details") + "</A>");
}
cell.getTableRow().setData("text", sb.toString());
}
use of com.biglybt.ui.swt.utils.SearchSubsResultBase in project BiglyBT by BiglySoftware.
the class ColumnSearchSubResultActions method cellPaint.
@Override
public void cellPaint(GC gc, TableCellSWT cell) {
SearchSubsResultBase entry = (SearchSubsResultBase) cell.getDataSource();
if (entry == null) {
return;
}
TableRow row = cell.getTableRow();
if (row == null) {
return;
}
String text = (String) row.getData("text");
if (text != null && text.length() > 0) {
if (font == null) {
FontData[] fontData = gc.getFont().getFontData();
fontData[0].setStyle(SWT.BOLD);
font = new Font(gc.getDevice(), fontData);
}
gc.setFont(font);
Rectangle bounds = getDrawBounds(cell);
GCStringPrinter sp = new GCStringPrinter(gc, text, bounds, true, true, SWT.WRAP | SWT.CENTER);
sp.calculateMetrics();
if (sp.hasHitUrl()) {
URLInfo[] hitUrlInfo = sp.getHitUrlInfo();
for (int i = 0; i < hitUrlInfo.length; i++) {
URLInfo info = hitUrlInfo[i];
// handle fake row when showing in column editor
info.urlUnderline = cell.getTableRow() == null || cell.getTableRow().isSelected();
if (info.urlUnderline) {
info.urlColor = null;
} else {
info.urlColor = colorLinkNormal;
}
}
int[] mouseOfs = cell.getMouseOffset();
if (mouseOfs != null) {
Rectangle realBounds = cell.getBounds();
URLInfo hitUrl = sp.getHitUrl(mouseOfs[0] + realBounds.x, mouseOfs[1] + realBounds.y);
if (hitUrl != null) {
hitUrl.urlColor = colorLinkHover;
}
}
}
sp.printString();
}
}
use of com.biglybt.ui.swt.utils.SearchSubsResultBase in project BiglyBT by BiglySoftware.
the class ColumnSearchSubResultCategory method refresh.
@Override
public void refresh(TableCell cell) {
SearchSubsResultBase result = (SearchSubsResultBase) cell.getDataSource();
String str = result.getCategory();
if (!cell.setSortValue(str) && cell.isValid()) {
return;
}
if (!cell.isShown()) {
return;
}
cell.setText(str);
return;
}
use of com.biglybt.ui.swt.utils.SearchSubsResultBase in project BiglyBT by BiglySoftware.
the class ColumnSearchSubResultExisting method refresh.
@Override
public void refresh(TableCell cell) {
SearchSubsResultBase result = (SearchSubsResultBase) cell.getDataSource();
int status = SearchSubsUtils.getHashStatus(result);
if (!cell.setSortValue(status) && cell.isValid()) {
return;
}
if (!cell.isShown()) {
return;
}
cell.setText(messages[status]);
}
use of com.biglybt.ui.swt.utils.SearchSubsResultBase in project BiglyBT by BiglySoftware.
the class ColumnSearchSubResultName method refresh.
@Override
public void refresh(TableCell cell) {
SearchSubsResultBase result = (SearchSubsResultBase) cell.getDataSource();
String str = result.getName();
if (!cell.setSortValue(str) && cell.isValid()) {
return;
}
if (!cell.isShown()) {
return;
}
cell.setText(str);
return;
}
Aggregations