Merge pull request #1497 from millmanorama/IG_show_tree_on_advance

show contents tree when next group button pressed;  expand tab labels…
This commit is contained in:
Richard Cordovano 2015-08-11 18:24:20 -04:00
commit 7bc6e9f277
5 changed files with 51 additions and 38 deletions

View File

@ -69,6 +69,7 @@ import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupManager;
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupViewState;
import org.sleuthkit.autopsy.imagegallery.gui.NoGroupsDialog;
import org.sleuthkit.autopsy.imagegallery.gui.Toolbar;
import org.sleuthkit.autopsy.imagegallery.gui.navpanel.NavPanel;
import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.BlackboardArtifact;
@ -138,6 +139,7 @@ public final class ImageGalleryController {
private Node infoOverlay;
private SleuthkitCase sleuthKitCase;
private NavPanel navPanel;
public ReadOnlyBooleanProperty getMetaDataCollapsed() {
return metaDataCollapsed.getReadOnlyProperty();
@ -218,7 +220,7 @@ public final class ImageGalleryController {
groupManager.getUnSeenGroups().addListener((Observable observable) -> {
//if there are unseen groups and none being viewed
if (groupManager.getUnSeenGroups().isEmpty() == false && (getViewState() == null || getViewState().getGroup() == null)) {
advance(GroupViewState.tile(groupManager.getUnSeenGroups().get(0)));
advance(GroupViewState.tile(groupManager.getUnSeenGroups().get(0)), true);
}
});
@ -246,8 +248,12 @@ public final class ImageGalleryController {
return historyManager.getCanRetreat();
}
public void advance(GroupViewState newState) {
public void advance(GroupViewState newState, boolean forceShowTree) {
if (Objects.nonNull(navPanel) && forceShowTree) {
navPanel.showTree();
}
historyManager.advance(newState);
}
public GroupViewState advance() {
@ -440,13 +446,15 @@ public final class ImageGalleryController {
case CONTENT_CHANGED:
//TODO: do we need to do anything here? -jm
case DATA_ADDED:
/* we could listen to DATA events and progressivly
* update files, and get data from DataSource ingest
* modules, but given that most modules don't post new
* artifacts in the events and we would have to query for
* them, without knowing which are the new ones, we just
* ignore these events for now. The relevant data should all
* be captured by file done event, anyways -jm */
/*
* we could listen to DATA events and progressivly update
* files, and get data from DataSource ingest modules, but
* given that most modules don't post new artifacts in the
* events and we would have to query for them, without
* knowing which are the new ones, we just ignore these
* events for now. The relevant data should all be captured
* by file done event, anyways -jm
*/
break;
case FILE_DONE:
/**
@ -523,6 +531,10 @@ public final class ImageGalleryController {
return tagsManager;
}
public void setNavPanel(NavPanel navPanel) {
this.navPanel = navPanel;
}
// @@@ REVIEW IF THIS SHOLD BE STATIC...
//TODO: concept seems like the controller deal with how much work to do at a given time
// @@@ review this class for synchronization issues (i.e. reset and cancel being called, add, etc.)
@ -844,8 +856,8 @@ public final class ImageGalleryController {
}
/**
* task that does pre-ingest copy over of files from a new datasource
* (uses fs_obj_id to identify files from new datasource) *
* task that does pre-ingest copy over of files from a new datasource (uses
* fs_obj_id to identify files from new datasource) *
*
* TODO: create methods to simplify progress value/text updates to both
* netbeans and ImageGallery progress/status
@ -881,9 +893,11 @@ public final class ImageGalleryController {
progressHandle.start();
updateMessage("prepopulating image/video database");
/* Get all "drawable" files, based on extension. After ingest we use
/*
* Get all "drawable" files, based on extension. After ingest we use
* file type id module and if necessary jpeg signature matching to
* add/remove files */
* add/remove files
*/
final List<AbstractFile> files;
try {
List<Long> fsObjIds = new ArrayList<>();
@ -896,11 +910,13 @@ public final class ImageGalleryController {
}
fsQuery = "(fs_obj_id = " + StringUtils.join(fsObjIds, " or fs_obj_id = ") + ") ";
} else {
/* NOTE: Logical files currently (Apr '15) have a null
* value for fs_obj_id in DB. for them, we will not specify
* a fs_obj_id, which means we will grab files from another
/*
* NOTE: Logical files currently (Apr '15) have a null value
* for fs_obj_id in DB. for them, we will not specify a
* fs_obj_id, which means we will grab files from another
* data source, but the drawable DB is smart enough to
* de-dupe them. */
* de-dupe them.
*/
fsQuery = "(fs_obj_id IS NULL) ";
}

View File

@ -35,11 +35,11 @@ import org.openide.windows.Mode;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.imagegallery.gui.drawableviews.GroupPane;
import org.sleuthkit.autopsy.imagegallery.gui.drawableviews.MetaDataPane;
import org.sleuthkit.autopsy.imagegallery.gui.StatusBar;
import org.sleuthkit.autopsy.imagegallery.gui.SummaryTablePane;
import org.sleuthkit.autopsy.imagegallery.gui.Toolbar;
import org.sleuthkit.autopsy.imagegallery.gui.drawableviews.GroupPane;
import org.sleuthkit.autopsy.imagegallery.gui.drawableviews.MetaDataPane;
import org.sleuthkit.autopsy.imagegallery.gui.navpanel.NavPanel;
/**
@ -158,6 +158,7 @@ public final class ImageGalleryTopComponent extends TopComponent implements Expl
splitPane.setDividerPositions(0.0, 1.0);
ImageGalleryController.getDefault().setStacks(fullUIStack, centralStack);
ImageGalleryController.getDefault().setNavPanel(navPanel);
});
}

View File

@ -68,7 +68,7 @@ public class NextUnseenGroup extends Action {
.ifPresent(group -> controller.getGroupManager().markGroupSeen(group, true));
if (false == controller.getGroupManager().getUnSeenGroups().isEmpty()) {
controller.advance(GroupViewState.tile(controller.getGroupManager().getUnSeenGroups().get(0)));
controller.advance(GroupViewState.tile(controller.getGroupManager().getUnSeenGroups().get(0)), true);
}
updateButton();
});

View File

@ -6,10 +6,9 @@
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<fx:root fx:id="navTabPane" maxHeight="1.7976931348623157E308" prefHeight="-1.0" prefWidth="-1.0" tabClosingPolicy="UNAVAILABLE" type="TabPane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<tabs>
<Tab fx:id="navTab" text="Contents">
<Tab fx:id="navTab" text="All Groups">
<content>
<AnchorPane prefHeight="-1.0" prefWidth="-1.0">
<children>
@ -25,7 +24,7 @@
</ImageView>
</graphic>
</Tab>
<Tab fx:id="hashTab" text="Hash Hits">
<Tab fx:id="hashTab" text="Groups With Hash Hits">
<content>
<AnchorPane id="Content" minHeight="0.0" minWidth="0.0" prefHeight="-1.0" prefWidth="-1.0">
<children>

View File

@ -18,10 +18,8 @@
*/
package org.sleuthkit.autopsy.imagegallery.gui.navpanel;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.ResourceBundle;
import javafx.application.Platform;
import javafx.beans.Observable;
import javafx.beans.property.SimpleObjectProperty;
@ -57,12 +55,6 @@ import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupViewState;
*/
public class NavPanel extends TabPane {
@FXML
private ResourceBundle resources;
@FXML
private URL location;
/**
* TreeView for folders with hash hits
*/
@ -212,7 +204,7 @@ public class NavPanel extends TabPane {
private void updateControllersGroup() {
final TreeItem<TreeNode> selectedItem = activeTreeProperty.get().getSelectionModel().getSelectedItem();
if (selectedItem != null && selectedItem.getValue() != null && selectedItem.getValue().getGroup() != null) {
controller.advance(GroupViewState.tile(selectedItem.getValue().getGroup()));
controller.advance(GroupViewState.tile(selectedItem.getValue().getGroup()), false);
}
}
@ -233,14 +225,15 @@ public class NavPanel extends TabPane {
final GroupTreeItem treeItemForGroup = ((GroupTreeItem) activeTreeProperty.get().getRoot()).getTreeItemForPath(path);
if (treeItemForGroup != null) {
/* When we used to run the below code on the FX thread, it would
* get into infinite loops when the next group button was pressed
/*
* When we used to run the below code on the FX thread, it would get
* into infinite loops when the next group button was pressed
* quickly because the udpates became out of order and History could
* not
* keep track of what was current.
* not keep track of what was current.
*
* Currently (4/2/15), this method is already on the FX thread, so
* it is OK. */
* it is OK.
*/
//Platform.runLater(() -> {
TreeItem<TreeNode> ti = treeItemForGroup;
while (ti != null) {
@ -316,4 +309,8 @@ public class NavPanel extends TabPane {
});
}
}
public void showTree() {
getSelectionModel().select(navTab);
}
}