private void deleteDetailButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteDetailButtonActionPerformed
        int index = masterTable.getSelectedRow();
        sosafe.model.SensorInfo s = list.get(masterTable.convertRowIndexToModel(index));
        Collection<sosafe.model.AlarmInfo> as = s.getAlarmInfoCollection();
        int[] selected = detailTable.getSelectedRows();
        List<sosafe.model.AlarmInfo> toRemove = new ArrayList<sosafe.model.AlarmInfo>(selected.length);
        for (int idx = 0; idx < selected.length; idx++) {

            selected[idx] = detailTable.convertRowIndexToModel(selected[idx]);

            int count = 0;
            Iterator<sosafe.model.AlarmInfo> iter = as.iterator();
            while (count++ < selected[idx]) {
                iter.next();
            }
            sosafe.model.AlarmInfo a = iter.next();
            toRemove.add(a);
            entityManager.remove(a);
        }
        as.removeAll(toRemove);
        masterTable.clearSelection();
        masterTable.setRowSelectionInterval(index, index);
    }//GEN-LAST:event_deleteDetailButtonActionPerformed