inital commit with a message of a merge from my other branch

This commit is contained in:
Kelly Kelly 2019-05-02 11:43:04 -04:00
parent 01ec2f56af
commit 806eb76f7f
6 changed files with 55 additions and 32 deletions

View File

@ -27,7 +27,6 @@ import org.openide.nodes.Children;
import org.openide.nodes.Node;
import org.openide.nodes.Sheet;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.ImageUtils;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.datamodel.AbstractAbstractFileNode;
import org.sleuthkit.autopsy.datamodel.FileNode;
@ -44,11 +43,11 @@ import org.sleuthkit.datamodel.TskCoreException;
* the addNotify function in ThumbnailChildNode ends up wtih a list containing
* just the wait node and the thumbanils never appear.
*/
final class ThumbnailChildren extends Children.Keys<AbstractFile> {
final class AttachementsChildren extends Children.Keys<AbstractFile> {
private static final Logger logger = Logger.getLogger(ThumbnailChildren.class.getName());
private static final Logger logger = Logger.getLogger(AttachementsChildren.class.getName());
private final Set<AbstractFile> thumbnails;
private final Set<BlackboardArtifact> artifacts;
/*
* Creates the list of thumbnails from the given list of
@ -57,9 +56,21 @@ final class ThumbnailChildren extends Children.Keys<AbstractFile> {
* The thumbnails will be initialls sorted by size, then name so that they
* appear sorted by size by default.
*/
ThumbnailChildren(Set<BlackboardArtifact> artifacts) {
AttachementsChildren(Set<BlackboardArtifact> artifacts) {
super(false);
thumbnails = new TreeSet<>((AbstractFile file1, AbstractFile file2) -> {
this.artifacts = artifacts;
}
@Override
protected Node[] createNodes(AbstractFile t) {
return new Node[]{new AttachmentNode(t)};
}
@Override
protected void addNotify() {
super.addNotify();
Set<AbstractFile> attachments = new TreeSet<>((AbstractFile file1, AbstractFile file2) -> {
int result = Long.compare(file1.getSize(), file2.getSize());
if (result == 0) {
result = file1.getName().compareTo(file2.getName());
@ -71,33 +82,24 @@ final class ThumbnailChildren extends Children.Keys<AbstractFile> {
artifacts.forEach((bba) -> {
try {
for (Content childContent : bba.getChildren()) {
if (childContent instanceof AbstractFile && ImageUtils.thumbnailSupported((AbstractFile) childContent)) {
thumbnails.add((AbstractFile) childContent);
if (childContent instanceof AbstractFile) {
attachments.add((AbstractFile) childContent);
}
}
} catch (TskCoreException ex) {
logger.log(Level.WARNING, "Unable to get children from artifact.", ex); //NON-NLS
}
});
}
@Override
protected Node[] createNodes(AbstractFile t) {
return new Node[]{new ThumbnailNode(t)};
}
@Override
protected void addNotify() {
super.addNotify();
setKeys(thumbnails);
setKeys(attachments);
}
/**
* A node for representing a thumbnail.
* A node for representing a attachememt.
*/
static class ThumbnailNode extends FileNode {
static class AttachmentNode extends FileNode {
ThumbnailNode(AbstractFile file) {
AttachmentNode(AbstractFile file) {
super(file, false);
}

View File

@ -46,11 +46,11 @@ import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.TskCoreException;
/**
*
* This panel is a RelationshipsViewer panel
*/
public class ThumbnailViewer extends JPanel implements RelationshipsViewer, ExplorerManager.Provider, Lookup.Provider {
public class MediaViewer extends JPanel implements RelationshipsViewer, ExplorerManager.Provider, Lookup.Provider {
private static final Logger logger = Logger.getLogger(ThumbnailChildren.class.getName());
private static final Logger logger = Logger.getLogger(MediaViewer.class.getName());
private final ExplorerManager tableEM = new ExplorerManager();
private final PropertyChangeListener focusPropertyListener;
@ -63,7 +63,7 @@ public class ThumbnailViewer extends JPanel implements RelationshipsViewer, Expl
/**
* Creates new form ThumbnailViewer
*/
public ThumbnailViewer() {
public MediaViewer() {
proxyLookup = new ModifiableProxyLookup(createLookup(tableEM, getActionMap()));
// See org.sleuthkit.autopsy.timeline.TimeLineTopComponent for a detailed
@ -78,7 +78,7 @@ public class ThumbnailViewer extends JPanel implements RelationshipsViewer, Expl
if (isDescendingFrom(newFocusOwner, contentViewer)) {
//if the focus owner is within the MessageContentViewer (the attachments table)
proxyLookup.setNewLookups(createLookup(((MessageDataContent) contentViewer).getExplorerManager(), getActionMap()));
} else if (isDescendingFrom(newFocusOwner, ThumbnailViewer.this)) {
} else if (isDescendingFrom(newFocusOwner, MediaViewer.this)) {
//... or if it is within the Results table.
proxyLookup.setNewLookups(createLookup(tableEM, getActionMap()));
@ -130,7 +130,7 @@ public class ThumbnailViewer extends JPanel implements RelationshipsViewer, Expl
thumbnailViewer.resetComponent();
}
thumbnailViewer.setNode(new TableFilterNode(new DataResultFilterNode(new AbstractNode(new ThumbnailChildren(artifactList)), tableEM), true));
thumbnailViewer.setNode(new TableFilterNode(new DataResultFilterNode(new AbstractNode(new AttachementsChildren(artifactList)), tableEM), true));
}
@Override

View File

@ -33,7 +33,7 @@ final class RelationshipBrowser extends JPanel implements Lookup.Provider {
private final MessagesViewer messagesViewer;
private final ContactsViewer contactsViewer;
private final ThumbnailViewer thumbnailsViewer;
private final MediaViewer thumbnailsViewer;
private final ModifiableProxyLookup proxyLookup;
@ -43,7 +43,7 @@ final class RelationshipBrowser extends JPanel implements Lookup.Provider {
public RelationshipBrowser() {
messagesViewer = new MessagesViewer();
contactsViewer = new ContactsViewer();
thumbnailsViewer = new ThumbnailViewer();
thumbnailsViewer = new MediaViewer();
proxyLookup = new ModifiableProxyLookup(messagesViewer.getLookup());

View File

@ -561,7 +561,7 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont
msgbodyTabbedPane.setEnabledAt(ATTM_TAB_INDEX, numberOfAttachments > 0);
msgbodyTabbedPane.setTitleAt(ATTM_TAB_INDEX, "Attachments (" + numberOfAttachments + ")");
drp.setNode(new TableFilterNode(new DataResultFilterNode(new AbstractNode(
new AttachmentsChildren(attachments)), null), true));
new AttachmentsChildren(attachments))), true));
}
private static String wrapInHtmlBody(String htmlText) {

View File

@ -125,9 +125,23 @@ public class DataResultFilterNode extends FilterNode {
static private final DisplayableItemNodeVisitor<List<Action>> getActionsDIV = new GetPopupActionsDisplayableItemNodeVisitor();
private final DisplayableItemNodeVisitor<AbstractAction> getPreferredActionsDIV = new GetPreferredActionsDisplayableItemNodeVisitor();
// In GetPreferredActionsDisplayableItemNodeVisitor this is expected
// to be the directory tree explorer manager
private final ExplorerManager sourceEm;
private final ExplorerManager sourceEm;
/**
* Constructs a node used to wrap another node before passing it to the
* result viewers. The wrapper node defines the actions associated with the
* wrapped node and may filter out some of its children.
*
* @param node The node to wrap.
*/
public DataResultFilterNode(Node node) {
super(node, null);
this.sourceEm = null;
}
/**
* Constructs a node used to wrap another node before passing it to the
* result viewers. The wrapper node defines the actions associated with the
@ -635,6 +649,10 @@ public class DataResultFilterNode extends FilterNode {
// is a DirectoryTreeFilterNode that wraps the dataModelNode. We need
// to set that wrapped node as the selection and root context of the
// directory tree explorer manager (sourceEm)
if(sourceEm == null) {
return null;
}
final Node currentSelectionInDirectoryTree = sourceEm.getSelectedNodes()[0];
return new AbstractAction() {
@ -675,6 +693,9 @@ public class DataResultFilterNode extends FilterNode {
* @return
*/
private AbstractAction openParent(AbstractNode node) {
if(sourceEm == null) {
return null;
}
// @@@ Why do we ignore node?
Node[] selectedFilterNodes = sourceEm.getSelectedNodes();
Node selectedFilterNode = selectedFilterNodes[0];