import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.util.AbstractMap.SimpleEntry;
-import java.util.ArrayList;
import java.util.Date;
-import java.util.List;
-import java.util.Map.Entry;
+import java.util.Map;
+import java.util.TreeMap;
import be.nikiroo.fanfix.Instance;
import be.nikiroo.fanfix.bundles.Config;
*
* @return the information
*/
- public static List<Entry<String, String>> getMetaDesc(MetaData meta) {
- List<Entry<String, String>> metaDesc = new ArrayList<Entry<String, String>>();
+ public static Map<String, String> getMetaDesc(MetaData meta) {
+ Map<String, String> metaDesc = new TreeMap<String, String>();
// TODO: i18n
tags.append(tag);
}
- metaDesc.add(new SimpleEntry<String, String>("Author", meta.getAuthor()));
- metaDesc.add(new SimpleEntry<String, String>("Publication date",
- formatDate(meta.getDate())));
- metaDesc.add(new SimpleEntry<String, String>("Published on", meta
- .getPublisher()));
- metaDesc.add(new SimpleEntry<String, String>("URL", meta.getUrl()));
- metaDesc.add(new SimpleEntry<String, String>("Word count", format(meta
- .getWords())));
- metaDesc.add(new SimpleEntry<String, String>("Source", meta.getSource()));
- metaDesc.add(new SimpleEntry<String, String>("Subject", meta
- .getSubject()));
- metaDesc.add(new SimpleEntry<String, String>("Language", meta.getLang()));
- metaDesc.add(new SimpleEntry<String, String>("Tags", tags.toString()));
+ metaDesc.put("Author", meta.getAuthor());
+ metaDesc.put("Publication date", formatDate(meta.getDate()));
+ metaDesc.put("Published on", meta.getPublisher());
+ metaDesc.put("URL", meta.getUrl());
+ metaDesc.put("Word count", format(meta.getWords()));
+ metaDesc.put("Source", meta.getSource());
+ metaDesc.put("Subject", meta.getSubject());
+ metaDesc.put("Language", meta.getLang());
+ metaDesc.put("Tags", tags.toString());
return metaDesc;
}
setCurrentTitle(meta.getTitle());
- List<Map.Entry<String, String>> metaDesc = BasicReader
- .getMetaDesc(meta);
+ Map<String, String> metaDesc = BasicReader.getMetaDesc(meta);
String[][] metaDescObj = new String[metaDesc.size()][2];
int i = 0;
- for (Map.Entry<String, String> entry : metaDesc) {
- metaDescObj[i][0] = " " + entry.getKey();
- metaDescObj[i][1] = entry.getValue();
+ for (String key : metaDesc.keySet()) {
+ metaDescObj[i][0] = " " + key;
+ metaDescObj[i][1] = metaDesc.get(key);
i++;
}
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;
mainPanel.add(mainPanelKeys, BorderLayout.WEST);
mainPanel.add(mainPanelValues, BorderLayout.CENTER);
- List<Entry<String, String>> desc = BasicReader.getMetaDesc(meta);
+ Map<String, String> desc = BasicReader.getMetaDesc(meta);
Color trans = new Color(0, 0, 0, 1);
- for (Entry<String, String> descLine : desc) {
- JTextArea key = new JTextArea(descLine.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(descLine.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