X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix_swing%2Fgui%2Fbook%2FBookBlock.java;h=329c714e200c8f3b04aac2b2736a5e9b76867c0c;hb=30c4d6ed834b52aa4ce4b252295c41b63375ecba;hp=8c83144f54dc6451e55de3fb1dca4bec99198c80;hpb=3cdf3fd8a60d22a592e1cd0634cb108faa1f5f9f;p=nikiroo-utils.git diff --git a/src/be/nikiroo/fanfix_swing/gui/book/BookBlock.java b/src/be/nikiroo/fanfix_swing/gui/book/BookBlock.java index 8c83144..329c714 100644 --- a/src/be/nikiroo/fanfix_swing/gui/book/BookBlock.java +++ b/src/be/nikiroo/fanfix_swing/gui/book/BookBlock.java @@ -21,7 +21,8 @@ import be.nikiroo.fanfix_swing.gui.BooksPanel; */ public class BookBlock extends BookLine { static private final long serialVersionUID = 1L; - static private Image empty = BookCoverImager.generateCoverImage(null, (BookInfo) null); + static private Image empty = BookCoverImager.generateCoverImage(null, + (BookInfo) null); private JLabel title; private Image coverImage; @@ -29,8 +30,10 @@ public class BookBlock extends BookLine { /** * Create a new {@link BookBlock} 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 BookBlock(BookInfo info, boolean seeWordCount) { super(info, seeWordCount); @@ -43,7 +46,8 @@ public class BookBlock extends BookLine { updateMeta(); JPanel filler = new JPanel(); - filler.setPreferredSize(new Dimension(BookCoverImager.getCoverWidth(), BookCoverImager.getCoverHeight())); + filler.setPreferredSize(new Dimension(BookCoverImager.getCoverWidth(), + BookCoverImager.getCoverHeight())); filler.setOpaque(false); setLayout(new BorderLayout(10, 10)); @@ -55,7 +59,8 @@ public class BookBlock extends BookLine { * the cover image to use a base (see * {@link BookCoverImager#generateCoverImage(BasicLibrary, BookInfo)}) * - * @param coverImage the image + * @param coverImage + * the image */ public void setCoverImage(Image coverImage) { this.coverImage = coverImage; @@ -64,32 +69,41 @@ public class BookBlock extends BookLine { @Override public void paint(Graphics g) { super.paint(g); - g.drawImage(coverImage, BookCoverImager.TEXT_WIDTH - BookCoverImager.COVER_WIDTH, 0, null); - BookCoverImager.paintOverlay(g, isEnabled(), isSelected(), isHovered(), getInfo().isCached()); + g.drawImage(coverImage, + BookCoverImager.TEXT_WIDTH - BookCoverImager.COVER_WIDTH, 0, + null); + BookCoverImager.paintOverlay(g, isEnabled(), isSelected(), isHovered(), + getInfo().isCached()); } @Override protected void updateMeta() { - String main = getInfo().getMainInfo(); - String optSecondary = getInfo().getSecondaryInfo(isSeeWordCount()); - String color = String.format("#%X%X%X", AUTHOR_COLOR.getRed(), AUTHOR_COLOR.getGreen(), AUTHOR_COLOR.getBlue()); - title.setText(String.format( - "" + "" + "%s" + "
" - + "" + "%s" + "" + "" + "", - BookCoverImager.TEXT_WIDTH, BookCoverImager.TEXT_HEIGHT, main, color, optSecondary)); + String main = getMainInfoDisplay(); + String optSecondary = getSecondaryInfoDisplay(isSeeWordCount()); + String color = String.format("#%X%X%X", AUTHOR_COLOR.getRed(), + AUTHOR_COLOR.getGreen(), AUTHOR_COLOR.getBlue()); + title.setText(String.format("" + + "" + + "%s" + "
" + "" + "%s" + "" + + "" + "", BookCoverImager.TEXT_WIDTH, + BookCoverImager.TEXT_HEIGHT, main, color, optSecondary)); - setBackground(BookCoverImager.getBackground(isEnabled(), isSelected(), isHovered())); + setBackground(BookCoverImager.getBackground(isEnabled(), isSelected(), + isHovered())); } /** * Generate a cover icon based upon the given {@link BookInfo}. * - * @param lib the library the meta comes from - * @param info the {@link BookInfo} + * @param lib + * the library the meta comes from + * @param info + * the {@link BookInfo} * * @return the image */ - static public java.awt.Image generateCoverImage(BasicLibrary lib, BookInfo info) { + static public java.awt.Image generateCoverImage(BasicLibrary lib, + BookInfo info) { return BookCoverImager.generateCoverImage(lib, info); } }