import javax.swing.JLabel;
import javax.swing.JPanel;
+import javax.swing.SwingConstants;
import be.nikiroo.fanfix.data.Story;
import be.nikiroo.fanfix_swing.gui.BooksPanel;
/**
* Create a new {@link BookLine} item for the given {@link Story}.
*
- * @param info the information about the story to represent
- * @param seeWordCount TRUE to see word counts, FALSE to see authors
+ * @param info
+ * the information about the story to represent
+ * @param seeWordCount
+ * TRUE to see word counts, FALSE to see authors
*/
public BookLine(BookInfo info, boolean seeWordCount) {
this.info = info;
* Initialise this {@link BookLine}.
*/
protected void init() {
- // TODO: image
- iconCached = new JLabel(" ");
- iconNotCached = new JLabel(" * ");
+ iconCached = new JLabel(" ◉ ");
+ iconNotCached = new JLabel(" ○ ");
+
+ iconNotCached.setForeground(BookCoverImager.UNCACHED_ICON_COLOR);
+ iconCached.setForeground(BookCoverImager.UNCACHED_ICON_COLOR);
+ iconCached.setPreferredSize(iconNotCached.getPreferredSize());
title = new JLabel();
secondary = new JLabel();
secondary.setForeground(AUTHOR_COLOR);
+ JLabel id = new JLabel(info.getMeta().getLuid());
+ id.setPreferredSize(new JLabel(" 999 ").getPreferredSize());
+ id.setForeground(Color.gray);
+ id.setHorizontalAlignment(SwingConstants.CENTER);
+
+ JPanel idTitle = new JPanel(new BorderLayout());
+ idTitle.setOpaque(false);
+ idTitle.add(id, BorderLayout.WEST);
+ idTitle.add(title, BorderLayout.CENTER);
+
setLayout(new BorderLayout());
- add(title, BorderLayout.CENTER);
+ add(idTitle, BorderLayout.CENTER);
add(secondary, BorderLayout.EAST);
updateMeta();
/**
* The book current selection state,
*
- * @param selected TRUE if it is selected
+ * @param selected
+ * TRUE if it is selected
*/
public void setSelected(boolean selected) {
if (this.selected != selected) {
/**
* The item mouse-hover state.
*
- * @param hovered TRUE if it is mouse-hovered
+ * @param hovered
+ * TRUE if it is mouse-hovered
*/
public void setHovered(boolean hovered) {
if (this.hovered != hovered) {
/**
* The secondary value content: word count or author.
*
- * @param seeWordCount TRUE to see word counts, FALSE to see authors
+ * @param seeWordCount
+ * TRUE to see word counts, FALSE to see authors
*/
public void setSeeWordCount(boolean seeWordCount) {
if (this.seeWordCount != seeWordCount) {
String main = info.getMainInfo();
String optSecondary = info.getSecondaryInfo(seeWordCount);
- //TODO: max size limit?
+ // TODO: max size limit?
title.setText(main);
secondary.setText(optSecondary + " ");
- setBackground(BookCoverImager.getBackground(isEnabled(), isSelected(), isHovered()));
+ setBackground(BookCoverImager.getBackground(isEnabled(), isSelected(),
+ isHovered()));
remove(iconCached);
remove(iconNotCached);
- add(getInfo().isCached() ? iconCached : iconNotCached, BorderLayout.WEST);
+ add(getInfo().isCached() ? iconCached : iconNotCached,
+ BorderLayout.WEST);
validate();
}
}