GUI: improve config + changelog
[fanfix.git] / src / be / nikiroo / fanfix / reader / ui / GuiReaderViewerPanel.java
index 4a4252b2a47fb4fbb959df062a3fa404730ad242..11f1d3870fdf1d6d4f81d9e4c7742d07991f06c5 100644 (file)
@@ -16,10 +16,12 @@ import javax.swing.JPanel;
 import javax.swing.JProgressBar;
 import javax.swing.JScrollPane;
 import javax.swing.SwingConstants;
+import javax.swing.plaf.basic.BasicArrowButton;
 
 import be.nikiroo.fanfix.Instance;
 import be.nikiroo.fanfix.bundles.StringIdGui;
 import be.nikiroo.fanfix.data.Chapter;
+import be.nikiroo.fanfix.data.MetaData;
 import be.nikiroo.fanfix.data.Story;
 import be.nikiroo.utils.Image;
 import be.nikiroo.utils.ui.ImageUtilsAwt;
@@ -51,14 +53,27 @@ public class GuiReaderViewerPanel extends JPanel {
         * Create a new viewer.
         * 
         * @param story
-        *            the {@link Story} to work on.
+        *            the {@link Story} to work on
         */
        public GuiReaderViewerPanel(Story story) {
+               this(story.getMeta(), story.getMeta().isImageDocument());
+       }
+
+       /**
+        * Create a new viewer.
+        * 
+        * @param meta
+        *            the {@link MetaData} of the story to show
+        * @param isImageDocument
+        *            TRUE if it is an image document, FALSE if not
+        */
+       public GuiReaderViewerPanel(MetaData meta, boolean isImageDocument) {
                super(new BorderLayout());
 
-               this.imageDocument = story.getMeta().isImageDocument();
+               this.imageDocument = isImageDocument;
 
                this.text = new JEditorPane("text/html", "");
+               text.setEditable(false);
                text.setAlignmentY(TOP_ALIGNMENT);
                htmlOutput = new GuiReaderViewerTextOutput();
 
@@ -69,6 +84,10 @@ public class GuiReaderViewerPanel extends JPanel {
                                JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
                scroll.getVerticalScrollBar().setUnitIncrement(16);
 
+               // TODO:
+               // JButton up = new BasicArrowButton(BasicArrowButton.NORTH);
+               // JButton down = new BasicArrowButton(BasicArrowButton.SOUTH);
+
                if (!imageDocument) {
                        add(scroll, BorderLayout.CENTER);
                } else {
@@ -101,7 +120,7 @@ public class GuiReaderViewerPanel extends JPanel {
                        main.invalidate();
                }
 
-               setChapter(story.getMeta().getResume());
+               setChapter(meta.getResume());
        }
 
        /**