19 package org.sleuthkit.autopsy.timeline.zooming;
21 import java.util.function.Consumer;
22 import java.util.function.Function;
23 import javafx.application.Platform;
24 import javafx.beans.InvalidationListener;
25 import javafx.beans.binding.BooleanBinding;
26 import javafx.beans.property.ReadOnlyObjectProperty;
27 import javafx.fxml.FXML;
28 import javafx.scene.control.Label;
29 import javafx.scene.control.Slider;
30 import javafx.scene.control.TitledPane;
31 import javafx.util.StringConverter;
32 import org.openide.util.NbBundle;
80 "ZoomSettingsPane.descrLODLabel.text=Description Detail:",
81 "ZoomSettingsPane.typeZoomLabel.text=Event Type:",
82 "ZoomSettingsPane.timeUnitLabel.text=Time Units:",
83 "ZoomSettingsPane.zoomLabel.text=Zoom"})
85 zoomLabel.setText(Bundle.ZoomSettingsPane_zoomLabel_text());
87 typeZoomSlider.setMin(1);
90 controller::pushEventTypeZoom,
93 EventTypeZoomLevel::ordinal,
95 typeZoomLabel.setText(Bundle.ZoomSettingsPane_typeZoomLabel_text());
99 controller::pushDescrLOD,
102 DescriptionLoD::ordinal,
103 Function.identity());
104 descrLODLabel.setText(Bundle.ZoomSettingsPane_descrLODLabel_text());
115 timeUnitSlider.setMax(
TimeUnits.values().length - 2);
117 controller::pushTimeUnit,
123 timeUnitLabel.setText(Bundle.ZoomSettingsPane_timeUnitLabel_text());
127 visibleProperty().bind(notListMode);
128 managedProperty().bind(notListMode);
171 Consumer<EnumType> sliderValueConsumer,
172 ReadOnlyObjectProperty<DriverType> modelProperty,
173 Class<EnumType> enumClass,
174 Function<DriverType, Integer> driverValueMapper,
175 Function<Integer, Integer> labelIndexMapper) {
181 final InvalidationListener sliderListener = observable -> {
183 if (slider.isValueChanging() ==
false) {
185 EnumType sliderValueAsEnum = enumClass.getEnumConstants()[Math.round((
float) slider.getValue())];
186 sliderValueConsumer.accept(sliderValueAsEnum);
190 slider.valueProperty().addListener(sliderListener);
191 slider.valueChangingProperty().addListener(sliderListener);
194 slider.setValue(driverValueMapper.apply(modelProperty.get()));
197 modelProperty.addListener(modelProp -> {
199 slider.valueProperty().removeListener(sliderListener);
200 slider.valueChangingProperty().removeListener(sliderListener);
202 Platform.runLater(() -> {
204 slider.setValue(driverValueMapper.apply(modelProperty.get()));
207 slider.valueProperty().addListener(sliderListener);
208 slider.valueChangingProperty().addListener(sliderListener);
221 static private class EnumSliderLabelFormatter<EnumType
extends Enum<EnumType> & DisplayNameProvider> extends StringConverter<Double> {
226 private final Class<EnumType>
clazz;
236 this.indexAdjsuter = indexMapper;
242 return clazz.getEnumConstants()[indexAdjsuter.apply(dbl.intValue())].getDisplayName();
247 throw new UnsupportedOperationException(
"This method should not be used. This EnumSliderLabelFormatter is being used in an unintended way.");
FilteredEventsModel getEventsModel()
synchronized ReadOnlyObjectProperty< EventTypeZoomLevel > eventTypeZoomProperty()
final FilteredEventsModel filteredEvents
final TimeLineController controller
static RangeDivisionInfo getRangeDivisionInfo(Interval timeRange)
static< DriverType, EnumTypeextendsEnum< EnumType > &DisplayNameProvider void configureSliderListeners(Slider slider, Consumer< EnumType > sliderValueConsumer, ReadOnlyObjectProperty< DriverType > modelProperty, Class< EnumType > enumClass, Function< DriverType, Integer > driverValueMapper, Function< Integer, Integer > labelIndexMapper)
ZoomSettingsPane(TimeLineController controller)
synchronized ReadOnlyObjectProperty< ViewMode > viewModeProperty()
synchronized ReadOnlyObjectProperty< DescriptionLoD > descriptionLODProperty()
TimeUnits getPeriodSize()
static void construct(Node node, String fxmlFileName)
synchronized ReadOnlyObjectProperty< Interval > timeRangeProperty()