mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
- add expand node method to DataResultViewer interface and implement it for DataResultViewerTable
- auto start the list search for all queries once button is pressed, using the expand node method
This commit is contained in:
parent
f67715bc59
commit
a8bfc14c13
@ -61,4 +61,10 @@ public interface DataResultViewer {
|
|||||||
* preparation for permanently disposing of it.
|
* preparation for permanently disposing of it.
|
||||||
*/
|
*/
|
||||||
public void clearComponent();
|
public void clearComponent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expand node, if supported by the viewed
|
||||||
|
* @param n Node to expand
|
||||||
|
*/
|
||||||
|
public void expandNode(Node n);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ import org.openide.nodes.Node;
|
|||||||
import org.openide.nodes.Node.Property;
|
import org.openide.nodes.Node.Property;
|
||||||
import org.openide.nodes.Node.PropertySet;
|
import org.openide.nodes.Node.PropertySet;
|
||||||
import org.openide.nodes.Sheet;
|
import org.openide.nodes.Sheet;
|
||||||
|
import org.openide.util.lookup.AbstractLookup;
|
||||||
import org.openide.util.lookup.ServiceProvider;
|
import org.openide.util.lookup.ServiceProvider;
|
||||||
import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
|
import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
|
||||||
|
|
||||||
@ -64,6 +65,18 @@ public class DataResultViewerTable extends AbstractDataResultViewer {
|
|||||||
|
|
||||||
this.em.addPropertyChangeListener(this);
|
this.em.addPropertyChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expand node
|
||||||
|
* @param n Node to expand
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void expandNode(Node n) {
|
||||||
|
if ( this.tableScrollPanel != null) {
|
||||||
|
OutlineView ov = ((OutlineView) this.tableScrollPanel);
|
||||||
|
ov.expandNode(n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
/** This method is called from within the constructor to
|
||||||
* initialize the form.
|
* initialize the form.
|
||||||
|
@ -91,6 +91,16 @@ public class DataResultViewerThumbnail extends AbstractDataResultViewer {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expand node
|
||||||
|
* @param n Node to expand
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void expandNode(Node n) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNode(Node givenNode) {
|
public void setNode(Node givenNode) {
|
||||||
// change the cursor to "waiting cursor" for this operation
|
// change the cursor to "waiting cursor" for this operation
|
||||||
|
@ -28,10 +28,14 @@ import java.util.Set;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
import org.apache.solr.client.solrj.response.TermsResponse.Term;
|
import org.apache.solr.client.solrj.response.TermsResponse.Term;
|
||||||
import org.openide.nodes.ChildFactory;
|
import org.openide.nodes.ChildFactory;
|
||||||
import org.openide.nodes.Children;
|
import org.openide.nodes.Children;
|
||||||
import org.openide.nodes.Node;
|
import org.openide.nodes.Node;
|
||||||
|
import org.openide.util.Lookup;
|
||||||
|
import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
|
||||||
|
import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable;
|
||||||
import org.sleuthkit.autopsy.datamodel.AbstractFsContentNode;
|
import org.sleuthkit.autopsy.datamodel.AbstractFsContentNode;
|
||||||
import org.sleuthkit.autopsy.datamodel.AbstractFsContentNode.FsContentPropertyType;
|
import org.sleuthkit.autopsy.datamodel.AbstractFsContentNode.FsContentPropertyType;
|
||||||
import org.sleuthkit.autopsy.datamodel.KeyValueNode;
|
import org.sleuthkit.autopsy.datamodel.KeyValueNode;
|
||||||
@ -140,17 +144,25 @@ public class KeywordSearchResultFactory extends ChildFactory<KeyValueThing> {
|
|||||||
@Override
|
@Override
|
||||||
protected Node createNodeForKey(KeyValueThing thing) {
|
protected Node createNodeForKey(KeyValueThing thing) {
|
||||||
ChildFactory<KeyValueThing> childFactory = null;
|
ChildFactory<KeyValueThing> childFactory = null;
|
||||||
switch (presentation) {
|
|
||||||
case COLLAPSE:
|
|
||||||
childFactory = new ResultCollapsedChildFactory(thing);
|
|
||||||
break;
|
|
||||||
case DETAIL:
|
|
||||||
childFactory = new ResulTermsMatchesChildFactory(things);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
|
|
||||||
return new KeyValueNode(thing, Children.create(childFactory, true));
|
if (presentation == Presentation.COLLAPSE) {
|
||||||
|
childFactory = new ResultCollapsedChildFactory(thing);
|
||||||
|
final Node ret = new KeyValueNode(thing, Children.create(childFactory, true));
|
||||||
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
//DataResultViewerTable view = Utilities.actionsGlobalContext().lookup(DataResultViewerTable.class);
|
||||||
|
for (DataResultViewer view : Lookup.getDefault().lookupAll(DataResultViewer.class)) {
|
||||||
|
view.expandNode(ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return ret;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
childFactory = new ResulTermsMatchesChildFactory(things);
|
||||||
|
return new KeyValueNode(thing, Children.create(childFactory, true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -184,14 +196,15 @@ public class KeywordSearchResultFactory extends ChildFactory<KeyValueThing> {
|
|||||||
//the query is executed later on demand
|
//the query is executed later on demand
|
||||||
StringBuilder highlightQuery = new StringBuilder();
|
StringBuilder highlightQuery = new StringBuilder();
|
||||||
Collection<Term> terms = tcq.getTerms();
|
Collection<Term> terms = tcq.getTerms();
|
||||||
final int lastTerm = terms.size() -1;
|
final int lastTerm = terms.size() - 1;
|
||||||
int curTerm = 0;
|
int curTerm = 0;
|
||||||
for (Term term : terms) {
|
for (Term term : terms) {
|
||||||
final String termS = KeywordSearchUtil.escapeLuceneQuery(term.getTerm(), true);
|
final String termS = KeywordSearchUtil.escapeLuceneQuery(term.getTerm(), true);
|
||||||
if (! termS.contains("*")) {
|
if (!termS.contains("*")) {
|
||||||
highlightQuery.append(termS);
|
highlightQuery.append(termS);
|
||||||
if (lastTerm != curTerm)
|
if (lastTerm != curTerm) {
|
||||||
highlightQuery.append(" ");
|
highlightQuery.append(" ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//String highlightQueryEscaped = KeywordSearchUtil.escapeLuceneQuery(highlightQuery.toString());
|
//String highlightQueryEscaped = KeywordSearchUtil.escapeLuceneQuery(highlightQuery.toString());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user