X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Freader%2Fui%2FGuiReaderGroup.java;h=45c7a8fcf7a4321091c5063341b0a5c66a6b920b;hb=c349fd480d7ab36ad423e965434a6f1f418d60a5;hp=c96b02df266e0ef307a023600a6085dd2caa83ad;hpb=16a81ef7656c5c692fb831927e75edde25dd77a0;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/reader/ui/GuiReaderGroup.java b/src/be/nikiroo/fanfix/reader/ui/GuiReaderGroup.java index c96b02d..45c7a8f 100644 --- a/src/be/nikiroo/fanfix/reader/ui/GuiReaderGroup.java +++ b/src/be/nikiroo/fanfix/reader/ui/GuiReaderGroup.java @@ -7,11 +7,9 @@ import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; -import javax.management.RuntimeErrorException; import javax.swing.JLabel; import javax.swing.JPanel; -import be.nikiroo.fanfix.data.MetaData; import be.nikiroo.fanfix.reader.ui.GuiReaderBook.BookActionListener; import be.nikiroo.utils.ui.WrapLayout; @@ -25,7 +23,7 @@ public class GuiReaderGroup extends JPanel { private BookActionListener action; private Color backgroundColor; private GuiReader reader; - private List stories; + private List infos; private List books; private JPanel pane; private boolean words; // words or authors (secondary info on books) @@ -79,19 +77,31 @@ public class GuiReaderGroup extends JPanel { */ public void setActionListener(BookActionListener action) { this.action = action; - refreshBooks(stories, words); + refreshBooks(infos, words); } /** * Refresh the list of {@link GuiReaderBook}s displayed in the control. * - * @param stories - * the stories + * @param infos + * the new list of infos + * @param seeWordcount + * TRUE to see word counts, FALSE to see authors + */ + public void refreshBooks(List infos, boolean seeWordcount) { + this.infos = infos; + refreshBooks(seeWordcount); + } + + /** + * Refresh the list of {@link GuiReaderBook}s displayed in the control. + *

+ * Will not change the current stories. + * * @param seeWordcount * TRUE to see word counts, FALSE to see authors */ - public void refreshBooks(List stories, boolean seeWordcount) { - this.stories = stories; + public void refreshBooks(boolean seeWordcount) { this.words = seeWordcount; books = new ArrayList(); @@ -99,10 +109,15 @@ public class GuiReaderGroup extends JPanel { pane.invalidate(); pane.removeAll(); - if (stories != null) { - for (MetaData meta : stories) { - GuiReaderBook book = new GuiReaderBook(reader, meta, - reader.isCached(meta.getLuid()), seeWordcount); + if (infos != null) { + for (GuiReaderBookInfo info : infos) { + boolean isCached = false; + if (info.getMeta() != null) { + isCached = reader.isCached(info.getMeta().getLuid()); + } + + GuiReaderBook book = new GuiReaderBook(reader, info, isCached, + words); if (backgroundColor != null) { book.setBackground(backgroundColor); }