19 package org.sleuthkit.autopsy.casemodule;
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;
33 @SuppressWarnings(
"PMD.SingularField")
34 final class OpenMultiUserCasePanel extends JPanel {
36 private static final long serialVersionUID = 1L;
37 private final JDialog parentDialog;
38 private final MultiUserCasesBrowserPanel caseBrowserPanel;
47 OpenMultiUserCasePanel(JDialog parentDialog) {
48 this.parentDialog = parentDialog;
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);
63 void refreshDisplay() {
64 caseBrowserPanel.displayCases();
72 @SuppressWarnings(
"unchecked")
74 private
void initComponents() {
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();
82 setName(
"Completed Cases");
83 setPreferredSize(
new java.awt.Dimension(960, 485));
85 org.openide.awt.Mnemonics.setLocalizedText(openSingleUserCaseButton,
org.openide.util.NbBundle.getMessage(OpenMultiUserCasePanel.class,
"OpenMultiUserCasePanel.openSingleUserCaseButton.text"));
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);
94 org.openide.awt.Mnemonics.setLocalizedText(cancelButton,
org.openide.util.NbBundle.getMessage(OpenMultiUserCasePanel.class,
"OpenMultiUserCasePanel.cancelButton.text"));
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);
104 org.openide.awt.Mnemonics.setLocalizedText(searchLabel,
org.openide.util.NbBundle.getMessage(OpenMultiUserCasePanel.class,
"OpenMultiUserCasePanel.searchLabel.text"));
106 org.openide.awt.Mnemonics.setLocalizedText(openSelectedCaseButton,
org.openide.util.NbBundle.getMessage(OpenMultiUserCasePanel.class,
"OpenMultiUserCasePanel.openSelectedCaseButton.text"));
107 openSelectedCaseButton.addActionListener(
new java.awt.event.ActionListener() {
108 public void actionPerformed(java.awt.event.ActionEvent evt) {
109 openSelectedCaseButtonActionPerformed(evt);
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()
119 .addComponent(searchLabel)
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)
127 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
128 .addGroup(layout.createSequentialGroup()
130 .addComponent(caseBrowserScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 948, Short.MAX_VALUE)
134 layout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {cancelButton, openSelectedCaseButton, openSingleUserCaseButton});
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))
146 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
147 .addGroup(layout.createSequentialGroup()
149 .addComponent(caseBrowserScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 445, javax.swing.GroupLayout.PREFERRED_SIZE)
150 .addContainerGap(49, Short.MAX_VALUE)))
153 layout.linkSize(javax.swing.SwingConstants.VERTICAL,
new java.awt.Component[] {cancelButton, openSelectedCaseButton, openSingleUserCaseButton});
162 private void openSingleUserCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {
163 Lookup.getDefault().lookup(CaseOpenAction.class).openCaseSelectionWindow();
171 private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {
172 if (parentDialog != null) {
173 parentDialog.setVisible(
false);
183 private void openSelectedCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {
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);
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;