19 package org.sleuthkit.autopsy.corecomponents;
21 import javax.swing.DefaultComboBoxModel;
22 import org.openide.util.NbBundle;
28 final class AutopsyOptionsPanel
extends javax.swing.JPanel {
30 AutopsyOptionsPanel(AutopsyOptionsPanelController controller) {
32 int availableProcessors = Runtime.getRuntime().availableProcessors();
33 Integer fileIngestThreadCountChoices[];
34 int recommendedFileIngestThreadCount;
35 if (availableProcessors >= 16) {
36 fileIngestThreadCountChoices =
new Integer[]{1, 2, 4, 6, 8, 12, 16};
37 if (availableProcessors >= 18) {
38 recommendedFileIngestThreadCount = 16;
40 recommendedFileIngestThreadCount = 12;
42 }
else if (availableProcessors >= 12 && availableProcessors <= 15) {
43 fileIngestThreadCountChoices =
new Integer[]{1, 2, 4, 6, 8, 12};
44 if (availableProcessors >= 14) {
45 recommendedFileIngestThreadCount = 12;
47 recommendedFileIngestThreadCount = 8;
49 }
else if (availableProcessors >= 8 && availableProcessors <= 11) {
50 fileIngestThreadCountChoices =
new Integer[]{1, 2, 4, 6, 8};
51 if (availableProcessors >= 10) {
52 recommendedFileIngestThreadCount = 8;
54 recommendedFileIngestThreadCount = 6;
56 }
else if (availableProcessors >= 6 && availableProcessors <= 7) {
57 fileIngestThreadCountChoices =
new Integer[]{1, 2, 4, 6};
58 recommendedFileIngestThreadCount = 4;
59 }
else if (availableProcessors >= 4 && availableProcessors <= 5) {
60 fileIngestThreadCountChoices =
new Integer[]{1, 2, 4};
61 recommendedFileIngestThreadCount = 2;
62 }
else if (availableProcessors >= 2 && availableProcessors <= 3) {
63 fileIngestThreadCountChoices =
new Integer[]{1, 2};
64 recommendedFileIngestThreadCount = 1;
66 fileIngestThreadCountChoices =
new Integer[]{1};
67 recommendedFileIngestThreadCount = 1;
69 numberOfFileIngestThreadsComboBox.setModel(
new DefaultComboBoxModel<>(fileIngestThreadCountChoices));
70 restartRequiredLabel.setText(NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.restartRequiredLabel.text", recommendedFileIngestThreadCount));
75 boolean keepPreferredViewer = UserPreferences.keepPreferredContentViewer();
76 keepCurrentViewerRB.setSelected(keepPreferredViewer);
77 useBestViewerRB.setSelected(!keepPreferredViewer);
78 dataSourcesHideKnownCB.setSelected(UserPreferences.hideKnownFilesInDataSourcesTree());
79 viewsHideKnownCB.setSelected(UserPreferences.hideKnownFilesInViewsTree());
80 boolean useLocalTime = UserPreferences.displayTimesInLocalTime();
81 useLocalTimeRB.setSelected(useLocalTime);
82 useGMTTimeRB.setSelected(!useLocalTime);
83 numberOfFileIngestThreadsComboBox.setSelectedItem(UserPreferences.numberOfFileIngestThreads());
87 UserPreferences.setKeepPreferredContentViewer(keepCurrentViewerRB.isSelected());
88 UserPreferences.setHideKnownFilesInDataSourcesTree(dataSourcesHideKnownCB.isSelected());
89 UserPreferences.setHideKnownFilesInViewsTree(viewsHideKnownCB.isSelected());
90 UserPreferences.setDisplayTimesInLocalTime(useLocalTimeRB.isSelected());
91 UserPreferences.setNumberOfFileIngestThreads((Integer) numberOfFileIngestThreadsComboBox.getSelectedItem());
104 private void initComponents() {
106 buttonGroup1 =
new javax.swing.ButtonGroup();
107 buttonGroup3 =
new javax.swing.ButtonGroup();
108 buttonGroupProcTimeOut =
new javax.swing.ButtonGroup();
109 useBestViewerRB =
new javax.swing.JRadioButton();
110 keepCurrentViewerRB =
new javax.swing.JRadioButton();
111 jLabelSelectFile =
new javax.swing.JLabel();
112 jLabelTimeDisplay =
new javax.swing.JLabel();
113 useLocalTimeRB =
new javax.swing.JRadioButton();
114 useGMTTimeRB =
new javax.swing.JRadioButton();
115 jLabelHideKnownFiles =
new javax.swing.JLabel();
116 dataSourcesHideKnownCB =
new javax.swing.JCheckBox();
117 viewsHideKnownCB =
new javax.swing.JCheckBox();
118 jLabelNumThreads =
new javax.swing.JLabel();
119 numberOfFileIngestThreadsComboBox =
new javax.swing.JComboBox<Integer>();
120 restartRequiredLabel =
new javax.swing.JLabel();
122 buttonGroup1.add(useBestViewerRB);
123 useBestViewerRB.setSelected(
true);
124 org.openide.awt.Mnemonics.setLocalizedText(useBestViewerRB,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.useBestViewerRB.text"));
125 useBestViewerRB.setToolTipText(
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.useBestViewerRB.toolTipText"));
127 buttonGroup1.add(keepCurrentViewerRB);
128 org.openide.awt.Mnemonics.setLocalizedText(keepCurrentViewerRB,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.keepCurrentViewerRB.text"));
129 keepCurrentViewerRB.setToolTipText(
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.keepCurrentViewerRB.toolTipText"));
131 org.openide.awt.Mnemonics.setLocalizedText(jLabelSelectFile,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.jLabelSelectFile.text"));
133 org.openide.awt.Mnemonics.setLocalizedText(jLabelTimeDisplay,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.jLabelTimeDisplay.text"));
135 buttonGroup3.add(useLocalTimeRB);
136 useLocalTimeRB.setSelected(
true);
137 org.openide.awt.Mnemonics.setLocalizedText(useLocalTimeRB,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.useLocalTimeRB.text"));
139 buttonGroup3.add(useGMTTimeRB);
140 org.openide.awt.Mnemonics.setLocalizedText(useGMTTimeRB,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.useGMTTimeRB.text"));
142 org.openide.awt.Mnemonics.setLocalizedText(jLabelHideKnownFiles,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.jLabelHideKnownFiles.text"));
144 org.openide.awt.Mnemonics.setLocalizedText(dataSourcesHideKnownCB,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.dataSourcesHideKnownCB.text"));
146 org.openide.awt.Mnemonics.setLocalizedText(viewsHideKnownCB,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.viewsHideKnownCB.text"));
148 org.openide.awt.Mnemonics.setLocalizedText(jLabelNumThreads,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.jLabelNumThreads.text"));
150 restartRequiredLabel.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/corecomponents/warning16.png")));
151 org.openide.awt.Mnemonics.setLocalizedText(restartRequiredLabel,
org.openide.util.NbBundle.getMessage(AutopsyOptionsPanel.class,
"AutopsyOptionsPanel.restartRequiredLabel.text"));
153 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
154 this.setLayout(layout);
155 layout.setHorizontalGroup(
156 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
157 .addGroup(layout.createSequentialGroup()
159 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
160 .addGroup(layout.createSequentialGroup()
162 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
163 .addComponent(keepCurrentViewerRB)
164 .addComponent(useBestViewerRB)
165 .addComponent(dataSourcesHideKnownCB)
166 .addComponent(viewsHideKnownCB)
167 .addGroup(layout.createSequentialGroup()
168 .addComponent(numberOfFileIngestThreadsComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
170 .addComponent(restartRequiredLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
171 .addContainerGap())))
172 .addGroup(layout.createSequentialGroup()
173 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
174 .addComponent(jLabelHideKnownFiles)
175 .addComponent(jLabelTimeDisplay)
176 .addGroup(layout.createSequentialGroup()
178 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
179 .addComponent(useLocalTimeRB)
180 .addComponent(useGMTTimeRB)))
181 .addComponent(jLabelSelectFile)
182 .addComponent(jLabelNumThreads))
183 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
185 layout.setVerticalGroup(
186 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
187 .addGroup(layout.createSequentialGroup()
188 .addComponent(jLabelSelectFile)
189 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
190 .addComponent(useBestViewerRB)
191 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
192 .addComponent(keepCurrentViewerRB)
193 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
194 .addComponent(jLabelHideKnownFiles)
195 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
196 .addComponent(dataSourcesHideKnownCB)
197 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
198 .addComponent(viewsHideKnownCB)
199 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
200 .addComponent(jLabelTimeDisplay)
201 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
202 .addComponent(useLocalTimeRB)
203 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
204 .addComponent(useGMTTimeRB)
205 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
206 .addComponent(jLabelNumThreads)
207 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
208 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
209 .addComponent(numberOfFileIngestThreadsComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
210 .addComponent(restartRequiredLabel))
211 .addContainerGap(155, Short.MAX_VALUE))
216 private javax.swing.ButtonGroup buttonGroup1;
217 private javax.swing.ButtonGroup buttonGroup3;
218 private javax.swing.ButtonGroup buttonGroupProcTimeOut;
219 private javax.swing.JCheckBox dataSourcesHideKnownCB;
220 private javax.swing.JLabel jLabelHideKnownFiles;
221 private javax.swing.JLabel jLabelNumThreads;
222 private javax.swing.JLabel jLabelSelectFile;
223 private javax.swing.JLabel jLabelTimeDisplay;
224 private javax.swing.JRadioButton keepCurrentViewerRB;
225 private javax.swing.JComboBox<Integer> numberOfFileIngestThreadsComboBox;
226 private javax.swing.JLabel restartRequiredLabel;
227 private javax.swing.JRadioButton useBestViewerRB;
228 private javax.swing.JRadioButton useGMTTimeRB;
229 private javax.swing.JRadioButton useLocalTimeRB;
230 private javax.swing.JCheckBox viewsHideKnownCB;