- for (List<String> types : shownTypes)
- {
- addAnnotationTypeToShowHide(hideAnnotationsMenu, types, false, false);
- }
- }
-
- /**
- * Helper method to populate lists of annotation types for the Show/Hide
- * Annotations menus. If sequenceGroup is not null, this is restricted to
- * annotations which are associated with sequences in the selection group.
- * <p/>
- * If an annotation row is currently visible, its type (label) is added (once
- * only per type), to the shownTypes list. If it is currently hidden, it is
- * added to the hiddenTypesList.
- * <p/>
- * For rows that belong to a line graph group, so are always rendered
- * together:
- * <ul>
- * <li>Treat all rows in the group as visible, if at least one of them is</li>
- * <li>Build a comma-separated label with all the types that belong to the
- * group</li>
- * </ul>
- *
- * @param shownTypes
- * @param hiddenTypes
- * @param visibleGraphGroups
- * @param annotations
- * @param sequenceGroup
- */
- public static void getAnnotationTypesForShowHide(
- List<List<String>> shownTypes, List<List<String>> hiddenTypes,
- BitSet visibleGraphGroups, AlignmentAnnotation[] annotations,
- SequenceGroup sequenceGroup)
- {
- // lookup table, key = graph group, value = list of types in the group
- Map<Integer, List<String>> groupLabels = new LinkedHashMap<Integer, List<String>>();
-
- List<String> addedToShown = new ArrayList<String>();
- List<String> addedToHidden = new ArrayList<String>();
+ /*
+ * Find shown/hidden annotations types, distinguished by source (calcId),
+ * and grouped by graphGroup. Using LinkedHashMap means we will retrieve in
+ * the insertion order, which is the order of the annotations on the
+ * alignment.
+ */
+ Map<String, List<List<String>>> shownTypes = new LinkedHashMap<String, List<List<String>>>();
+ Map<String, List<List<String>>> hiddenTypes = new LinkedHashMap<String, List<List<String>>>();
+ AlignmentAnnotationUtils.getShownHiddenTypes(shownTypes, hiddenTypes,
+ AlignmentAnnotationUtils.asList(annotations), forSequences);