Autopsy  4.5.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
AbstractDataResultViewer.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-17 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obt ain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.corecomponents;
20 
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;
31 
38 abstract class AbstractDataResultViewer extends JPanel implements DataResultViewer, Provider {
39 
40  private static final Logger logger = Logger.getLogger(AbstractDataResultViewer.class.getName());
41  protected transient ExplorerManager em;
42 
53  AbstractDataResultViewer(ExplorerManager explorerManager) {
54  this.em = explorerManager;
55  }
56 
62  public AbstractDataResultViewer() {
63  this(new ExplorerManager());
64  }
65 
66  @Override
67  public void clearComponent() {
68  }
69 
70  public Node getSelectedNode() {
71  Node result = null;
72  Node[] selectedNodes = this.getExplorerManager().getSelectedNodes();
73  if (selectedNodes.length > 0) {
74  result = selectedNodes[0];
75  }
76  return result;
77  }
78 
79  @Override
80  public void expandNode(Node n) {
81  }
82 
83  @Override
84  public void resetComponent() {
85  }
86 
87  @Override
88  public Component getComponent() {
89  return this;
90  }
91 
92  @Override
93  public ExplorerManager getExplorerManager() {
94  return this.em;
95  }
96 
97  @Override
98  public void setSelectedNodes(Node[] selected) {
99  try {
100  this.em.setSelectedNodes(selected);
101  } catch (PropertyVetoException ex) {
102  logger.log(Level.WARNING, "Couldn't set selected nodes.", ex); //NON-NLS
103  }
104  }
105 
106  @Deprecated
107  @Override
108  public void setContentViewer(DataContent contentViewer) {
109  }
110 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2016 Basis Technology. Generated on: Tue Feb 20 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.