private Date lastClick;
private List<BookActionListener> listeners;
- private String luid;
+ private MetaData meta;
private boolean cached;
/**
* 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 = "";
+ }
+ }
- String optAuthor = meta.getAuthor();
- if (optAuthor != null && !optAuthor.isEmpty()) {
- optAuthor = "(" + optAuthor + ")";
+ if (optSecondary != null && !optSecondary.isEmpty()) {
+ optSecondary = "(" + optSecondary + ")";
}
icon = new JLabel(generateCoverIcon(meta.getCover()));
+ "%s" + "<br>" + "<span style='color: %s;'>"
+ "%s" + "</span>" + "</body>" + "</html>",
TEXT_WIDTH, TEXT_HEIGHT, meta.getTitle(), AUTHOR_COLOR,
- optAuthor));
+ optSecondary));
setLayout(new BorderLayout(10, 10));
add(icon, BorderLayout.CENTER);
}
/**
- * 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;
}
/**