X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;ds=inline;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Freader%2Fui%2FGuiReaderMainPanel.java;h=476e130b01bc6acd7eb4804ddd7d19ddc15db4c4;hb=ca7d4e2fe5a5ae4df2c6b07e6dedf5640d5b8650;hp=cfd1e947013cbff6916b96f54a096e426e957422;hpb=574d709a282747a775b02fbaef01d26076cfec60;p=nikiroo-utils.git diff --git a/src/be/nikiroo/fanfix/reader/ui/GuiReaderMainPanel.java b/src/be/nikiroo/fanfix/reader/ui/GuiReaderMainPanel.java index cfd1e94..476e130 100644 --- a/src/be/nikiroo/fanfix/reader/ui/GuiReaderMainPanel.java +++ b/src/be/nikiroo/fanfix/reader/ui/GuiReaderMainPanel.java @@ -17,6 +17,7 @@ import java.lang.reflect.InvocationTargetException; import java.net.URL; import java.net.UnknownHostException; import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -42,6 +43,7 @@ import be.nikiroo.fanfix.library.BasicLibrary.Status; import be.nikiroo.fanfix.library.LocalLibrary; import be.nikiroo.fanfix.reader.BasicReader; import be.nikiroo.fanfix.reader.ui.GuiReaderBook.BookActionListener; +import be.nikiroo.fanfix.reader.ui.GuiReaderBookInfo.Type; import be.nikiroo.utils.Progress; import be.nikiroo.utils.ui.ProgressBar; @@ -85,10 +87,10 @@ class GuiReaderMainPanel extends JPanel { *
* Will invalidate the layout.
*
- * @param libOk
- * the library can be queried
+ * @param status
+ * the library status, must not be NULL
*/
- public void createMenu(boolean libOk);
+ public void createMenu(Status status);
/**
* Create a popup menu for a {@link GuiReaderBook} that represents a
@@ -108,18 +110,18 @@ class GuiReaderMainPanel extends JPanel {
}
/**
- * A {@link Runnable} with a {@link Story} parameter.
+ * A {@link Runnable} with a {@link MetaData} parameter.
*
* @author niki
*/
- public interface StoryRunnable {
+ public interface MetaDataRunnable {
/**
* Run the action.
*
- * @param story
- * the story
+ * @param meta
+ * the meta of the story
*/
- public void run(Story story);
+ public void run(MetaData meta);
}
/**
@@ -138,6 +140,7 @@ class GuiReaderMainPanel extends JPanel {
pane = new JPanel();
pane.setLayout(new BoxLayout(pane, BoxLayout.PAGE_AXIS));
+ JScrollPane scroll = new JScrollPane(pane);
Integer icolor = Instance.getUiConfig().getColor(
UiConfig.BACKGROUND_COLOR);
@@ -145,9 +148,9 @@ class GuiReaderMainPanel extends JPanel {
color = new Color(icolor);
setBackground(color);
pane.setBackground(color);
+ scroll.setBackground(color);
}
- JScrollPane scroll = new JScrollPane(pane);
scroll.getVerticalScrollBar().setUnitIncrement(16);
add(scroll, BorderLayout.CENTER);
@@ -197,23 +200,28 @@ class GuiReaderMainPanel extends JPanel {
final BasicLibrary lib = helper.getReader().getLibrary();
final Status status = lib.getStatus();
- if (status == Status.READY) {
+ if (status == Status.READ_WRITE) {
lib.refresh(pg);
}
inUi(new Runnable() {
@Override
public void run() {
- if (status == Status.READY) {
- helper.createMenu(true);
+ if (status.isReady()) {
+ helper.createMenu(status);
pane.setVisible(true);
if (typeF == null) {
- addBookPane(true, false);
+ try {
+ addBookPane(true, false);
+ } catch (IOException e) {
+ error(e.getLocalizedMessage(),
+ "IOException", e);
+ }
} else {
addBookPane(typeF, true);
}
} else {
- helper.createMenu(false);
+ helper.createMenu(status);
validate();
String desc = Instance.getTransGui().getStringX(
@@ -255,8 +263,11 @@ class GuiReaderMainPanel extends JPanel {
* @param listMode
* TRUE to get a listing of all the sources or authors, FALSE to
* get one icon per source or author
+ *
+ * @throws IOException
+ * in case of I/O error
*/
- public void addBookPane(boolean type, boolean listMode) {
+ public void addBookPane(boolean type, boolean listMode) throws IOException {
this.currentType = type;
BasicLibrary lib = helper.getReader().getLibrary();
if (type) {
@@ -352,11 +363,17 @@ class GuiReaderMainPanel extends JPanel {
List