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.
|
||||
*/
|
||||
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.PropertySet;
|
||||
import org.openide.nodes.Sheet;
|
||||
import org.openide.util.lookup.AbstractLookup;
|
||||
import org.openide.util.lookup.ServiceProvider;
|
||||
import org.sleuthkit.autopsy.corecomponentinterfaces.DataResultViewer;
|
||||
|
||||
@ -65,6 +66,18 @@ public class DataResultViewerTable extends AbstractDataResultViewer {
|
||||
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
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
|
@ -91,6 +91,16 @@ public class DataResultViewerThumbnail extends AbstractDataResultViewer {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Expand node
|
||||
* @param n Node to expand
|
||||
*/
|
||||
@Override
|
||||
public void expandNode(Node n) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNode(Node givenNode) {
|
||||
// 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.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.swing.SwingUtilities;
|
||||
import org.apache.solr.client.solrj.response.TermsResponse.Term;
|
||||
import org.openide.nodes.ChildFactory;
|
||||
import org.openide.nodes.Children;
|
||||
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.FsContentPropertyType;
|
||||
import org.sleuthkit.autopsy.datamodel.KeyValueNode;
|
||||
@ -140,18 +144,26 @@ public class KeywordSearchResultFactory extends ChildFactory<KeyValueThing> {
|
||||
@Override
|
||||
protected Node createNodeForKey(KeyValueThing thing) {
|
||||
ChildFactory<KeyValueThing> childFactory = null;
|
||||
switch (presentation) {
|
||||
case COLLAPSE:
|
||||
childFactory = new ResultCollapsedChildFactory(thing);
|
||||
break;
|
||||
case DETAIL:
|
||||
childFactory = new ResulTermsMatchesChildFactory(things);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* factory produces collapsed view of all fscontent matches per query
|
||||
@ -184,16 +196,17 @@ public class KeywordSearchResultFactory extends ChildFactory<KeyValueThing> {
|
||||
//the query is executed later on demand
|
||||
StringBuilder highlightQuery = new StringBuilder();
|
||||
Collection<Term> terms = tcq.getTerms();
|
||||
final int lastTerm = terms.size() -1;
|
||||
final int lastTerm = terms.size() - 1;
|
||||
int curTerm = 0;
|
||||
for (Term term : terms) {
|
||||
final String termS = KeywordSearchUtil.escapeLuceneQuery(term.getTerm(), true);
|
||||
if (! termS.contains("*")) {
|
||||
if (!termS.contains("*")) {
|
||||
highlightQuery.append(termS);
|
||||
if (lastTerm != curTerm)
|
||||
if (lastTerm != curTerm) {
|
||||
highlightQuery.append(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
//String highlightQueryEscaped = KeywordSearchUtil.escapeLuceneQuery(highlightQuery.toString());
|
||||
String highlightQueryEscaped = highlightQuery.toString();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user