From: jprocter Date: Thu, 11 Mar 2010 17:08:15 +0000 (+0000) Subject: new ROWPROPERTIES statement for setting an individual row's label format X-Git-Tag: Release_2_5~134 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=88ce5193255ac106b41ec465d48fd4128dad370a;p=jalview.git new ROWPROPERTIES statement for setting an individual row's label format --- 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) {