default to full spanning interval if the requeste dinterval does not overlap the spaning interval

This commit is contained in:
jmillman 2016-06-28 16:19:55 -04:00
parent 6fc88b5b10
commit 7acee871bc

View File

@ -672,15 +672,35 @@ public class TimeLineController {
}
}
@SuppressWarnings("AssignmentToMethodParameter") //clamp timerange to case
/**
* Set the new interval to view, and record it in the history. The interval
* will be clamped to the span of events in the current case.
*
* @param timeRange The Interval to view.
*
* @return True if the interval was changed. False if the interval was the
* same as the existing one and no change happened.
*/
synchronized public boolean pushTimeRange(Interval timeRange) {
timeRange = this.filteredEvents.getSpanningInterval().overlap(timeRange);
//clamp timerange to case
Interval clampedTimeRange;
if (timeRange == null) {
clampedTimeRange = this.filteredEvents.getSpanningInterval();
} else {
Interval spanningInterval = this.filteredEvents.getSpanningInterval();
if (spanningInterval.overlaps(timeRange)) {
clampedTimeRange = spanningInterval.overlap(timeRange);
} else {
clampedTimeRange = spanningInterval;
}
}
ZoomParams currentZoom = filteredEvents.zoomParametersProperty().get();
if (currentZoom == null) {
advance(InitialZoomState.withTimeRange(timeRange));
advance(InitialZoomState.withTimeRange(clampedTimeRange));
return true;
} else if (currentZoom.hasTimeRange(timeRange) == false) {
advance(currentZoom.withTimeRange(timeRange));
} else if (currentZoom.hasTimeRange(clampedTimeRange) == false) {
advance(currentZoom.withTimeRange(clampedTimeRange));
return true;
} else {
return false;