19 package org.sleuthkit.autopsy.keywordsearch;
21 import java.beans.PropertyChangeEvent;
22 import java.beans.PropertyChangeListener;
23 import java.util.ArrayList;
24 import java.util.HashMap;
25 import java.util.List;
27 import javax.swing.JTable;
28 import javax.swing.ListSelectionModel;
29 import javax.swing.table.AbstractTableModel;
30 import javax.swing.table.TableColumn;
52 keywordListNames.clear();
53 keywordListStates.clear();
54 List<KeywordList> keywordLists = keywordListsManager.getListsL();
56 String listName = list.getName();
57 keywordListNames.add(listName);
58 keywordListStates.put(listName, settings.keywordListIsEnabled(listName));
66 keywordListsManager.addPropertyChangeListener(
this);
73 listsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
75 listsTable.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
77 for (
int i = 0; i <
listsTable.getColumnCount(); i++) {
78 column =
listsTable.getColumnModel().getColumn(i);
80 column.setPreferredWidth(((
int) (width * 0.07)));
82 column.setPreferredWidth(((
int) (width * 0.92)));
88 List<SCRIPT> scripts = KeywordSearchSettings.getStringExtractScripts();
89 StringBuilder langs =
new StringBuilder();
90 langs.append(
"<html>");
91 for (
int i = 0; i < scripts.size(); i++) {
92 langs.append(scripts.get(i).toString());
93 if (i + 1 < scripts.size()) {
97 langs.append(
"</html>");
98 String langsS = langs.toString();
104 String utf8 = KeywordSearchSettings.getStringExtractOption(StringsTextExtractor.ExtractOptions.EXTRACT_UTF8.toString());
105 String utf16 = KeywordSearchSettings.getStringExtractOption(StringsTextExtractor.ExtractOptions.EXTRACT_UTF16.toString());
106 ArrayList<String> encodingsList =
new ArrayList<>();
107 if (utf8 == null || Boolean.parseBoolean(utf8)) {
108 encodingsList.add(
"UTF8");
110 if (utf16 == null || Boolean.parseBoolean(utf16)) {
111 encodingsList.add(
"UTF16");
113 String encodings = encodingsList.toString();
114 encodings = encodings.substring(1, encodings.length() - 1);
120 if (event.getPropertyName().equals(XmlKeywordSearchList.ListsEvt.LIST_ADDED.name())
121 || event.getPropertyName().equals(XmlKeywordSearchList.ListsEvt.LIST_DELETED.name())
122 || event.getPropertyName().equals(XmlKeywordSearchList.ListsEvt.LIST_UPDATED.name())
123 || event.getPropertyName().equals(XmlKeywordSearchList.LanguagesEvent.LANGUAGES_CHANGED.name())) {
132 tableModel.fireTableDataChanged();
137 List<KeywordList> keywordLists = keywordListsManager.getListsL();
138 List<String> currentListNames =
new ArrayList<>();
140 currentListNames.add(list.getName());
144 for (String listName : keywordListNames) {
145 if (!currentListNames.contains(listName)) {
146 keywordListStates.remove(listName);
151 keywordListNames.clear();
152 for (String currentListName : currentListNames) {
153 keywordListNames.add(currentListName);
154 if (!keywordListStates.containsKey(currentListName)) {
155 keywordListStates.put(currentListName, Boolean.TRUE);
162 List<String> enabledListNames =
new ArrayList<>();
163 List<String> disabledListNames =
new ArrayList<>();
164 for (String listName : keywordListNames) {
165 if (keywordListStates.get(listName)) {
166 enabledListNames.add(listName);
168 disabledListNames.add(listName);
171 return new KeywordSearchJobSettings(enabledListNames, disabledListNames);
174 void reset(KeywordSearchJobSettings newSettings) {
178 tableModel.fireTableDataChanged();
196 if (columnIndex == 0) {
197 return keywordListStates.get(listName);
205 return columnIndex == 0;
209 public void setValueAt(Object aValue,
int rowIndex,
int columnIndex) {
211 if (columnIndex == 0) {
212 keywordListStates.put(listName, (Boolean) aValue);
227 @SuppressWarnings(
"unchecked")
239 setPreferredSize(
new java.awt.Dimension(300, 170));
241 listsScrollPane.setBorder(javax.swing.BorderFactory.createEtchedBorder());
244 listsTable.setBackground(
new java.awt.Color(240, 240, 240));
245 listsTable.setModel(
new javax.swing.table.DefaultTableModel(
262 languagesLabel.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
271 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
272 this.setLayout(layout);
273 layout.setHorizontalGroup(
274 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
275 .addGroup(layout.createSequentialGroup()
277 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
278 .addGroup(layout.createSequentialGroup()
279 .addComponent(
listsScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
281 .addGroup(layout.createSequentialGroup()
283 .addComponent(
languagesValLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 274, javax.swing.GroupLayout.PREFERRED_SIZE)
284 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
285 .addComponent(
languagesLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
286 .addGroup(layout.createSequentialGroup()
287 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
289 .addGroup(layout.createSequentialGroup()
291 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
293 .addGap(0, 0, Short.MAX_VALUE))))
295 layout.setVerticalGroup(
296 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
297 .addGroup(layout.createSequentialGroup()
300 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
301 .addComponent(
listsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE)
302 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
303 .addComponent(
languagesLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
304 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
306 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
307 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
final KeywordListsTableModel tableModel
void customizeKeywordListsTable()
boolean isCellEditable(int rowIndex, int columnIndex)
void customizeComponents()
void updateKeywordListSettings()
final XmlKeywordSearchList keywordListsManager
void propertyChange(PropertyChangeEvent event)
javax.swing.JLabel encodingsLabel
void initializeKeywordListSettings(KeywordSearchJobSettings settings)
javax.swing.JLabel keywordSearchEncodings
javax.swing.JScrollPane listsScrollPane
javax.swing.JLabel languagesValLabel
void setValueAt(Object aValue, int rowIndex, int columnIndex)
javax.swing.JLabel titleLabel
javax.swing.JTable listsTable
javax.swing.JLabel languagesLabel
final Map< String, Boolean > keywordListStates
final List< String > keywordListNames
IngestModuleIngestJobSettings getSettings()
Object getValueAt(int rowIndex, int columnIndex)
Class<?> getColumnClass(int c)