From: Niki Roo Date: Wed, 13 May 2020 12:46:18 +0000 (+0200) Subject: code cleanup X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=fa691534b483b04c87647c0eedb8ab00dd4420bd;p=fanfix-swing.git code cleanup --- diff --git a/src/be/nikiroo/fanfix_swing/Actions.java b/src/be/nikiroo/fanfix_swing/Actions.java index 6350c8a7..1db0c238 100644 --- a/src/be/nikiroo/fanfix_swing/Actions.java +++ b/src/be/nikiroo/fanfix_swing/Actions.java @@ -278,49 +278,4 @@ public class Actions { return source; } - - /** - * Describe a {@link Story} from its {@link MetaData} and return a list of - * title/value that represent this {@link Story}. - * - * @param meta - * the {@link MetaData} to represent - * - * @return the information - */ - static public Map getMetaDesc(MetaData meta) { - Map metaDesc = new LinkedHashMap(); - - // TODO: i18n - - StringBuilder tags = new StringBuilder(); - for (String tag : meta.getTags()) { - if (tags.length() > 0) { - tags.append(", "); - } - tags.append(tag); - } - - // TODO: i18n - metaDesc.put("Author", meta.getAuthor()); - metaDesc.put("Published on", meta.getPublisher()); - metaDesc.put("Publication date", meta.getDate()); - metaDesc.put("Creation date", meta.getCreationDate()); - String count = ""; - if (meta.getWords() > 0) { - count = StringUtils.formatNumber(meta.getWords()); - } - if (meta.isImageDocument()) { - metaDesc.put("Number of images", count); - } else { - metaDesc.put("Number of words", count); - } - metaDesc.put("Source", meta.getSource()); - metaDesc.put("Subject", meta.getSubject()); - metaDesc.put("Language", meta.getLang()); - metaDesc.put("Tags", tags.toString()); - metaDesc.put("URL", meta.getUrl()); - - return metaDesc; - } } diff --git a/src/be/nikiroo/fanfix_swing/gui/PropertiesPanel.java b/src/be/nikiroo/fanfix_swing/gui/PropertiesPanel.java index 82c1e873..b5063579 100644 --- a/src/be/nikiroo/fanfix_swing/gui/PropertiesPanel.java +++ b/src/be/nikiroo/fanfix_swing/gui/PropertiesPanel.java @@ -99,7 +99,7 @@ public class PropertiesPanel extends JPanel { mainPanel.add(UIUtils.scroll(mainPanelValues, true, false), BorderLayout.CENTER); - Map desc = Actions.getMetaDesc(meta); + Map desc = BasicLibrary.getMetaDesc(meta); for (String key : desc.keySet()) { JTextArea jKey = new JTextArea(key); jKey.setFont(new Font(jKey.getFont().getFontName(), Font.BOLD,