mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
maintain selection when the table contents change
This commit is contained in:
parent
27f53ddc88
commit
795c40d169
@ -149,6 +149,10 @@ class ListTimeline extends BorderPane {
|
||||
table.getItems().clear();
|
||||
}
|
||||
|
||||
Long getSelectedEventID() {
|
||||
return table.getSelectionModel().getSelectedItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Collection of events (by ID) to show in the table.
|
||||
*
|
||||
@ -169,6 +173,13 @@ class ListTimeline extends BorderPane {
|
||||
return table.getSelectionModel().getSelectedItems();
|
||||
}
|
||||
|
||||
void selectEventID(Long selectedEventID) {
|
||||
//restore selection.
|
||||
table.scrollTo(selectedEventID);
|
||||
table.getSelectionModel().select(selectedEventID);
|
||||
table.requestFocus();
|
||||
}
|
||||
|
||||
/**
|
||||
* TableCell to show the icon for the type of an event.
|
||||
*/
|
||||
|
@ -73,7 +73,7 @@ public class ListViewPane extends AbstractTimeLineView {
|
||||
|
||||
@Override
|
||||
protected void clearData() {
|
||||
listChart.clear();
|
||||
|
||||
}
|
||||
|
||||
private static class ListViewSettingsPane extends Parent {
|
||||
@ -96,13 +96,18 @@ public class ListViewPane extends AbstractTimeLineView {
|
||||
}
|
||||
FilteredEventsModel eventsModel = getEventsModel();
|
||||
|
||||
Long selectedEventID = listChart.getSelectedEventID();
|
||||
|
||||
//clear the chart and set the horixontal axis
|
||||
resetView(eventsModel.getTimeRange());
|
||||
|
||||
updateMessage("Querying db for events");
|
||||
//get the event stripes to be displayed
|
||||
List<Long> eventIDs = eventsModel.getEventIDs();
|
||||
Platform.runLater(() -> listChart.setEventIDs(eventIDs));
|
||||
Platform.runLater(() -> {
|
||||
listChart.setEventIDs(eventIDs);
|
||||
listChart.selectEventID(selectedEventID);
|
||||
});
|
||||
|
||||
updateMessage("updating ui");
|
||||
return eventIDs.isEmpty() == false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user