X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix_swing%2Fgui%2Fbook%2FBookBlock.java;h=595f42ba7051d65ac80df1d906d20ad2d96bc064;hp=8c83144f54dc6451e55de3fb1dca4bec99198c80;hb=32ed608959c0dec74660388248831976b97e8c56;hpb=e7d4218c344d292a7450a4c18bbcab1e567d8d9a diff --git a/src/be/nikiroo/fanfix_swing/gui/book/BookBlock.java b/src/be/nikiroo/fanfix_swing/gui/book/BookBlock.java index 8c83144..595f42b 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 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); } }