remove the new event notification cooldown

This commit is contained in:
millmanorama 2019-03-01 11:35:21 +01:00
parent 3e51321102
commit 233b89495d

View File

@ -18,7 +18,7 @@
*/ */
package org.sleuthkit.autopsy.timeline.ui; package org.sleuthkit.autopsy.timeline.ui;
import org.sleuthkit.autopsy.timeline.actions.CreateManualEvent; import org.sleuthkit.autopsy.timeline.actions.AddManualEvent;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.eventbus.Subscribe; import com.google.common.eventbus.Subscribe;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -117,13 +117,13 @@ final public class ViewFrame extends BorderPane {
private static final Image REFRESH = new Image("org/sleuthkit/autopsy/timeline/images/arrow-circle-double-135.png"); //NON-NLS private static final Image REFRESH = new Image("org/sleuthkit/autopsy/timeline/images/arrow-circle-double-135.png"); //NON-NLS
private static final Background GRAY_BACKGROUND = new Background(new BackgroundFill(Color.GREY, CornerRadii.EMPTY, Insets.EMPTY)); private static final Background GRAY_BACKGROUND = new Background(new BackgroundFill(Color.GREY, CornerRadii.EMPTY, Insets.EMPTY));
private NotificationState notificationState = NotificationState.Ready; // private NotificationState notificationState = NotificationState.Ready;
//
enum NotificationState { // enum NotificationState {
Showing, // Showing,
Paused, // Paused,
Ready; // Ready;
} // }
/** /**
* Region that will be stacked in between the no-events "dialog" and the * Region that will be stacked in between the no-events "dialog" and the
@ -279,24 +279,24 @@ final public class ViewFrame extends BorderPane {
} }
}; };
private final Timer notificationTimer = new Timer(30_000, new ActionListener() { // private final Timer notificationTimer = new Timer(30_000, new ActionListener() {
@Override // @Override
public void actionPerformed(ActionEvent actionEvent) { // public void actionPerformed(ActionEvent actionEvent) {
Platform.runLater(() -> { // Platform.runLater(() -> {
switch (notificationState) { // switch (notificationState) {
case Ready: // case Ready:
break; // break;
case Showing: // case Showing:
notificationPane.hide(); // notificationPane.hide();
notificationState = NotificationState.Paused; // notificationState = NotificationState.Paused;
break; // break;
case Paused: // case Paused:
notificationState = NotificationState.Ready; // notificationState = NotificationState.Ready;
break; // break;
} // }
}); // });
} // }
}); // });
/** /**
* hides the notification pane on any event * hides the notification pane on any event
@ -398,7 +398,7 @@ final public class ViewFrame extends BorderPane {
controller.viewModeProperty().addListener(viewMode -> syncViewMode()); controller.viewModeProperty().addListener(viewMode -> syncViewMode());
syncViewMode(); syncViewMode();
ActionUtils.configureButton(new CreateManualEvent(controller), addEventButton); ActionUtils.configureButton(new AddManualEvent(controller), addEventButton);
ActionUtils.configureButton(new SaveSnapshotAsReport(controller, notificationPane::getContent), snapShotButton); ActionUtils.configureButton(new SaveSnapshotAsReport(controller, notificationPane::getContent), snapShotButton);
/////configure start and end pickers /////configure start and end pickers
@ -462,7 +462,7 @@ final public class ViewFrame extends BorderPane {
refreshTimeUI(); //populate the view refreshTimeUI(); //populate the view
refreshHistorgram(); refreshHistorgram();
notificationTimer.start(); // notificationTimer.start();
} }
/** /**
@ -478,18 +478,18 @@ final public class ViewFrame extends BorderPane {
Platform.runLater(() -> { Platform.runLater(() -> {
hostedView.setNeedsRefresh(); hostedView.setNeedsRefresh();
switch (notificationState) { // switch (notificationState) {
case Paused: // case Paused:
break; // break;
case Ready: // case Ready:
notificationPane.show(Bundle.ViewFrame_tagsAddedOrDeleted()); notificationPane.show(Bundle.ViewFrame_tagsAddedOrDeleted());
notificationState = NotificationState.Showing; // notificationState = NotificationState.Showing;
break; // break;
case Showing: // case Showing:
notificationPane.setText(Bundle.ViewFrame_tagsAddedOrDeleted()); // notificationPane.setText(Bundle.ViewFrame_tagsAddedOrDeleted());
notificationTimer.restart(); // notificationTimer.restart();
break; // break;
} // }
}); });
} }
@ -506,8 +506,8 @@ final public class ViewFrame extends BorderPane {
public void handleRefreshRequested(RefreshRequestedEvent event) { public void handleRefreshRequested(RefreshRequestedEvent event) {
Platform.runLater(() -> { Platform.runLater(() -> {
notificationPane.hide(); notificationPane.hide();
notificationState = NotificationState.Paused; // notificationState = NotificationState.Paused;
notificationTimer.restart(); // notificationTimer.restart();
refreshHistorgram(); refreshHistorgram();
}); });
} }
@ -526,19 +526,19 @@ final public class ViewFrame extends BorderPane {
Platform.runLater(() -> { Platform.runLater(() -> {
if (hostedView.needsRefresh() == false) { if (hostedView.needsRefresh() == false) {
hostedView.setNeedsRefresh(); hostedView.setNeedsRefresh();
switch (notificationState) { // switch (notificationState) {
case Paused: // case Paused:
break; // break;
case Ready: // case Ready:
notificationPane.show(Bundle.ViewFrame_notification_cacheInvalidated()); notificationPane.show(Bundle.ViewFrame_notification_cacheInvalidated());
notificationState = NotificationState.Showing; // notificationState = NotificationState.Showing;
notificationTimer.restart(); // notificationTimer.restart();
break; // break;
case Showing: // case Showing:
notificationPane.setText(Bundle.ViewFrame_notification_cacheInvalidated()); // notificationPane.setText(Bundle.ViewFrame_notification_cacheInvalidated());
notificationTimer.restart(); // notificationTimer.restart();
break; // break;
} // }
} }
}); });
} }