X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Freader%2FLocalReaderBook.java;h=8c470785dbf72f99d742125a5195492ace180dc7;hb=793f1071fae48daed3b545a03a286c85e527d244;hp=d19b6034d67eeb60b435e002f853d5b973122ebc;hpb=edd4628984f5f06e955606651fc828ac839f7f43;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/reader/LocalReaderBook.java b/src/be/nikiroo/fanfix/reader/LocalReaderBook.java index d19b603..8c47078 100644 --- a/src/be/nikiroo/fanfix/reader/LocalReaderBook.java +++ b/src/be/nikiroo/fanfix/reader/LocalReaderBook.java @@ -85,7 +85,7 @@ class LocalReaderBook extends JPanel { private Date lastClick; private List listeners; - private String luid; + private MetaData meta; private boolean cached; /** @@ -95,14 +95,26 @@ class LocalReaderBook extends JPanel { * the story {@code}link MetaData} * @param cached * TRUE if it is locally cached + * @param seeWordcount + * TRUE to see word counts, FALSE to see authors */ - public LocalReaderBook(MetaData meta, boolean cached) { + public LocalReaderBook(MetaData meta, boolean cached, boolean seeWordCount) { this.cached = cached; - luid = meta.getLuid(); + this.meta = meta; + + String optSecondary = meta.getAuthor(); + if (seeWordCount) { + if (meta.getWords() >= 4000) { + optSecondary = (meta.getWords() / 1000) + "k words"; + } else if (meta.getWords() > 0) { + optSecondary = meta.getWords() + " words"; + } else { + optSecondary = "empty"; + } + } - String optAuthor = meta.getAuthor(); - if (optAuthor != null && !optAuthor.isEmpty()) { - optAuthor = "(" + optAuthor + ")"; + if (optSecondary != null && !optSecondary.isEmpty()) { + optSecondary = "(" + optSecondary + ")"; } icon = new JLabel(generateCoverIcon(meta.getCover())); @@ -114,7 +126,7 @@ class LocalReaderBook extends JPanel { + "%s" + "
" + "" + "%s" + "" + "" + "", TEXT_WIDTH, TEXT_HEIGHT, meta.getTitle(), AUTHOR_COLOR, - optAuthor)); + optSecondary)); setLayout(new BorderLayout(10, 10)); add(icon, BorderLayout.CENTER); @@ -229,12 +241,12 @@ class LocalReaderBook extends JPanel { } /** - * The Library UID of the book represented by this item. + * The Library {@code}link MetaData} of the book represented by this item. * - * @return the LUID + * @return the meta */ - public String getLuid() { - return luid; + public MetaData getMeta() { + return meta; } /**