Autopsy  4.20.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 2012-2018 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.nodes.Node;
29 
49 public abstract class AbstractDataResultViewer extends JPanel implements DataResultViewer, ExplorerManager.Provider {
50 
51  private static final Logger logger = Logger.getLogger(AbstractDataResultViewer.class.getName());
52  private transient ExplorerManager explorerManager;
53 
65  public AbstractDataResultViewer(ExplorerManager explorerManager) {
66  this.explorerManager = explorerManager;
67  }
68 
69  @Override
70  public ExplorerManager getExplorerManager() {
71  if (this.explorerManager == null) {
72  this.explorerManager = ExplorerManager.find(this);
73  }
74  return this.explorerManager;
75  }
76 
77  @Override
78  public void setSelectedNodes(Node[] selected) {
79  try {
80  this.getExplorerManager().setSelectedNodes(selected);
81  } catch (PropertyVetoException ex) {
82  logger.log(Level.SEVERE, "Couldn't set selected nodes", ex); //NON-NLS
83  }
84  }
85 
86  @Override
87  public Component getComponent() {
88  return this;
89  }
90 
91 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2022 Basis Technology. Generated on: Tue Aug 1 2023
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.