Renames and jDo
authorNiki Roo <niki@nikiroo.be>
Sun, 2 Jul 2017 11:34:32 +0000 (13:34 +0200)
committerNiki Roo <niki@nikiroo.be>
Sun, 2 Jul 2017 11:34:32 +0000 (13:34 +0200)
src/be/nikiroo/fanfix/reader/BasicReader.java
src/be/nikiroo/fanfix/reader/GuiReader.java [moved from src/be/nikiroo/fanfix/reader/LocalReader.java with 97% similarity]
src/be/nikiroo/fanfix/reader/GuiReaderBook.java [moved from src/be/nikiroo/fanfix/reader/LocalReaderBook.java with 86% similarity]
src/be/nikiroo/fanfix/reader/GuiReaderFrame.java [moved from src/be/nikiroo/fanfix/reader/LocalReaderFrame.java with 90% similarity]
src/be/nikiroo/fanfix/reader/GuiReaderGroup.java [moved from src/be/nikiroo/fanfix/reader/LocalReaderGroup.java with 79% similarity]
src/be/nikiroo/fanfix/reader/TuiReader.java
src/be/nikiroo/fanfix/reader/TuiReaderApplication.java
src/be/nikiroo/fanfix/reader/TuiReaderMainWindow.java
src/be/nikiroo/fanfix/reader/TuiReaderStoryWindow.java

index f8341ae0b10d32cc75eba966ed116561749ea7cf..baf3c7dede9ebab876d7a4b3158d369e8224331d 100644 (file)
@@ -25,6 +25,11 @@ import be.nikiroo.utils.serial.SerialUtils;
  * @author niki
  */
 public abstract class BasicReader {
+       /**
+        * A type of {@link BasicReader}.
+        * 
+        * @author niki
+        */
        public enum ReaderType {
                /** Simple reader that outputs everything on the console */
                CLI,
@@ -35,6 +40,12 @@ public abstract class BasicReader {
 
                ;
 
+               /**
+                * Return the full class name of a type that implements said
+                * {@link ReaderType}.
+                * 
+                * @return the class name
+                */
                public String getTypeName() {
                        String pkg = "be.nikiroo.fanfix.reader.";
                        switch (this) {
@@ -43,7 +54,7 @@ public abstract class BasicReader {
                        case TUI:
                                return pkg + "TuiReader";
                        case GUI:
-                               return pkg + "LocalReader";
+                               return pkg + "GuiReader";
                        }
 
                        return null;
@@ -86,6 +97,8 @@ public abstract class BasicReader {
         * 
         * @param type
         *            the new type
+        * 
+        * @return the type
         */
        protected BasicReader setType(ReaderType type) {
                this.type = type;
@@ -196,9 +209,6 @@ public abstract class BasicReader {
         * Start the reader in browse mode for the given source (or pass NULL for
         * all sources).
         * 
-        * @param library
-        *            the library to browse
-        * 
         * @param source
         *            the type of {@link Story} to take into account, or NULL for
         *            all
@@ -286,7 +296,18 @@ public abstract class BasicReader {
                return source;
        }
 
-       // open with external player the related file
+       /**
+        * Open the {@link Story} with an external reader (the program will be
+        * passed the main file associated with this {@link Story}).
+        * 
+        * @param lib
+        *            the {@link BasicLibrary} to select the {@link Story} from
+        * @param luid
+        *            the {@link Story} LUID
+        * 
+        * @throws IOException
+        *             in case of I/O error
+        */
        public static void open(BasicLibrary lib, String luid) throws IOException {
                MetaData meta = lib.getInfo(luid);
                File target = lib.getFile(luid);
@@ -294,7 +315,18 @@ public abstract class BasicReader {
                open(meta, target);
        }
 
-       // open with external player the related file
+       /**
+        * Open the {@link Story} with an external reader (the program will be
+        * passed the given target file).
+        * 
+        * @param meta
+        *            the {@link Story} to load
+        * @param target
+        *            the target {@link File}
+        * 
+        * @throws IOException
+        *             in case of I/O error
+        */
        protected static void open(MetaData meta, File target) throws IOException {
                String program = null;
                if (meta.isImageDocument()) {
similarity index 97%
rename from src/be/nikiroo/fanfix/reader/LocalReader.java
rename to src/be/nikiroo/fanfix/reader/GuiReader.java
index 593f58b2122685034d3ad7b34e4c230467e1ed0f..cdf80d0c9fda7b3d02b0d4b7d045a011f877b551 100644 (file)
@@ -22,12 +22,12 @@ import be.nikiroo.utils.Progress;
 import be.nikiroo.utils.Version;
 import be.nikiroo.utils.ui.UIUtils;
 
-class LocalReader extends BasicReader {
+class GuiReader extends BasicReader {
        static private boolean nativeLookLoaded;
 
        private LocalLibrary localLibrary;
 
-       public LocalReader() throws IOException {
+       public GuiReader() throws IOException {
                if (!nativeLookLoaded) {
                        UIUtils.setLookAndFeel();
                        nativeLookLoaded = true;
@@ -120,7 +120,7 @@ class LocalReader extends BasicReader {
 
        /**
         * Check if the {@link Story} denoted by this Library UID is present in the
-        * {@link LocalReader} cache.
+        * {@link GuiReader} cache.
         * 
         * @param luid
         *            the Library UID
@@ -189,7 +189,7 @@ class LocalReader extends BasicReader {
                                        }
                                }
 
-                               new LocalReaderFrame(LocalReader.this, typeFinal)
+                               new GuiReaderFrame(GuiReader.this, typeFinal)
                                                .setVisible(true);
                        }
                });
similarity index 86%
rename from src/be/nikiroo/fanfix/reader/LocalReaderBook.java
rename to src/be/nikiroo/fanfix/reader/GuiReaderBook.java
index 0145559cd04d15ed189548cb6ef909e712e25a81..e6fe91b4d84ed95def7fe13ba48b52850ceb9686 100644 (file)
@@ -31,11 +31,11 @@ import be.nikiroo.utils.IOUtils;
 import be.nikiroo.utils.ui.UIUtils;
 
 /**
- * A book item presented in a {@link LocalReaderFrame}.
+ * A book item presented in a {@link GuiReaderFrame}.
  * 
  * @author niki
  */
-class LocalReaderBook extends JPanel {
+class GuiReaderBook extends JPanel {
        /**
         * Action on a book item.
         * 
@@ -46,27 +46,27 @@ class LocalReaderBook extends JPanel {
                 * The book was selected (single click).
                 * 
                 * @param book
-                *            the {@link LocalReaderBook} itself
+                *            the {@link GuiReaderBook} itself
                 */
-               public void select(LocalReaderBook book);
+               public void select(GuiReaderBook book);
 
                /**
                 * The book was double-clicked.
                 * 
                 * @param book
-                *            the {@link LocalReaderBook} itself
+                *            the {@link GuiReaderBook} itself
                 */
-               public void action(LocalReaderBook book);
+               public void action(GuiReaderBook book);
 
                /**
-                * A popup menu was requested for this {@link LocalReaderBook}.
+                * A popup menu was requested for this {@link GuiReaderBook}.
                 * 
                 * @param book
-                *            the {@link LocalReaderBook} itself
+                *            the {@link GuiReaderBook} itself
                 * @param e
                 *            the {@link MouseEvent} that generated this call
                 */
-               public void popupRequested(LocalReaderBook book, MouseEvent e);
+               public void popupRequested(GuiReaderBook book, MouseEvent e);
        }
 
        private static final long serialVersionUID = 1L;
@@ -97,16 +97,16 @@ class LocalReaderBook extends JPanel {
        private boolean cached;
 
        /**
-        * Create a new {@link LocalReaderBook} item for the given {@link Story}.
+        * Create a new {@link GuiReaderBook} item for the given {@link Story}.
         * 
         * @param meta
-        *            the story {@code}link MetaData}
+        *            the story {@link MetaData}
         * @param cached
         *            TRUE if it is locally cached
-        * @param seeWordcount
+        * @param seeWordCount
         *            TRUE to see word counts, FALSE to see authors
         */
-       public LocalReaderBook(MetaData meta, boolean cached, boolean seeWordCount) {
+       public GuiReaderBook(MetaData meta, boolean cached, boolean seeWordCount) {
                this.cached = cached;
                this.meta = meta;
 
@@ -182,7 +182,7 @@ class LocalReaderBook extends JPanel {
         * events.
         */
        private void setupListeners() {
-               listeners = new ArrayList<LocalReaderBook.BookActionListener>();
+               listeners = new ArrayList<GuiReaderBook.BookActionListener>();
                addMouseListener(new MouseListener() {
                        public void mouseReleased(MouseEvent e) {
                                if (e.isPopupTrigger()) {
@@ -221,17 +221,17 @@ class LocalReaderBook extends JPanel {
                        private void click(boolean doubleClick) {
                                for (BookActionListener listener : listeners) {
                                        if (doubleClick) {
-                                               listener.action(LocalReaderBook.this);
+                                               listener.action(GuiReaderBook.this);
                                        } else {
-                                               listener.select(LocalReaderBook.this);
+                                               listener.select(GuiReaderBook.this);
                                        }
                                }
                        }
 
                        private void popup(MouseEvent e) {
                                for (BookActionListener listener : listeners) {
-                                       listener.select((LocalReaderBook.this));
-                                       listener.popupRequested(LocalReaderBook.this, e);
+                                       listener.select((GuiReaderBook.this));
+                                       listener.popupRequested(GuiReaderBook.this, e);
                                }
                        }
                });
@@ -248,7 +248,7 @@ class LocalReaderBook extends JPanel {
        }
 
        /**
-        * The Library {@code}link MetaData} of the book represented by this item.
+        * The Library {@link MetaData} of the book represented by this item.
         * 
         * @return the meta
         */
@@ -257,19 +257,19 @@ class LocalReaderBook extends JPanel {
        }
 
        /**
-        * This item {@link LocalReader} library cache state.
+        * This item {@link GuiReader} library cache state.
         * 
-        * @return TRUE if it is present in the {@link LocalReader} cache
+        * @return TRUE if it is present in the {@link GuiReader} cache
         */
        public boolean isCached() {
                return cached;
        }
 
        /**
-        * This item {@link LocalReader} library cache state.
+        * This item {@link GuiReader} library cache state.
         * 
         * @param cached
-        *            TRUE if it is present in the {@link LocalReader} cache
+        *            TRUE if it is present in the {@link GuiReader} cache
         */
        public void setCached(boolean cached) {
                if (this.cached != cached) {
@@ -279,7 +279,7 @@ class LocalReaderBook extends JPanel {
        }
 
        /**
-        * Paint the item, then call {@link LocalReaderBook#paintOverlay(Graphics)}.
+        * Paint the item, then call {@link GuiReaderBook#paintOverlay(Graphics)}.
         */
        @Override
        public void paint(Graphics g) {
@@ -291,6 +291,9 @@ class LocalReaderBook extends JPanel {
         * Draw a partially transparent overlay if needed depending upon the
         * selection and mouse-hover states on top of the normal component, as well
         * as a possible "cached" icon if the item is cached.
+        * 
+        * @param g
+        *            the {@link Graphics} to paint onto
         */
        public void paintOverlay(Graphics g) {
                Rectangle clip = g.getClipBounds();
similarity index 90%
rename from src/be/nikiroo/fanfix/reader/LocalReaderFrame.java
rename to src/be/nikiroo/fanfix/reader/GuiReaderFrame.java
index bf94f26f8d7ceb1a197a7ab588e33fd4b1652fc9..26ab23f3c83d09fc3737edb2114f805ae290e1a5 100644 (file)
@@ -40,42 +40,42 @@ import be.nikiroo.fanfix.bundles.UiConfig;
 import be.nikiroo.fanfix.data.MetaData;
 import be.nikiroo.fanfix.data.Story;
 import be.nikiroo.fanfix.output.BasicOutput.OutputType;
-import be.nikiroo.fanfix.reader.LocalReaderBook.BookActionListener;
+import be.nikiroo.fanfix.reader.GuiReaderBook.BookActionListener;
 import be.nikiroo.utils.Progress;
 import be.nikiroo.utils.Version;
 import be.nikiroo.utils.ui.ConfigEditor;
 import be.nikiroo.utils.ui.ProgressBar;
 
 /**
- * A {@link Frame} that will show a {@link LocalReaderBook} item for each
+ * A {@link Frame} that will show a {@link GuiReaderBook} item for each
  * {@link Story} in the main cache ({@link Instance#getCache()}), and offer a
- * way to copy them to the {@link LocalReader} cache ({@link LocalReader#lib}),
- * read them, delete them...
+ * way to copy them to the {@link GuiReader} cache (
+ * {@link BasicReader#getLibrary()}), read them, delete them...
  * 
  * @author niki
  */
-class LocalReaderFrame extends JFrame {
+class GuiReaderFrame extends JFrame {
        private static final long serialVersionUID = 1L;
-       private LocalReader reader;
-       private Map<LocalReaderGroup, String> booksByType;
-       private Map<LocalReaderGroup, String> booksByAuthor;
+       private GuiReader reader;
+       private Map<GuiReaderGroup, String> booksByType;
+       private Map<GuiReaderGroup, String> booksByAuthor;
        private JPanel pane;
        private Color color;
        private ProgressBar pgBar;
        private JMenuBar bar;
-       private LocalReaderBook selectedBook;
+       private GuiReaderBook selectedBook;
        private boolean words; // words or authors (secondary info on books)
 
        /**
-        * Create a new {@link LocalReaderFrame}.
+        * Create a new {@link GuiReaderFrame}.
         * 
         * @param reader
-        *            the associated {@link LocalReader} to forward some commands
-        *            and access its {@link LocalLibrary}
+        *            the associated {@link GuiReader} to forward some commands and
+        *            access its {@link LocalLibrary}
         * @param type
         *            the type of {@link Story} to load, or NULL for all types
         */
-       public LocalReaderFrame(LocalReader reader, String type) {
+       public GuiReaderFrame(GuiReader reader, String type) {
                super(String.format("Fanfix %s Library", Version.getCurrentVersion()));
 
                this.reader = reader;
@@ -117,8 +117,8 @@ class LocalReaderFrame extends JFrame {
                        }
                });
 
-               booksByType = new HashMap<LocalReaderGroup, String>();
-               booksByAuthor = new HashMap<LocalReaderGroup, String>();
+               booksByType = new HashMap<GuiReaderGroup, String>();
+               booksByAuthor = new HashMap<GuiReaderGroup, String>();
 
                pane.setVisible(false);
                final Progress pg = new Progress();
@@ -139,8 +139,8 @@ class LocalReaderFrame extends JFrame {
        }
 
        /**
-        * Add a new {@link LocalReaderGroup} on the frame to display the books of
-        * the selected type or author.
+        * Add a new {@link GuiReaderGroup} on the frame to display the books of the
+        * selected type or author.
         * 
         * @param value
         *            the author or the type, or NULL to get all the
@@ -167,7 +167,7 @@ class LocalReaderFrame extends JFrame {
                        return;
                }
 
-               LocalReaderGroup bookPane = new LocalReaderGroup(reader, value, color);
+               GuiReaderGroup bookPane = new GuiReaderGroup(reader, value, color);
                if (type) {
                        booksByType.put(bookPane, value);
                } else {
@@ -181,11 +181,11 @@ class LocalReaderFrame extends JFrame {
                this.validate();
 
                bookPane.setActionListener(new BookActionListener() {
-                       public void select(LocalReaderBook book) {
+                       public void select(GuiReaderBook book) {
                                selectedBook = book;
                        }
 
-                       public void popupRequested(LocalReaderBook book, MouseEvent e) {
+                       public void popupRequested(GuiReaderBook book, MouseEvent e) {
                                JPopupMenu popup = new JPopupMenu();
                                popup.add(createMenuItemOpenBook());
                                popup.addSeparator();
@@ -198,7 +198,7 @@ class LocalReaderFrame extends JFrame {
                                popup.show(e.getComponent(), e.getX(), e.getY());
                        }
 
-                       public void action(final LocalReaderBook book) {
+                       public void action(final GuiReaderBook book) {
                                openBook(book);
                        }
                });
@@ -215,17 +215,17 @@ class LocalReaderFrame extends JFrame {
        }
 
        /**
-        * Refresh the list of {@link LocalReaderBook}s from disk.
+        * Refresh the list of {@link GuiReaderBook}s from disk.
         * 
         */
        private void refreshBooks() {
-               for (LocalReaderGroup group : booksByType.keySet()) {
+               for (GuiReaderGroup group : booksByType.keySet()) {
                        List<MetaData> stories = Instance.getLibrary().getListBySource(
                                        booksByType.get(group));
                        group.refreshBooks(stories, words);
                }
 
-               for (LocalReaderGroup group : booksByAuthor.keySet()) {
+               for (GuiReaderGroup group : booksByAuthor.keySet()) {
                        List<MetaData> stories = Instance.getLibrary().getListByAuthor(
                                        booksByAuthor.get(group));
                        group.refreshBooks(stories, words);
@@ -261,8 +261,8 @@ class LocalReaderFrame extends JFrame {
                JMenuItem exit = new JMenuItem("Exit", KeyEvent.VK_X);
                exit.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
-                               LocalReaderFrame.this.dispatchEvent(new WindowEvent(
-                                               LocalReaderFrame.this, WindowEvent.WINDOW_CLOSING));
+                               GuiReaderFrame.this.dispatchEvent(new WindowEvent(
+                                               GuiReaderFrame.this, WindowEvent.WINDOW_CLOSING));
                        }
                });
 
@@ -453,7 +453,7 @@ class LocalReaderFrame extends JFrame {
                export.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                                if (selectedBook != null) {
-                                       fc.showDialog(LocalReaderFrame.this, "Save");
+                                       fc.showDialog(GuiReaderFrame.this, "Save");
                                        if (fc.getSelectedFile() != null) {
                                                final OutputType type = filters.get(fc.getFileFilter());
                                                final String path = fc.getSelectedFile()
@@ -559,7 +559,7 @@ class LocalReaderFrame extends JFrame {
                                                String type = ftype;
                                                if (type == null) {
                                                        Object rep = JOptionPane.showInputDialog(
-                                                                       LocalReaderFrame.this, "Move to:",
+                                                                       GuiReaderFrame.this, "Move to:",
                                                                        "Moving story",
                                                                        JOptionPane.QUESTION_MESSAGE, null, null,
                                                                        selectedBook.getMeta().getSource());
@@ -607,7 +607,7 @@ class LocalReaderFrame extends JFrame {
                                        imprt(meta.getUrl(), new Runnable() {
                                                public void run() {
                                                        reader.delete(meta.getLuid());
-                                                       LocalReaderFrame.this.selectedBook = null;
+                                                       GuiReaderFrame.this.selectedBook = null;
                                                }
                                        }, "Removing old copy");
                                }
@@ -659,12 +659,12 @@ class LocalReaderFrame extends JFrame {
        }
 
        /**
-        * Open a {@link LocalReaderBook} item.
+        * Open a {@link GuiReaderBook} item.
         * 
         * @param book
-        *            the {@link LocalReaderBook} to open
+        *            the {@link GuiReaderBook} to open
         */
-       private void openBook(final LocalReaderBook book) {
+       private void openBook(final GuiReaderBook book) {
                final Progress pg = new Progress();
                outOfUi(pg, new Runnable() {
                        public void run() {
@@ -690,7 +690,7 @@ class LocalReaderFrame extends JFrame {
         * The code will make sure that the {@link ProgressBar} (if not NULL) is set
         * to done when the action is done.
         * 
-        * @param pg
+        * @param progress
         *            the {@link ProgressBar} or NULL
         * @param run
         *            the action to run
@@ -749,7 +749,7 @@ class LocalReaderFrame extends JFrame {
                                clipboard = "";
                        }
 
-                       url = JOptionPane.showInputDialog(LocalReaderFrame.this,
+                       url = JOptionPane.showInputDialog(GuiReaderFrame.this,
                                        "url of the story to import?", "Importing from URL",
                                        JOptionPane.QUESTION_MESSAGE, null, null, clipboard);
                } else if (fc.showOpenDialog(this) != JFileChooser.CANCEL_OPTION) {
@@ -800,9 +800,8 @@ class LocalReaderFrame extends JFrame {
                                        Instance.syserr(e);
                                        SwingUtilities.invokeLater(new Runnable() {
                                                public void run() {
-                                                       JOptionPane.showMessageDialog(
-                                                                       LocalReaderFrame.this, "Cannot import: "
-                                                                                       + url, e.getMessage(),
+                                                       JOptionPane.showMessageDialog(GuiReaderFrame.this,
+                                                                       "Cannot import: " + url, e.getMessage(),
                                                                        JOptionPane.ERROR_MESSAGE);
                                                }
                                        });
@@ -833,10 +832,10 @@ class LocalReaderFrame extends JFrame {
                        bar.setEnabled(b);
                }
 
-               for (LocalReaderGroup group : booksByType.keySet()) {
+               for (GuiReaderGroup group : booksByType.keySet()) {
                        group.setEnabled(b);
                }
-               for (LocalReaderGroup group : booksByAuthor.keySet()) {
+               for (GuiReaderGroup group : booksByAuthor.keySet()) {
                        group.setEnabled(b);
                }
                super.setEnabled(b);
similarity index 79%
rename from src/be/nikiroo/fanfix/reader/LocalReaderGroup.java
rename to src/be/nikiroo/fanfix/reader/GuiReaderGroup.java
index c5755460f15a77afd56c9f9117f59159b1f41c00..2161de563aec2e25265c3ed66636a06a242167c4 100644 (file)
@@ -11,36 +11,36 @@ import javax.swing.JLabel;
 import javax.swing.JPanel;
 
 import be.nikiroo.fanfix.data.MetaData;
-import be.nikiroo.fanfix.reader.LocalReaderBook.BookActionListener;
+import be.nikiroo.fanfix.reader.GuiReaderBook.BookActionListener;
 import be.nikiroo.utils.ui.WrapLayout;
 
 /**
- * A group of {@link LocalReaderBook}s for display.
+ * A group of {@link GuiReaderBook}s for display.
  * 
  * @author niki
  */
-public class LocalReaderGroup extends JPanel {
+public class GuiReaderGroup extends JPanel {
        private static final long serialVersionUID = 1L;
        private BookActionListener action;
        private Color backgroundColor;
-       private LocalReader reader;
+       private GuiReader reader;
        private List<MetaData> stories;
-       private List<LocalReaderBook> books;
+       private List<GuiReaderBook> books;
        private JPanel pane;
        private boolean words; // words or authors (secondary info on books)
 
        /**
-        * Create a new {@link LocalReaderGroup}.
+        * Create a new {@link GuiReaderGroup}.
         * 
         * @param reader
-        *            the {@link LocalReaderBook} used to probe some information
+        *            the {@link GuiReaderBook} used to probe some information
         *            about the stories
         * @param title
         *            the title of this group
         * @param backgroundColor
         *            the background colour to use (or NULL for default)
         */
-       public LocalReaderGroup(LocalReader reader, String title,
+       public GuiReaderGroup(GuiReader reader, String title,
                        Color backgroundColor) {
                this.reader = reader;
                this.backgroundColor = backgroundColor;
@@ -72,7 +72,7 @@ public class LocalReaderGroup extends JPanel {
 
        /**
         * Set the {@link ActionListener} that will be fired on each
-        * {@link LocalReaderBook} action.
+        * {@link GuiReaderBook} action.
         * 
         * @param action
         *            the action
@@ -83,7 +83,7 @@ public class LocalReaderGroup extends JPanel {
        }
 
        /**
-        * Refresh the list of {@link LocalReaderBook}s displayed in the control.
+        * Refresh the list of {@link GuiReaderBook}s displayed in the control.
         * 
         * @param stories
         *            the stories
@@ -94,14 +94,14 @@ public class LocalReaderGroup extends JPanel {
                this.stories = stories;
                this.words = seeWordcount;
 
-               books = new ArrayList<LocalReaderBook>();
+               books = new ArrayList<GuiReaderBook>();
                invalidate();
                pane.invalidate();
                pane.removeAll();
 
                if (stories != null) {
                        for (MetaData meta : stories) {
-                               LocalReaderBook book = new LocalReaderBook(meta,
+                               GuiReaderBook book = new GuiReaderBook(meta,
                                                reader.isCached(meta.getLuid()), seeWordcount);
                                if (backgroundColor != null) {
                                        book.setBackground(backgroundColor);
@@ -110,17 +110,17 @@ public class LocalReaderGroup extends JPanel {
                                books.add(book);
 
                                book.addActionListener(new BookActionListener() {
-                                       public void select(LocalReaderBook book) {
-                                               for (LocalReaderBook abook : books) {
+                                       public void select(GuiReaderBook book) {
+                                               for (GuiReaderBook abook : books) {
                                                        abook.setSelected(abook == book);
                                                }
                                        }
 
-                                       public void popupRequested(LocalReaderBook book,
+                                       public void popupRequested(GuiReaderBook book,
                                                        MouseEvent e) {
                                        }
 
-                                       public void action(LocalReaderBook book) {
+                                       public void action(GuiReaderBook book) {
                                        }
                                });
 
@@ -152,7 +152,7 @@ public class LocalReaderGroup extends JPanel {
        @Override
        public void setEnabled(boolean b) {
                if (books != null) {
-                       for (LocalReaderBook book : books) {
+                       for (GuiReaderBook book : books) {
                                book.setEnabled(b);
                                book.repaint();
                        }
index 12f048240a05f0d19d116eec3c7df4c82c61a57a..98130a989b8b0fa505f307dddd7f958bb9bdeb7f 100644 (file)
@@ -1,11 +1,8 @@
 package be.nikiroo.fanfix.reader;
 
 import java.io.IOException;
-import java.util.List;
 
 import be.nikiroo.fanfix.Instance;
-import be.nikiroo.fanfix.LocalLibrary;
-import be.nikiroo.fanfix.data.MetaData;
 
 class TuiReader extends BasicReader {
        @Override
@@ -25,9 +22,9 @@ class TuiReader extends BasicReader {
 
        @Override
        public void browse(String source) {
-               List<MetaData> stories = getLibrary().getListBySource(source);
                try {
-                       TuiReaderApplication app = new TuiReaderApplication(stories, this);
+                       TuiReaderApplication app = new TuiReaderApplication(getLibrary()
+                                       .getListBySource(source), this);
                        new Thread(app).start();
                } catch (Exception e) {
                        Instance.syserr(e);
index 9a534983f3f25068ea7fd9f2b6b31909775abb39..719f0954160fc3d90b0e1996dc7f5db744f36121 100644 (file)
@@ -7,7 +7,7 @@ import jexer.TApplication;
 import jexer.TMessageBox;
 import be.nikiroo.fanfix.data.MetaData;
 
-public class TuiReaderApplication extends TApplication {
+class TuiReaderApplication extends TApplication {
        private BasicReader reader;
 
        private static BackendType guessBackendType() {
index 55072664e9ae9376a0f7e4f119cbfb81f7d7f8bc..8f00b493e99238c461746abd46e80fc7b94fbdab 100644 (file)
@@ -3,10 +3,17 @@ package be.nikiroo.fanfix.reader;
 import java.util.ArrayList;
 import java.util.List;
 
-import jexer.*;
+import jexer.TAction;
+import jexer.TCommand;
+import jexer.TKeypress;
+import jexer.TList;
+import jexer.TRadioGroup;
+import jexer.TTreeItem;
+import jexer.TTreeView;
+import jexer.TWindow;
 import be.nikiroo.fanfix.data.MetaData;
 
-public class TuiReaderMainWindow extends TWindow {
+class TuiReaderMainWindow extends TWindow {
        private TList list;
        private List<MetaData> listKeys;
        private List<String> listItems;
@@ -15,10 +22,10 @@ public class TuiReaderMainWindow extends TWindow {
        /**
         * Constructor.
         * 
-        * @param parent
-        *            the main application
-        * @param flags
-        *            bitmask of MODAL, CENTERED, or RESIZABLE
+        * @param reader
+        *            the reader and main application
+        * @param stories
+        *            the stories to display
         */
        public TuiReaderMainWindow(TuiReaderApplication reader,
                        List<MetaData> stories) {
@@ -49,7 +56,7 @@ public class TuiReaderMainWindow extends TWindow {
                                }
                        }
                });
-               
+
                // TODO: add the current "type" or filter
                statusBar = newStatusBar("Library");
                statusBar.addShortcutKeypress(TKeypress.kbF10, TCommand.cmExit, "Exit");
index f556a4b7a77edefd8e808a692dc1111f4fe59a79..2b1cace8ba817462473e3bb067ce77010e044d78 100644 (file)
@@ -13,14 +13,12 @@ import jexer.TText;
 import jexer.TWindow;
 import jexer.event.TResizeEvent;
 import be.nikiroo.fanfix.BasicLibrary;
-import be.nikiroo.fanfix.Instance;
-import be.nikiroo.fanfix.LocalLibrary;
 import be.nikiroo.fanfix.data.Chapter;
 import be.nikiroo.fanfix.data.MetaData;
 import be.nikiroo.fanfix.data.Paragraph;
 import be.nikiroo.fanfix.data.Story;
 
-public class TuiReaderStoryWindow extends TWindow {
+class TuiReaderStoryWindow extends TWindow {
        private BasicLibrary lib;
        private MetaData meta;
        private Story story;