[unknown] for unknown tag/author
authorNiki Roo <niki@nikiroo.be>
Wed, 8 Apr 2020 15:44:35 +0000 (17:44 +0200)
committerNiki Roo <niki@nikiroo.be>
Wed, 8 Apr 2020 15:44:35 +0000 (17:44 +0200)
src/be/nikiroo/fanfix_swing/gui/browser/AuthorTab.java
src/be/nikiroo/fanfix_swing/gui/browser/TagsTab.java

index 2436e43a6729214e6f7cd289c315c80e9f555d31..f93b1d49ebfcce6d8f3293b6b91ff9230b0638dc 100644 (file)
@@ -6,6 +6,7 @@ import java.util.List;
 import javax.swing.tree.DefaultMutableTreeNode;
 
 import be.nikiroo.fanfix.Instance;
+import be.nikiroo.fanfix.bundles.StringIdGui;
 
 public class AuthorTab extends BasicTab<List<String>> {
        public AuthorTab(int index, String listenerCommand) {
@@ -37,6 +38,10 @@ public class AuthorTab extends BasicTab<List<String>> {
 
        @Override
        protected String keyToDisplay(String key) {
+               if (key.trim().isEmpty()) {
+                       key = Instance.getInstance().getTransGui().getString(StringIdGui.MENU_AUTHORS_UNKNOWN);
+               }
+               
                return key;
        }
 
index 746f268928f07ae15ddb7287c26bf1a5b11b282e..90c82192fc48d0b7b3ae7bfce7d722a6ff9d1d8b 100644 (file)
@@ -6,7 +6,9 @@ import java.util.List;
 import javax.swing.tree.DefaultMutableTreeNode;
 
 import be.nikiroo.fanfix.Instance;
+import be.nikiroo.fanfix.bundles.StringIdGui;
 import be.nikiroo.fanfix.data.MetaData;
+import be.nikiroo.fanfix.library.MetaResultList;
 
 public class TagsTab extends BasicTab<List<String>> {
        public TagsTab(int index, String listenerCommand) {
@@ -21,8 +23,9 @@ public class TagsTab extends BasicTab<List<String>> {
        @Override
        protected void fillData(List<String> data) {
                try {
-                       List<MetaData> metas = Instance.getInstance().getLibrary().getList();
-                       for (MetaData meta : metas) {
+                       MetaResultList metas = Instance.getInstance().getLibrary().getList();
+                       // TODO: getTagList, getAuthorList... ?
+                       for (MetaData meta : metas.getMetas()) {
                                List<String> tags = meta.getTags();
                                if (tags != null) {
                                        for (String tag : tags) {
@@ -45,6 +48,11 @@ public class TagsTab extends BasicTab<List<String>> {
 
        @Override
        protected String keyToDisplay(String key) {
+               if (key.trim().isEmpty()) {
+                       // TODO: new TAG_UNKNOWN needed
+                       key = Instance.getInstance().getTransGui().getString(StringIdGui.MENU_AUTHORS_UNKNOWN);
+               }
+
                return key;
        }