X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FAnnotationFile.java;h=4e15c187459555c85cff1fa2a22cbb7f92425dd1;hb=88ce5193255ac106b41ec465d48fd4128dad370a;hp=0095aefab7cf8267e5a746a2eec74e742140adcb;hpb=aa5a15ade3b078f6c2cf78db5aa05e0dcb1ce792;p=jalview.git diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java index 0095aef..4e15c18 100755 --- a/src/jalview/io/AnnotationFile.java +++ b/src/jalview/io/AnnotationFile.java @@ -85,7 +85,7 @@ public class AnnotationFile StringBuffer colours = new StringBuffer(); StringBuffer graphLine = new StringBuffer(); - + StringBuffer rowprops = new StringBuffer(); Hashtable graphGroup = new Hashtable(); java.awt.Color color; @@ -276,7 +276,14 @@ public class AnnotationFile colours.append("COLOUR\t" + row.label + "\t" + jalview.util.Format.getHexString(color) + "\n"); } - + if (row.scaleColLabel || row.showAllColLabels || row.centreColLabels) + { + rowprops.append("ROWPROPERTIES\t"+row.label); + rowprops.append("\tscaletofit="+row.scaleColLabel); + rowprops.append("\tshowalllabs="+row.showAllColLabels); + rowprops.append("\tcentrelabs="+row.centreColLabels); + rowprops.append("\n"); + } } text.append("\n"); @@ -292,6 +299,7 @@ public class AnnotationFile text.append(en.nextElement() + "\n"); } } + text.append(rowprops); } if (groups != null) @@ -498,7 +506,11 @@ public class AnnotationFile combineAnnotations(al, st); continue; } - + else if (token.equalsIgnoreCase("ROWPROPERTIES")) + { + addRowProperties(al, st); + continue; + } else if (token.equalsIgnoreCase("GRAPHLINE")) { addLine(al, st); @@ -933,6 +945,35 @@ public class AnnotationFile } } + void addRowProperties(AlignmentI al, StringTokenizer st) + { + String label = st.nextToken(),keyValue,key,value; + boolean scaletofit=false,centerlab=false,showalllabs=false; + while (st.hasMoreTokens()) { + keyValue=st.nextToken(); + key = keyValue.substring(0, keyValue.indexOf("=")); + value = keyValue.substring(keyValue.indexOf("=") + 1); + if (key.equalsIgnoreCase("scaletofit")) { + scaletofit = Boolean.valueOf(value).booleanValue(); + } + if (key.equalsIgnoreCase("showalllabs")) { + showalllabs = Boolean.valueOf(value).booleanValue(); + } + if (key.equalsIgnoreCase("centrelabs")) { + centerlab = Boolean.valueOf(value).booleanValue(); + } + AlignmentAnnotation[] alr = al.getAlignmentAnnotation(); + for (int i = 0; i < alr.length; i++) + { + if (alr[i].label.equalsIgnoreCase(label)) + { + alr[i].centreColLabels = centerlab; + alr[i].scaleColLabel = scaletofit; + alr[i].showAllColLabels = showalllabs; + } + } + } + } void addProperties(AlignmentI al, StringTokenizer st) {