+ bookPane.setActionListener(new BookActionListener() {
+ public void select(LocalReaderBook book) {
+ selectedBook = book;
+ }
+
+ public void popupRequested(LocalReaderBook book, MouseEvent e) {
+ JPopupMenu popup = new JPopupMenu();
+ popup.add(createMenuItemOpenBook());
+ popup.addSeparator();
+ popup.add(createMenuItemExport());
+ popup.add(createMenuItemClearCache());
+ popup.add(createMenuItemRedownload());
+ popup.addSeparator();
+ popup.add(createMenuItemDelete());
+ popup.show(e.getComponent(), e.getX(), e.getY());
+ }
+
+ public void action(final LocalReaderBook book) {
+ openBook(book);
+ }
+ });
+ }
+
+ private void removeBookPanes() {
+ booksByType.clear();
+ booksByAuthor.clear();
+ pane.invalidate();
+ this.invalidate();
+ pane.removeAll();
+ pane.validate();
+ this.validate();
+ }
+
+ /**
+ * Refresh the list of {@link LocalReaderBook}s from disk.
+ *
+ */
+ private void refreshBooks() {
+ for (LocalReaderGroup group : booksByType.keySet()) {
+ List<MetaData> stories = Instance.getLibrary().getListByType(
+ booksByType.get(group));
+ group.refreshBooks(stories, words);
+ }