Autopsy  4.19.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
DomainSummaryViewer.java
Go to the documentation of this file.
1 /*
2  * Autopsy
3  *
4  * Copyright 2020 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 obtain 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.discovery.ui;
20 
21 import javax.swing.DefaultListModel;
22 import javax.swing.event.ListSelectionListener;
25 
29 public class DomainSummaryViewer extends javax.swing.JPanel {
30 
31  private static final long serialVersionUID = 1L;
32 
33  private final DefaultListModel<DomainWrapper> domainListModel = new DefaultListModel<>();
34 
41  }
42 
47  void clearViewer() {
48  domainListModel.removeAllElements();
49  domainScrollPane.getVerticalScrollBar().setValue(0);
50  }
51 
57  @SuppressWarnings("unchecked")
58  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
59  private void initComponents() {
60 
61  domainScrollPane = new javax.swing.JScrollPane();
62  domainList = new javax.swing.JList<>();
63 
64  setLayout(new java.awt.BorderLayout());
65 
66  domainList.setModel(domainListModel);
67  domainList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
68  domainList.setCellRenderer(new DomainSummaryPanel());
69  domainScrollPane.setViewportView(domainList);
70 
71  add(domainScrollPane, java.awt.BorderLayout.CENTER);
72  }// </editor-fold>//GEN-END:initComponents
73 
74 
75  // Variables declaration - do not modify//GEN-BEGIN:variables
76  private javax.swing.JList<DomainWrapper> domainList;
77  private javax.swing.JScrollPane domainScrollPane;
78  // End of variables declaration//GEN-END:variables
79 
87  void addDomain(DomainWrapper domainWrapper) {
88  domainListModel.addElement(domainWrapper);
89  }
90 
98  void sendPopulateEvent() {
99  String domain = "";
100  if (domainList.getSelectedIndex() != -1) {
101  domain = domainListModel.getElementAt(domainList.getSelectedIndex()).getResultDomain().getDomain();
102  }
103  //send populateMesage
104  DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.PopulateDomainTabsEvent(domain));
105  }
106 
113  @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
114  void addListSelectionListener(ListSelectionListener listener) {
115  domainList.getSelectionModel().addListSelectionListener(listener);
116  }
117 }
final DefaultListModel< DomainWrapper > domainListModel

Copyright © 2012-2021 Basis Technology. Generated on: Fri Aug 6 2021
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.