Autopsy  4.20.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
ListViewPane.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2016 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.timeline.ui.listvew;
20 
21 import com.google.common.collect.ImmutableList;
22 import com.google.common.collect.ImmutableSet;
23 import com.google.common.eventbus.Subscribe;
24 import java.util.List;
25 import java.util.Set;
26 import javafx.application.Platform;
27 import javafx.concurrent.Task;
28 import javafx.scene.Node;
29 import org.joda.time.Interval;
30 import org.openide.util.NbBundle;
38 
42 public class ListViewPane extends AbstractTimeLineView {
43 
44  private final ListTimeline listTimeline;
46 
53  super(controller);
54  listViewModel = new ListViewModel(getEventsModel());
55  listTimeline = new ListTimeline(controller);
56 
57  //initialize chart;
58  setCenter(listTimeline);
59 
60  }
61 
62  @Override
63  protected Task<Boolean> getNewUpdateTask() {
64  return new ListUpdateTask();
65  }
66 
72  @Override
73  protected void clearData() {
74 
75  }
76 
77  @Override
78  final protected ViewMode getViewMode() {
79  return ViewMode.LIST;
80  }
81 
82  @Override
83  protected ImmutableList<Node> getSettingsControls() {
84  return ImmutableList.of();
85  }
86 
87  @Override
88  protected ImmutableList<Node> getTimeNavigationControls() {
89  return ImmutableList.copyOf(listTimeline.getTimeNavigationControls());
90  }
91 
92  @Override
93  protected boolean hasCustomTimeNavigationControls() {
94  return true;
95  }
96 
97  @Subscribe
99  listTimeline.selectEvents(event.getEventIDs());
100  }
101 
102  private class ListUpdateTask extends ViewRefreshTask<Interval> {
103 
104  @NbBundle.Messages({
105  "ListViewPane.loggedTask.queryDb=Retrieving event data",
106  "ListViewPane.loggedTask.name=Updating List View",
107  "ListViewPane.loggedTask.updateUI=Populating view"})
108  ListUpdateTask() {
109  super(Bundle.ListViewPane_loggedTask_name(), true);
110  }
111 
112  @Override
113  protected Boolean call() throws Exception {
114  super.call();
115  if (isCancelled()) {
116  return null;
117  }
118 
119  EventsModel eventsModel = getEventsModel();
120 
121  Set<Long> selectedEventIDs;
123  //grab the currently selected event
124  synchronized (controller) {
125  selectedEventIDs = ImmutableSet.copyOf(controller.getSelectedEventIDs());
126  }
127 
128  //clear the chart and set the time range.
129  resetView(eventsModel.getTimeRange());
130 
131  //get the combined events to be displayed
132  updateMessage(Bundle.ListViewPane_loggedTask_queryDb());
133  List<CombinedEvent> combinedEvents = listViewModel.getCombinedEvents();
134 
135  updateMessage(Bundle.ListViewPane_loggedTask_updateUI());
136  Platform.runLater(() -> {
137  //put the combined events into the table.
138  listTimeline.setCombinedEvents(combinedEvents);
139  //restore the selected events
140  listTimeline.selectEvents(selectedEventIDs);
141  });
142 
143  return combinedEvents.isEmpty() == false;
144  }
145 
146  @Override
147  protected void cancelled() {
148  super.cancelled();
150  }
151 
152  @Override
153  protected void setDateValues(Interval timeRange) {
154  }
155  }
156 }
void handleViewInTimelineRequested(ViewInTimelineRequestedEvent event)
synchronized ObservableList< Long > getSelectedEventIDs()

Copyright © 2012-2022 Basis Technology. Generated on: Tue Aug 1 2023
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.