git://git.nikiroo.be
/
nikiroo-utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
68e2c6d
)
Renames and jDo
author
Niki Roo
<niki@nikiroo.be>
Sun, 2 Jul 2017 11:34:32 +0000
(13:34 +0200)
committer
Niki Roo
<niki@nikiroo.be>
Sun, 2 Jul 2017 11:34:32 +0000
(13:34 +0200)
src/be/nikiroo/fanfix/reader/BasicReader.java
patch
|
blob
|
blame
|
history
src/be/nikiroo/fanfix/reader/GuiReader.java
[moved from
src/be/nikiroo/fanfix/reader/LocalReader.java
with 97% similarity]
patch
|
blob
|
blame
|
history
src/be/nikiroo/fanfix/reader/GuiReaderBook.java
[moved from
src/be/nikiroo/fanfix/reader/LocalReaderBook.java
with 86% similarity]
patch
|
blob
|
blame
|
history
src/be/nikiroo/fanfix/reader/GuiReaderFrame.java
[moved from
src/be/nikiroo/fanfix/reader/LocalReaderFrame.java
with 90% similarity]
patch
|
blob
|
blame
|
history
src/be/nikiroo/fanfix/reader/GuiReaderGroup.java
[moved from
src/be/nikiroo/fanfix/reader/LocalReaderGroup.java
with 79% similarity]
patch
|
blob
|
blame
|
history
src/be/nikiroo/fanfix/reader/TuiReader.java
patch
|
blob
|
blame
|
history
src/be/nikiroo/fanfix/reader/TuiReaderApplication.java
patch
|
blob
|
blame
|
history
src/be/nikiroo/fanfix/reader/TuiReaderMainWindow.java
patch
|
blob
|
blame
|
history
src/be/nikiroo/fanfix/reader/TuiReaderStoryWindow.java
patch
|
blob
|
blame
|
history
diff --git
a/src/be/nikiroo/fanfix/reader/BasicReader.java
b/src/be/nikiroo/fanfix/reader/BasicReader.java
index f8341ae0b10d32cc75eba966ed116561749ea7cf..baf3c7dede9ebab876d7a4b3158d369e8224331d 100644
(file)
--- a/
src/be/nikiroo/fanfix/reader/BasicReader.java
+++ b/
src/be/nikiroo/fanfix/reader/BasicReader.java
@@
-25,6
+25,11
@@
import be.nikiroo.utils.serial.SerialUtils;
* @author niki
*/
public abstract class BasicReader {
* @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,
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) {
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:
case TUI:
return pkg + "TuiReader";
case GUI:
- return pkg + "
Local
Reader";
+ return pkg + "
Gui
Reader";
}
return null;
}
return null;
@@
-86,6
+97,8
@@
public abstract class BasicReader {
*
* @param type
* the new type
*
* @param type
* the new type
+ *
+ * @return the type
*/
protected BasicReader setType(ReaderType type) {
this.type = 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).
*
* 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
* @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;
}
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);
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(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()) {
protected static void open(MetaData meta, File target) throws IOException {
String program = null;
if (meta.isImageDocument()) {
diff --git
a/src/be/nikiroo/fanfix/reader/LocalReader.java
b/src/be/nikiroo/fanfix/reader/GuiReader.java
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)
--- a/
src/be/nikiroo/fanfix/reader/LocalReader.java
+++ b/
src/be/nikiroo/fanfix/reader/GuiReader.java
@@
-22,12
+22,12
@@
import be.nikiroo.utils.Progress;
import be.nikiroo.utils.Version;
import be.nikiroo.utils.ui.UIUtils;
import be.nikiroo.utils.Version;
import be.nikiroo.utils.ui.UIUtils;
-class
Local
Reader extends BasicReader {
+class
Gui
Reader extends BasicReader {
static private boolean nativeLookLoaded;
private LocalLibrary localLibrary;
static private boolean nativeLookLoaded;
private LocalLibrary localLibrary;
- public
Local
Reader() throws IOException {
+ public
Gui
Reader() throws IOException {
if (!nativeLookLoaded) {
UIUtils.setLookAndFeel();
nativeLookLoaded = true;
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
/**
* Check if the {@link Story} denoted by this Library UID is present in the
- * {@link
Local
Reader} cache.
+ * {@link
Gui
Reader} cache.
*
* @param luid
* the Library UID
*
* @param luid
* the Library UID
@@
-189,7
+189,7
@@
class LocalReader extends BasicReader {
}
}
}
}
- new
LocalReaderFrame(Local
Reader.this, typeFinal)
+ new
GuiReaderFrame(Gui
Reader.this, typeFinal)
.setVisible(true);
}
});
.setVisible(true);
}
});
diff --git
a/src/be/nikiroo/fanfix/reader/LocalReaderBook.java
b/src/be/nikiroo/fanfix/reader/GuiReaderBook.java
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)
--- a/
src/be/nikiroo/fanfix/reader/LocalReaderBook.java
+++ b/
src/be/nikiroo/fanfix/reader/GuiReaderBook.java
@@
-31,11
+31,11
@@
import be.nikiroo.utils.IOUtils;
import be.nikiroo.utils.ui.UIUtils;
/**
import be.nikiroo.utils.ui.UIUtils;
/**
- * A book item presented in a {@link
Local
ReaderFrame}.
+ * A book item presented in a {@link
Gui
ReaderFrame}.
*
* @author niki
*/
*
* @author niki
*/
-class
Local
ReaderBook extends JPanel {
+class
Gui
ReaderBook extends JPanel {
/**
* Action on a book item.
*
/**
* Action on a book item.
*
@@
-46,27
+46,27
@@
class LocalReaderBook extends JPanel {
* The book was selected (single click).
*
* @param book
* The book was selected (single click).
*
* @param book
- * the {@link
Local
ReaderBook} itself
+ * the {@link
Gui
ReaderBook} itself
*/
*/
- public void select(
Local
ReaderBook book);
+ public void select(
Gui
ReaderBook book);
/**
* The book was double-clicked.
*
* @param book
/**
* The book was double-clicked.
*
* @param book
- * the {@link
Local
ReaderBook} itself
+ * the {@link
Gui
ReaderBook} itself
*/
*/
- public void action(
Local
ReaderBook book);
+ public void action(
Gui
ReaderBook book);
/**
/**
- * A popup menu was requested for this {@link
Local
ReaderBook}.
+ * A popup menu was requested for this {@link
Gui
ReaderBook}.
*
* @param book
*
* @param book
- * the {@link
Local
ReaderBook} itself
+ * the {@link
Gui
ReaderBook} itself
* @param e
* the {@link MouseEvent} that generated this call
*/
* @param e
* the {@link MouseEvent} that generated this call
*/
- public void popupRequested(
Local
ReaderBook book, MouseEvent e);
+ public void popupRequested(
Gui
ReaderBook book, MouseEvent e);
}
private static final long serialVersionUID = 1L;
}
private static final long serialVersionUID = 1L;
@@
-97,16
+97,16
@@
class LocalReaderBook extends JPanel {
private boolean cached;
/**
private boolean cached;
/**
- * Create a new {@link
Local
ReaderBook} item for the given {@link Story}.
+ * Create a new {@link
Gui
ReaderBook} item for the given {@link Story}.
*
* @param meta
*
* @param meta
- * the story {@
code}
link MetaData}
+ * the story {@link MetaData}
* @param cached
* TRUE if it is locally cached
* @param cached
* TRUE if it is locally cached
- * @param seeWord
c
ount
+ * @param seeWord
C
ount
* TRUE to see word counts, FALSE to see authors
*/
* TRUE to see word counts, FALSE to see authors
*/
- public
Local
ReaderBook(MetaData meta, boolean cached, boolean seeWordCount) {
+ public
Gui
ReaderBook(MetaData meta, boolean cached, boolean seeWordCount) {
this.cached = cached;
this.meta = meta;
this.cached = cached;
this.meta = meta;
@@
-182,7
+182,7
@@
class LocalReaderBook extends JPanel {
* events.
*/
private void setupListeners() {
* events.
*/
private void setupListeners() {
- listeners = new ArrayList<
Local
ReaderBook.BookActionListener>();
+ listeners = new ArrayList<
Gui
ReaderBook.BookActionListener>();
addMouseListener(new MouseListener() {
public void mouseReleased(MouseEvent e) {
if (e.isPopupTrigger()) {
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) {
private void click(boolean doubleClick) {
for (BookActionListener listener : listeners) {
if (doubleClick) {
- listener.action(
Local
ReaderBook.this);
+ listener.action(
Gui
ReaderBook.this);
} else {
} else {
- listener.select(
Local
ReaderBook.this);
+ listener.select(
Gui
ReaderBook.this);
}
}
}
private void popup(MouseEvent e) {
for (BookActionListener listener : listeners) {
}
}
}
private void popup(MouseEvent e) {
for (BookActionListener listener : listeners) {
- listener.select((
Local
ReaderBook.this));
- listener.popupRequested(
Local
ReaderBook.this, e);
+ listener.select((
Gui
ReaderBook.this));
+ listener.popupRequested(
Gui
ReaderBook.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
*/
*
* @return the meta
*/
@@
-257,19
+257,19
@@
class LocalReaderBook extends JPanel {
}
/**
}
/**
- * This item {@link
Local
Reader} library cache state.
+ * This item {@link
Gui
Reader} library cache state.
*
*
- * @return TRUE if it is present in the {@link
Local
Reader} cache
+ * @return TRUE if it is present in the {@link
Gui
Reader} cache
*/
public boolean isCached() {
return cached;
}
/**
*/
public boolean isCached() {
return cached;
}
/**
- * This item {@link
Local
Reader} library cache state.
+ * This item {@link
Gui
Reader} library cache state.
*
* @param cached
*
* @param cached
- * TRUE if it is present in the {@link
Local
Reader} cache
+ * TRUE if it is present in the {@link
Gui
Reader} cache
*/
public void setCached(boolean cached) {
if (this.cached != cached) {
*/
public void setCached(boolean cached) {
if (this.cached != cached) {
@@
-279,7
+279,7
@@
class LocalReaderBook extends JPanel {
}
/**
}
/**
- * Paint the item, then call {@link
Local
ReaderBook#paintOverlay(Graphics)}.
+ * Paint the item, then call {@link
Gui
ReaderBook#paintOverlay(Graphics)}.
*/
@Override
public void paint(Graphics g) {
*/
@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.
* 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();
*/
public void paintOverlay(Graphics g) {
Rectangle clip = g.getClipBounds();
diff --git
a/src/be/nikiroo/fanfix/reader/LocalReaderFrame.java
b/src/be/nikiroo/fanfix/reader/GuiReaderFrame.java
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)
--- a/
src/be/nikiroo/fanfix/reader/LocalReaderFrame.java
+++ b/
src/be/nikiroo/fanfix/reader/GuiReaderFrame.java
@@
-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.data.MetaData;
import be.nikiroo.fanfix.data.Story;
import be.nikiroo.fanfix.output.BasicOutput.OutputType;
-import be.nikiroo.fanfix.reader.
Local
ReaderBook.BookActionListener;
+import be.nikiroo.fanfix.reader.
Gui
ReaderBook.BookActionListener;
import be.nikiroo.utils.Progress;
import be.nikiroo.utils.Version;
import be.nikiroo.utils.ui.ConfigEditor;
import be.nikiroo.utils.ui.ProgressBar;
/**
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
Local
ReaderBook} item for each
+ * A {@link Frame} that will show a {@link
Gui
ReaderBook} item for each
* {@link Story} in the main cache ({@link Instance#getCache()}), and offer a
* {@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
*/
*
* @author niki
*/
-class
Local
ReaderFrame extends JFrame {
+class
Gui
ReaderFrame extends JFrame {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
- private
Local
Reader reader;
- private Map<
Local
ReaderGroup, String> booksByType;
- private Map<
Local
ReaderGroup, String> booksByAuthor;
+ private
Gui
Reader reader;
+ private Map<
Gui
ReaderGroup, String> booksByType;
+ private Map<
Gui
ReaderGroup, String> booksByAuthor;
private JPanel pane;
private Color color;
private ProgressBar pgBar;
private JMenuBar bar;
private JPanel pane;
private Color color;
private ProgressBar pgBar;
private JMenuBar bar;
- private
Local
ReaderBook selectedBook;
+ private
Gui
ReaderBook selectedBook;
private boolean words; // words or authors (secondary info on books)
/**
private boolean words; // words or authors (secondary info on books)
/**
- * Create a new {@link
Local
ReaderFrame}.
+ * Create a new {@link
Gui
ReaderFrame}.
*
* @param reader
*
* @param reader
- * the associated {@link
LocalReader} to forward some commands
- * a
nd a
ccess 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
*/
* @param type
* the type of {@link Story} to load, or NULL for all types
*/
- public
LocalReaderFrame(Local
Reader reader, String type) {
+ public
GuiReaderFrame(Gui
Reader reader, String type) {
super(String.format("Fanfix %s Library", Version.getCurrentVersion()));
this.reader = reader;
super(String.format("Fanfix %s Library", Version.getCurrentVersion()));
this.reader = reader;
@@
-117,8
+117,8
@@
class LocalReaderFrame extends JFrame {
}
});
}
});
- booksByType = new HashMap<
Local
ReaderGroup, String>();
- booksByAuthor = new HashMap<
Local
ReaderGroup, String>();
+ booksByType = new HashMap<
Gui
ReaderGroup, String>();
+ booksByAuthor = new HashMap<
Gui
ReaderGroup, String>();
pane.setVisible(false);
final Progress pg = new Progress();
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
*
* @param value
* the author or the type, or NULL to get all the
@@
-167,7
+167,7
@@
class LocalReaderFrame extends JFrame {
return;
}
return;
}
-
LocalReaderGroup bookPane = new Local
ReaderGroup(reader, value, color);
+
GuiReaderGroup bookPane = new Gui
ReaderGroup(reader, value, color);
if (type) {
booksByType.put(bookPane, value);
} else {
if (type) {
booksByType.put(bookPane, value);
} else {
@@
-181,11
+181,11
@@
class LocalReaderFrame extends JFrame {
this.validate();
bookPane.setActionListener(new BookActionListener() {
this.validate();
bookPane.setActionListener(new BookActionListener() {
- public void select(
Local
ReaderBook book) {
+ public void select(
Gui
ReaderBook book) {
selectedBook = book;
}
selectedBook = book;
}
- public void popupRequested(
Local
ReaderBook book, MouseEvent e) {
+ public void popupRequested(
Gui
ReaderBook book, MouseEvent e) {
JPopupMenu popup = new JPopupMenu();
popup.add(createMenuItemOpenBook());
popup.addSeparator();
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());
}
popup.show(e.getComponent(), e.getX(), e.getY());
}
- public void action(final
Local
ReaderBook book) {
+ public void action(final
Gui
ReaderBook book) {
openBook(book);
}
});
openBook(book);
}
});
@@
-215,17
+215,17
@@
class LocalReaderFrame extends JFrame {
}
/**
}
/**
- * Refresh the list of {@link
Local
ReaderBook}s from disk.
+ * Refresh the list of {@link
Gui
ReaderBook}s from disk.
*
*/
private void refreshBooks() {
*
*/
private void refreshBooks() {
- for (
Local
ReaderGroup group : booksByType.keySet()) {
+ for (
Gui
ReaderGroup group : booksByType.keySet()) {
List<MetaData> stories = Instance.getLibrary().getListBySource(
booksByType.get(group));
group.refreshBooks(stories, words);
}
List<MetaData> stories = Instance.getLibrary().getListBySource(
booksByType.get(group));
group.refreshBooks(stories, words);
}
- for (
Local
ReaderGroup group : booksByAuthor.keySet()) {
+ for (
Gui
ReaderGroup group : booksByAuthor.keySet()) {
List<MetaData> stories = Instance.getLibrary().getListByAuthor(
booksByAuthor.get(group));
group.refreshBooks(stories, words);
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) {
JMenuItem exit = new JMenuItem("Exit", KeyEvent.VK_X);
exit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
-
Local
ReaderFrame.this.dispatchEvent(new WindowEvent(
-
Local
ReaderFrame.this, WindowEvent.WINDOW_CLOSING));
+
Gui
ReaderFrame.this.dispatchEvent(new WindowEvent(
+
Gui
ReaderFrame.this, WindowEvent.WINDOW_CLOSING));
}
});
}
});
@@
-453,7
+453,7
@@
class LocalReaderFrame extends JFrame {
export.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedBook != null) {
export.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedBook != null) {
- fc.showDialog(
Local
ReaderFrame.this, "Save");
+ fc.showDialog(
Gui
ReaderFrame.this, "Save");
if (fc.getSelectedFile() != null) {
final OutputType type = filters.get(fc.getFileFilter());
final String path = fc.getSelectedFile()
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(
String type = ftype;
if (type == null) {
Object rep = JOptionPane.showInputDialog(
-
Local
ReaderFrame.this, "Move to:",
+
Gui
ReaderFrame.this, "Move to:",
"Moving story",
JOptionPane.QUESTION_MESSAGE, null, null,
selectedBook.getMeta().getSource());
"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());
imprt(meta.getUrl(), new Runnable() {
public void run() {
reader.delete(meta.getLuid());
-
Local
ReaderFrame.this.selectedBook = null;
+
Gui
ReaderFrame.this.selectedBook = null;
}
}, "Removing old copy");
}
}
}, "Removing old copy");
}
@@
-659,12
+659,12
@@
class LocalReaderFrame extends JFrame {
}
/**
}
/**
- * Open a {@link
Local
ReaderBook} item.
+ * Open a {@link
Gui
ReaderBook} item.
*
* @param book
*
* @param book
- * the {@link
Local
ReaderBook} to open
+ * the {@link
Gui
ReaderBook} to open
*/
*/
- private void openBook(final
Local
ReaderBook book) {
+ private void openBook(final
Gui
ReaderBook book) {
final Progress pg = new Progress();
outOfUi(pg, new Runnable() {
public void run() {
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.
*
* The code will make sure that the {@link ProgressBar} (if not NULL) is set
* to done when the action is done.
*
- * @param p
g
+ * @param p
rogress
* the {@link ProgressBar} or NULL
* @param run
* the action to run
* the {@link ProgressBar} or NULL
* @param run
* the action to run
@@
-749,7
+749,7
@@
class LocalReaderFrame extends JFrame {
clipboard = "";
}
clipboard = "";
}
- url = JOptionPane.showInputDialog(
Local
ReaderFrame.this,
+ url = JOptionPane.showInputDialog(
Gui
ReaderFrame.this,
"url of the story to import?", "Importing from URL",
JOptionPane.QUESTION_MESSAGE, null, null, clipboard);
} else if (fc.showOpenDialog(this) != JFileChooser.CANCEL_OPTION) {
"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() {
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);
}
});
JOptionPane.ERROR_MESSAGE);
}
});
@@
-833,10
+832,10
@@
class LocalReaderFrame extends JFrame {
bar.setEnabled(b);
}
bar.setEnabled(b);
}
- for (
Local
ReaderGroup group : booksByType.keySet()) {
+ for (
Gui
ReaderGroup group : booksByType.keySet()) {
group.setEnabled(b);
}
group.setEnabled(b);
}
- for (
Local
ReaderGroup group : booksByAuthor.keySet()) {
+ for (
Gui
ReaderGroup group : booksByAuthor.keySet()) {
group.setEnabled(b);
}
super.setEnabled(b);
group.setEnabled(b);
}
super.setEnabled(b);
diff --git
a/src/be/nikiroo/fanfix/reader/LocalReaderGroup.java
b/src/be/nikiroo/fanfix/reader/GuiReaderGroup.java
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)
--- a/
src/be/nikiroo/fanfix/reader/LocalReaderGroup.java
+++ b/
src/be/nikiroo/fanfix/reader/GuiReaderGroup.java
@@
-11,36
+11,36
@@
import javax.swing.JLabel;
import javax.swing.JPanel;
import be.nikiroo.fanfix.data.MetaData;
import javax.swing.JPanel;
import be.nikiroo.fanfix.data.MetaData;
-import be.nikiroo.fanfix.reader.
Local
ReaderBook.BookActionListener;
+import be.nikiroo.fanfix.reader.
Gui
ReaderBook.BookActionListener;
import be.nikiroo.utils.ui.WrapLayout;
/**
import be.nikiroo.utils.ui.WrapLayout;
/**
- * A group of {@link
Local
ReaderBook}s for display.
+ * A group of {@link
Gui
ReaderBook}s for display.
*
* @author niki
*/
*
* @author niki
*/
-public class
Local
ReaderGroup extends JPanel {
+public class
Gui
ReaderGroup extends JPanel {
private static final long serialVersionUID = 1L;
private BookActionListener action;
private Color backgroundColor;
private static final long serialVersionUID = 1L;
private BookActionListener action;
private Color backgroundColor;
- private
Local
Reader reader;
+ private
Gui
Reader reader;
private List<MetaData> stories;
private List<MetaData> stories;
- private List<
Local
ReaderBook> books;
+ private List<
Gui
ReaderBook> books;
private JPanel pane;
private boolean words; // words or authors (secondary info on books)
/**
private JPanel pane;
private boolean words; // words or authors (secondary info on books)
/**
- * Create a new {@link
Local
ReaderGroup}.
+ * Create a new {@link
Gui
ReaderGroup}.
*
* @param reader
*
* @param reader
- * the {@link
Local
ReaderBook} used to probe some information
+ * the {@link
Gui
ReaderBook} 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)
*/
* about the stories
* @param title
* the title of this group
* @param backgroundColor
* the background colour to use (or NULL for default)
*/
- public
LocalReaderGroup(Local
Reader reader, String title,
+ public
GuiReaderGroup(Gui
Reader reader, String title,
Color backgroundColor) {
this.reader = reader;
this.backgroundColor = backgroundColor;
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
/**
* Set the {@link ActionListener} that will be fired on each
- * {@link
Local
ReaderBook} action.
+ * {@link
Gui
ReaderBook} action.
*
* @param action
* the action
*
* @param action
* the action
@@
-83,7
+83,7
@@
public class LocalReaderGroup extends JPanel {
}
/**
}
/**
- * Refresh the list of {@link
Local
ReaderBook}s displayed in the control.
+ * Refresh the list of {@link
Gui
ReaderBook}s displayed in the control.
*
* @param stories
* the stories
*
* @param stories
* the stories
@@
-94,14
+94,14
@@
public class LocalReaderGroup extends JPanel {
this.stories = stories;
this.words = seeWordcount;
this.stories = stories;
this.words = seeWordcount;
- books = new ArrayList<
Local
ReaderBook>();
+ books = new ArrayList<
Gui
ReaderBook>();
invalidate();
pane.invalidate();
pane.removeAll();
if (stories != null) {
for (MetaData meta : stories) {
invalidate();
pane.invalidate();
pane.removeAll();
if (stories != null) {
for (MetaData meta : stories) {
-
LocalReaderBook book = new Local
ReaderBook(meta,
+
GuiReaderBook book = new Gui
ReaderBook(meta,
reader.isCached(meta.getLuid()), seeWordcount);
if (backgroundColor != null) {
book.setBackground(backgroundColor);
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() {
books.add(book);
book.addActionListener(new BookActionListener() {
- public void select(
Local
ReaderBook book) {
- for (
Local
ReaderBook abook : books) {
+ public void select(
Gui
ReaderBook book) {
+ for (
Gui
ReaderBook abook : books) {
abook.setSelected(abook == book);
}
}
abook.setSelected(abook == book);
}
}
- public void popupRequested(
Local
ReaderBook book,
+ public void popupRequested(
Gui
ReaderBook book,
MouseEvent e) {
}
MouseEvent e) {
}
- public void action(
Local
ReaderBook book) {
+ public void action(
Gui
ReaderBook book) {
}
});
}
});
@@
-152,7
+152,7
@@
public class LocalReaderGroup extends JPanel {
@Override
public void setEnabled(boolean b) {
if (books != null) {
@Override
public void setEnabled(boolean b) {
if (books != null) {
- for (
Local
ReaderBook book : books) {
+ for (
Gui
ReaderBook book : books) {
book.setEnabled(b);
book.repaint();
}
book.setEnabled(b);
book.repaint();
}
diff --git
a/src/be/nikiroo/fanfix/reader/TuiReader.java
b/src/be/nikiroo/fanfix/reader/TuiReader.java
index 12f048240a05f0d19d116eec3c7df4c82c61a57a..98130a989b8b0fa505f307dddd7f958bb9bdeb7f 100644
(file)
--- a/
src/be/nikiroo/fanfix/reader/TuiReader.java
+++ b/
src/be/nikiroo/fanfix/reader/TuiReader.java
@@
-1,11
+1,8
@@
package be.nikiroo.fanfix.reader;
import java.io.IOException;
package be.nikiroo.fanfix.reader;
import java.io.IOException;
-import java.util.List;
import be.nikiroo.fanfix.Instance;
import be.nikiroo.fanfix.Instance;
-import be.nikiroo.fanfix.LocalLibrary;
-import be.nikiroo.fanfix.data.MetaData;
class TuiReader extends BasicReader {
@Override
class TuiReader extends BasicReader {
@Override
@@
-25,9
+22,9
@@
class TuiReader extends BasicReader {
@Override
public void browse(String source) {
@Override
public void browse(String source) {
- List<MetaData> stories = getLibrary().getListBySource(source);
try {
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);
new Thread(app).start();
} catch (Exception e) {
Instance.syserr(e);
diff --git
a/src/be/nikiroo/fanfix/reader/TuiReaderApplication.java
b/src/be/nikiroo/fanfix/reader/TuiReaderApplication.java
index 9a534983f3f25068ea7fd9f2b6b31909775abb39..719f0954160fc3d90b0e1996dc7f5db744f36121 100644
(file)
--- a/
src/be/nikiroo/fanfix/reader/TuiReaderApplication.java
+++ b/
src/be/nikiroo/fanfix/reader/TuiReaderApplication.java
@@
-7,7
+7,7
@@
import jexer.TApplication;
import jexer.TMessageBox;
import be.nikiroo.fanfix.data.MetaData;
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() {
private BasicReader reader;
private static BackendType guessBackendType() {
diff --git
a/src/be/nikiroo/fanfix/reader/TuiReaderMainWindow.java
b/src/be/nikiroo/fanfix/reader/TuiReaderMainWindow.java
index 55072664e9ae9376a0f7e4f119cbfb81f7d7f8bc..8f00b493e99238c461746abd46e80fc7b94fbdab 100644
(file)
--- a/
src/be/nikiroo/fanfix/reader/TuiReaderMainWindow.java
+++ b/
src/be/nikiroo/fanfix/reader/TuiReaderMainWindow.java
@@
-3,10
+3,17
@@
package be.nikiroo.fanfix.reader;
import java.util.ArrayList;
import java.util.List;
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;
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;
private TList list;
private List<MetaData> listKeys;
private List<String> listItems;
@@
-15,10
+22,10
@@
public class TuiReaderMainWindow extends TWindow {
/**
* Constructor.
*
/**
* Constructor.
*
- * @param
parent
- * the main application
- * @param
flag
s
- *
bitmask of MODAL, CENTERED, or RESIZABLE
+ * @param
reader
+ * the
reader and
main application
+ * @param
storie
s
+ *
the stories to display
*/
public TuiReaderMainWindow(TuiReaderApplication reader,
List<MetaData> stories) {
*/
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");
// TODO: add the current "type" or filter
statusBar = newStatusBar("Library");
statusBar.addShortcutKeypress(TKeypress.kbF10, TCommand.cmExit, "Exit");
diff --git
a/src/be/nikiroo/fanfix/reader/TuiReaderStoryWindow.java
b/src/be/nikiroo/fanfix/reader/TuiReaderStoryWindow.java
index f556a4b7a77edefd8e808a692dc1111f4fe59a79..2b1cace8ba817462473e3bb067ce77010e044d78 100644
(file)
--- a/
src/be/nikiroo/fanfix/reader/TuiReaderStoryWindow.java
+++ b/
src/be/nikiroo/fanfix/reader/TuiReaderStoryWindow.java
@@
-13,14
+13,12
@@
import jexer.TText;
import jexer.TWindow;
import jexer.event.TResizeEvent;
import be.nikiroo.fanfix.BasicLibrary;
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;
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;
private BasicLibrary lib;
private MetaData meta;
private Story story;