From ac8f929a09ea92d4edce24c011875165b442cd72 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 5 Apr 2019 17:38:36 -0400 Subject: [PATCH] 4792 clean up and comments --- .../contentviewer/Bundle.properties-MERGED | 1 - .../DataContentViewerOtherCases.java | 50 ++++++++----- .../contentviewer/OccurrencePanel.java | 63 ++++++++++++++++- .../OtherOccurrenceNodeInstanceData.java | 8 ++- .../OtherOccurrencesCasesTableModel.java | 14 +++- ...OtherOccurrencesDataSourcesTableModel.java | 70 ++++++++++++++++--- .../OtherOccurrencesFilesTableModel.java | 23 +++--- 7 files changed, 187 insertions(+), 42 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/Bundle.properties-MERGED index 7d0f5f44dc..21c7b81c76 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/Bundle.properties-MERGED @@ -24,7 +24,6 @@ DataContentViewerOtherCases.earliestCaseDate.text=Earliest Case Date DataContentViewerOtherCases.earliestCaseLabel.toolTipText= DataContentViewerOtherCases.earliestCaseLabel.text=Central Repository Starting Date: DataContentViewerOtherCases.foundInLabel.text= -DataContentViewerOtherCases.caseDatasourceFileSplitPane.toolTipText= DataContentViewerOtherCases.title=Other Occurrences DataContentViewerOtherCases.toolTip=Displays instances of the selected file/artifact from other occurrences. DataContentViewerOtherCasesModel.csvHeader.attribute=Matched Attribute diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java index 779d50ef3c..ede26edd9c 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/DataContentViewerOtherCases.java @@ -165,14 +165,18 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi updateOnDataSourceSelection(); } }); + + //alows resizing of the 4th section filesTable.getSelectionModel().addListSelectionListener((e) -> { if (Case.isCaseOpen()) { occurrencePanel = new OccurrencePanel(); updateOnFileSelection(); } }); + //sort tables alphabetically initially casesTable.getRowSorter().toggleSortOrder(0); dataSourcesTable.getRowSorter().toggleSortOrder(0); + filesTable.getRowSorter().toggleSortOrder(0); } @Messages({"DataContentViewerOtherCases.correlatedArtifacts.isEmpty=There are no files or artifacts to correlate.", @@ -233,7 +237,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi if (-1 != selectedRowViewIdx) { EamDb dbManager = EamDb.getInstance(); int selectedRowModelIdx = filesTable.convertRowIndexToModel(selectedRowViewIdx); - List rowList = filesTableModel.getRow(selectedRowModelIdx); + List rowList = filesTableModel.getListOfNodesForFile(selectedRowModelIdx); if (rowList.get(0) instanceof OtherOccurrenceNodeInstanceData) { if (!rowList.isEmpty()) { CorrelationCase eamCasePartial = ((OtherOccurrenceNodeInstanceData) rowList.get(0)).getCorrelationAttributeInstance().getCorrelationCase(); @@ -292,6 +296,9 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi "DataContentViewerOtherCasesModel.csvHeader.path=Path", "DataContentViewerOtherCasesModel.csvHeader.comment=Comment" }) + /** + * Write data for all cases in the content viewer to a CSV file + */ private void writeOtherOccurrencesToFileAsCSV(File destFile) { try (BufferedWriter writer = Files.newBufferedWriter(destFile.toPath())) { //write headers @@ -558,7 +565,6 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi try { final Case openCase = Case.getCurrentCaseThrows(); String caseUUID = openCase.getName(); - HashMap nodeDataMap = new HashMap<>(); if (EamDb.isEnabled()) { @@ -583,7 +589,6 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi } } } - if (corAttr.getCorrelationType().getDisplayName().equals("Files")) { List caseDbFiles = getCaseDbMatches(corAttr, openCase); @@ -591,7 +596,6 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi addOrUpdateNodeData(openCase, nodeDataMap, caseDbFile); } } - return nodeDataMap; } catch (EamDbException ex) { LOGGER.log(Level.SEVERE, "Error getting artifact instances from database.", ex); // NON-NLS @@ -867,17 +871,16 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi } } + /** + * Update the data displayed in the details section to be correct for the + * currently selected File + */ private void updateOnFileSelection() { - occurrencePanel = new OccurrencePanel(); - occurrencePanel.getPreferredSize(); - detailsPanelScrollPane.setViewportView(occurrencePanel); - //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.getRow(filesTable.convertRowIndexToModel(filesTable.getSelectedRow()))); - occurrencePanel.getPreferredSize(); - detailsPanelScrollPane.setViewportView(occurrencePanel); + //if there is one file selected update the deatils to show the data for that file + occurrencePanel = new OccurrencePanel(filesTableModel.getListOfNodesForFile(filesTable.convertRowIndexToModel(filesTable.getSelectedRow()))); } else if (dataSourcesTable.getSelectedRowCount() == 1) { - //calling getPreferredSize has a side effect of ensuring it has a preferred size which reflects the contents which are visible + //if no files were selected and only one data source is selected update the information to reflect the data source String caseName = dataSourcesTableModel.getCaseNameForRow(dataSourcesTable.convertRowIndexToModel(dataSourcesTable.getSelectedRow())); String dsName = dataSourcesTableModel.getValueAt(dataSourcesTable.convertRowIndexToModel(dataSourcesTable.getSelectedRow()), 0).toString(); String caseCreatedDate = ""; @@ -888,10 +891,9 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi } } occurrencePanel = new OccurrencePanel(caseName, caseCreatedDate, dsName); - occurrencePanel.getPreferredSize(); - detailsPanelScrollPane.setViewportView(occurrencePanel); } else if (casesTable.getSelectedRowCount() == 1) { - //calling getPreferredSize has a side effect of ensuring it has a preferred size which reflects the contents which are visible + //if no files were selected and a number of data source other than 1 are selected + //update the information to reflect the case String createdDate = ""; String caseName = ""; if (casesTable.getRowCount() > 0) { @@ -903,11 +905,23 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi createdDate = getCaseCreatedDate(casesTable.getSelectedRow()); occurrencePanel = new OccurrencePanel(caseName, createdDate); } - occurrencePanel.getPreferredSize(); - detailsPanelScrollPane.setViewportView(occurrencePanel); + } else { + //else display an empty details area + occurrencePanel = new OccurrencePanel(); } + //calling getPreferredSize has a side effect of ensuring it has a preferred size which reflects the contents which are visible + occurrencePanel.getPreferredSize(); + detailsPanelScrollPane.setViewportView(occurrencePanel); } + /** + * Get the date a case was created + * + * @param caseTableRowIdx the row from the casesTable representing the case + * + * @return A string representing the date the case was created or an empty + * string if the date could not be determined + */ private String getCaseCreatedDate(int caseTableRowIdx) { try { if (EamDb.isEnabled()) { @@ -1081,7 +1095,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi boolean enableCentralRepoActions = false; if (EamDb.isEnabled() && filesTable.getSelectedRowCount() == 1) { int rowIndex = filesTable.getSelectedRow(); - List selectedFile = filesTableModel.getRow(rowIndex); + List selectedFile = filesTableModel.getListOfNodesForFile(rowIndex); if (selectedFile.get(0) instanceof OtherOccurrenceNodeInstanceData) { OtherOccurrenceNodeInstanceData instanceData = (OtherOccurrenceNodeInstanceData) selectedFile.get(0); enableCentralRepoActions = instanceData.isCentralRepoNode(); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OccurrencePanel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OccurrencePanel.java index 03cd6dc6d2..d8b18d5f82 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OccurrencePanel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OccurrencePanel.java @@ -35,6 +35,9 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.TskData; +/** + * Panel for displaying other occurrence details. + */ final class OccurrencePanel extends javax.swing.JPanel { private static final Logger LOGGER = Logger.getLogger(OccurrencePanel.class.getName()); @@ -52,17 +55,34 @@ final class OccurrencePanel extends javax.swing.JPanel { private final Set dataSourceNames = new HashSet<>(); private final Set filePaths = new HashSet<>(); + /** + * Construct an empty OccurrencePanel + */ OccurrencePanel() { nodeDataList = new ArrayList<>(); customizeComponents(); } + /** + * Construct an OccurrencePanel which will display only Case information + * + * @param caseName the name of the case + * @param caseCreatedDate the date the case was created + */ OccurrencePanel(String caseName, String caseCreatedDate) { nodeDataList = new ArrayList<>(); caseNamesAndDates.put(caseName, caseCreatedDate); customizeComponents(); } + /** + * Construct an OccurrencePanel which will display only case and data source + * information + * + * @param caseName the name of the case + * @param caseCreatedDate the date the case was created + * @param dataSourceName the name of the data source + */ OccurrencePanel(String caseName, String caseCreatedDate, String dataSourceName) { nodeDataList = new ArrayList<>(); caseNamesAndDates.put(caseName, caseCreatedDate); @@ -71,16 +91,27 @@ final class OccurrencePanel extends javax.swing.JPanel { } /** - * Creates new form OccurrencePanel2 + * Construct a OccurrencePanel which will display details for all other + * occurrences associated with a file + * + * @param nodeDataList the list of OtherOccurrenceNodeData representing + * common properties for the file */ OccurrencePanel(List nodeDataList) { this.nodeDataList = nodeDataList; customizeComponents(); } + /** + * Do all the construction of gui elements and adding of the appropriate + * elements to the gridbaglayout + */ private void customizeComponents() { initComponents(); if (!this.nodeDataList.isEmpty()) { + //if addInstanceDetails is going to be called it should be called + // before addFileDetails, addDataSourceDetails, and addCaseDetails + //because it also collects the information they display addInstanceDetails(); if (!filePaths.isEmpty()) { addFileDetails(); @@ -103,6 +134,13 @@ final class OccurrencePanel extends javax.swing.JPanel { "OccurrencePanel.commonPropertyKnownStatusLabel.text=Known Status:", "OccurrencePanel.commonPropertyCommentLabel.text=Comment:" }) + /** + * Add the Common Property instance details to the gridbaglayout supports + * adding multiple common properties + * + * Also collects the case, data source, and file path information to be + * displayed + */ private void addInstanceDetails() { javax.swing.JLabel commonPropertiesLabel = new javax.swing.JLabel(); org.openide.awt.Mnemonics.setLocalizedText(commonPropertiesLabel, Bundle.OccurrencePanel_commonProperties_text()); @@ -143,7 +181,6 @@ final class OccurrencePanel extends javax.swing.JPanel { } addItemToBag(gridY, 1, 0, 0, knownStatusValue); gridY++; - String comment = ((OtherOccurrenceNodeInstanceData) occurrence).getComment(); if (!comment.isEmpty()) { javax.swing.JLabel commentLabel = new javax.swing.JLabel(); @@ -176,6 +213,7 @@ final class OccurrencePanel extends javax.swing.JPanel { } catch (EamDbException ex) { LOGGER.log(Level.WARNING, "Error getting case created date for other occurrence content viewer", ex); } + //Collect the data that is necessary for the other sections caseNamesAndDates.put(((OtherOccurrenceNodeInstanceData) occurrence).getCaseName(), caseDate); dataSourceNames.add(((OtherOccurrenceNodeInstanceData) occurrence).getDataSourceName()); filePaths.add(((OtherOccurrenceNodeInstanceData) occurrence).getFilePath()); @@ -188,6 +226,9 @@ final class OccurrencePanel extends javax.swing.JPanel { "OccurrencePanel.fileDetails.text=File Details", "OccurrencePanel.filePathLabel.text=File Path:" }) + /** + * Add the File specific details such as file path to the gridbaglayout + */ private void addFileDetails() { String filePath = filePaths.size() > 1 ? "" : filePaths.iterator().next(); if (!filePath.isEmpty()) { @@ -196,7 +237,6 @@ final class OccurrencePanel extends javax.swing.JPanel { fileDetailsLabel.setFont(fileDetailsLabel.getFont().deriveFont(Font.BOLD, fileDetailsLabel.getFont().getSize())); addItemToBag(gridY, 0, TOP_INSET, 0, fileDetailsLabel); gridY++; - 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); @@ -219,6 +259,10 @@ final class OccurrencePanel extends javax.swing.JPanel { "OccurrencePanel.dataSourceDetails.text=Data Source Details", "OccurrencePanel.dataSourceNameLabel.text=Name:" }) + /** + * Add the data source specific details such as data source name to the + * gridbaglayout + */ private void addDataSourceDetails() { String dataSourceName = dataSourceNames.size() > 1 ? "" : dataSourceNames.iterator().next(); if (!dataSourceName.isEmpty()) { @@ -242,6 +286,9 @@ final class OccurrencePanel extends javax.swing.JPanel { "OccurrencePanel.caseNameLabel.text=Name:", "OccurrencePanel.caseCreatedDateLabel.text=Created Date:" }) + /** + * Add the case specific details such as case name to the gridbaglayout + */ private void addCaseDetails() { javax.swing.JLabel caseDetailsLabel = new javax.swing.JLabel(); org.openide.awt.Mnemonics.setLocalizedText(caseDetailsLabel, Bundle.OccurrencePanel_caseDetails_text()); @@ -270,6 +317,16 @@ final class OccurrencePanel extends javax.swing.JPanel { } } + /** + * Add a JComponent to the gridbaglayout + * + * @param gridYLocation the row number the item should be added at + * @param gridXLocation the column number the item should be added at + * @param topInset the gap from the top of the cell which should exist + * @param bottomInset the gap from the bottom of the cell which should + * exist + * @param item the JComponent to add to the gridbaglayout + */ private void addItemToBag(int gridYLocation, int gridXLocation, int topInset, int bottomInset, javax.swing.JComponent item) { java.awt.GridBagConstraints gridBagConstraints; gridBagConstraints = new java.awt.GridBagConstraints(); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrenceNodeInstanceData.java b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrenceNodeInstanceData.java index 9ae78931ae..c9c1c14484 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrenceNodeInstanceData.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrenceNodeInstanceData.java @@ -1,7 +1,7 @@ /* * Central Repository * - * Copyright 2018 Basis Technology Corp. + * Copyright 2018-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -232,6 +232,12 @@ class OtherOccurrenceNodeInstanceData implements OtherOccurrenceNodeData { return originalCorrelationInstance; } + /** + * Create a string representation of the node's data comma separated with a + * line separator ending + * + * @return a comma separated string representation of the node's data + */ String toCsvString() { StringBuilder line = new StringBuilder(""); line.append('"').append(getCaseName()).append('"').append(','); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesCasesTableModel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesCasesTableModel.java index 253152a85d..1f432b2117 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesCasesTableModel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesCasesTableModel.java @@ -33,6 +33,9 @@ public class OtherOccurrencesCasesTableModel extends AbstractTableModel { private static final long serialVersionUID = 1L; private final List correlationCaseList = new ArrayList<>(); + /** + * Create a table model for displaying case names + */ OtherOccurrencesCasesTableModel() { } @@ -66,6 +69,15 @@ public class OtherOccurrencesCasesTableModel extends AbstractTableModel { return value; } + /** + * Get a correlation case for the selected index. Does not query the Central + * Repository so CorrelationCase will be partial missing CR case ID and + * other information that is stored in the CR. + * + * @param rowIdx the row from the table model which corresponds to the case + * + * @return CorrelationCase for the table item specified + */ CorrelationCase getCorrelationCase(int rowIdx) { if (rowIdx < correlationCaseList.size()) { return correlationCaseList.get(rowIdx).getCorrelationCase(); @@ -80,7 +92,7 @@ public class OtherOccurrencesCasesTableModel extends AbstractTableModel { } /** - * Add one correlated instance object to the table + * Add one correlation case wrapper object to the table * * @param newCorrelationCaseWrapper data to add to the table */ diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesDataSourcesTableModel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesDataSourcesTableModel.java index 63bfaddcf5..a546ef7eb7 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesDataSourcesTableModel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesDataSourcesTableModel.java @@ -23,15 +23,18 @@ import java.util.Objects; import javax.swing.table.AbstractTableModel; import org.openide.util.NbBundle; +/** + * Model for cells in the data sources section of the other occurrences data + * content viewer + */ final class OtherOccurrencesDataSourcesTableModel extends AbstractTableModel { private static final long serialVersionUID = 1L; - - @NbBundle.Messages({"OtherOccurrencesDataSourcesTableModel.dataSourceName=Data Source Name", - "OtherOccurrencesDataSourcesTableModel.noData=No Data."}) - private final LinkedHashSet dataSourceSet = new LinkedHashSet<>(); + /** + * Create a table model for displaying data source names + */ OtherOccurrencesDataSourcesTableModel() { } @@ -46,6 +49,8 @@ final class OtherOccurrencesDataSourcesTableModel extends AbstractTableModel { return dataSourceSet.size(); } + @NbBundle.Messages({"OtherOccurrencesDataSourcesTableModel.dataSourceName=Data Source Name", + "OtherOccurrencesDataSourcesTableModel.noData=No Data."}) @Override public String getColumnName(int colIdx) { return Bundle.OtherOccurrencesDataSourcesTableModel_dataSourceName(); @@ -59,11 +64,25 @@ final class OtherOccurrencesDataSourcesTableModel extends AbstractTableModel { return ((DataSourceColumnItem) dataSourceSet.toArray()[rowIdx]).getDataSourceName(); } - public String getDeviceIdForRow(int rowIdx) { + /** + * Get the device id of the data source shown at the specified row index + * + * @param rowIdx the row index of the data source you want the device id for + * + * @return the device id of the specified data source + */ + String getDeviceIdForRow(int rowIdx) { return ((DataSourceColumnItem) dataSourceSet.toArray()[rowIdx]).getDeviceId(); } - - public String getCaseNameForRow(int rowIdx){ + + /** + * Get the case name of the data source shown at the specified row index + * + * @param rowIdx the row index of the data source you want the case name for + * + * @return the case name of the specified data source + */ + String getCaseNameForRow(int rowIdx) { return ((DataSourceColumnItem) dataSourceSet.toArray()[rowIdx]).getCaseName(); } @@ -73,12 +92,11 @@ final class OtherOccurrencesDataSourcesTableModel extends AbstractTableModel { } /** - * Add one correlated instance object to the table + * Add data source information to the table of unique data sources * * @param newNodeData data to add to the table */ void addNodeData(OtherOccurrenceNodeData newNodeData) { -// String key = createDataSourceKey((OtherOccurrenceNodeInstanceData)newNodeData); dataSourceSet.add(new DataSourceColumnItem((OtherOccurrenceNodeInstanceData) newNodeData)); fireTableDataChanged(); } @@ -91,30 +109,64 @@ final class OtherOccurrencesDataSourcesTableModel extends AbstractTableModel { fireTableDataChanged(); } + /** + * Private class for storing data source information in a way that + * facilitates de-duping. + */ private final class DataSourceColumnItem { private final String caseName; private final String deviceId; private final String dataSourceName; + /** + * Create a DataSourceColumnItem given an + * OtherOccurrenceNodeInstanceData object + * + * @param nodeData the OtherOccurrenceNodeInstanceData which contains + * the data source information + */ private DataSourceColumnItem(OtherOccurrenceNodeInstanceData nodeData) { this(nodeData.getCaseName(), nodeData.getDeviceID(), nodeData.getDataSourceName()); } + /** + * Create a DataSourceColumnItem given a case name, device id, and data + * source name + * + * @param caseName the name of the case the data source exists in + * @param deviceId the name of the device id for the data source + * @param dataSourceName the name of the data source + */ private DataSourceColumnItem(String caseName, String deviceId, String dataSourceName) { this.caseName = caseName; this.deviceId = deviceId; this.dataSourceName = dataSourceName; } + /** + * Get the device id + * + * @return the data source's device id + */ private String getDeviceId() { return deviceId; } + /** + * Get the data source name + * + * @return the data source's name + */ private String getDataSourceName() { return dataSourceName; } + /** + * Get the name of the case the data source exists in + * + * @return the name of the case the data source is in + */ private String getCaseName() { return caseName; } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesFilesTableModel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesFilesTableModel.java index 664943cf34..8d9c50ad4c 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesFilesTableModel.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrencesFilesTableModel.java @@ -33,13 +33,12 @@ import org.apache.commons.io.FilenameUtils; public class OtherOccurrencesFilesTableModel extends AbstractTableModel { private static final long serialVersionUID = 1L; - - @Messages({"OtherOccurrencesFilesTableModel.fileName=File Name", - "OtherOccurrencesFilesTableModel.noData=No Data."}) - private final List nodeKeys = new ArrayList<>(); private final Map> nodeMap = new HashMap<>(); + /** + * Create a table model for displaying file names + */ OtherOccurrencesFilesTableModel() { } @@ -54,6 +53,8 @@ public class OtherOccurrencesFilesTableModel extends AbstractTableModel { return nodeKeys.size(); } + @Messages({"OtherOccurrencesFilesTableModel.fileName=File Name", + "OtherOccurrencesFilesTableModel.noData=No Data."}) @Override public String getColumnName(int colIdx) { return Bundle.OtherOccurrencesFilesTableModel_fileName(); @@ -67,7 +68,15 @@ public class OtherOccurrencesFilesTableModel extends AbstractTableModel { return FilenameUtils.getName(((OtherOccurrenceNodeInstanceData) nodeMap.get(nodeKeys.get(rowIdx)).get(0)).getFilePath()); } - List getRow(int rowIdx) { + /** + * Get a list of OtherOccurrenceNodeData that exist for the file which + * corresponds to the Index + * + * @param rowIdx the index of the file to get data for + * + * @return a list of OtherOccurrenceNodeData for the specified index + */ + List getListOfNodesForFile(int rowIdx) { return nodeMap.get(nodeKeys.get(rowIdx)); } @@ -93,10 +102,6 @@ public class OtherOccurrencesFilesTableModel extends AbstractTableModel { fireTableDataChanged(); } -// List getNodeDataList(String nodeKey) { -// return Collections.unmodifiableList(nodeMap.get(nodeKey)); -// } - private String createNodeKey(OtherOccurrenceNodeInstanceData nodeData) { return nodeData.getCaseName() + nodeData.getDataSourceName() + nodeData.getDeviceID() + nodeData.getFilePath(); }