19 package org.sleuthkit.autopsy.ingest;
 
   21 import java.awt.Component;
 
   22 import java.awt.event.ActionEvent;
 
   23 import java.awt.event.ActionListener;
 
   24 import java.awt.event.WindowAdapter;
 
   25 import java.awt.event.WindowEvent;
 
   26 import java.util.ArrayList;
 
   27 import java.util.List;
 
   28 import javax.swing.JTable;
 
   29 import javax.swing.ListSelectionModel;
 
   30 import javax.swing.event.ListSelectionEvent;
 
   31 import javax.swing.event.ListSelectionListener;
 
   32 import javax.swing.table.AbstractTableModel;
 
   33 import javax.swing.table.DefaultTableCellRenderer;
 
   34 import javax.swing.table.TableColumn;
 
   43     private final List<IngestModuleModel> 
modules;
 
   54         this.modules = 
new ArrayList<>();
 
   55         for (IngestModuleTemplate moduleTemplate : settings.getIngestModuleTemplates()) {
 
   68         List<IngestModuleTemplate> moduleTemplates = 
new ArrayList<>();
 
   70             IngestModuleTemplate moduleTemplate = module.getIngestModuleTemplate();
 
   71             if (module.hasModuleSettingsPanel()) {
 
   73                 moduleTemplate.setModuleSettings(moduleSettings);
 
   75             moduleTemplates.add(moduleTemplate);
 
   77         this.settings.setIngestModuleTemplates(moduleTemplates);
 
   84         modulesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
 
   91         for (
int i = 0; i < 
modulesTable.getColumnCount(); ++i) {
 
   92             TableColumn column = 
modulesTable.getColumnModel().getColumn(i);
 
   94                 column.setPreferredWidth(((
int) (width * 0.15)));
 
   96                 column.setCellRenderer(renderer);
 
   97                 column.setPreferredWidth(((
int) (width * 0.84)));
 
  104         modulesTable.getSelectionModel().addListSelectionListener(
new ListSelectionListener() {
 
  106             public void valueChanged(ListSelectionEvent e) {
 
  107                 ListSelectionModel listSelectionModel = (ListSelectionModel) e.getSource();
 
  108                 if (!listSelectionModel.isSelectionEmpty()) {
 
  109                     int index = listSelectionModel.getMinSelectionIndex();
 
  110                     selectedModule = modules.get(index);
 
  112                     if (null != selectedModule.getModuleSettingsPanel()) {
 
  113                         simplePanel.add(selectedModule.getModuleSettingsPanel());
 
  117                     advancedButton.setEnabled(null != selectedModule.getGlobalSettingsPanel());
 
  132     @SuppressWarnings(
"unchecked")
 
  136         timeGroup = 
new javax.swing.ButtonGroup();
 
  139         jPanel1 = 
new javax.swing.JPanel();
 
  148         setMaximumSize(
new java.awt.Dimension(5750, 3000));
 
  149         setMinimumSize(
new java.awt.Dimension(522, 257));
 
  150         setPreferredSize(
new java.awt.Dimension(575, 300));
 
  152         modulesScrollPane.setBorder(javax.swing.BorderFactory.createLineBorder(
new java.awt.Color(160, 160, 160)));
 
  155         modulesTable.setBackground(
new java.awt.Color(240, 240, 240));
 
  156         modulesTable.setModel(
new javax.swing.table.DefaultTableModel(
 
  168         jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(
new java.awt.Color(160, 160, 160)));
 
  169         jPanel1.setPreferredSize(
new java.awt.Dimension(338, 257));
 
  174         advancedButton.addActionListener(
new java.awt.event.ActionListener() {
 
  175             public void actionPerformed(java.awt.event.ActionEvent evt) {
 
  183         jScrollPane1.setPreferredSize(
new java.awt.Dimension(250, 180));
 
  188         javax.swing.GroupLayout jPanel1Layout = 
new javax.swing.GroupLayout(
jPanel1);
 
  189         jPanel1.setLayout(jPanel1Layout);
 
  190         jPanel1Layout.setHorizontalGroup(
 
  191             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  192             .addComponent(
jSeparator2, javax.swing.GroupLayout.Alignment.TRAILING)
 
  193             .addGroup(jPanel1Layout.createSequentialGroup()
 
  195                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  196                     .addComponent(
jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
 
  197                     .addGroup(jPanel1Layout.createSequentialGroup()
 
  198                         .addComponent(
descriptionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 203, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  199                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 22, Short.MAX_VALUE)
 
  203         jPanel1Layout.setVerticalGroup(
 
  204             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  205             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
 
  207                 .addComponent(
jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 211, Short.MAX_VALUE)
 
  208                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
 
  209                 .addComponent(
jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  210                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 
  211                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  212                     .addComponent(
descriptionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  217         processUnallocPanel.setBorder(javax.swing.BorderFactory.createLineBorder(
new java.awt.Color(160, 160, 160)));
 
  222             public void actionPerformed(java.awt.event.ActionEvent evt) {
 
  227         javax.swing.GroupLayout processUnallocPanelLayout = 
new javax.swing.GroupLayout(
processUnallocPanel);
 
  229         processUnallocPanelLayout.setHorizontalGroup(
 
  230             processUnallocPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  231             .addGroup(processUnallocPanelLayout.createSequentialGroup()
 
  234                 .addContainerGap(60, Short.MAX_VALUE))
 
  236         processUnallocPanelLayout.setVerticalGroup(
 
  237             processUnallocPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  238             .addGroup(processUnallocPanelLayout.createSequentialGroup()
 
  241                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
 
  244         javax.swing.GroupLayout layout = 
new javax.swing.GroupLayout(
this);
 
  245         this.setLayout(layout);
 
  246         layout.setHorizontalGroup(
 
  247             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  248             .addGroup(layout.createSequentialGroup()
 
  250                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  251                     .addComponent(
processUnallocPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
 
  252                     .addComponent(
modulesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
 
  253                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 
  254                 .addComponent(
jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 328, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  257         layout.setVerticalGroup(
 
  258             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  259             .addGroup(layout.createSequentialGroup()
 
  261                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  262                     .addComponent(
jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE)
 
  263                     .addGroup(layout.createSequentialGroup()
 
  264                         .addComponent(
modulesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
 
  265                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 
  266                         .addComponent(
processUnallocPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
 
  280             public void actionPerformed(ActionEvent e) {
 
  281                 if (selectedModule.hasGlobalSettingsPanel()) {
 
  282                     selectedModule.saveResourcesConfig();
 
  288         dialog.addWindowListener(
new WindowAdapter() {
 
  290             public void windowClosing(WindowEvent e) {
 
  295         dialog.
display(selectedModule.getGlobalSettingsPanel());
 
  325             if (moduleTemplate.hasModuleSettingsPanel()) {
 
  326                 moduleSettingsPanel = moduleTemplate.getModuleSettingsPanel();
 
  328             if (moduleTemplate.hasGlobalSettingsPanel()) {
 
  329                 globalSettingsPanel = moduleTemplate.getGlobalSettingsPanel();
 
  333         IngestModuleTemplate getIngestModuleTemplate() {
 
  338             return moduleTemplate.getModuleName();
 
  341         String getDescription() {
 
  342             return moduleTemplate.getModuleDescription();
 
  345         void setEnabled(
boolean enabled) {
 
  346             moduleTemplate.setEnabled(enabled);
 
  349         boolean isEnabled() {
 
  350             return moduleTemplate.isEnabled();
 
  353         boolean hasModuleSettingsPanel() {
 
  354             return moduleTemplate.hasModuleSettingsPanel();
 
  357         IngestModuleIngestJobSettingsPanel getModuleSettingsPanel() {
 
  361         boolean hasGlobalSettingsPanel() {
 
  362             return moduleTemplate.hasGlobalSettingsPanel();
 
  365         IngestModuleGlobalSettingsPanel getGlobalSettingsPanel() {
 
  369         void saveResourcesConfig() {
 
  382             return modules.size();
 
  393             if (columnIndex == 0) {
 
  394                 return module.isEnabled();
 
  396                 return module.getName();
 
  402             return columnIndex == 0;
 
  406         public void setValueAt(Object aValue, 
int rowIndex, 
int columnIndex) {
 
  407             if (columnIndex == 0) {
 
  408                 modules.get(rowIndex).setEnabled((
boolean) aValue);
 
  424         List<String> tooltips = 
new ArrayList<>();
 
  428                 tooltips.add(moduleTemplate.getDescription());
 
  434             super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
 
  436                 setToolTipText(tooltips.get(row));
 
IngestJobSettingsPanel(IngestJobSettings settings)
 
void advancedButtonActionPerformed(java.awt.event.ActionEvent evt)
 
javax.swing.JPanel processUnallocPanel
 
javax.swing.JSeparator jSeparator2
 
void processUnallocCheckboxActionPerformed(java.awt.event.ActionEvent evt)
 
void display(JPanel panel)
 
IngestModulesTableRenderer()
 
javax.swing.JCheckBox processUnallocCheckbox
 
javax.swing.JLabel descriptionLabel
 
void addApplyButtonListener(ActionListener l)
 
javax.swing.JTable modulesTable
 
final List< IngestModuleModel > modules
 
Class<?> getColumnClass(int c)
 
abstract void saveSettings()
 
IngestModuleGlobalSettingsPanel globalSettingsPanel
 
IngestJobSettings getSettings()
 
IngestModuleIngestJobSettingsPanel moduleSettingsPanel
 
javax.swing.ButtonGroup timeGroup
 
void setValueAt(Object aValue, int rowIndex, int columnIndex)
 
javax.swing.JScrollPane modulesScrollPane
 
javax.swing.JPanel simplePanel
 
javax.swing.JButton advancedButton
 
final IngestJobSettings settings
 
Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
 
javax.swing.JPanel jPanel1
 
Object getValueAt(int rowIndex, int columnIndex)
 
boolean isCellEditable(int rowIndex, int columnIndex)
 
javax.swing.JScrollPane jScrollPane1
 
IngestModuleModel selectedModule
 
final IngestModuleTemplate moduleTemplate
 
void customizeComponents()