+ return BAR_GRAPH;
+ }
+ else if (string.equalsIgnoreCase("LINE_GRAPH"))
+ {
+ return LINE_GRAPH;
+ }
+ else
+ {
+ return NO_GRAPH;
+ }
+ }
+
+ /**
+ * Creates a new AlignmentAnnotation object.
+ *
+ * @param label
+ * short label shown under sequence labels
+ * @param description
+ * text displayed on mouseover
+ * @param annotations
+ * set of positional annotation elements
+ */
+ public AlignmentAnnotation(String label, String description,
+ Annotation[] annotations)
+ {
+ // always editable?
+ editable = true;
+ this.label = label;
+ this.description = description;
+ this.annotations = annotations;
+
+ validateRangeAndDisplay();
+ }
+
+ void areLabelsSecondaryStructure()
+ {
+ boolean nonSSLabel = false;
+ char firstChar = 0;
+ for (int i = 0; i < annotations.length; i++)
+ {
+ if (annotations[i] == null)
+ {
+ continue;
+ }
+ if (annotations[i].secondaryStructure == 'H'
+ || annotations[i].secondaryStructure == 'E')
+ {
+ hasIcons = true;
+ }
+
+ if (annotations[i].displayCharacter == null)
+ {
+ continue;
+ }
+ if (annotations[i].displayCharacter.length() == 1)
+ {
+ firstChar = annotations[i].displayCharacter.charAt(0);
+ // check to see if it looks like a sequence or is secondary structure
+ // labelling.
+ if (
+ // Uncomment to only catch case where displayCharacter==secondary
+ // Structure
+ // to correctly redisplay SS annotation imported from Stockholm,
+ // exported to JalviewXML and read back in again.
+ // &&
+ // annotations[i].displayCharacter.charAt(0)==annotations[i].secondaryStructure
+ firstChar != 'H'
+ && firstChar != 'E'
+ && firstChar != '-'
+ && firstChar < jalview.schemes.ResidueProperties.aaIndex.length)
+ {
+ if (jalview.schemes.ResidueProperties.aaIndex[firstChar] < 23) // TODO: parameterise to gap symbol number
+ {
+ nonSSLabel = true;
+ }
+ }
+ }
+
+ if (annotations[i].displayCharacter.length() > 0)
+ {
+ hasText = true;
+ }