import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
-import java.util.List;
-import java.util.Map.Entry;
+import java.util.Map;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JTextArea;
import be.nikiroo.fanfix.data.MetaData;
+import be.nikiroo.fanfix.data.Story;
import be.nikiroo.fanfix.reader.BasicReader;
import be.nikiroo.fanfix.reader.Reader;
+/**
+ * A frame displaying properties and other information of a {@link Story}.
+ *
+ * @author niki
+ */
public class GuiReaderPropertiesFrame extends JFrame {
private static final long serialVersionUID = 1L;
- public GuiReaderPropertiesFrame(Reader reader, MetaData meta) {
+ /**
+ * Create a new {@link GuiReaderPropertiesFrame}.
+ *
+ * @param reader
+ * the linked reader
+ * @param meta
+ * the meta to describe
+ */
+ public GuiReaderPropertiesFrame(Reader reader, GuiReaderBookInfo info) {
+ MetaData meta = info.getMeta();
+
// Borders
int top = 20;
int space = 10;
// Image
ImageIcon img = GuiReaderCoverImager.generateCoverIcon(
- reader.getLibrary(), meta);
+ reader.getLibrary(), info);
// frame
setTitle(meta.getLuid() + ": " + meta.getTitle());
mainPanel.add(mainPanelKeys, BorderLayout.WEST);
mainPanel.add(mainPanelValues, BorderLayout.CENTER);
- List<Entry<String, String>> infos = BasicReader.getMetaDesc(meta);
+ Map<String, String> desc = BasicReader.getMetaDesc(meta);
Color trans = new Color(0, 0, 0, 1);
- for (Entry<String, String> info : infos) {
- JTextArea key = new JTextArea(info.getKey());
- key.setFont(new Font(key.getFont().getFontName(), Font.BOLD, key
+ for (String key : desc.keySet()) {
+ JTextArea jKey = new JTextArea(key);
+ jKey.setFont(new Font(jKey.getFont().getFontName(), Font.BOLD, jKey
.getFont().getSize()));
- key.setEditable(false);
- key.setLineWrap(false);
- key.setBackground(trans);
- mainPanelKeys.add(key);
-
- JTextArea value = new JTextArea(info.getValue());
- value.setEditable(false);
- value.setLineWrap(false);
- value.setBackground(trans);
- mainPanelValues.add(value);
+ jKey.setEditable(false);
+ jKey.setLineWrap(false);
+ jKey.setBackground(trans);
+ mainPanelKeys.add(jKey);
+
+ JTextArea jValue = new JTextArea(desc.get(key));
+ jValue.setEditable(false);
+ jValue.setLineWrap(false);
+ jValue.setBackground(trans);
+ mainPanelValues.add(jValue);
}
// Image