- public void actionPerformed(ActionEvent e) {
- int[] selected = list.getSelectedIndices();
- if (selected.length == 1) {
- final BookInfo book = data.get(selected[0]);
- BasicLibrary lib = Instance.getInstance().getLibrary();
- Actions.openExternal(lib, book.getMeta(), BooksPanel.this, new Runnable() {
- @Override
- public void run() {
- data.fireElementChanged(book);
- }
- });
+ public void setCached(BookInfo book, boolean cached) {
+ book.setCached(cached);
+ fireElementChanged(book);
+ }
+
+ public void fireElementChanged(BookInfo book) {
+ data.fireElementChanged(book);
+ }
+
+ @Override
+ public List<BookInfo> getSelected() {
+ List<BookInfo> selected = new ArrayList<BookInfo>();
+ for (int index : list.getSelectedIndices()) {
+ selected.add(data.get(index));