19 package org.sleuthkit.autopsy.directorytree;
21 import javax.swing.JFrame;
22 import org.openide.util.NbBundle;
23 import org.openide.windows.WindowManager;
28 @SuppressWarnings(
"PMD.SingularField")
29 final class GroupDataSourcesDialog extends javax.swing.JDialog {
31 boolean shouldGroupByDataSource =
false;
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());
41 dataSourceCountLabel.setText(Bundle.GroupDataSourcesDialog_groupDataSources_text(dataSourceCount));
49 setSize(getPreferredSize());
50 setLocationRelativeTo(this.getParent());
51 setAlwaysOnTop(
false);
56 boolean groupByDataSourceSelected() {
57 return shouldGroupByDataSource;
65 @SuppressWarnings(
"unchecked")
67 private
void initComponents() {
69 dataSourceCountLabel =
new javax.swing.JLabel();
70 queryLabel =
new javax.swing.JLabel();
71 yesButton =
new javax.swing.JButton();
72 noButton =
new javax.swing.JButton();
74 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
75 setTitle(
org.openide.util.NbBundle.getMessage(GroupDataSourcesDialog.class,
"GroupDataSourcesDialog.title"));
77 org.openide.awt.Mnemonics.setLocalizedText(dataSourceCountLabel,
org.openide.util.NbBundle.getMessage(GroupDataSourcesDialog.class,
"GroupDataSourcesDialog.dataSourceCountLabel.text"));
79 org.openide.awt.Mnemonics.setLocalizedText(queryLabel,
org.openide.util.NbBundle.getMessage(GroupDataSourcesDialog.class,
"GroupDataSourcesDialog.queryLabel.text"));
81 org.openide.awt.Mnemonics.setLocalizedText(yesButton,
org.openide.util.NbBundle.getMessage(GroupDataSourcesDialog.class,
"GroupDataSourcesDialog.yesButton.text"));
82 yesButton.addActionListener(
new java.awt.event.ActionListener() {
83 public void actionPerformed(java.awt.event.ActionEvent evt) {
84 yesButtonActionPerformed(evt);
88 org.openide.awt.Mnemonics.setLocalizedText(noButton,
org.openide.util.NbBundle.getMessage(GroupDataSourcesDialog.class,
"GroupDataSourcesDialog.noButton.text"));
89 noButton.addActionListener(
new java.awt.event.ActionListener() {
90 public void actionPerformed(java.awt.event.ActionEvent evt) {
91 noButtonActionPerformed(evt);
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()
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)))
113 layout.setVerticalGroup(
114 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
115 .addGroup(layout.createSequentialGroup()
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))
130 private void yesButtonActionPerformed(java.awt.event.ActionEvent evt) {
131 shouldGroupByDataSource =
true;
135 private void noButtonActionPerformed(java.awt.event.ActionEvent evt) {
136 shouldGroupByDataSource =
false;
142 private javax.swing.JLabel dataSourceCountLabel;
143 private javax.swing.JButton noButton;
144 private javax.swing.JLabel queryLabel;
145 private javax.swing.JButton yesButton;