GUI search, step 3
[fanfix.git] / src / be / nikiroo / fanfix / searchable / SearchableTag.java
index eebbe09849520b9b681639132e24d7a946425797..f73dd15d7ce627fc3d3f7a72eb16959db52c96a6 100644 (file)
@@ -43,7 +43,7 @@ public class SearchableTag {
         *            the tag is a leaf tag, that is, it will not return subtags
         *            with {@link BasicSearchable#fillTag(SearchableTag)} but will
         *            return stories with
-        *            {@link BasicSearchable#search(SearchableTag)}
+        *            {@link BasicSearchable#search(SearchableTag, int)}
         */
        public SearchableTag(String id, String name, boolean leaf) {
                this(id, name, leaf, true);
@@ -60,7 +60,7 @@ public class SearchableTag {
         *            the tag is a leaf tag, that is, it will not return subtags
         *            with {@link BasicSearchable#fillTag(SearchableTag)} but will
         *            return stories with
-        *            {@link BasicSearchable#search(SearchableTag)}
+        *            {@link BasicSearchable#search(SearchableTag, int)}
         * @param complete
         *            the tag {@link SearchableTag#isComplete()} or not
         */
@@ -92,6 +92,21 @@ public class SearchableTag {
                return name;
        }
 
+       /**
+        * The fully qualified tag name, which can be displayed to the user.
+        * <p>
+        * It will display all the tags that lead to this one as well as this one.
+        * 
+        * @return the fully qualified name
+        */
+       public String getFqName() {
+               if (parent != null) {
+                       return parent.getFqName() + " / " + name;
+               }
+               
+               return name;
+       }
+
        /**
         * Non-complete, non-leaf tags can still be completed via a
         * {@link BasicSearchable#fillTag(SearchableTag)} operation from a
@@ -135,31 +150,6 @@ public class SearchableTag {
                return count;
        }
 
-       /**
-        * The number of items that can be found with this tag if it is searched,
-        * displayable format.
-        * <p>
-        * Will report the number of subtags by default.
-        * 
-        * @return the number of items
-        */
-       public String getCountDisplay() {
-               long count = this.count;
-               if (count <= 0) {
-                       count = children.size();
-               }
-
-               if (count > 999999) {
-                       return count / 1000000 + "M";
-               }
-
-               if (count > 2000) {
-                       return count / 1000 + "k";
-               }
-
-               return Long.toString(count);
-       }
-
        /**
         * The number of items that can be found with this tag if it is searched.
         * 
@@ -196,7 +186,7 @@ public class SearchableTag {
        /**
         * This tag is a leaf tag, that is, it will not return other subtags with
         * {@link BasicSearchable#fillTag(SearchableTag)} but will return stories
-        * with {@link BasicSearchable#search(SearchableTag)}.
+        * with {@link BasicSearchable#search(SearchableTag, int)}.
         * 
         * @return TRUE if it is
         */
@@ -207,7 +197,7 @@ public class SearchableTag {
        /**
         * This tag is a leaf tag, that is, it will not return other subtags with
         * {@link BasicSearchable#fillTag(SearchableTag)} but will return stories
-        * with {@link BasicSearchable#search(SearchableTag)}.
+        * with {@link BasicSearchable#search(SearchableTag, int)}.
         * <p>
         * Will reset the number of pages to -1.
         * 
@@ -263,7 +253,7 @@ public class SearchableTag {
                }
 
                if (getCount() > 0) {
-                       rep += " (" + getCountDisplay() + ")";
+                       rep += " (" + getCount() + ")";
                }
 
                if (!children.isEmpty()) {