Merge branch 'subtree'
[nikiroo-utils.git] / src / be / nikiroo / fanfix / reader / ui / GuiReaderGroup.java
index 17bf43cbb455a66bb357e68ddb53f0d97d426ebb..cc3f1e15f59794e4c3117b3f9efe3e9d1be90ecd 100644 (file)
@@ -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.
         * <p>
         * Note: this class' implementation will also set the main pane background
-        * color at the same time.
+        * colour at the same time.
         * <p>
-        * 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
         * <code>JComponent</code> or <code>ComponentUI</code> implementations.
         * Direct subclasses of <code>JComponent</code> must override
-        * <code>paintComponent</code> to honor this property.
+        * <code>paintComponent</code> to honour this property.
         * <p>
-        * 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 <code>Color</code>
+        * @param backgroundColor
+        *            the desired background <code>Colour</code>
         * @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
@@ -197,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<GuiReaderBookInfo>());
+       }
+
+       /**
+        * Refresh the list of {@link GuiReaderBook}s displayed in the control.
+        */
+       public void refreshBooks() {
+               refreshBooks(infos, words);
+       }
+
+       /**
+        * Refresh the list of {@link GuiReaderBook}s displayed in the control.
+        * 
+        * @param infos
+        *            the new list of infos
+        */
+       public void refreshBooks(List<GuiReaderBookInfo> infos) {
                refreshBooks(infos, words);
        }
 
@@ -335,7 +361,7 @@ public class GuiReaderGroup extends JPanel {
         * @param index
         *            the index of the book to select, can be outside the bounds
         *            (either all the items will be unselected or the first or last
-        *            book will then be selected, see <tt>forceRange>/tt>)
+        *            book will then be selected, see <tt>forceRange></tt>)
         * @param forceRange
         *            TRUE to constraint the index to the first/last element, FALSE
         *            to unselect when outside the range