Download dl = (Download) cell.getDataSource();
if (dl == null)
return;
DefaultRankCalculator dlData = null;
Object o = cell.getSortValue();
if (o instanceof DefaultRankCalculator)
dlData = (DefaultRankCalculator) o;
else {
dlData = (DefaultRankCalculator) downloadDataMap.get(dl);
cell.setSortValue(dlData);
}
if (dlData == null)
return;
long sr = dl.getSeedingRank();
String sText = "";
if (sr >= 0) {
if (dlData.getCachedIsFP())
sText += MessageText.getString("StartStopRules.firstPriority") + " ";
if (iRankType == StartStopRulesDefaultPlugin.RANK_TIMED) {
//sText += "" + sr + " ";
if (sr > DefaultRankCalculator.SR_TIMED_QUEUED_ENDS_AT) {
long timeStarted = dl.getStats().getTimeStartedSeeding();
long timeLeft;
if (dl.isForceStart())
timeLeft = Constants.INFINITY_AS_INT;
else if (timeStarted <= 0)
timeLeft = minTimeAlive;
else
timeLeft = (minTimeAlive - (SystemTime.getCurrentTime() - timeStarted));
sText += TimeFormatter.format(timeLeft / 1000);
} else if (sr > 0) {
sText += MessageText.getString("StartStopRules.waiting");
}
} else if (sr > 0) {
sText += String.valueOf(sr);
}
} else if (sr == DefaultRankCalculator.SR_FP0PEERS)
sText = MessageText.getString("StartStopRules.FP0Peers");
else if (sr == DefaultRankCalculator.SR_FP_SPRATIOMET)
sText = MessageText.getString("StartStopRules.SPratioMet");
else if (sr == DefaultRankCalculator.SR_RATIOMET)
sText = MessageText.getString("StartStopRules.ratioMet");
else if (sr == DefaultRankCalculator.SR_NUMSEEDSMET)
sText = MessageText.getString("StartStopRules.numSeedsMet");
else if (sr == DefaultRankCalculator.SR_NOTQUEUED)
sText = "";
else if (sr == DefaultRankCalculator.SR_0PEERS)
sText = MessageText.getString("StartStopRules.0Peers");
else if (sr == DefaultRankCalculator.SR_SHARERATIOMET)
sText = MessageText.getString("StartStopRules.shareRatioMet");
else {
sText = "ERR" + sr;
}
// Add a Star if it's before minTimeAlive
if (SystemTime.getCurrentTime() - dl.getStats().getTimeStartedSeeding() < minTimeAlive)
sText = "* " + sText;
cell.setText(sText);
if (bDebugLog) {
cell.setToolTip("FP:\n" + dlData.sExplainFP + "\n" + "SR:" + dlData.sExplainSR
+ "\n" + "TRACE:\n" + dlData.sTrace);
} else {
cell.setToolTip(null);
}