Autopsy  4.17.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
GroupDataSourcesDialog.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-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 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.directorytree;
20 
21 import javax.swing.JFrame;
22 import org.openide.util.NbBundle;
23 import org.openide.windows.WindowManager;
24 
28 @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
29 final class GroupDataSourcesDialog extends javax.swing.JDialog {
30 
31  boolean shouldGroupByDataSource = false;
32 
36  @NbBundle.Messages({"# {0} - dataSourceCount",
37  "GroupDataSourcesDialog.groupDataSources.text=This case contains {0} data sources."})
38  GroupDataSourcesDialog(int dataSourceCount) {
39  super((JFrame) WindowManager.getDefault().getMainWindow());
40  initComponents();
41  dataSourceCountLabel.setText(Bundle.GroupDataSourcesDialog_groupDataSources_text(dataSourceCount));
42  }
43 
47  void display() {
48  setModal(true);
49  setSize(getPreferredSize());
50  setLocationRelativeTo(this.getParent());
51  setAlwaysOnTop(false);
52  pack();
53  setVisible(true);
54  }
55 
56  boolean groupByDataSourceSelected() {
57  return shouldGroupByDataSource;
58  }
59 
65  @SuppressWarnings("unchecked")
66  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
67  private void initComponents() {
68 
69  dataSourceCountLabel = new javax.swing.JLabel();
70  queryLabel = new javax.swing.JLabel();
71  yesButton = new javax.swing.JButton();
72  noButton = new javax.swing.JButton();
73 
74  setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
75  setTitle(org.openide.util.NbBundle.getMessage(GroupDataSourcesDialog.class, "GroupDataSourcesDialog.title")); // NOI18N
76 
77  org.openide.awt.Mnemonics.setLocalizedText(dataSourceCountLabel, org.openide.util.NbBundle.getMessage(GroupDataSourcesDialog.class, "GroupDataSourcesDialog.dataSourceCountLabel.text")); // NOI18N
78 
79  org.openide.awt.Mnemonics.setLocalizedText(queryLabel, org.openide.util.NbBundle.getMessage(GroupDataSourcesDialog.class, "GroupDataSourcesDialog.queryLabel.text")); // NOI18N
80 
81  org.openide.awt.Mnemonics.setLocalizedText(yesButton, org.openide.util.NbBundle.getMessage(GroupDataSourcesDialog.class, "GroupDataSourcesDialog.yesButton.text")); // NOI18N
82  yesButton.addActionListener(new java.awt.event.ActionListener() {
83  public void actionPerformed(java.awt.event.ActionEvent evt) {
84  yesButtonActionPerformed(evt);
85  }
86  });
87 
88  org.openide.awt.Mnemonics.setLocalizedText(noButton, org.openide.util.NbBundle.getMessage(GroupDataSourcesDialog.class, "GroupDataSourcesDialog.noButton.text")); // NOI18N
89  noButton.addActionListener(new java.awt.event.ActionListener() {
90  public void actionPerformed(java.awt.event.ActionEvent evt) {
91  noButtonActionPerformed(evt);
92  }
93  });
94 
95  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
96  getContentPane().setLayout(layout);
97  layout.setHorizontalGroup(
98  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
99  .addGroup(layout.createSequentialGroup()
100  .addContainerGap()
101  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
102  .addComponent(queryLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
103  .addGroup(layout.createSequentialGroup()
104  .addComponent(dataSourceCountLabel)
105  .addGap(0, 0, Short.MAX_VALUE))
106  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
107  .addGap(0, 0, Short.MAX_VALUE)
108  .addComponent(yesButton, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
109  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
110  .addComponent(noButton, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)))
111  .addContainerGap())
112  );
113  layout.setVerticalGroup(
114  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
115  .addGroup(layout.createSequentialGroup()
116  .addContainerGap()
117  .addComponent(dataSourceCountLabel)
118  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
119  .addComponent(queryLabel)
120  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
121  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
122  .addComponent(yesButton)
123  .addComponent(noButton))
124  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
125  );
126 
127  pack();
128  }// </editor-fold>//GEN-END:initComponents
129 
130  private void yesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_yesButtonActionPerformed
131  shouldGroupByDataSource = true;
132  dispose();
133  }//GEN-LAST:event_yesButtonActionPerformed
134 
135  private void noButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noButtonActionPerformed
136  shouldGroupByDataSource = false;
137  dispose();
138  }//GEN-LAST:event_noButtonActionPerformed
139 
140 
141  // Variables declaration - do not modify//GEN-BEGIN:variables
142  private javax.swing.JLabel dataSourceCountLabel;
143  private javax.swing.JButton noButton;
144  private javax.swing.JLabel queryLabel;
145  private javax.swing.JButton yesButton;
146  // End of variables declaration//GEN-END:variables
147 }

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