- 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:
adam-m 2012-01-06 17:47:57 -05:00
parent f67715bc59
commit a8bfc14c13
4 changed files with 55 additions and 13 deletions

View File

@ -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);
}

View File

@ -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

View File

@ -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

View File

@ -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
@ -190,10 +202,11 @@ public class KeywordSearchResultFactory extends ChildFactory<KeyValueThing> {
final String termS = KeywordSearchUtil.escapeLuceneQuery(term.getTerm(), true);
if (!termS.contains("*")) {
highlightQuery.append(termS);
if (lastTerm != curTerm)
if (lastTerm != curTerm) {
highlightQuery.append(" ");
}
}
}
//String highlightQueryEscaped = KeywordSearchUtil.escapeLuceneQuery(highlightQuery.toString());
String highlightQueryEscaped = highlightQuery.toString();