private void btnImportActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnImportActionPerformed
   cancelled = false;
   if (jTabbedPane.getSelectedIndex() == 0) {
     selectedSolverConfigs = solverConfigTableModelByExperiments.getSelectedSolverConfigurations();
   } else {
     selectedSolverConfigs = solverConfigTableModelBySolvers.getSelectedSolverConfigurations();
   }
   this.setVisible(false);
 } // GEN-LAST:event_btnImportActionPerformed
 private void btnSelectAllSolverConfigsActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnSelectAllSolverConfigsActionPerformed
   for (int row = 0; row < tblSolverConfigsBySolvers.getRowCount(); row++) {
     solverConfigTableModelBySolvers.setValueAt(
         true,
         tblSolverConfigsBySolvers.convertRowIndexToModel(row),
         SolverConfigurationTableModel.COL_SEL);
   }
   solverConfigTableModelBySolvers.fireTableDataChanged();
 } // GEN-LAST:event_btnSelectAllSolverConfigsActionPerformed
 private void btnSolverTabFilterExistingSolverConfigsActionPerformed(
     java.awt.event.ActionEvent
         evt) { // GEN-FIRST:event_btnSolverTabFilterExistingSolverConfigsActionPerformed
   EDACCApp.getApplication().show(existingSolverConfigFilter);
   solverConfigTableModelBySolvers.fireTableDataChanged();
   updateExistingSolverConfigFilterStatus();
 } // GEN-LAST:event_btnSolverTabFilterExistingSolverConfigsActionPerformed
  /** Creates new form EDACCExperimentModeImportSolverConfigs */
  public EDACCExperimentModeImportSolverConfigs(
      java.awt.Frame parent, boolean modal, ExperimentController expController) {
    super(parent, modal);

    ArrayList<SolverConfiguration> scs = null;
    ArrayList<Solver> solvers = new ArrayList<Solver>();
    try {
      scs = SolverConfigurationDAO.getAll();
      ParameterInstanceDAO.cacheParameterInstances(scs);
      LinkedList<Solver> tmp = SolverDAO.getAll();
      solvers.addAll(tmp);
    } catch (SQLException ex) {
    }

    cancelled = true;
    selectedSolverConfigs = new ArrayList<SolverConfiguration>();
    experimentTableModel = new ExperimentTableModel(true);
    solverConfigTableModelByExperiments = new SolverConfigurationTableModel();
    solverConfigTableModelBySolvers = new SolverConfigurationTableModel();
    experimentTableModel.setExperiments(expController.getExperiments());

    initComponents();

    tblExperiments.setDefaultRenderer(
        char.class,
        new DefaultTableCellRenderer() {

          @Override
          public Component getTableCellRendererComponent(
              JTable table,
              Object value,
              boolean isSelected,
              boolean hasFocus,
              int row,
              int column) {
            JLabel lbl =
                (JLabel)
                    super.getTableCellRendererComponent(
                        table, value, isSelected, hasFocus, row, column);
            lbl.setHorizontalAlignment(JLabel.CENTER);
            return lbl;
          }
        });

    tblExperiments
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {

              @Override
              public void valueChanged(ListSelectionEvent e) {
                solverConfigurationTableRowFilterByExperiments.clearIncludedExperiments();
                for (int row : tblExperiments.getSelectedRows()) {
                  Experiment exp =
                      experimentTableModel.getExperimentAt(
                          tblExperiments.convertRowIndexToModel(row));
                  solverConfigurationTableRowFilterByExperiments.includeExperiment(exp.getId());
                }
                solverConfigTableModelByExperiments.fireTableDataChanged();
              }
            });

    TableRowSorter tableSolverConfigurationsRowSorterByExperiments =
        new TableRowSorter<SolverConfigurationTableModel>(solverConfigTableModelByExperiments);
    solverConfigurationTableRowFilterByExperiments = new SolverConfigurationTableRowFilter();
    tableSolverConfigurationsRowSorterByExperiments.setRowFilter(
        solverConfigurationTableRowFilterByExperiments);
    tblSolverConfigsByExperiments.setRowSorter(tableSolverConfigurationsRowSorterByExperiments);
    tblSolverConfigsByExperiments.setModel(solverConfigTableModelByExperiments);
    Util.addSpaceSelection(tblSolverConfigsByExperiments, SolverConfigurationTableModel.COL_SEL);
    solverConfigTableModelByExperiments.setSolverConfigurations(scs);

    solTableModel = new SolverTableModel();
    tableSolvers.setModel(solTableModel);
    tableSolvers.removeColumn(
        tableSolvers.getColumnModel().getColumn(SolverTableModel.COL_SELECTED));
    solTableModel.setSolvers(solvers);
    TableRowSorter tableSolverConfigurationsRowSorterBySolvers =
        new TableRowSorter<SolverConfigurationTableModel>(solverConfigTableModelBySolvers);
    solverConfigurationTableRowFilterBySolvers = new SolverConfigurationTableRowFilter();
    tableSolverConfigurationsRowSorterBySolvers.setRowFilter(
        solverConfigurationTableRowFilterBySolvers);
    tblSolverConfigsBySolvers.setRowSorter(tableSolverConfigurationsRowSorterBySolvers);
    tblSolverConfigsBySolvers.setModel(solverConfigTableModelBySolvers);
    Util.addSpaceSelection(tblSolverConfigsBySolvers, SolverConfigurationTableModel.COL_SEL);
    solverConfigTableModelBySolvers.setSolverConfigurations(scs);

    tableSolvers
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {

              @Override
              public void valueChanged(ListSelectionEvent e) {
                solverConfigurationTableRowFilterBySolvers.clearSolverBinaryIds();
                for (int rowView : tableSolvers.getSelectedRows()) {
                  int rowModel = tableSolvers.convertRowIndexToModel(rowView);
                  for (SolverBinaries sb : solTableModel.getSolver(rowModel).getSolverBinaries()) {
                    solverConfigurationTableRowFilterBySolvers.addSolverBinaryId(sb.getId());
                  }
                }
                solverConfigTableModelBySolvers.fireTableDataChanged();
                updateExistingSolverConfigFilterStatus();
              }
            });

    SwingUtilities.invokeLater(
        new Runnable() {

          @Override
          public void run() {
            existingSolverConfigFilter =
                new EDACCFilter(
                    EDACCApp.getApplication().getMainFrame(),
                    true,
                    tblSolverConfigsBySolvers,
                    true);
            solverFilter =
                new EDACCFilter(EDACCApp.getApplication().getMainFrame(), true, tableSolvers, true);
          }
        });
  }