in src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java [445:485]
public int findColoredRow(int startLocation, boolean searchForward) {
List filteredListCopy;
synchronized (mutex) {
filteredListCopy = new ArrayList(filteredList);
}
if (searchForward) {
for (int i = startLocation; i < filteredListCopy.size(); i++) {
LoggingEventWrapper event = (LoggingEventWrapper) filteredListCopy.get(i);
if (!event.getColorRuleBackground().equals(ChainsawConstants.COLOR_DEFAULT_BACKGROUND) ||
!event.getColorRuleForeground().equals(ChainsawConstants.COLOR_DEFAULT_FOREGROUND)) {
return i;
}
}
//searching forward, no colorized event was found - now start at row zero and go to startLocation
for (int i = 0; i < startLocation; i++) {
LoggingEventWrapper event = (LoggingEventWrapper) filteredListCopy.get(i);
if (!event.getColorRuleBackground().equals(ChainsawConstants.COLOR_DEFAULT_BACKGROUND) ||
!event.getColorRuleForeground().equals(ChainsawConstants.COLOR_DEFAULT_FOREGROUND)) {
return i;
}
}
} else {
for (int i = startLocation; i > -1; i--) {
LoggingEventWrapper event = (LoggingEventWrapper) filteredListCopy.get(i);
if (!event.getColorRuleBackground().equals(ChainsawConstants.COLOR_DEFAULT_BACKGROUND) ||
!event.getColorRuleForeground().equals(ChainsawConstants.COLOR_DEFAULT_FOREGROUND)) {
return i;
}
}
//searching backward, no colorized event was found - now start at list.size() - 1 and go to startLocation
for (int i = filteredListCopy.size() - 1; i > startLocation; i--) {
LoggingEventWrapper event = (LoggingEventWrapper) filteredListCopy.get(i);
if (!event.getColorRuleBackground().equals(ChainsawConstants.COLOR_DEFAULT_BACKGROUND) ||
!event.getColorRuleForeground().equals(ChainsawConstants.COLOR_DEFAULT_FOREGROUND)) {
return i;
}
}
}
return -1;
}