/** Invoked when removing selected reading list is required. */ private void onRemoveReadingList() { int[] rows = tblReadingLists.getSelectedRows(); boolean haveFeeds = false; for (int i = 0; !haveFeeds && i < rows.length; i++) { int row = rows[i]; haveFeeds = readingListsModel.getLists()[row].getFeeds().length > 0; } boolean delete = true; if (haveFeeds) { String msg = rows.length == 1 ? Strings.message("guide.dialog.readinglists.has.feeds") : Strings.message("guide.dialog.readinglists.have.feeds"); delete = JOptionPane.showConfirmDialog( this, msg, Strings.message("guide.dialog.delete.readinglist"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; } if (delete) readingListsModel.removeRows(rows); }
/** * Returns the default table cell renderer. * * @param table the <code>JTable</code> * @param value the value to assign to the cell at <code>[row, column]</code> * @param isSelected true if cell is selected * @param hasFocus true if cell has focus * @param row the row of the cell to render * @param column the column of the cell to render * @return the default table cell renderer */ public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { ReadingList list = model.getLists()[row]; Component comp = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); comp.setForeground(list.isMissing() ? Color.GRAY : table.getForeground()); return comp; }
/** * Returns currently displayed list of reading lists. * * @return list which is currently displayed. */ public ReadingList[] getReadingLists() { return readingListsModel.getLists(); }