7811 check table model row count instead of table

This commit is contained in:
William Schaefer 2021-07-13 12:57:51 -04:00
parent 5db2cd89fb
commit 7923e582da

View File

@ -254,8 +254,8 @@ public final class OtherOccurrencesPanel extends javax.swing.JPanel {
private void saveToCSV() throws NoCurrentCaseException { private void saveToCSV() throws NoCurrentCaseException {
if (casesTableModel.getRowCount() > 0) { if (casesTableModel.getRowCount() > 0) {
if(CSVFileChooser == null) { if (CSVFileChooser == null) {
try{ try {
CSVFileChooser = futureFileChooser.get(); CSVFileChooser = futureFileChooser.get();
} catch (InterruptedException | ExecutionException ex) { } catch (InterruptedException | ExecutionException ex) {
// If something happened with the thread try and // If something happened with the thread try and
@ -339,12 +339,13 @@ public final class OtherOccurrencesPanel extends javax.swing.JPanel {
casesTableModel.addCorrelationCase(NO_ARTIFACTS_CASE); casesTableModel.addCorrelationCase(NO_ARTIFACTS_CASE);
} else if (caseCount == 0) { } else if (caseCount == 0) {
casesTableModel.addCorrelationCase(NO_RESULTS_CASE); casesTableModel.addCorrelationCase(NO_RESULTS_CASE);
} } else {
String earliestDate = data.getEarliestCaseDate(); String earliestDate = data.getEarliestCaseDate();
earliestCaseDate.setText(earliestDate.isEmpty() ? Bundle.OtherOccurrencesPanel_earliestCaseNotAvailable() : earliestDate); earliestCaseDate.setText(earliestDate.isEmpty() ? Bundle.OtherOccurrencesPanel_earliestCaseNotAvailable() : earliestDate);
foundInLabel.setText(String.format(Bundle.OtherOccurrencesPanel_foundIn_text(), data.getTotalCount(), caseCount, data.getDataSourceCount())); foundInLabel.setText(String.format(Bundle.OtherOccurrencesPanel_foundIn_text(), data.getTotalCount(), caseCount, data.getDataSourceCount()));
if (caseCount > 0) { if (caseCount > 0) {
casesTable.setRowSelectionInterval(0, 0); casesTable.setRowSelectionInterval(0, 0);
}
} }
} catch (InterruptedException | ExecutionException ex) { } catch (InterruptedException | ExecutionException ex) {
@ -389,12 +390,13 @@ public final class OtherOccurrencesPanel extends javax.swing.JPanel {
casesTableModel.addCorrelationCase(NO_ARTIFACTS_CASE); casesTableModel.addCorrelationCase(NO_ARTIFACTS_CASE);
} else if (caseCount == 0) { } else if (caseCount == 0) {
casesTableModel.addCorrelationCase(NO_RESULTS_CASE); casesTableModel.addCorrelationCase(NO_RESULTS_CASE);
} } else {
String earliestDate = data.getEarliestCaseDate(); String earliestDate = data.getEarliestCaseDate();
earliestCaseDate.setText(earliestDate.isEmpty() ? Bundle.OtherOccurrencesPanel_earliestCaseNotAvailable() : earliestDate); earliestCaseDate.setText(earliestDate.isEmpty() ? Bundle.OtherOccurrencesPanel_earliestCaseNotAvailable() : earliestDate);
foundInLabel.setText(String.format(Bundle.OtherOccurrencesPanel_foundIn_text(), data.getInstanceDataCount(), caseCount, data.getDataSourceCount())); foundInLabel.setText(String.format(Bundle.OtherOccurrencesPanel_foundIn_text(), data.getInstanceDataCount(), caseCount, data.getDataSourceCount()));
if (caseCount > 0) { if (caseCount > 0) {
casesTable.setRowSelectionInterval(0, 0); casesTable.setRowSelectionInterval(0, 0);
}
} }
} }
@ -457,14 +459,14 @@ public final class OtherOccurrencesPanel extends javax.swing.JPanel {
} }
} }
} }
if (dataSourcesTable.getRowCount() > 0) { if (dataSourcesTableModel.getRowCount() > 0) {
dataSourcesTable.setRowSelectionInterval(0, 0); dataSourcesTable.setRowSelectionInterval(0, 0);
} }
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
} catch (InterruptedException | ExecutionException ex) { } catch (InterruptedException | ExecutionException ex) {
logger.log(Level.SEVERE, "Failed to update OtherOccurrencesPanel on data source selection", ex); logger.log(Level.SEVERE, "Failed to update OtherOccurrencesPanel on data source selection", ex);
} }
} }
}; };
@ -514,7 +516,7 @@ public final class OtherOccurrencesPanel extends javax.swing.JPanel {
} }
} }
} }
if (filesTable.getRowCount() > 0) { if (filesTableModel.getRowCount() > 0) {
filesTable.setRowSelectionInterval(0, 0); filesTable.setRowSelectionInterval(0, 0);
} }
} catch (InterruptedException | ExecutionException ex) { } catch (InterruptedException | ExecutionException ex) {
@ -633,7 +635,7 @@ public final class OtherOccurrencesPanel extends javax.swing.JPanel {
for (CorrelationAttributeInstance corAttr : coAtInstances) { for (CorrelationAttributeInstance corAttr : coAtInstances) {
correlatedNodeDataMap.putAll(OtherOccurrences.getCorrelatedInstances(abstractFile, deviceIdStr, dataSourceNameStr, corAttr)); correlatedNodeDataMap.putAll(OtherOccurrences.getCorrelatedInstances(abstractFile, deviceIdStr, dataSourceNameStr, corAttr));
if(isCancelled()) { if (isCancelled()) {
return new HashMap<>(); return new HashMap<>();
} }
} }