Add setPath to DataResult

This commit is contained in:
Peter J. Martel 2011-12-16 16:11:33 -05:00
parent e8588b0be7
commit be10a4bb41
3 changed files with 22 additions and 8 deletions

View File

@ -45,6 +45,13 @@ public interface DataResult {
* @param title the given title (String)
*/
public void setTitle(String title);
/**
* Sets the descriptive context text at the top of the pane.
* @param pathText Descriptive text giving context for the current results
*/
public void setPath(String pathText);
/**
* Checks if this is the main (uncloseable) instance of DataResult

View File

@ -42,9 +42,9 @@ public final class DataResultTopComponent extends TopComponent implements DataRe
private Node rootNode;
private PropertyChangeSupport pcs = new PropertyChangeSupport(this);
private boolean isMain;
/** path to the icon used by the component and its open action */
// static final String ICON_PATH = "SET/PATH/TO/ICON/HERE";
private static String PREFERRED_ID = "NodeTableTopComponent";
/**
* Name of property change fired when a file search result is closed
*/
@ -111,7 +111,7 @@ public final class DataResultTopComponent extends TopComponent implements DataRe
// set the tree table view
newDataResult.setNode(givenNode);
newDataResult.directoryTablePath.setText(pathText);
newDataResult.setPath(pathText);
return newDataResult;
}
@ -284,17 +284,13 @@ public final class DataResultTopComponent extends TopComponent implements DataRe
public void setNode(Node selectedNode) {
this.rootNode = selectedNode;
if (selectedNode != null) {
//path = DataConversion.getformattedPath(ContentUtils.getDisplayPath(selectedNode.getLookup().lookup(Content.class)), 0);
int childrenCount = selectedNode.getChildren().getNodesCount(true);
this.numberMatchLabel.setText(Integer.toString(childrenCount));
}
this.numberMatchLabel.setVisible(true);
this.matchLabel.setVisible(true);
this.directoryTablePath.setText("TEST"); // set the node path
resetTabs(selectedNode);
// set the display on the current active tab
@ -309,6 +305,11 @@ public final class DataResultTopComponent extends TopComponent implements DataRe
public void setTitle(String title) {
setName(title);
}
@Override
public void setPath(String pathText) {
this.directoryTablePath.setText(pathText);
}
@Override
public boolean isMain() {

View File

@ -45,7 +45,10 @@ import org.openide.nodes.Children;
import org.openide.nodes.Node;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.corecomponents.DataResultTopComponent;
import org.sleuthkit.autopsy.datamodel.ContentUtils;
import org.sleuthkit.autopsy.datamodel.DataConversion;
import org.sleuthkit.autopsy.datamodel.RootContentChildren;
import org.sleuthkit.datamodel.Content;
/**
* Top component which displays something.
@ -553,6 +556,9 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
}
DirectoryTreeTopComponent.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
DirectoryTreeTopComponent.this.dataResult.setNode(new DataResultFilterNode(originNode, DirectoryTreeTopComponent.this.em));
String path = DataConversion.getformattedPath(ContentUtils.getDisplayPath(originNode.getLookup().lookup(Content.class)), 0);
DirectoryTreeTopComponent.this.dataResult.setPath(path);
}
// set the directory listing to be active