always show tag notification

This commit is contained in:
jmillman 2016-05-03 14:21:36 -04:00
parent 076ee69394
commit dfce250309
3 changed files with 128 additions and 111 deletions

View File

@ -1,7 +1,20 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
* Autopsy Forensic Browser
*
* Copyright 2014-2016 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.timeline.events;

View File

@ -36,6 +36,5 @@ abstract public class TagsUpdatedEvent {
public TagsUpdatedEvent(Set<Long> updatedEventIDs) {
this.updatedEventIDs = updatedEventIDs;
}
}

View File

@ -31,7 +31,6 @@ import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.geometry.Insets;
import javafx.scene.control.Button;
@ -81,8 +80,8 @@ import org.sleuthkit.autopsy.timeline.actions.ZoomIn;
import org.sleuthkit.autopsy.timeline.actions.ZoomOut;
import org.sleuthkit.autopsy.timeline.actions.ZoomToEvents;
import org.sleuthkit.autopsy.timeline.datamodel.FilteredEventsModel;
import org.sleuthkit.autopsy.timeline.events.RefreshRequestedEvent;
import org.sleuthkit.autopsy.timeline.events.TagsUpdatedEvent;
import org.sleuthkit.autopsy.timeline.filters.TagsFilter;
import org.sleuthkit.autopsy.timeline.ui.countsview.CountsViewPane;
import org.sleuthkit.autopsy.timeline.ui.detailview.DetailViewPane;
import org.sleuthkit.autopsy.timeline.ui.detailview.tree.EventsTree;
@ -216,12 +215,12 @@ final public class VisualizationPanel extends BorderPane {
}
/**
* convert the given epoch millis to a LocalDateTime USING THE CURERNT
* Convert the given epoch millis to a LocalDateTime USING THE CURERNT
* TIMEZONE FROM TIMELINECONTROLLER
*
* @param millis
* @param millis The milliseconds to convert.
*
* @return the given epoch millis as a LocalDateTime
* @return The given epoch millis as a LocalDateTime
*/
private static LocalDateTime epochMillisToLocalDateTime(long millis) {
return LocalDateTime.ofInstant(Instant.ofEpochMilli(millis), TimeLineController.getTimeZoneID());
@ -235,7 +234,7 @@ final public class VisualizationPanel extends BorderPane {
}
@FXML // This method is called by the FXMLLoader when initialization is complete
@NbBundle.Messages({"VisualizationPanel.refresh=refresh",
@NbBundle.Messages({
"VisualizationPanel.visualizationModeLabel.text=Visualization Mode:",
"VisualizationPanel.startLabel.text=Start:",
"VisualizationPanel.endLabel.text=End:",
@ -252,15 +251,6 @@ final public class VisualizationPanel extends BorderPane {
//configure notification pane
notificationPane.getStyleClass().add(NotificationPane.STYLE_CLASS_DARK);
notificationPane.getActions().setAll(new Action(Bundle.VisualizationPanel_refresh()) {
{
setGraphic(new ImageView(REFRESH));
setEventHandler((ActionEvent t) -> {
filteredEvents.refresh();
notificationPane.hide();
});
}
});
setCenter(notificationPane);
//configure visualization mode toggle
@ -411,12 +401,16 @@ final public class VisualizationPanel extends BorderPane {
@Subscribe
@NbBundle.Messages("VisualizationPanel.tagsAddedOrDeleted=Tags have been created and/or deleted. The visualization may not be up to date.")
public void handleTimeLineTagEvent(TagsUpdatedEvent event) {
TagsFilter tagsFilter = filteredEvents.getFilter().getTagsFilter();
if (tagsFilter.isSelected() && tagsFilter.isDisabled() == false) {
Platform.runLater(() -> {
notificationPane.show(Bundle.VisualizationPanel_tagsAddedOrDeleted(), new ImageView(INFORMATION));
});
}
Platform.runLater(() -> {
notificationPane.setCloseButtonVisible(false);
notificationPane.getActions().setAll(new Refresh());
notificationPane.show(Bundle.VisualizationPanel_tagsAddedOrDeleted(), new ImageView(INFORMATION));
});
}
@Subscribe
public void handleRefreshRequestedEvent(RefreshRequestedEvent event) {
Platform.runLater(notificationPane::hide);
}
synchronized private void refreshHistorgram() {
@ -427,54 +421,54 @@ final public class VisualizationPanel extends BorderPane {
histogramTask = new LoggedTask<Void>(
NbBundle.getMessage(VisualizationPanel.class, "VisualizationPanel.histogramTask.title"), true) { // NON-NLS
private final Lighting lighting = new Lighting();
private final Lighting lighting = new Lighting();
@Override
protected Void call() throws Exception {
updateMessage(NbBundle.getMessage(VisualizationPanel.class, "VisualizationPanel.histogramTask.preparing")); // NON-NLS
updateMessage(NbBundle.getMessage(VisualizationPanel.class, "VisualizationPanel.histogramTask.preparing")); // NON-NLS
long max = 0;
final RangeDivisionInfo rangeInfo = RangeDivisionInfo.getRangeDivisionInfo(filteredEvents.getSpanningInterval());
final long lowerBound = rangeInfo.getLowerBound();
final long upperBound = rangeInfo.getUpperBound();
Interval timeRange = new Interval(new DateTime(lowerBound, TimeLineController.getJodaTimeZone()), new DateTime(upperBound, TimeLineController.getJodaTimeZone()));
long max = 0;
final RangeDivisionInfo rangeInfo = RangeDivisionInfo.getRangeDivisionInfo(filteredEvents.getSpanningInterval());
final long lowerBound = rangeInfo.getLowerBound();
final long upperBound = rangeInfo.getUpperBound();
Interval timeRange = new Interval(new DateTime(lowerBound, TimeLineController.getJodaTimeZone()), new DateTime(upperBound, TimeLineController.getJodaTimeZone()));
//extend range to block bounderies (ie day, month, year)
int p = 0; // progress counter
//extend range to block bounderies (ie day, month, year)
int p = 0; // progress counter
//clear old data, and reset ranges and series
Platform.runLater(() -> {
updateMessage(NbBundle.getMessage(VisualizationPanel.class, "VisualizationPanel.histogramTask.resetUI")); // NON-NLS
//clear old data, and reset ranges and series
Platform.runLater(() -> {
updateMessage(NbBundle.getMessage(VisualizationPanel.class, "VisualizationPanel.histogramTask.resetUI")); // NON-NLS
});
});
ArrayList<Long> bins = new ArrayList<>();
ArrayList<Long> bins = new ArrayList<>();
DateTime start = timeRange.getStart();
while (timeRange.contains(start)) {
if (isCancelled()) {
return null;
}
DateTime end = start.plus(rangeInfo.getPeriodSize().getPeriod());
final Interval interval = new Interval(start, end);
//increment for next iteration
DateTime start = timeRange.getStart();
while (timeRange.contains(start)) {
if (isCancelled()) {
return null;
}
DateTime end = start.plus(rangeInfo.getPeriodSize().getPeriod());
final Interval interval = new Interval(start, end);
//increment for next iteration
start = end;
start = end;
updateMessage(NbBundle.getMessage(VisualizationPanel.class, "VisualizationPanel.histogramTask.queryDb")); // NON-NLS
//query for current range
long count = filteredEvents.getEventCounts(interval).values().stream().mapToLong(Long::valueOf).sum();
bins.add(count);
updateMessage(NbBundle.getMessage(VisualizationPanel.class, "VisualizationPanel.histogramTask.queryDb")); // NON-NLS
//query for current range
long count = filteredEvents.getEventCounts(interval).values().stream().mapToLong(Long::valueOf).sum();
bins.add(count);
max = Math.max(count, max);
max = Math.max(count, max);
final double fMax = Math.log(max);
final ArrayList<Long> fbins = new ArrayList<>(bins);
Platform.runLater(() -> {
updateMessage(NbBundle.getMessage(VisualizationPanel.class, "VisualizationPanel.histogramTask.updateUI2")); // NON-NLS
final double fMax = Math.log(max);
final ArrayList<Long> fbins = new ArrayList<>(bins);
Platform.runLater(() -> {
updateMessage(NbBundle.getMessage(VisualizationPanel.class, "VisualizationPanel.histogramTask.updateUI2")); // NON-NLS
histogramBox.getChildren().clear();
histogramBox.getChildren().clear();
for (Long bin : fbins) {
if (isCancelled()) {
@ -499,7 +493,7 @@ final public class VisualizationPanel extends BorderPane {
return null;
}
};
};
new Thread(histogramTask).start();
controller.monitorTask(histogramTask);
}
@ -666,4 +660,15 @@ final public class VisualizationPanel extends BorderPane {
}
}
}
private class Refresh extends Action {
@NbBundle.Messages({"VisualizationPanel.refresh=refresh"})
Refresh() {
super(Bundle.VisualizationPanel_refresh());
setGraphic(new ImageView(REFRESH));
setEventHandler(actionEvent -> filteredEvents.refresh());
}
}
}