コード例 #1
0
 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;
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 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);
   }
 }
コード例 #4
0
  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();
  }
コード例 #5
0
 public void refresh(Module element) {
   final int row = myTableModel.getElementRow(element);
   if (row >= 0) {
     myTableModel.fireTableRowsUpdated(row, row);
   }
 }
コード例 #6
0
 /**
  * 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);
 }
コード例 #7
0
 /**
  * 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);
 }