public void clearReviewsActionPerformed(ActionEvent e) { int rowSorted = bookTable_.getSelectedRow(); int row = sorter_.convertRowIndexToModel(rowSorted); if (row < 0) { System.err.println("No row selected..."); } else { ATBookWrapper selectedBook = bookTableModel_.getBook(row); selectedBook.clearReviews(); } }
public int findRow(ATBookWrapper book) { int index = 0; ATBookWrapper current; for (Iterator i = books_.iterator(); i.hasNext(); ) { current = (ATBookWrapper) i.next(); if (current.equals(book)) { return index; } index++; } return -1; // error }
public void setValueAt(Object value, int row, int col) { ATBookWrapper book = books_.elementAt(row); switch (col) { case titleIdx_: book.setTitle((String) value); break; case authorsIdx_: book.setAuthors((String) value); break; default: System.err.println("Cannot edit field in column #" + col); break; } fireTableCellUpdated(row, col); }
public Object getValueAt(int row, int col) { if (books_.size() == 0) { return null; } if (row >= books_.size()) { return null; } ATBookWrapper book = (ATBookWrapper) books_.get(row); switch (col) { case statsIdx_: return null; case titleIdx_: return book.getTitle(); case authorsIdx_: return book.getAuthors(); case ratingIdx_: return book.getRating(); case favorIdx_: return book.getMatchFromString(keywords_); // TODO } return null; }