X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Fresources%2FMetaInfo.java;h=d95e98c986a0e53266bbd203f95efa90066a7580;hb=0877d6f5485d3531b9fde6c264e5848630c80baf;hp=746fd4d939a71f346c3529b63fd65b13af5f9be9;hpb=424dcb0d7835d3be74134bfa7c4152e492c6f9ce;p=fanfix.git diff --git a/src/be/nikiroo/utils/resources/MetaInfo.java b/src/be/nikiroo/utils/resources/MetaInfo.java index 746fd4d..d95e98c 100644 --- a/src/be/nikiroo/utils/resources/MetaInfo.java +++ b/src/be/nikiroo/utils/resources/MetaInfo.java @@ -1,6 +1,7 @@ package be.nikiroo.utils.resources; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -17,11 +18,12 @@ import be.nikiroo.utils.resources.Meta.Format; * @param * the type of {@link Bundle} to edit */ -public class MetaInfo> { +public class MetaInfo> implements Iterable> { private final Bundle bundle; private final E id; private Meta meta; + private List> children = new ArrayList>(); private String value; private List reloadedListeners = new ArrayList(); @@ -53,8 +55,14 @@ public class MetaInfo> { if (description == null) { description = meta.description(); + if (description == null) { + description = ""; + } if (meta.info() != null && !meta.info().isEmpty()) { - description += " (" + meta.info() + ")"; + if (!description.isEmpty()) { + description += "\n\n"; + } + description += meta.info(); } } @@ -94,6 +102,16 @@ public class MetaInfo> { return meta.format(); } + // for ComboBox, this is mostly a suggestion + public String[] getAllowedValues() { + return meta.list(); + } + + // TODO: use it! + public boolean isArray() { + return meta.array(); + } + /** * The value stored by this item, as a {@link String}. * @@ -217,6 +235,15 @@ public class MetaInfo> { saveListeners.add(listener); } + @Override + public Iterator> iterator() { + return children.iterator(); + } + + public List> getChildren() { + return children; + } + /** * Create a list of {@link MetaInfo}, one for each of the item in the given * {@link Bundle}.