Autopsy  4.19.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
OpenMultiUserCasePanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2017-2019 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.casemodule;
20 
22 import javax.swing.JDialog;
23 import javax.swing.JPanel;
24 import javax.swing.event.ListSelectionEvent;
25 import org.openide.explorer.ExplorerManager;
26 import org.openide.nodes.Node;
27 import org.openide.util.Lookup;
29 
33 @SuppressWarnings("PMD.SingularField") // Matisse-generated UI widgets cause lots of false positives
34 final class OpenMultiUserCasePanel extends JPanel {
35 
36  private static final long serialVersionUID = 1L;
37  private final JDialog parentDialog;
38  private final MultiUserCasesBrowserPanel caseBrowserPanel;
39 
47  OpenMultiUserCasePanel(JDialog parentDialog) {
48  this.parentDialog = parentDialog;
49  initComponents(); // Machine generated code
50  caseBrowserPanel = new MultiUserCasesBrowserPanel(new ExplorerManager(), new OpenMultiUserCaseDialogCustomizer());
51  caseBrowserScrollPane.add(caseBrowserPanel);
52  caseBrowserScrollPane.setViewportView(caseBrowserPanel);
53  openSelectedCaseButton.setEnabled(false);
54  caseBrowserPanel.addListSelectionListener((ListSelectionEvent event) -> {
55  openSelectedCaseButton.setEnabled(caseBrowserPanel.getExplorerManager().getSelectedNodes().length > 0);
56  });
57  }
58 
63  void refreshDisplay() {
64  caseBrowserPanel.displayCases();
65  }
66 
72  @SuppressWarnings("unchecked")
73  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
74  private void initComponents() {
75 
76  openSingleUserCaseButton = new javax.swing.JButton();
77  cancelButton = new javax.swing.JButton();
78  searchLabel = new javax.swing.JLabel();
79  openSelectedCaseButton = new javax.swing.JButton();
80  caseBrowserScrollPane = new javax.swing.JScrollPane();
81 
82  setName("Completed Cases"); // NOI18N
83  setPreferredSize(new java.awt.Dimension(960, 485));
84 
85  org.openide.awt.Mnemonics.setLocalizedText(openSingleUserCaseButton, org.openide.util.NbBundle.getMessage(OpenMultiUserCasePanel.class, "OpenMultiUserCasePanel.openSingleUserCaseButton.text")); // NOI18N
86  openSingleUserCaseButton.setMinimumSize(new java.awt.Dimension(156, 23));
87  openSingleUserCaseButton.setPreferredSize(new java.awt.Dimension(156, 23));
88  openSingleUserCaseButton.addActionListener(new java.awt.event.ActionListener() {
89  public void actionPerformed(java.awt.event.ActionEvent evt) {
90  openSingleUserCaseButtonActionPerformed(evt);
91  }
92  });
93 
94  org.openide.awt.Mnemonics.setLocalizedText(cancelButton, org.openide.util.NbBundle.getMessage(OpenMultiUserCasePanel.class, "OpenMultiUserCasePanel.cancelButton.text")); // NOI18N
95  cancelButton.setMaximumSize(new java.awt.Dimension(80, 23));
96  cancelButton.setMinimumSize(new java.awt.Dimension(80, 23));
97  cancelButton.setPreferredSize(new java.awt.Dimension(80, 23));
98  cancelButton.addActionListener(new java.awt.event.ActionListener() {
99  public void actionPerformed(java.awt.event.ActionEvent evt) {
100  cancelButtonActionPerformed(evt);
101  }
102  });
103 
104  org.openide.awt.Mnemonics.setLocalizedText(searchLabel, org.openide.util.NbBundle.getMessage(OpenMultiUserCasePanel.class, "OpenMultiUserCasePanel.searchLabel.text")); // NOI18N
105 
106  org.openide.awt.Mnemonics.setLocalizedText(openSelectedCaseButton, org.openide.util.NbBundle.getMessage(OpenMultiUserCasePanel.class, "OpenMultiUserCasePanel.openSelectedCaseButton.text")); // NOI18N
107  openSelectedCaseButton.addActionListener(new java.awt.event.ActionListener() {
108  public void actionPerformed(java.awt.event.ActionEvent evt) {
109  openSelectedCaseButtonActionPerformed(evt);
110  }
111  });
112 
113  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
114  this.setLayout(layout);
115  layout.setHorizontalGroup(
116  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
117  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
118  .addContainerGap()
119  .addComponent(searchLabel)
120  .addGap(32, 32, 32)
121  .addComponent(openSingleUserCaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
122  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 74, Short.MAX_VALUE)
123  .addComponent(openSelectedCaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
124  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
125  .addComponent(cancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
126  .addContainerGap())
127  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
128  .addGroup(layout.createSequentialGroup()
129  .addContainerGap()
130  .addComponent(caseBrowserScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 948, Short.MAX_VALUE)
131  .addContainerGap()))
132  );
133 
134  layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {cancelButton, openSelectedCaseButton, openSingleUserCaseButton});
135 
136  layout.setVerticalGroup(
137  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
138  .addGroup(layout.createSequentialGroup()
139  .addGap(462, 462, 462)
140  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
141  .addComponent(cancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
142  .addComponent(openSingleUserCaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
143  .addComponent(searchLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
144  .addComponent(openSelectedCaseButton))
145  .addContainerGap())
146  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
147  .addGroup(layout.createSequentialGroup()
148  .addContainerGap()
149  .addComponent(caseBrowserScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 445, javax.swing.GroupLayout.PREFERRED_SIZE)
150  .addContainerGap(49, Short.MAX_VALUE)))
151  );
152 
153  layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {cancelButton, openSelectedCaseButton, openSingleUserCaseButton});
154 
155  }// </editor-fold>//GEN-END:initComponents
156 
162  private void openSingleUserCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openSingleUserCaseButtonActionPerformed
163  Lookup.getDefault().lookup(CaseOpenAction.class).openCaseSelectionWindow();
164  }//GEN-LAST:event_openSingleUserCaseButtonActionPerformed
165 
171  private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
172  if (parentDialog != null) {
173  parentDialog.setVisible(false);
174  }
175  }//GEN-LAST:event_cancelButtonActionPerformed
176 
183  private void openSelectedCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openSelectedCaseButtonActionPerformed
184  ExplorerManager explorerManager = caseBrowserPanel.getExplorerManager();
185  Node[] selectedNodes = explorerManager.getSelectedNodes();
186  if (selectedNodes.length > 0) {
187  CaseNodeData nodeData = selectedNodes[0].getLookup().lookup(CaseNodeData.class);
188  if (nodeData != null) {
189  new OpenMultiUserCaseAction(nodeData).actionPerformed(evt);
190  }
191  }
192  }//GEN-LAST:event_openSelectedCaseButtonActionPerformed
193 
194  // Variables declaration - do not modify//GEN-BEGIN:variables
195  private javax.swing.JButton cancelButton;
196  private javax.swing.JScrollPane caseBrowserScrollPane;
197  private javax.swing.JButton openSelectedCaseButton;
198  private javax.swing.JButton openSingleUserCaseButton;
199  private javax.swing.JLabel searchLabel;
200  // End of variables declaration//GEN-END:variables
201 }

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