private int[] getElementsRows(final Collection<? extends T> elements) {
   final int[] rows = new int[elements.size()];
   int index = 0;
   for (final T element : elements) {
     rows[index++] = myTable.convertRowIndexToView(myTableModel.getElementRow(element));
   }
   return rows;
 }
 private int[] getElementsRows(final Collection<? extends Module> elements) {
   final int[] rows = new int[elements.size()];
   int index = 0;
   for (final Module element : elements) {
     rows[index++] = myTableModel.getElementRow(element);
   }
   return rows;
 }
 public void moveElement(T element, int newRow) {
   final int elementRow = myTableModel.getElementRow(element);
   if (elementRow < 0
       || elementRow == newRow
       || newRow < 0
       || newRow >= myTableModel.getRowCount()) {
     return;
   }
   final boolean wasSelected = myTable.getSelectionModel().isSelectedIndex(elementRow);
   myTableModel.changeElementRow(element, newRow);
   if (wasSelected) {
     selectRow(newRow);
   }
 }
  public void removeModule(Module element) {
    final int elementRow = myTableModel.getElementRow(element);
    if (elementRow < 0) {
      return; // no such element
    }
    final boolean wasSelected = myTable.getSelectionModel().isSelectedIndex(elementRow);

    myTableModel.removeElement(element);

    if (wasSelected) {
      final int rowCount = myTableModel.getRowCount();
      if (rowCount > 0) {
        selectRow(elementRow % rowCount);
      } else {
        myTable.getSelectionModel().clearSelection();
      }
    }
    myTable.requestFocus();
  }
 public void refresh(Module element) {
   final int row = myTableModel.getElementRow(element);
   if (row >= 0) {
     myTableModel.fireTableRowsUpdated(row, row);
   }
 }
 /**
  * Check if element is marked
  *
  * @param element an element to test
  * @param marked a new value of mark.
  */
 public void setElementMarked(T element, boolean marked) {
   final int elementRow = myTableModel.getElementRow(element);
   myTableModel.setMarked(elementRow, marked);
 }
 /**
  * Check if element is marked
  *
  * @param element an element to test
  * @return true if element is marked
  */
 public boolean isElementMarked(T element) {
   final int elementRow = myTableModel.getElementRow(element);
   return myTableModel.isElementMarked(elementRow);
 }