X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Freader%2Fui%2FGuiReaderGroup.java;h=cc3f1e15f59794e4c3117b3f9efe3e9d1be90ecd;hb=405ba34f06efbe7936306fe758def4bc8391c698;hp=7b15425682b96e363df67c66d7a87ac7be35da9d;hpb=ed8cda22e3c10ae5a9de890547d39bb143f44983;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/reader/ui/GuiReaderGroup.java b/src/be/nikiroo/fanfix/reader/ui/GuiReaderGroup.java index 7b15425..cc3f1e1 100644 --- a/src/be/nikiroo/fanfix/reader/ui/GuiReaderGroup.java +++ b/src/be/nikiroo/fanfix/reader/ui/GuiReaderGroup.java @@ -116,31 +116,33 @@ public class GuiReaderGroup extends JPanel { } /** - * Note: this class supports NULL as a background color, which will revert + * Note: this class supports NULL as a background colour, which will revert * it to its default state. *
* Note: this class' implementation will also set the main pane background - * color at the same time. + * colour at the same time. *
- * Sets the background color of this component. The background color is used
- * only if the component is opaque, and only by subclasses of
+ * Sets the background colour of this component. The background colour is
+ * used only if the component is opaque, and only by subclasses of
* JComponent
or ComponentUI
implementations.
* Direct subclasses of JComponent
must override
- * paintComponent
to honor this property.
+ * paintComponent
to honour this property.
*
- * It is up to the look and feel to honor this property, some may choose to
+ * It is up to the look and feel to honour this property, some may choose to
* ignore it.
*
- * @param bg
- * the desired background Color
+ * @param backgroundColor
+ * the desired background Colour
* @see java.awt.Component#getBackground
* @see #setOpaque
*
* @beaninfo preferred: true bound: true attribute: visualUpdate true
- * description: The background color of the component.
+ * description: The background colour of the component.
*/
@Override
public void setBackground(Color backgroundColor) {
+ this.backgroundColor = backgroundColor;
+
Color cme = backgroundColor == null ? backgroundColorDef
: backgroundColor;
Color cpane = backgroundColor == null ? backgroundColorDefPane
@@ -179,8 +181,13 @@ public class GuiReaderGroup extends JPanel {
* up/down one line at a time.
*/
private void computeItemsPerLine() {
- // TODO
- itemsPerLine = 5;
+ itemsPerLine = 1;
+
+ if (books != null && books.size() > 0) {
+ // this.pane holds all the books with a hgap of 5 px
+ int wbook = books.get(0).getWidth() + 5;
+ itemsPerLine = pane.getWidth() / wbook;
+ }
}
/**
@@ -192,6 +199,30 @@ public class GuiReaderGroup extends JPanel {
*/
public void setActionListener(BookActionListener action) {
this.action = action;
+ refreshBooks();
+ }
+
+ /**
+ * Clear all the books in this {@link GuiReaderGroup}.
+ */
+ public void clear() {
+ refreshBooks(new ArrayList