19 package org.sleuthkit.autopsy.centralrepository.optionspanel;
21 import java.util.ArrayList;
22 import java.util.List;
23 import javax.swing.table.AbstractTableModel;
24 import org.openide.util.NbBundle.Messages;
30 class DataSourcesTableModel
extends AbstractTableModel {
32 private static final long serialVersionUID = 1L;
37 private final List<CorrelationDataSource> dataSources;
43 DataSourcesTableModel() {
44 dataSources =
new ArrayList<>();
48 public int getColumnCount() {
49 return DataSourcesTableColumns.values().length;
53 public int getRowCount() {
54 return dataSources.size();
58 public String getColumnName(
int colIdx) {
59 return DataSourcesTableColumns.values()[colIdx].columnName();
63 public Object getValueAt(
int rowIdx,
int colIdx) {
64 if (dataSources.isEmpty()) {
65 return Bundle.DataSourcesTableModel_noData();
68 return mapValueById(rowIdx, DataSourcesTableColumns.values()[colIdx]);
79 @Messages({
"DataSourcesTableModel.noData=No Data Sources"})
80 private Object mapValueById(
int rowIdx, DataSourcesTableColumns colId) {
81 CorrelationDataSource dataSource = dataSources.get(rowIdx);
82 String value = Bundle.DataSourcesTableModel_noData();
89 value = dataSource.getDeviceID();
98 public Class<String> getColumnClass(
int colIdx) {
107 void addDataSources(List<CorrelationDataSource> dataSourceList) {
108 dataSources.addAll(dataSourceList);
109 fireTableDataChanged();
117 fireTableDataChanged();
120 @Messages({
"DataSourcesTableModel.dataSource=Data Source Name",
121 "DataSourcesTableModel.deviceId=Device ID"})
139 this.columnName = columnName;
DataSourcesTableColumns(String columnName)