19 package org.sleuthkit.autopsy.corecomponents;
21 import java.awt.Component;
22 import java.beans.PropertyVetoException;
23 import java.util.logging.Level;
24 import javax.swing.JPanel;
25 import org.openide.explorer.ExplorerManager;
26 import org.openide.explorer.ExplorerManager.Provider;
27 import org.openide.nodes.Node;
28 import org.openide.util.Lookup;
39 abstract class AbstractDataResultViewer
extends JPanel implements DataResultViewer, Provider {
41 private static final Logger logger = Logger.
getLogger(AbstractDataResultViewer.class.getName());
42 protected transient ExplorerManager em;
47 protected DataContent contentViewer;
57 public AbstractDataResultViewer(ExplorerManager explorerManager) {
58 this.em = explorerManager;
67 public AbstractDataResultViewer() {
68 em =
new ExplorerManager();
72 private void initialize() {
75 contentViewer = Lookup.getDefault().lookup(DataContent.class);
79 public void clearComponent() {
82 public Node getSelectedNode() {
84 Node[] selectedNodes = this.getExplorerManager().getSelectedNodes();
85 if (selectedNodes.length > 0) {
86 result = selectedNodes[0];
92 public void expandNode(Node n) {
96 public void resetComponent() {
100 public Component getComponent() {
105 public ExplorerManager getExplorerManager() {
110 public void setSelectedNodes(Node[] selected) {
112 this.em.setSelectedNodes(selected);
113 }
catch (PropertyVetoException ex) {
114 logger.log(Level.WARNING,
"Couldn't set selected nodes.", ex);
119 public void setContentViewer(DataContent contentViewer) {
120 this.contentViewer = contentViewer;
synchronized static Logger getLogger(String name)