mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 07:56:16 +00:00
4792 kinda working field population
This commit is contained in:
parent
48264cbba0
commit
d5531d8ffc
@ -33,7 +33,6 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@ -237,47 +236,37 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
||||
"DataContentViewerOtherCases.caseDetailsDialog.noCaseNameError=Error",
|
||||
"DataContentViewerOtherCases.noOpenCase.errMsg=No open case available."})
|
||||
private void showCaseDetails(int selectedRowViewIdx) {
|
||||
|
||||
String caseDisplayName = Bundle.DataContentViewerOtherCases_caseDetailsDialog_noCaseNameError();
|
||||
String details = Bundle.DataContentViewerOtherCases_caseDetailsDialog_noDetails();
|
||||
try {
|
||||
if (-1 != selectedRowViewIdx) {
|
||||
EamDb dbManager = EamDb.getInstance();
|
||||
int selectedRowModelIdx = filesTable.convertRowIndexToModel(selectedRowViewIdx);
|
||||
OtherOccurrenceNodeInstanceData nodeData = (OtherOccurrenceNodeInstanceData) filesTableModel.getRow(selectedRowModelIdx);
|
||||
CorrelationCase eamCasePartial = nodeData.getCorrelationAttributeInstance().getCorrelationCase();
|
||||
if (eamCasePartial == null) {
|
||||
JOptionPane.showConfirmDialog(showCaseDetailsMenuItem,
|
||||
Bundle.DataContentViewerOtherCases_caseDetailsDialog_noDetailsReference(),
|
||||
caseDisplayName,
|
||||
DEFAULT_OPTION, PLAIN_MESSAGE);
|
||||
return;
|
||||
}
|
||||
CorrelationCase eamCasePartial = null;
|
||||
List<OtherOccurrenceNodeData> rowList = filesTableModel.getRow(selectedRowModelIdx);
|
||||
if (rowList.get(0) instanceof OtherOccurrenceNodeInstanceData) {
|
||||
if (!rowList.isEmpty()) {
|
||||
eamCasePartial = ((OtherOccurrenceNodeInstanceData) rowList.get(0)).getCorrelationAttributeInstance().getCorrelationCase();
|
||||
caseDisplayName = eamCasePartial.getDisplayName();
|
||||
// query case details
|
||||
CorrelationCase eamCase = dbManager.getCaseByUUID(eamCasePartial.getCaseUUID());
|
||||
if (eamCase == null) {
|
||||
JOptionPane.showConfirmDialog(showCaseDetailsMenuItem,
|
||||
Bundle.DataContentViewerOtherCases_caseDetailsDialog_noDetails(),
|
||||
caseDisplayName,
|
||||
DEFAULT_OPTION, PLAIN_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
// display case details
|
||||
JOptionPane.showConfirmDialog(showCaseDetailsMenuItem,
|
||||
eamCase.getCaseDetailsOptionsPaneDialog(),
|
||||
caseDisplayName,
|
||||
DEFAULT_OPTION, PLAIN_MESSAGE);
|
||||
if (eamCase != null) {
|
||||
details = eamCase.getCaseDetailsOptionsPaneDialog();
|
||||
} else {
|
||||
JOptionPane.showConfirmDialog(showCaseDetailsMenuItem,
|
||||
Bundle.DataContentViewerOtherCases_caseDetailsDialog_notSelected(),
|
||||
caseDisplayName,
|
||||
DEFAULT_OPTION, PLAIN_MESSAGE);
|
||||
details = Bundle.DataContentViewerOtherCases_caseDetailsDialog_noDetails();
|
||||
}
|
||||
} else {
|
||||
details = Bundle.DataContentViewerOtherCases_caseDetailsDialog_noDetailsReference();
|
||||
}
|
||||
} else {
|
||||
details = Bundle.DataContentViewerOtherCases_caseDetailsDialog_notSelected();
|
||||
}
|
||||
}
|
||||
} catch (EamDbException ex) {
|
||||
LOGGER.log(Level.SEVERE, "Error loading case details", ex);
|
||||
} finally {
|
||||
JOptionPane.showConfirmDialog(showCaseDetailsMenuItem,
|
||||
Bundle.DataContentViewerOtherCases_caseDetailsDialog_noDetails(),
|
||||
details,
|
||||
caseDisplayName,
|
||||
DEFAULT_OPTION, PLAIN_MESSAGE);
|
||||
}
|
||||
@ -301,6 +290,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
||||
|
||||
writeSelectedRowsToFileAsCSV(selectedFile);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -308,9 +298,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
||||
StringBuilder content;
|
||||
int[] selectedRowViewIndices = filesTable.getSelectedRows();
|
||||
int colCount = filesTableModel.getColumnCount();
|
||||
|
||||
try (BufferedWriter writer = Files.newBufferedWriter(destFile.toPath())) {
|
||||
|
||||
// write column names
|
||||
content = new StringBuilder("");
|
||||
for (int colIdx = 0; colIdx < colCount; colIdx++) {
|
||||
@ -319,7 +307,6 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
||||
content.append(",");
|
||||
}
|
||||
}
|
||||
|
||||
content.append(System.getProperty("line.separator"));
|
||||
writer.write(content.toString());
|
||||
|
||||
@ -387,6 +374,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
||||
@Override
|
||||
public int isPreferred(Node node) {
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -886,7 +874,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
||||
private void updateOnFileSelection() {
|
||||
//calling getPreferredSize has a side effect of ensuring it has a preferred size which reflects the contents which are visible
|
||||
if (filesTable.getSelectedRowCount() == 1) {
|
||||
occurrencePanel = new OccurrencePanel(filesTableModel.getNodeDataList());
|
||||
occurrencePanel = new OccurrencePanel(filesTableModel.getRow(filesTable.convertRowIndexToModel(filesTable.getSelectedRow())));
|
||||
} else if (dataSourcesTable.getSelectedRowCount() == 1) {
|
||||
|
||||
} else if (casesTable.getSelectedRowCount() == 1) {
|
||||
@ -1075,18 +1063,18 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void rightClickPopupMenuPopupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_rightClickPopupMenuPopupMenuWillBecomeVisible
|
||||
boolean enableCentralRepoActions = false;
|
||||
|
||||
if (EamDb.isEnabled() && filesTable.getSelectedRowCount() == 1) {
|
||||
int rowIndex = filesTable.getSelectedRow();
|
||||
OtherOccurrenceNodeData selectedNode = (OtherOccurrenceNodeData) filesTableModel.getRow(rowIndex);
|
||||
if (selectedNode instanceof OtherOccurrenceNodeInstanceData) {
|
||||
OtherOccurrenceNodeInstanceData instanceData = (OtherOccurrenceNodeInstanceData) selectedNode;
|
||||
enableCentralRepoActions = instanceData.isCentralRepoNode();
|
||||
}
|
||||
}
|
||||
showCaseDetailsMenuItem.setVisible(enableCentralRepoActions);
|
||||
showCommonalityMenuItem.setVisible(enableCentralRepoActions);
|
||||
// boolean enableCentralRepoActions = false;
|
||||
//
|
||||
// if (EamDb.isEnabled() && filesTable.getSelectedRowCount() == 1) {
|
||||
// int rowIndex = filesTable.getSelectedRow();
|
||||
// List<OtherOccurrenceNodeData> selectedNode = (OtherOccurrenceNodeData) filesTableModel.getRow(rowIndex);
|
||||
// if (selectedNode instanceof OtherOccurrenceNodeInstanceData) {
|
||||
// OtherOccurrenceNodeInstanceData instanceData = (OtherOccurrenceNodeInstanceData) selectedNode;
|
||||
// enableCentralRepoActions = instanceData.isCentralRepoNode();
|
||||
// }
|
||||
// }
|
||||
// showCaseDetailsMenuItem.setVisible(enableCentralRepoActions);
|
||||
// showCommonalityMenuItem.setVisible(enableCentralRepoActions);
|
||||
}//GEN-LAST:event_rightClickPopupMenuPopupMenuWillBecomeVisible
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
|
@ -19,7 +19,9 @@
|
||||
package org.sleuthkit.autopsy.centralrepository.contentviewer;
|
||||
|
||||
import java.awt.Font;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
|
||||
final class OccurrencePanel extends javax.swing.JPanel {
|
||||
@ -33,20 +35,29 @@ final class OccurrencePanel extends javax.swing.JPanel {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int gridY = 0;
|
||||
List<OtherOccurrenceNodeData> nodeData;
|
||||
private final List<OtherOccurrenceNodeData> nodeData;
|
||||
private final Set<String> caseNames = new HashSet<>();
|
||||
private final Set<String> dataSourceNames = new HashSet<>();
|
||||
private final Set<String> filePaths = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Creates new form OccurrencePanel2
|
||||
*/
|
||||
OccurrencePanel(List<OtherOccurrenceNodeData> nodeDataList) {
|
||||
nodeData = nodeDataList;
|
||||
// if (nodeData != null && !nodeData.isEmpty()) {
|
||||
initComponents();
|
||||
if (!nodeData.isEmpty()) {
|
||||
addInstanceDetails();
|
||||
if (!filePaths.isEmpty()) {
|
||||
addFileDetails();
|
||||
}
|
||||
if (!dataSourceNames.isEmpty()) {
|
||||
addDataSourceDetails();
|
||||
}
|
||||
if (!caseNames.isEmpty()) {
|
||||
addCaseDetails();
|
||||
// }
|
||||
}
|
||||
}
|
||||
//add filler to keep everything else at the top
|
||||
addItemToBag(gridY, 0, 0, 0, new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767)));
|
||||
}
|
||||
@ -65,33 +76,45 @@ final class OccurrencePanel extends javax.swing.JPanel {
|
||||
addItemToBag(gridY, 0, TOP_INSET, 0, commonPropertiesLabel);
|
||||
gridY++;
|
||||
//for each other occurrence
|
||||
for (int i = 1; i < 3; i++) {
|
||||
for (OtherOccurrenceNodeData occurrence : nodeData) {
|
||||
if (occurrence instanceof OtherOccurrenceNodeInstanceData) {
|
||||
String type = ((OtherOccurrenceNodeInstanceData) occurrence).getType();
|
||||
if (!type.isEmpty()) {
|
||||
javax.swing.JLabel typeLabel = new javax.swing.JLabel();
|
||||
org.openide.awt.Mnemonics.setLocalizedText(typeLabel, Bundle.OccurrencePanel_commonPropertyTypeLabel_text());
|
||||
addItemToBag(gridY, 0, VERTICAL_GAP, 0, typeLabel);
|
||||
javax.swing.JLabel typeFieldValue = new javax.swing.JLabel();
|
||||
typeFieldValue.setText("FAKETYPE" + i);
|
||||
typeFieldValue.setText(type);
|
||||
addItemToBag(gridY, 1, VERTICAL_GAP, 0, typeFieldValue);
|
||||
gridY++;
|
||||
}
|
||||
String value = ((OtherOccurrenceNodeInstanceData) occurrence).getValue();
|
||||
if (!value.isEmpty()) {
|
||||
javax.swing.JLabel valueLabel = new javax.swing.JLabel();
|
||||
org.openide.awt.Mnemonics.setLocalizedText(valueLabel, Bundle.OccurrencePanel_commonPropertyValueLabel_text());
|
||||
addItemToBag(gridY, 0, 0, 0, valueLabel);
|
||||
javax.swing.JLabel valueFieldValue = new javax.swing.JLabel();
|
||||
valueFieldValue.setText("FAKEVALUE" + i);
|
||||
valueFieldValue.setText(value);
|
||||
addItemToBag(gridY, 1, 0, 0, valueFieldValue);
|
||||
gridY++;
|
||||
}
|
||||
String known = ((OtherOccurrenceNodeInstanceData) occurrence).getKnown().toString();
|
||||
if (!known.isEmpty()) {
|
||||
javax.swing.JLabel knownStatusLabel = new javax.swing.JLabel();
|
||||
org.openide.awt.Mnemonics.setLocalizedText(knownStatusLabel, Bundle.OccurrencePanel_commonPropertyKnownStatusLabel_text());
|
||||
addItemToBag(gridY, 0, 0, 0, knownStatusLabel);
|
||||
javax.swing.JLabel knownStatusValue = new javax.swing.JLabel();
|
||||
knownStatusValue.setText("FAKESTATUS" + i);
|
||||
knownStatusValue.setText(known);
|
||||
addItemToBag(gridY, 1, 0, 0, knownStatusValue);
|
||||
gridY++;
|
||||
}
|
||||
String comment = ((OtherOccurrenceNodeInstanceData) occurrence).getComment();
|
||||
if (!comment.isEmpty()) {
|
||||
javax.swing.JLabel commentLabel = new javax.swing.JLabel();
|
||||
org.openide.awt.Mnemonics.setLocalizedText(commentLabel, Bundle.OccurrencePanel_commonPropertyCommentLabel_text());
|
||||
addItemToBag(gridY, 0, 0, VERTICAL_GAP, commentLabel);
|
||||
javax.swing.JTextArea commentValue = new javax.swing.JTextArea();
|
||||
commentValue.setText("FAKECOMMENT" + i);
|
||||
commentValue.setText(comment);
|
||||
commentValue.setEditable(false);
|
||||
commentValue.setColumns(20);
|
||||
commentValue.setLineWrap(true);
|
||||
@ -103,6 +126,11 @@ final class OccurrencePanel extends javax.swing.JPanel {
|
||||
addItemToBag(gridY, 1, 0, VERTICAL_GAP, commentValue);
|
||||
gridY++;
|
||||
}
|
||||
caseNames.add(((OtherOccurrenceNodeInstanceData) occurrence).getCaseName());
|
||||
dataSourceNames.add(((OtherOccurrenceNodeInstanceData) occurrence).getDataSourceName());
|
||||
filePaths.add(((OtherOccurrenceNodeInstanceData) occurrence).getFilePath());
|
||||
}
|
||||
}
|
||||
//end for each
|
||||
}
|
||||
|
||||
@ -111,16 +139,18 @@ final class OccurrencePanel extends javax.swing.JPanel {
|
||||
"OccurrencePanel.filePathLabel.text=File Path:"
|
||||
})
|
||||
private void addFileDetails() {
|
||||
|
||||
javax.swing.JLabel fileDetailsLabel = new javax.swing.JLabel();
|
||||
org.openide.awt.Mnemonics.setLocalizedText(fileDetailsLabel, Bundle.OccurrencePanel_fileDetails_text());
|
||||
fileDetailsLabel.setFont(fileDetailsLabel.getFont().deriveFont(Font.BOLD, fileDetailsLabel.getFont().getSize()));
|
||||
addItemToBag(gridY, 0, TOP_INSET, 0, fileDetailsLabel);
|
||||
gridY++;
|
||||
String filePath = filePaths.size() > 1 ? "too many files" : filePaths.iterator().next();
|
||||
javax.swing.JLabel filePathLabel = new javax.swing.JLabel();
|
||||
org.openide.awt.Mnemonics.setLocalizedText(filePathLabel, Bundle.OccurrencePanel_filePathLabel_text());
|
||||
addItemToBag(gridY, 0, VERTICAL_GAP, VERTICAL_GAP, filePathLabel);
|
||||
javax.swing.JTextArea filePathValue = new javax.swing.JTextArea();
|
||||
filePathValue.setText("fakedataSourceName");
|
||||
filePathValue.setText(filePath);
|
||||
filePathValue.setEditable(false);
|
||||
filePathValue.setColumns(20);
|
||||
filePathValue.setLineWrap(true);
|
||||
@ -143,11 +173,12 @@ final class OccurrencePanel extends javax.swing.JPanel {
|
||||
dataSourceDetailsLabel.setFont(dataSourceDetailsLabel.getFont().deriveFont(Font.BOLD, dataSourceDetailsLabel.getFont().getSize()));
|
||||
addItemToBag(gridY, 0, TOP_INSET, 0, dataSourceDetailsLabel);
|
||||
gridY++;
|
||||
String dataSourceName = dataSourceNames.size() > 1 ? "too many data sources" : dataSourceNames.iterator().next();
|
||||
javax.swing.JLabel dataSourceNameLabel = new javax.swing.JLabel();
|
||||
org.openide.awt.Mnemonics.setLocalizedText(dataSourceNameLabel, Bundle.OccurrencePanel_dataSourceNameLabel_text());
|
||||
addItemToBag(gridY, 0, VERTICAL_GAP, VERTICAL_GAP, dataSourceNameLabel);
|
||||
javax.swing.JLabel dataSourceNameValue = new javax.swing.JLabel();
|
||||
dataSourceNameValue.setText("fakedataSourceName");
|
||||
dataSourceNameValue.setText(dataSourceName);
|
||||
addItemToBag(gridY, 1, VERTICAL_GAP, VERTICAL_GAP, dataSourceNameValue);
|
||||
gridY++;
|
||||
}
|
||||
@ -163,11 +194,12 @@ final class OccurrencePanel extends javax.swing.JPanel {
|
||||
caseDetailsLabel.setFont(caseDetailsLabel.getFont().deriveFont(Font.BOLD, caseDetailsLabel.getFont().getSize()));
|
||||
addItemToBag(gridY, 0, TOP_INSET, 0, caseDetailsLabel);
|
||||
gridY++;
|
||||
String caseName = caseNames.size() > 1 ? "too many cases" : caseNames.iterator().next();
|
||||
javax.swing.JLabel caseNameLabel = new javax.swing.JLabel();
|
||||
org.openide.awt.Mnemonics.setLocalizedText(caseNameLabel, Bundle.OccurrencePanel_caseNameLabel_text());
|
||||
addItemToBag(gridY, 0, VERTICAL_GAP, 0, caseNameLabel);
|
||||
javax.swing.JLabel caseNameValue = new javax.swing.JLabel();
|
||||
caseNameValue.setText("fakecaseName");
|
||||
caseNameValue.setText(caseName);
|
||||
addItemToBag(gridY, 1, VERTICAL_GAP, 0, caseNameValue);
|
||||
gridY++;
|
||||
javax.swing.JLabel caseCreatedLabel = new javax.swing.JLabel();
|
||||
|
@ -24,7 +24,6 @@ import javax.swing.JComponent;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
import org.sleuthkit.datamodel.TskData;
|
||||
|
||||
/**
|
||||
* Renderer for cells in the files section of the other occurrences data content viewer
|
||||
@ -49,17 +48,17 @@ public class OtherOccurrencesFilesTableCellRenderer implements TableCellRenderer
|
||||
foreground = Color.WHITE;
|
||||
background = new Color(51,153,255);
|
||||
} else {
|
||||
TskData.FileKnown knownStatus = ((OtherOccurrencesFilesTableModel)table.getModel()).getKnownStatusForRow(table.convertRowIndexToModel(row));
|
||||
if (knownStatus.equals(TskData.FileKnown.BAD)) {
|
||||
foreground = Color.WHITE;
|
||||
background = Color.RED;
|
||||
} else if (knownStatus.equals(TskData.FileKnown.UNKNOWN)) {
|
||||
// TskData.FileKnown knownStatus = ((OtherOccurrencesFilesTableModel)table.getModel()).getKnownStatusForRow(table.convertRowIndexToModel(row));
|
||||
// if (knownStatus.equals(TskData.FileKnown.BAD)) {
|
||||
// foreground = Color.WHITE;
|
||||
// background = Color.RED;
|
||||
// } else if (knownStatus.equals(TskData.FileKnown.UNKNOWN)) {
|
||||
// foreground = Color.BLACK;
|
||||
// background = Color.WHITE;
|
||||
// } else {
|
||||
foreground = Color.BLACK;
|
||||
background = Color.WHITE;
|
||||
} else {
|
||||
foreground = Color.BLACK;
|
||||
background = Color.WHITE;
|
||||
}
|
||||
// }
|
||||
}
|
||||
renderer.setForeground(foreground);
|
||||
renderer.setBackground(background);
|
||||
|
@ -20,11 +20,12 @@ package org.sleuthkit.autopsy.centralrepository.contentviewer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.sleuthkit.datamodel.TskData;
|
||||
|
||||
/**
|
||||
* Model for cells in the files section of the other occurrences data content
|
||||
@ -56,7 +57,9 @@ public class OtherOccurrencesFilesTableModel extends AbstractTableModel {
|
||||
}
|
||||
};
|
||||
|
||||
private final List<OtherOccurrenceNodeData> nodeDataList = new ArrayList<>();
|
||||
// private final List<OtherOccurrenceNodeData> nodeDataList = new ArrayList<>();
|
||||
private final List<String> nodeKeys = new ArrayList<>();
|
||||
private final Map<String, List<OtherOccurrenceNodeData>> nodeMap = new HashMap<>();
|
||||
|
||||
OtherOccurrencesFilesTableModel() {
|
||||
|
||||
@ -83,7 +86,7 @@ public class OtherOccurrencesFilesTableModel extends AbstractTableModel {
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return nodeDataList.size();
|
||||
return nodeKeys.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -93,46 +96,51 @@ public class OtherOccurrencesFilesTableModel extends AbstractTableModel {
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int rowIdx, int colIdx) {
|
||||
if (0 == nodeDataList.size()) {
|
||||
if (0 == nodeKeys.size()) {
|
||||
return Bundle.OtherOccurrencesFilesTableModel_noData();
|
||||
}System.out.println("Getting file path");
|
||||
String nodeKey = nodeKeys.get(rowIdx);
|
||||
System.out.println("KEY: " + nodeKey);
|
||||
List<OtherOccurrenceNodeData> dataList = nodeMap.get(nodeKey);
|
||||
OtherOccurrenceNodeInstanceData data = (OtherOccurrenceNodeInstanceData)dataList.get(0);
|
||||
String filePath = data.getFilePath();
|
||||
System.out.println("PATH: " + filePath);
|
||||
String fileName = FilenameUtils.getName(filePath);
|
||||
System.out.println("NAME: " + fileName);
|
||||
return fileName;
|
||||
// return nodeMap.get(FilenameUtils.getName(((OtherOccurrenceNodeInstanceData)nodeMap.get(nodeKeys.get(rowIdx)).get(0)).getFilePath()));
|
||||
}
|
||||
|
||||
OtherOccurrenceNodeData nodeData = nodeDataList.get(rowIdx);
|
||||
TableColumns columnId = TableColumns.values()[colIdx];
|
||||
return mapNodeInstanceData((OtherOccurrenceNodeInstanceData) nodeData, columnId);
|
||||
}
|
||||
// public TskData.FileKnown getKnownStatusForRow(int rowIdx) {
|
||||
// if (rowIdx >= nodeDataList.size()) {
|
||||
// return TskData.FileKnown.UNKNOWN;
|
||||
// } else {
|
||||
// return ((OtherOccurrenceNodeInstanceData) nodeDataList.get(rowIdx)).getKnown();
|
||||
// }
|
||||
// }
|
||||
// /**
|
||||
// * Map a column ID to the value in that cell for node instance data.
|
||||
// *
|
||||
// * @param nodeData The node instance data.
|
||||
// * @param columnId The ID of the cell column.
|
||||
// *
|
||||
// * @return The value in the cell.
|
||||
// */
|
||||
// private Object mapNodeInstanceData(OtherOccurrenceNodeInstanceData nodeData, TableColumns columnId) {
|
||||
// String value = Bundle.OtherOccurrencesFilesTableModel_noData();
|
||||
//
|
||||
// switch (columnId) {
|
||||
// case FILE_NAME:
|
||||
// value = FilenameUtils.getName(nodeData.getFilePath());
|
||||
// break;
|
||||
// default: //Use default "No data" value.
|
||||
// break;
|
||||
// }
|
||||
// return value;
|
||||
// }
|
||||
|
||||
public TskData.FileKnown getKnownStatusForRow(int rowIdx) {
|
||||
if (rowIdx >= nodeDataList.size()) {
|
||||
return TskData.FileKnown.UNKNOWN;
|
||||
} else {
|
||||
return ((OtherOccurrenceNodeInstanceData) nodeDataList.get(rowIdx)).getKnown();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Map a column ID to the value in that cell for node instance data.
|
||||
*
|
||||
* @param nodeData The node instance data.
|
||||
* @param columnId The ID of the cell column.
|
||||
*
|
||||
* @return The value in the cell.
|
||||
*/
|
||||
private Object mapNodeInstanceData(OtherOccurrenceNodeInstanceData nodeData, TableColumns columnId) {
|
||||
String value = Bundle.OtherOccurrencesFilesTableModel_noData();
|
||||
|
||||
switch (columnId) {
|
||||
case FILE_NAME:
|
||||
value = FilenameUtils.getName(nodeData.getFilePath());
|
||||
break;
|
||||
default: //Use default "No data" value.
|
||||
break;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
Object getRow(int rowIdx) {
|
||||
return nodeDataList.get(rowIdx);
|
||||
List<OtherOccurrenceNodeData> getRow(int rowIdx) {
|
||||
return nodeMap.get(nodeKeys.get(rowIdx));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -146,19 +154,31 @@ public class OtherOccurrencesFilesTableModel extends AbstractTableModel {
|
||||
* @param newNodeData data to add to the table
|
||||
*/
|
||||
void addNodeData(OtherOccurrenceNodeData newNodeData) {
|
||||
nodeDataList.add(newNodeData);
|
||||
String newNodeKey = createNodeKey((OtherOccurrenceNodeInstanceData) newNodeData);//FilenameUtils.getName(((OtherOccurrenceNodeInstanceData)newNodeData).getFilePath());
|
||||
List<OtherOccurrenceNodeData> nodeList = nodeMap.get(newNodeKey);
|
||||
if (nodeList == null) {
|
||||
nodeKeys.add(newNodeKey);
|
||||
nodeList = new ArrayList<>();
|
||||
}
|
||||
nodeList.add(newNodeData);
|
||||
nodeMap.put(newNodeKey, nodeList);
|
||||
fireTableDataChanged();
|
||||
}
|
||||
|
||||
List<OtherOccurrenceNodeData> getNodeDataList() {
|
||||
return Collections.unmodifiableList(nodeDataList);
|
||||
List<OtherOccurrenceNodeData> getNodeDataList(String nodeKey) {
|
||||
return Collections.unmodifiableList(nodeMap.get(nodeKey));
|
||||
}
|
||||
|
||||
private String createNodeKey(OtherOccurrenceNodeInstanceData nodeData) {
|
||||
return nodeData.getCaseName() + nodeData.getDataSourceName() + nodeData.getDeviceID() + nodeData.getFilePath();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the node data table.
|
||||
*/
|
||||
void clearTable() {
|
||||
nodeDataList.clear();
|
||||
nodeKeys.clear();
|
||||
nodeMap.clear();
|
||||
fireTableDataChanged();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user