Skip to content

Commit

Permalink
Fix #113 - Table sorting display markers at their correct place. Corr…
Browse files Browse the repository at this point in the history
…ectly places markers at list's last element.
  • Loading branch information
maribeiro authored and paulosousadias committed Nov 13, 2019
1 parent c28f7bc commit 2c4e17b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pt/lsts/neptus/util/llf/LogTableVisualization.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole
if (value != null)
setText(fmt.format(new Date((Long) value)));
}
if (markerList.containsKey(row)) {
if (markerList.containsKey(table.getRowSorter().convertRowIndexToModel(row))) {
setForeground(Color.RED);
setToolTipText(I18n.text("Marker") + ": " + markerList.get(row).getLabel());
setToolTipText(I18n.text("Marker") + ": " + markerList.get(table.getRowSorter().convertRowIndexToModel(row)).getLabel());
}
return this;
}
Expand Down Expand Up @@ -350,8 +350,8 @@ public void addLogMarker(LogMarker marker) {
long smallestTimestampDiff = Long.MAX_VALUE;
int iTSMarker = -1;

for (int i = 0; i < log.getNumberOfEntries() - 1; i++) {
long timestampDiff = Math.abs(((long) model.getValueAt(i, 0)) - timestamp);
for (int i = 0; i < log.getNumberOfEntries(); i++) {
long timestampDiff = Math.abs(((long) model.getValueAt(table.getRowSorter().convertRowIndexToModel(i), 0)) - timestamp);
if(timestampDiff > 500) {
continue;
}
Expand Down

0 comments on commit 2c4e17b

Please sign in to comment.