mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
Eliminated setting the display 2x when a selected artifact is found; removed always false check for ArtifactStringContent object in Lookup of selected node
This commit is contained in:
parent
e643c32ee5
commit
43025d2bc6
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011 Basis Technology Corp.
|
* Copyright 2011-2013 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -34,7 +34,6 @@ import java.util.logging.Level;
|
|||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import javax.swing.JMenuItem;
|
import javax.swing.JMenuItem;
|
||||||
import javax.swing.JTextPane;
|
import javax.swing.JTextPane;
|
||||||
import javax.swing.text.Document;
|
|
||||||
import javax.swing.text.html.HTMLEditorKit;
|
import javax.swing.text.html.HTMLEditorKit;
|
||||||
import javax.swing.text.html.StyleSheet;
|
import javax.swing.text.html.StyleSheet;
|
||||||
import org.openide.nodes.Node;
|
import org.openide.nodes.Node;
|
||||||
@ -204,12 +203,12 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
|||||||
|
|
||||||
private void nextPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextPageButtonActionPerformed
|
private void nextPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextPageButtonActionPerformed
|
||||||
currentPage = currentPage+1;
|
currentPage = currentPage+1;
|
||||||
setDataView(artifacts, currentPage);
|
setDataView(currentPage);
|
||||||
}//GEN-LAST:event_nextPageButtonActionPerformed
|
}//GEN-LAST:event_nextPageButtonActionPerformed
|
||||||
|
|
||||||
private void prevPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prevPageButtonActionPerformed
|
private void prevPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prevPageButtonActionPerformed
|
||||||
currentPage = currentPage-1;
|
currentPage = currentPage-1;
|
||||||
setDataView(artifacts, currentPage);
|
setDataView(currentPage);
|
||||||
}//GEN-LAST:event_prevPageButtonActionPerformed
|
}//GEN-LAST:event_prevPageButtonActionPerformed
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
@ -243,16 +242,26 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.setDataView(content.getAllArtifacts(), 1);
|
artifacts = content.getAllArtifacts();
|
||||||
} catch (TskException ex) {
|
}
|
||||||
logger.log(Level.WARNING, "Couldn't get artifacts: ", ex);
|
catch (TskException ex) {
|
||||||
|
logger.log(Level.WARNING, "Couldn't get artifacts", ex);
|
||||||
|
resetComponent();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// focus on a specific artifact if it is in the node
|
// focus on a specific artifact if it is in the node
|
||||||
|
int index = 0;
|
||||||
BlackboardArtifact artifact = lookup.lookup(BlackboardArtifact.class);
|
BlackboardArtifact artifact = lookup.lookup(BlackboardArtifact.class);
|
||||||
if (artifact != null) {
|
if (artifact != null) {
|
||||||
this.setSelectedArtifact(artifact);
|
index = artifacts.indexOf(artifact);
|
||||||
|
if (index == -1) {
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A little bit of cleverness here - add one since setDataView() is also passed page numbers.
|
||||||
|
setDataView(index + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -279,7 +288,7 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
|||||||
public void resetComponent() {
|
public void resetComponent() {
|
||||||
// clear / reset the fields
|
// clear / reset the fields
|
||||||
currentPage = 1;
|
currentPage = 1;
|
||||||
this.artifacts = new ArrayList<BlackboardArtifact>();
|
this.artifacts = new ArrayList<>();
|
||||||
currentPageLabel.setText("");
|
currentPageLabel.setText("");
|
||||||
totalPageLabel.setText("");
|
totalPageLabel.setText("");
|
||||||
outputViewPane.setText("");
|
outputViewPane.setText("");
|
||||||
@ -311,12 +320,7 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArtifactStringContent artifact = node.getLookup().lookup(ArtifactStringContent.class);
|
|
||||||
Content content = node.getLookup().lookup(Content.class);
|
Content content = node.getLookup().lookup(Content.class);
|
||||||
|
|
||||||
if(artifact != null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if(content != null) {
|
if(content != null) {
|
||||||
try {
|
try {
|
||||||
long size = content.getAllArtifactsCount();
|
long size = content.getAllArtifactsCount();
|
||||||
@ -380,7 +384,7 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
|||||||
* @param artifacts List of artifacts that could be displayed
|
* @param artifacts List of artifacts that could be displayed
|
||||||
* @param offset Index into the list for the artifact to display
|
* @param offset Index into the list for the artifact to display
|
||||||
*/
|
*/
|
||||||
private void setDataView(List<BlackboardArtifact> artifacts, int offset) {
|
private void setDataView(int offset) {
|
||||||
// change the cursor to "waiting cursor" for this operation
|
// change the cursor to "waiting cursor" for this operation
|
||||||
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||||
|
|
||||||
@ -388,7 +392,6 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
|||||||
resetComponent();
|
resetComponent();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.artifacts = artifacts;
|
|
||||||
StringContent artifactString = new ArtifactStringContent(artifacts.get(offset-1));
|
StringContent artifactString = new ArtifactStringContent(artifacts.get(offset-1));
|
||||||
String text = artifactString.getString();
|
String text = artifactString.getString();
|
||||||
|
|
||||||
@ -407,15 +410,4 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
|||||||
outputViewPane.moveCaretPosition(0);
|
outputViewPane.moveCaretPosition(0);
|
||||||
this.setCursor(null);
|
this.setCursor(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the displayed artifact to the specified one.
|
|
||||||
* @param artifact Artifact to display
|
|
||||||
*/
|
|
||||||
private void setSelectedArtifact(BlackboardArtifact artifact) {
|
|
||||||
if(artifacts.contains(artifact)) {
|
|
||||||
int index = artifacts.indexOf(artifact);
|
|
||||||
setDataView(artifacts, index+1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user