protected void deleteFile() { // If a table cell is being edited, we must cancel the editing before // deleting the row int rowSelected = files.getSelectedRow(); if (rowSelected >= 0) { tableModel.removeRow(rowSelected); tableModel.fireTableDataChanged(); } }
model.fireTableDataChanged(); }).start();
/** * Remove the currently selected argument from the table. */ private void deleteArgument() { // If a table cell is being edited, we must cancel the editing before // deleting the row GuiUtils.cancelEditing(table); int rowSelected = table.getSelectedRow(); if (rowSelected >= 0) { tableModel.removeRow(rowSelected); tableModel.fireTableDataChanged(); // Disable DELETE if there are no rows in the table to delete. if (tableModel.getRowCount() == 0) { delete.setEnabled(false); } // Table still contains one or more rows, so highlight (select) // the appropriate one. else { int rowToSelect = rowSelected; if (rowSelected >= tableModel.getRowCount()) { rowToSelect = rowSelected - 1; } table.setRowSelectionInterval(rowToSelect, rowToSelect); } } }
@Override public void run() { if (isSampleIncluded(res)) { SamplingStatCalculator row = null; final String sampleLabel = res.getSampleLabel(useGroupName.isSelected()); synchronized (lock) { row = tableRows.get(sampleLabel); if (row == null) { row = new SamplingStatCalculator(sampleLabel); tableRows.put(row.getLabel(), row); model.insertRow(row, model.getRowCount() - 1); } } /* * Synch is needed because multiple threads can update the * counts. */ synchronized (row) { row.addSample(res); } SamplingStatCalculator tot = tableRows.get(TOTAL_ROW_LABEL); synchronized (tot) { tot.addSample(res); } model.fireTableDataChanged(); } } });
@Override public void run() { if (isSampleIncluded(res)) { SamplingStatCalculator row; final String sampleLabel = res.getSampleLabel(useGroupName.isSelected()); synchronized (lock) { row = tableRows.get(sampleLabel); if (row == null) { row = new SamplingStatCalculator(sampleLabel); tableRows.put(row.getLabel(), row); model.insertRow(row, model.getRowCount() - 1); } } /* * Synch is needed because multiple threads can update the * counts. */ synchronized (row) { row.addSample(res); } SamplingStatCalculator tot = tableRows.get(TOTAL_ROW_LABEL); synchronized (tot) { tot.addSample(res); } model.fireTableDataChanged(); } } });
model.fireTableDataChanged(); }).start();
/** * Runs specified command on currently selected file. * * @param command specifies which process will be done on selected * file. it's coming from action command currently caught by * action listener. */ private void runCommandOnSelectedFile(String command) { // If a table cell is being edited, we must cancel the editing before // deleting the row GuiUtils.cancelEditing(table); int rowSelected = table.getSelectedRow(); if (rowSelected >= 0) { runCommandOnRow(command, rowSelected); tableModel.fireTableDataChanged(); // Disable DELETE and BROWSE if there are no rows in the table to delete. checkDeleteAndBrowseStatus(); // Table still contains one or more rows, so highlight (select) // the appropriate one. if (tableModel.getRowCount() != 0) { int rowToSelect = rowSelected; if (rowSelected >= tableModel.getRowCount()) { rowToSelect = rowSelected - 1; } table.setRowSelectionInterval(rowToSelect, rowToSelect); } } }
model.insertRow(newRows.pop(), model.getRowCount() - 1); model.fireTableDataChanged();