disable unneeded ui elements when list mode is selected

This commit is contained in:
jmillman 2016-05-17 12:28:18 -04:00
parent 035d35856a
commit affc212b89
4 changed files with 62 additions and 49 deletions

View File

@ -22,7 +22,6 @@ import java.awt.BorderLayout;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.Observable;
import javafx.embed.swing.JFXPanel; import javafx.embed.swing.JFXPanel;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.SplitPane; import javafx.scene.control.SplitPane;
@ -112,8 +111,8 @@ public final class TimeLineTopComponent extends TopComponent implements Explorer
final TabPane leftTabPane = new TabPane(filterTab, eventsTreeTab); final TabPane leftTabPane = new TabPane(filterTab, eventsTreeTab);
VBox.setVgrow(leftTabPane, Priority.ALWAYS); VBox.setVgrow(leftTabPane, Priority.ALWAYS);
controller.viewModeProperty().addListener((Observable observable) -> { controller.viewModeProperty().addListener(viewMode -> {
if (controller.viewModeProperty().get().equals(ViewMode.DETAIL) == false) { if (controller.getViewMode().equals(ViewMode.DETAIL) == false) {
//if view mode is counts, make sure events tab is not active //if view mode is counts, make sure events tab is not active
leftTabPane.getSelectionModel().select(filterTab); leftTabPane.getSelectionModel().select(filterTab);
} }

View File

@ -91,8 +91,8 @@ import org.sleuthkit.autopsy.timeline.ui.listvew.ListViewPane;
import org.sleuthkit.autopsy.timeline.utils.RangeDivisionInfo; import org.sleuthkit.autopsy.timeline.utils.RangeDivisionInfo;
/** /**
* A container for an AbstractVisualizationPane. Has a Toolbar on top to hold * A container for an AbstractTimelineView. Has a Toolbar on top to hold
* settings widgets supplied by contained AbstractVisualizationPane, and the * settings widgets supplied by contained AbstractTimelineView, and the
* histogram / time selection on bottom. * histogram / time selection on bottom.
* *
* TODO: Refactor common code out of histogram and CountsView? -jm * TODO: Refactor common code out of histogram and CountsView? -jm
@ -121,7 +121,7 @@ final public class VisualizationPanel extends BorderPane {
private LoggedTask<Void> histogramTask; private LoggedTask<Void> histogramTask;
private final EventsTree eventsTree; private final EventsTree eventsTree;
private AbstractTimeLineView visualization; private AbstractTimeLineView hostedView;
/* /*
* HBox that contains the histogram bars. * HBox that contains the histogram bars.
@ -295,8 +295,8 @@ final public class VisualizationPanel extends BorderPane {
controller.setViewMode(newValue != null ? newValue : (oldVisMode != null ? oldVisMode : ViewMode.COUNTS)); controller.setViewMode(newValue != null ? newValue : (oldVisMode != null ? oldVisMode : ViewMode.COUNTS));
}); });
controller.viewModeProperty().addListener(visualizationMode -> syncVisualizationMode()); controller.viewModeProperty().addListener(viewMode -> syncViewMode());
syncVisualizationMode(); syncViewMode();
ActionUtils.configureButton(new SaveSnapshotAsReport(controller, notificationPane::getContent), snapShotButton); ActionUtils.configureButton(new SaveSnapshotAsReport(controller, notificationPane::getContent), snapShotButton);
ActionUtils.configureButton(new UpdateDB(controller), updateDBButton); ActionUtils.configureButton(new UpdateDB(controller), updateDBButton);
@ -326,7 +326,7 @@ final public class VisualizationPanel extends BorderPane {
rangeHistogramStack.getChildren().add(rangeSlider); rangeHistogramStack.getChildren().add(rangeSlider);
/* /*
* this padding attempts to compensates for the fact that the * This padding attempts to compensates for the fact that the
* rangeslider track doesn't extend to edge of node,and so the * rangeslider track doesn't extend to edge of node,and so the
* histrogram doesn't quite line up with the rangeslider * histrogram doesn't quite line up with the rangeslider
*/ */
@ -372,7 +372,7 @@ final public class VisualizationPanel extends BorderPane {
*/ */
@Subscribe @Subscribe
public void handleTimeLineTagUpdate(TagsUpdatedEvent event) { public void handleTimeLineTagUpdate(TagsUpdatedEvent event) {
visualization.setOutOfDate(); hostedView.setOutOfDate();
Platform.runLater(() -> { Platform.runLater(() -> {
if (notificationPane.isShowing() == false) { if (notificationPane.isShowing() == false) {
notificationPane.getActions().setAll(new Refresh()); notificationPane.getActions().setAll(new Refresh());
@ -410,7 +410,7 @@ final public class VisualizationPanel extends BorderPane {
*/ */
@Subscribe @Subscribe
public void handleDBUpdated(DBUpdatedEvent event) { public void handleDBUpdated(DBUpdatedEvent event) {
visualization.refresh(); hostedView.refresh();
refreshHistorgram(); refreshHistorgram();
Platform.runLater(notificationPane::hide); Platform.runLater(notificationPane::hide);
} }
@ -576,22 +576,28 @@ final public class VisualizationPanel extends BorderPane {
} }
/** /**
* Switch to the given VisualizationMode, by swapping out the hosted * Switch to the given ViewMode, by swapping out the hosted
* AbstractVislualization for one of the correct type. * AbstractTimelineView for one of the correct type.
*/ */
private void syncVisualizationMode() { private void syncViewMode() {
AbstractTimeLineView vizPane; AbstractTimeLineView view;
ViewMode visMode = controller.viewModeProperty().get(); ViewMode viewMode = controller.viewModeProperty().get();
//make new visualization. //make new visualization.
switch (visMode) { switch (viewMode) {
case LIST: case LIST:
vizPane = new ListViewPane(controller); view = new ListViewPane(controller);
Platform.runLater(() -> listToggle.setSelected(true)); Platform.runLater(() -> {
listToggle.setSelected(true);
//TODO: should remove listeners from events tree
});
break; break;
case COUNTS: case COUNTS:
vizPane = new CountsViewPane(controller); view = new CountsViewPane(controller);
Platform.runLater(() -> countsToggle.setSelected(true)); Platform.runLater(() -> {
countsToggle.setSelected(true);
//TODO: should remove listeners from events tree
});
break; break;
case DETAIL: case DETAIL:
DetailViewPane detailViewPane = new DetailViewPane(controller); DetailViewPane detailViewPane = new DetailViewPane(controller);
@ -600,34 +606,34 @@ final public class VisualizationPanel extends BorderPane {
detailViewPane.setHighLightedEvents(eventsTree.getSelectedEvents()); detailViewPane.setHighLightedEvents(eventsTree.getSelectedEvents());
eventsTree.setDetailViewPane(detailViewPane); eventsTree.setDetailViewPane(detailViewPane);
}); });
vizPane = detailViewPane; view = detailViewPane;
break; break;
default: default:
throw new IllegalArgumentException("Unknown VisualizationMode: " + visMode.toString()); throw new IllegalArgumentException("Unknown VisualizationMode: " + viewMode.toString());
} }
//Set the new AbstractVisualizationPane as the one hosted by this VisualizationPanel. //Set the new AbstractVisualizationPane as the one hosted by this VisualizationPanel.
Platform.runLater(() -> { Platform.runLater(() -> {
//clear out old vis. //clear out old vis.
if (visualization != null) { if (hostedView != null) {
toolBar.getItems().removeAll(visualization.getSettingsNodes()); toolBar.getItems().removeAll(hostedView.getSettingsNodes());
visualization.dispose(); hostedView.dispose();
} }
visualization = vizPane; hostedView = view;
//setup new vis. //setup new vis.
ActionUtils.configureButton(new Refresh(), refreshButton);//configure new refresh action for new visualization ActionUtils.configureButton(new Refresh(), refreshButton);//configure new refresh action for new visualization
visualization.refresh(); hostedView.refresh();
toolBar.getItems().addAll(2, vizPane.getSettingsNodes()); toolBar.getItems().addAll(2, view.getSettingsNodes());
notificationPane.setContent(visualization); notificationPane.setContent(hostedView);
//listen to has events property and show "dialog" if it is false. //listen to has events property and show "dialog" if it is false.
visualization.hasVisibleEventsProperty().addListener(hasEvents -> { hostedView.hasVisibleEventsProperty().addListener(hasEvents -> {
notificationPane.setContent(visualization.hasVisibleEvents() notificationPane.setContent(hostedView.hasVisibleEvents()
? visualization ? hostedView
: new StackPane(visualization, : new StackPane(hostedView,
NO_EVENTS_BACKGROUND, NO_EVENTS_BACKGROUND,
new NoEventsDialog(() -> notificationPane.setContent(visualization)) new NoEventsDialog(() -> notificationPane.setContent(hostedView))
) )
); );
}); });
@ -773,7 +779,7 @@ final public class VisualizationPanel extends BorderPane {
setLongText(Bundle.VisualizationPanel_refresh_longText()); setLongText(Bundle.VisualizationPanel_refresh_longText());
setGraphic(new ImageView(REFRESH)); setGraphic(new ImageView(REFRESH));
setEventHandler(actionEvent -> filteredEvents.postRefreshRequest()); setEventHandler(actionEvent -> filteredEvents.postRefreshRequest());
disabledProperty().bind(visualization.outOfDateProperty().not()); disabledProperty().bind(hostedView.outOfDateProperty().not());
} }
} }
} }

View File

@ -131,18 +131,24 @@ final public class FilterSetPanel extends BorderPane {
controller.viewModeProperty().addListener(observable -> { controller.viewModeProperty().addListener(observable -> {
applyFilters(); applyFilters();
if (controller.viewModeProperty().get() == ViewMode.COUNTS) { switch (controller.getViewMode()) {
case COUNTS:
case LIST:
dividerPosition = splitPane.getDividerPositions()[0]; dividerPosition = splitPane.getDividerPositions()[0];
splitPane.setDividerPositions(1); splitPane.setDividerPositions(1);
hiddenDescriptionsPane.setExpanded(false); hiddenDescriptionsPane.setExpanded(false);
hiddenDescriptionsPane.setCollapsible(false); hiddenDescriptionsPane.setCollapsible(false);
hiddenDescriptionsPane.setDisable(true); hiddenDescriptionsPane.setDisable(true);
} else { break;
case DETAIL:
splitPane.setDividerPositions(dividerPosition); splitPane.setDividerPositions(dividerPosition);
hiddenDescriptionsPane.setDisable(false); hiddenDescriptionsPane.setDisable(false);
hiddenDescriptionsPane.setCollapsible(true); hiddenDescriptionsPane.setCollapsible(true);
hiddenDescriptionsPane.setExpanded(true); hiddenDescriptionsPane.setExpanded(true);
hiddenDescriptionsPane.setCollapsible(false); hiddenDescriptionsPane.setCollapsible(false);
break;
default:
throw new UnsupportedOperationException("Unknown ViewMode: " + controller.getViewMode());
} }
}); });
} }

View File

@ -92,6 +92,7 @@ public class ZoomSettingsPane extends TitledPane {
EventTypeZoomLevel::ordinal, EventTypeZoomLevel::ordinal,
Function.identity()); Function.identity());
typeZoomLabel.setText(Bundle.ZoomSettingsPane_typeZoomLabel_text()); typeZoomLabel.setText(Bundle.ZoomSettingsPane_typeZoomLabel_text());
typeZoomSlider.disableProperty().bind(controller.viewModeProperty().isEqualTo(ViewMode.LIST));
descrLODSlider.setMax(DescriptionLoD.values().length - 1); descrLODSlider.setMax(DescriptionLoD.values().length - 1);
configureSliderListeners(descrLODSlider, configureSliderListeners(descrLODSlider,
@ -102,7 +103,7 @@ public class ZoomSettingsPane extends TitledPane {
Function.identity()); Function.identity());
descrLODLabel.setText(Bundle.ZoomSettingsPane_descrLODLabel_text()); descrLODLabel.setText(Bundle.ZoomSettingsPane_descrLODLabel_text());
//the description slider is only usefull in the detail view //the description slider is only usefull in the detail view
descrLODSlider.disableProperty().bind(controller.viewModeProperty().isEqualTo(ViewMode.COUNTS)); descrLODSlider.disableProperty().bind(controller.viewModeProperty().isNotEqualTo(ViewMode.DETAIL));
/** /**
* In order for the selected value in the time unit slider to correspond * In order for the selected value in the time unit slider to correspond
@ -121,6 +122,7 @@ public class ZoomSettingsPane extends TitledPane {
modelTimeRange -> RangeDivisionInfo.getRangeDivisionInfo(modelTimeRange).getPeriodSize().ordinal() - 1, modelTimeRange -> RangeDivisionInfo.getRangeDivisionInfo(modelTimeRange).getPeriodSize().ordinal() - 1,
index -> index + 1); //compensate for the -1 above when mapping to the Enum whose displayName will be shown at index index -> index + 1); //compensate for the -1 above when mapping to the Enum whose displayName will be shown at index
timeUnitLabel.setText(Bundle.ZoomSettingsPane_timeUnitLabel_text()); timeUnitLabel.setText(Bundle.ZoomSettingsPane_timeUnitLabel_text());
timeUnitSlider.disableProperty().bind(controller.viewModeProperty().isEqualTo(ViewMode.LIST));
} }
/** /**