19 package org.sleuthkit.autopsy.centralrepository.contentviewer;
24 import java.awt.Cursor;
25 import java.awt.event.ActionEvent;
26 import java.awt.event.ActionListener;
27 import java.awt.event.ComponentAdapter;
28 import java.awt.event.ComponentEvent;
30 import java.util.ArrayList;
31 import java.util.Calendar;
32 import java.util.Collection;
33 import java.util.Collections;
34 import java.util.HashMap;
35 import java.util.List;
37 import java.util.concurrent.ExecutionException;
38 import java.util.concurrent.ExecutorService;
39 import java.util.concurrent.Executors;
40 import java.util.concurrent.FutureTask;
41 import java.util.logging.Level;
42 import javax.swing.JFileChooser;
43 import javax.swing.JMenuItem;
44 import javax.swing.JOptionPane;
45 import static javax.swing.JOptionPane.DEFAULT_OPTION;
46 import static javax.swing.JOptionPane.ERROR_MESSAGE;
47 import static javax.swing.JOptionPane.PLAIN_MESSAGE;
48 import javax.swing.SwingWorker;
49 import javax.swing.filechooser.FileNameExtensionFilter;
50 import javax.swing.table.TableModel;
51 import javax.swing.table.TableRowSorter;
52 import org.openide.util.NbBundle;
68 "OtherOccurrencesPanel.table.noArtifacts=Item has no attributes with which to search.",
69 "OtherOccurrencesPanel.table.noResultsFound=No results found.",
70 "OtherOccurrencesPanel_table_loadingResults=Loading results"
74 private static final CorrelationCaseWrapper NO_ARTIFACTS_CASE =
new CorrelationCaseWrapper(Bundle.OtherOccurrencesPanel_table_noArtifacts());
75 private static final CorrelationCaseWrapper NO_RESULTS_CASE =
new CorrelationCaseWrapper(Bundle.OtherOccurrencesPanel_table_noResultsFound());
77 private static final long serialVersionUID = 1L;
83 private String dataSourceName =
"";
84 private String deviceId =
"";
85 private AbstractFile file = null;
91 private final FutureTask<JFileChooser> futureFileChooser =
new FutureTask<>(JFileChooser::new);
100 this.dataSourcesTableModel =
new OtherOccurrencesDataSourcesTableModel();
101 this.correlationAttributes =
new ArrayList<>();
103 customizeComponents();
105 ExecutorService executor = Executors.newSingleThreadExecutor();
106 executor.execute(futureFileChooser);
110 ActionListener actList = (ActionEvent e) -> {
111 JMenuItem jmi = (JMenuItem) e.getSource();
112 if (jmi.equals(showCaseDetailsMenuItem)) {
113 showCaseDetails(filesTable.getSelectedRow());
114 }
else if (jmi.equals(exportToCSVMenuItem)) {
118 logger.log(Level.SEVERE,
"Exception while getting open case.", ex);
120 }
else if (jmi.equals(showCommonalityMenuItem)) {
121 showCommonalityDetails();
125 exportToCSVMenuItem.addActionListener(actList);
126 showCaseDetailsMenuItem.addActionListener(actList);
127 showCommonalityMenuItem.addActionListener(actList);
128 filesTable.setComponentPopupMenu(rightClickPopupMenu);
130 TableRowSorter<TableModel> sorter =
new TableRowSorter<>(filesTable.getModel());
131 filesTable.setRowSorter(sorter);
134 casesTable.getRowSorter().toggleSortOrder(0);
135 dataSourcesTable.getRowSorter().toggleSortOrder(0);
136 filesTable.getRowSorter().toggleSortOrder(0);
138 casesTable.getSelectionModel().addListSelectionListener((e) -> {
140 updateOnCaseSelection();
143 dataSourcesTable.getSelectionModel().addListSelectionListener((e) -> {
145 updateOnDataSourceSelection();
150 filesTable.getSelectionModel().addListSelectionListener((e) -> {
152 occurrencePanel =
new OccurrencePanel();
153 updateOnFileSelection();
156 detailsPanelScrollPane.addComponentListener(
new ComponentAdapter() {
158 public void componentResized(ComponentEvent componentEvent) {
160 occurrencePanel.setPreferredSize(
new java.awt.Dimension(detailsPanelScrollPane.getPreferredSize().width, occurrencePanel.getPreferredSize().height));
161 detailsPanelScrollPane.setViewportView(occurrencePanel);
167 @NbBundle.Messages({
"OtherOccurrencesPanel.correlatedArtifacts.isEmpty=There are no files or artifacts to correlate.",
168 "# {0} - commonality percentage",
169 "# {1} - correlation type",
170 "# {2} - correlation value",
171 "OtherOccurrencesPanel.correlatedArtifacts.byType={0}% of data sources have {2} (type: {1})\n",
172 "OtherOccurrencesPanel.correlatedArtifacts.title=Attribute Frequency",
173 "OtherOccurrencesPanel.correlatedArtifacts.failed=Failed to get frequency details."})
179 if (correlationAttributes.isEmpty()) {
181 Bundle.OtherOccurrencesPanel_correlatedArtifacts_isEmpty(),
182 Bundle.OtherOccurrencesPanel_correlatedArtifacts_title(),
183 DEFAULT_OPTION, PLAIN_MESSAGE);
185 StringBuilder msg =
new StringBuilder(correlationAttributes.size());
187 this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
194 msg.append(Bundle.OtherOccurrencesPanel_correlatedArtifacts_byType(percentage,
195 eamArtifact.getCorrelationType().getDisplayName(),
196 eamArtifact.getCorrelationValue()));
198 logger.log(Level.WARNING, String.format(
"Error getting commonality details for artifact with ID: %s.", eamArtifact.getID()), ex);
201 this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
204 Bundle.OtherOccurrencesPanel_correlatedArtifacts_title(),
205 DEFAULT_OPTION, PLAIN_MESSAGE);
207 this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
208 logger.log(Level.SEVERE,
"Error getting commonality details.", ex);
210 Bundle.OtherOccurrencesPanel_correlatedArtifacts_failed(),
211 Bundle.OtherOccurrencesPanel_correlatedArtifacts_title(),
212 DEFAULT_OPTION, ERROR_MESSAGE);
217 @NbBundle.Messages({
"OtherOccurrencesPanel.caseDetailsDialog.notSelected=No Row Selected",
218 "OtherOccurrencesPanel.caseDetailsDialog.noDetails=No details for this case.",
219 "OtherOccurrencesPanel.caseDetailsDialog.noDetailsReference=No case details for Global reference properties.",
220 "OtherOccurrencesPanel.caseDetailsDialog.noCaseNameError=Error",
221 "OtherOccurrencesPanel.noOpenCase.errMsg=No open case available."})
223 String caseDisplayName = Bundle.OtherOccurrencesPanel_caseDetailsDialog_noCaseNameError();
224 String details = Bundle.OtherOccurrencesPanel_caseDetailsDialog_noDetails();
226 if (-1 != selectedRowViewIdx && filesTableModel.
getRowCount() > 0) {
228 int selectedRowModelIdx = filesTable.convertRowIndexToModel(selectedRowViewIdx);
229 List<NodeData> rowList = filesTableModel.getListOfNodesForFile(selectedRowModelIdx);
230 if (!rowList.isEmpty()) {
231 CorrelationCase eamCasePartial = rowList.get(0).getCorrelationAttributeInstance().getCorrelationCase();
235 if (eamCase != null) {
238 details = Bundle.OtherOccurrencesPanel_caseDetailsDialog_noDetails();
241 details = Bundle.OtherOccurrencesPanel_caseDetailsDialog_noDetailsReference();
245 logger.log(Level.SEVERE,
"Error loading case details", ex);
250 DEFAULT_OPTION, PLAIN_MESSAGE);
257 if (CSVFileChooser == null) {
259 CSVFileChooser = futureFileChooser.get();
260 }
catch (InterruptedException | ExecutionException ex) {
263 logger.log(Level.WARNING,
"A failure occurred in the JFileChooser background thread");
264 CSVFileChooser =
new JFileChooser();
268 Calendar now = Calendar.getInstance();
269 String fileName = String.format(
"%1$tY%1$tm%1$te%1$tI%1$tM%1$tS_other_data_sources.csv", now);
271 CSVFileChooser.setSelectedFile(
new File(fileName));
272 CSVFileChooser.setFileFilter(
new FileNameExtensionFilter(
"csv file",
"csv"));
274 int returnVal = CSVFileChooser.showSaveDialog(filesTable);
275 if (returnVal == JFileChooser.APPROVE_OPTION) {
277 File selectedFile = CSVFileChooser.getSelectedFile();
278 if (!selectedFile.getName().endsWith(
".csv")) {
279 selectedFile =
new File(selectedFile.toString() +
".csv");
281 CSVWorker csvWorker =
new CSVWorker(selectedFile, file, dataSourceName, deviceId, Collections.unmodifiableCollection(correlationAttributes));
287 @NbBundle.Messages({
"OtherOccurrencesPanel_earliestCaseNotAvailable=Not Available."})
293 casesTableModel.clearTable();
294 dataSourcesTableModel.clearTable();
295 filesTableModel.clearTable();
296 correlationAttributes.clear();
297 earliestCaseDate.setText(Bundle.OtherOccurrencesPanel_earliestCaseNotAvailable());
298 foundInLabel.setText(
"");
300 occurrencePanel =
new OccurrencePanel();
301 occurrencePanel.getPreferredSize();
302 detailsPanelScrollPane.setViewportView(occurrencePanel);
316 if (worker != null) {
321 casesTableModel.addCorrelationCase(NO_ARTIFACTS_CASE);
323 worker =
new OtherOccurrenceOneTypeWorker(aType, value, file, deviceId, dataSourceName) {
331 casesTableModel.clearTable();
333 OtherOccurrenceOneTypeWorker.OneTypeData data =
get();
334 correlationAttributes.addAll(data.getCorrelationAttributesToAdd());
336 casesTableModel.addCorrelationCase(
new CorrelationCaseWrapper(corCase));
339 if (correlationAttributes.isEmpty()) {
340 casesTableModel.addCorrelationCase(NO_ARTIFACTS_CASE);
341 }
else if (caseCount == 0) {
342 casesTableModel.addCorrelationCase(NO_RESULTS_CASE);
344 String earliestDate = data.getEarliestCaseDate();
345 earliestCaseDate.setText(earliestDate.isEmpty() ? Bundle.OtherOccurrencesPanel_earliestCaseNotAvailable() : earliestDate);
346 foundInLabel.setText(String.format(Bundle.OtherOccurrencesPanel_foundIn_text(), data.getTotalCount(), caseCount, data.getDataSourceCount()));
348 casesTable.setRowSelectionInterval(0, 0);
352 }
catch (InterruptedException | ExecutionException ex) {
353 logger.log(Level.SEVERE,
"Failed to update OtherOccurrence panel", ex);
364 void showPanelLoadingMessage() {
365 casesTableModel.addCorrelationCase(NO_ARTIFACTS_CASE);
375 "OtherOccurrencesPanel.foundIn.text=Found %d instances in %d cases and %d data sources."
377 void populateTable(OtherOccurrencesData data) {
378 this.file = data.getFile();
379 this.dataSourceName = data.getDataSourceName();
380 this.deviceId = data.getDeviceId();
382 casesTableModel.clearTable();
384 correlationAttributes.addAll(data.getCorrelationAttributes());
386 for (CorrelationCase corCase : data.getCaseMap().values()) {
387 casesTableModel.addCorrelationCase(
new CorrelationCaseWrapper(corCase));
390 if (correlationAttributes.isEmpty()) {
391 casesTableModel.addCorrelationCase(NO_ARTIFACTS_CASE);
392 }
else if (caseCount == 0) {
393 casesTableModel.addCorrelationCase(NO_RESULTS_CASE);
395 String earliestDate = data.getEarliestCaseDate();
396 earliestCaseDate.setText(earliestDate.isEmpty() ? Bundle.OtherOccurrencesPanel_earliestCaseNotAvailable() : earliestDate);
397 foundInLabel.setText(String.format(Bundle.OtherOccurrencesPanel_foundIn_text(), data.getInstanceDataCount(), caseCount, data.getDataSourceCount()));
399 casesTable.setRowSelectionInterval(0, 0);
409 if (worker != null) {
414 final int[] selectedCaseIndexes = casesTable.getSelectedRows();
415 dataSourcesTableModel.clearTable();
416 filesTableModel.clearTable();
418 if (selectedCaseIndexes.length == 0) {
420 occurrencePanel =
new OccurrencePanel();
421 occurrencePanel.getPreferredSize();
422 detailsPanelScrollPane.setViewportView(occurrencePanel);
427 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
429 worker =
new SelectionWorker(correlationAttributes, file, deviceId, dataSourceName) {
437 Map<UniquePathKey, NodeData> correlatedNodeDataMap =
get();
439 String currentCaseName;
443 currentCaseName = null;
444 logger.log(Level.WARNING,
"Unable to get current case for other occurrences content viewer", ex);
447 for (
NodeData nodeData : correlatedNodeDataMap.values()) {
448 for (
int selectedRow : selectedCaseIndexes) {
450 if (nodeData.isCentralRepoNode()) {
451 if (casesTableModel.getCorrelationCase(casesTable.convertRowIndexToModel(selectedRow)) != null
452 && casesTableModel.getCorrelationCase(casesTable.convertRowIndexToModel(selectedRow)).getCaseUUID().equals(nodeData.getCorrelationAttributeInstance().getCorrelationCase().getCaseUUID())) {
453 dataSourcesTableModel.addNodeData(nodeData);
455 }
else if (currentCaseName != null && (casesTableModel.getCorrelationCase(casesTable.convertRowIndexToModel(selectedRow)).getCaseUUID().equals(currentCaseName))) {
456 dataSourcesTableModel.addNodeData(nodeData);
459 logger.log(Level.WARNING,
"Unable to get correlation attribute instance from OtherOccurrenceNodeInstanceData for case " + nodeData.getCaseName(), ex);
464 if (dataSourcesTableModel.getRowCount() > 0) {
465 dataSourcesTable.setRowSelectionInterval(0, 0);
468 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
470 }
catch (InterruptedException | ExecutionException ex) {
471 logger.log(Level.SEVERE,
"Failed to update OtherOccurrencesPanel on data source selection", ex);
484 if (worker != null) {
489 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
491 final int[] selectedDataSources = dataSourcesTable.getSelectedRows();
492 filesTableModel.clearTable();
494 worker =
new SelectionWorker(correlationAttributes, file, deviceId, dataSourceName) {
502 Map<UniquePathKey, NodeData> correlatedNodeDataMap =
get();
503 if (dataSourcesTableModel.getRowCount() > 0) {
504 for (
NodeData nodeData : correlatedNodeDataMap.values()) {
505 for (
int selectedDataSourceRow : selectedDataSources) {
506 int rowModelIndex = dataSourcesTable.convertRowIndexToModel(selectedDataSourceRow);
508 if (nodeData.isCentralRepoNode()) {
509 if (dataSourcesTableModel.getCaseUUIDForRow(rowModelIndex).equals(nodeData.getCorrelationAttributeInstance().getCorrelationCase().getCaseUUID())
510 && dataSourcesTableModel.getDeviceIdForRow(rowModelIndex).equals(nodeData.getDeviceID())) {
511 filesTableModel.addNodeData(nodeData);
514 if (dataSourcesTableModel.getDeviceIdForRow(dataSourcesTable.convertRowIndexToModel(selectedDataSourceRow)).equals(nodeData.getDeviceID())) {
515 filesTableModel.addNodeData(nodeData);
519 logger.log(Level.WARNING,
"Unable to get correlation attribute instance from OtherOccurrenceNodeInstanceData for case " + nodeData.getCaseName(), ex);
526 filesTable.setRowSelectionInterval(0, 0);
528 }
catch (InterruptedException | ExecutionException ex) {
529 logger.log(Level.SEVERE,
"Failed to update OtherOccurrencesPanel on case selection", ex);
531 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
544 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
546 if (filesTableModel.
getRowCount() > 0 && filesTable.getSelectedRowCount() == 1) {
548 occurrencePanel =
new OccurrencePanel(filesTableModel.getListOfNodesForFile(filesTable.convertRowIndexToModel(filesTable.getSelectedRow())));
549 }
else if (dataSourcesTableModel.getRowCount() > 0 && dataSourcesTable.getSelectedRowCount() == 1) {
551 String caseName = dataSourcesTableModel.getCaseNameForRow(dataSourcesTable.convertRowIndexToModel(dataSourcesTable.getSelectedRow()));
552 String dsName = dataSourcesTableModel.getValueAt(dataSourcesTable.convertRowIndexToModel(dataSourcesTable.getSelectedRow()), 0).toString();
553 String caseCreatedDate =
"";
555 for (
int row : casesTable.getSelectedRows()) {
556 if (casesTableModel.
getValueAt(casesTable.convertRowIndexToModel(row), 0).toString().equals(caseName)) {
557 caseCreatedDate = getCaseCreatedDate(row);
562 occurrencePanel =
new OccurrencePanel(caseName, caseCreatedDate, dsName);
563 }
else if (casesTable.getSelectedRowCount() == 1) {
567 String caseName =
"";
569 caseName = casesTableModel.
getValueAt(casesTable.convertRowIndexToModel(casesTable.getSelectedRow()), 0).toString();
571 if (caseName.isEmpty()) {
572 occurrencePanel =
new OccurrencePanel();
574 createdDate = getCaseCreatedDate(casesTable.getSelectedRow());
575 occurrencePanel =
new OccurrencePanel(caseName, createdDate);
579 occurrencePanel =
new OccurrencePanel();
582 occurrencePanel.getPreferredSize();
583 detailsPanelScrollPane.setViewportView(occurrencePanel);
585 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
601 partialCase = casesTableModel.getCorrelationCase(casesTable.convertRowIndexToModel(caseTableRowIdx));
602 if (partialCase == null) {
610 logger.log(Level.WARNING,
"Error getting case created date for row: " + caseTableRowIdx, ex);
618 private class SelectionWorker extends SwingWorker<Map<UniquePathKey, NodeData>, Void> {
633 SelectionWorker(Collection<CorrelationAttributeInstance> coAtInstances, AbstractFile abstractFile, String deviceIdStr, String dataSourceNameStr) {
634 this.coAtInstances = coAtInstances;
635 this.abstractFile = abstractFile;
636 this.dataSourceNameStr = dataSourceNameStr;
637 this.deviceIdStr = deviceIdStr;
642 Map<UniquePathKey, NodeData> correlatedNodeDataMap =
new HashMap<>();
647 return new HashMap<>();
651 return correlatedNodeDataMap;
658 private class CSVWorker extends SwingWorker<Void, Void> {
675 CSVWorker(File destFile, AbstractFile sourceFile, String dataSourceName, String deviceId, Collection<CorrelationAttributeInstance> correlationAttList) {
676 this.destFile = destFile;
677 this.abstractFile = sourceFile;
678 this.dataSourceName = dataSourceName;
679 this.deviceId = deviceId;
680 this.correlationAttList = correlationAttList;
693 }
catch (InterruptedException | ExecutionException ex) {
695 "Failed to create csv file for Other Occurrences at\n" + destFile.getAbsolutePath(),
696 "Error Creating CSV",
697 JOptionPane.ERROR_MESSAGE);
699 logger.log(Level.SEVERE,
"Error writing selected rows to from OtherOccurrencePanel to " + destFile.getAbsolutePath(), ex);
709 @SuppressWarnings(
"unchecked")
711 private
void initComponents() {
712 java.awt.GridBagConstraints gridBagConstraints;
714 rightClickPopupMenu =
new javax.swing.JPopupMenu();
715 exportToCSVMenuItem =
new javax.swing.JMenuItem();
716 showCaseDetailsMenuItem =
new javax.swing.JMenuItem();
717 showCommonalityMenuItem =
new javax.swing.JMenuItem();
718 tableContainerPanel =
new javax.swing.JPanel();
719 tablesViewerSplitPane =
new javax.swing.JSplitPane();
720 caseDatasourceFileSplitPane =
new javax.swing.JSplitPane();
721 caseDatasourceSplitPane =
new javax.swing.JSplitPane();
722 caseScrollPane =
new javax.swing.JScrollPane();
723 casesTable =
new javax.swing.JTable();
724 dataSourceScrollPane =
new javax.swing.JScrollPane();
725 dataSourcesTable =
new javax.swing.JTable();
726 filesTableScrollPane =
new javax.swing.JScrollPane();
727 filesTable =
new javax.swing.JTable();
728 detailsPanelScrollPane =
new javax.swing.JScrollPane();
729 jPanel1 =
new javax.swing.JPanel();
730 foundInLabel =
new javax.swing.JLabel();
731 earliestCaseDate =
new javax.swing.JLabel();
732 earliestCaseLabel =
new javax.swing.JLabel();
733 filler1 =
new javax.swing.Box.Filler(
new java.awt.Dimension(0, 0),
new java.awt.Dimension(0, 0),
new java.awt.Dimension(32767, 0));
735 rightClickPopupMenu.addPopupMenuListener(
new javax.swing.event.PopupMenuListener() {
736 public void popupMenuCanceled(javax.swing.event.PopupMenuEvent evt) {
738 public void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {
740 public void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {
741 rightClickPopupMenuPopupMenuWillBecomeVisible(evt);
745 org.openide.awt.Mnemonics.setLocalizedText(exportToCSVMenuItem,
org.openide.util.NbBundle.getMessage(
OtherOccurrencesPanel.class,
"OtherOccurrencesPanel.exportToCSVMenuItem.text"));
746 rightClickPopupMenu.add(exportToCSVMenuItem);
748 org.openide.awt.Mnemonics.setLocalizedText(showCaseDetailsMenuItem,
org.openide.util.NbBundle.getMessage(
OtherOccurrencesPanel.class,
"OtherOccurrencesPanel.showCaseDetailsMenuItem.text"));
749 rightClickPopupMenu.add(showCaseDetailsMenuItem);
751 org.openide.awt.Mnemonics.setLocalizedText(showCommonalityMenuItem,
org.openide.util.NbBundle.getMessage(
OtherOccurrencesPanel.class,
"OtherOccurrencesPanel.showCommonalityMenuItem.text"));
752 rightClickPopupMenu.add(showCommonalityMenuItem);
754 tableContainerPanel.setPreferredSize(
new java.awt.Dimension(600, 63));
755 tableContainerPanel.setRequestFocusEnabled(
false);
757 tablesViewerSplitPane.setDividerLocation(450);
758 tablesViewerSplitPane.setResizeWeight(0.75);
760 caseDatasourceFileSplitPane.setDividerLocation(300);
761 caseDatasourceFileSplitPane.setResizeWeight(0.66);
762 caseDatasourceFileSplitPane.setToolTipText(
org.openide.util.NbBundle.getMessage(
OtherOccurrencesPanel.class,
"OtherOccurrencesPanel.caseDatasourceFileSplitPane.toolTipText"));
764 caseDatasourceSplitPane.setDividerLocation(150);
765 caseDatasourceSplitPane.setResizeWeight(0.5);
767 caseScrollPane.setPreferredSize(
new java.awt.Dimension(150, 30));
769 casesTable.setAutoCreateRowSorter(
true);
770 casesTable.setModel(casesTableModel);
771 caseScrollPane.setViewportView(casesTable);
773 caseDatasourceSplitPane.setLeftComponent(caseScrollPane);
775 dataSourceScrollPane.setPreferredSize(
new java.awt.Dimension(150, 30));
777 dataSourcesTable.setAutoCreateRowSorter(
true);
778 dataSourcesTable.setModel(dataSourcesTableModel);
779 dataSourceScrollPane.setViewportView(dataSourcesTable);
781 caseDatasourceSplitPane.setRightComponent(dataSourceScrollPane);
783 caseDatasourceFileSplitPane.setLeftComponent(caseDatasourceSplitPane);
785 filesTableScrollPane.setPreferredSize(
new java.awt.Dimension(150, 30));
787 filesTable.setAutoCreateRowSorter(
true);
788 filesTable.setModel(filesTableModel);
789 filesTable.setToolTipText(
org.openide.util.NbBundle.getMessage(
OtherOccurrencesPanel.class,
"OtherOccurrencesPanel.filesTable.toolTipText"));
790 filesTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
791 filesTableScrollPane.setViewportView(filesTable);
793 caseDatasourceFileSplitPane.setRightComponent(filesTableScrollPane);
795 tablesViewerSplitPane.setLeftComponent(caseDatasourceFileSplitPane);
797 detailsPanelScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
798 detailsPanelScrollPane.setPreferredSize(
new java.awt.Dimension(300, 100));
799 tablesViewerSplitPane.setRightComponent(detailsPanelScrollPane);
801 jPanel1.setPreferredSize(
new java.awt.Dimension(576, 22));
802 jPanel1.setLayout(
new java.awt.GridBagLayout());
804 foundInLabel.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
805 org.openide.awt.Mnemonics.setLocalizedText(foundInLabel,
org.openide.util.NbBundle.getMessage(
OtherOccurrencesPanel.class,
"OtherOccurrencesPanel.foundInLabel.text"));
806 foundInLabel.setPreferredSize(
new java.awt.Dimension(400, 16));
807 gridBagConstraints =
new java.awt.GridBagConstraints();
808 gridBagConstraints.gridx = 3;
809 gridBagConstraints.gridy = 0;
810 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
811 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
812 gridBagConstraints.insets =
new java.awt.Insets(2, 2, 0, 0);
813 jPanel1.add(foundInLabel, gridBagConstraints);
815 org.openide.awt.Mnemonics.setLocalizedText(earliestCaseDate,
org.openide.util.NbBundle.getMessage(
OtherOccurrencesPanel.class,
"OtherOccurrencesPanel.earliestCaseDate.text"));
816 earliestCaseDate.setMaximumSize(
new java.awt.Dimension(200, 16));
817 gridBagConstraints =
new java.awt.GridBagConstraints();
818 gridBagConstraints.gridx = 1;
819 gridBagConstraints.gridy = 0;
820 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
821 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
822 gridBagConstraints.insets =
new java.awt.Insets(0, 7, 0, 0);
823 jPanel1.add(earliestCaseDate, gridBagConstraints);
825 org.openide.awt.Mnemonics.setLocalizedText(earliestCaseLabel,
org.openide.util.NbBundle.getMessage(
OtherOccurrencesPanel.class,
"OtherOccurrencesPanel.earliestCaseLabel.text"));
826 earliestCaseLabel.setToolTipText(
org.openide.util.NbBundle.getMessage(
OtherOccurrencesPanel.class,
"OtherOccurrencesPanel.earliestCaseLabel.toolTipText"));
827 earliestCaseLabel.setMaximumSize(
new java.awt.Dimension(260, 16));
828 gridBagConstraints =
new java.awt.GridBagConstraints();
829 gridBagConstraints.gridx = 0;
830 gridBagConstraints.gridy = 0;
831 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
832 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
833 jPanel1.add(earliestCaseLabel, gridBagConstraints);
834 gridBagConstraints =
new java.awt.GridBagConstraints();
835 gridBagConstraints.gridx = 2;
836 gridBagConstraints.gridy = 0;
837 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
838 gridBagConstraints.weightx = 0.1;
839 jPanel1.add(filler1, gridBagConstraints);
841 javax.swing.GroupLayout tableContainerPanelLayout =
new javax.swing.GroupLayout(tableContainerPanel);
842 tableContainerPanel.setLayout(tableContainerPanelLayout);
843 tableContainerPanelLayout.setHorizontalGroup(
844 tableContainerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
845 .addGroup(tableContainerPanelLayout.createSequentialGroup()
846 .addGroup(tableContainerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
847 .addComponent(tablesViewerSplitPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
848 .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 516, Short.MAX_VALUE))
851 tableContainerPanelLayout.setVerticalGroup(
852 tableContainerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
853 .addGroup(tableContainerPanelLayout.createSequentialGroup()
855 .addComponent(tablesViewerSplitPane)
856 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
857 .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
861 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
862 this.setLayout(layout);
863 layout.setHorizontalGroup(
864 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
865 .addComponent(tableContainerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 528, Short.MAX_VALUE)
867 layout.setVerticalGroup(
868 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
869 .addComponent(tableContainerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 143, Short.MAX_VALUE)
874 boolean enableCentralRepoActions =
false;
876 int rowIndex = filesTable.getSelectedRow();
877 List<NodeData> selectedFile = filesTableModel.getListOfNodesForFile(rowIndex);
878 if (!selectedFile.isEmpty() && selectedFile.get(0) instanceof
NodeData) {
879 NodeData instanceData = selectedFile.get(0);
883 showCaseDetailsMenuItem.setVisible(enableCentralRepoActions);
884 showCommonalityMenuItem.setVisible(enableCentralRepoActions);
Object getValueAt(int rowIdx, int colIdx)
javax.swing.JScrollPane caseScrollPane
javax.swing.JScrollPane filesTableScrollPane
final AbstractFile abstractFile
javax.swing.JPopupMenu rightClickPopupMenu
final OtherOccurrencesDataSourcesTableModel dataSourcesTableModel
static void writeOtherOccurrencesToFileAsCSV(File destFile, AbstractFile abstractFile, Collection< CorrelationAttributeInstance > correlationAttList, String dataSourceName, String deviceId)
static Map< UniquePathKey, NodeData > getCorrelatedInstances(AbstractFile file, String deviceId, String dataSourceName, CorrelationAttributeInstance corAttr)
javax.swing.JMenuItem showCaseDetailsMenuItem
javax.swing.JSplitPane caseDatasourceSplitPane
final Collection< CorrelationAttributeInstance > correlationAttList
CorrelationCase getCaseByUUID(String caseUUID)
void customizeComponents()
boolean isCentralRepoNode()
javax.swing.JPanel tableContainerPanel
final Collection< CorrelationAttributeInstance > correlationAttributes
final String dataSourceName
String getCaseCreatedDate(int caseTableRowIdx)
javax.swing.JLabel foundInLabel
javax.swing.JTable casesTable
void showCommonalityDetails()
void showCaseDetails(int selectedRowViewIdx)
final Collection< CorrelationAttributeInstance > coAtInstances
String getCaseDetailsOptionsPaneDialog()
OccurrencePanel occurrencePanel
javax.swing.JScrollPane detailsPanelScrollPane
void updateOnDataSourceSelection()
void updateOnFileSelection()
javax.swing.Box.Filler filler1
javax.swing.JLabel earliestCaseDate
javax.swing.JPanel jPanel1
final AbstractFile abstractFile
final OtherOccurrencesFilesTableModel filesTableModel
javax.swing.JScrollPane dataSourceScrollPane
void populateTableForOneType(CorrelationAttributeInstance.Type aType, String value)
javax.swing.JMenuItem exportToCSVMenuItem
int getFrequencyPercentage(CorrelationAttributeInstance corAttr)
javax.swing.JMenuItem showCommonalityMenuItem
javax.swing.JLabel earliestCaseLabel
final String dataSourceNameStr
static Case getCurrentCase()
synchronized static Logger getLogger(String name)
javax.swing.JTable filesTable
JFileChooser CSVFileChooser
static Case getCurrentCaseThrows()
javax.swing.JSplitPane tablesViewerSplitPane
void updateOnCaseSelection()
void rightClickPopupMenuPopupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt)
String getExportDirectory()
final OtherOccurrencesCasesTableModel casesTableModel
javax.swing.JSplitPane caseDatasourceFileSplitPane
static CentralRepository getInstance()
static boolean isCaseOpen()
Map< UniquePathKey, NodeData > doInBackground()
static boolean isEnabled()
javax.swing.JTable dataSourcesTable