From: amwaterhouse Date: Thu, 28 Apr 2005 15:33:12 +0000 (+0000) Subject: Viewport now looks at preferences when loading up X-Git-Tag: Release_2_0~359 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ebb52a433edbbdbd31ab82cbb1c59fc116a72b1d;p=jalview.git Viewport now looks at preferences when loading up --- diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index 7fd7461..a135620 100755 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -6,6 +6,7 @@ import jalview.analysis.NJTree; import jalview.datamodel.*; import jalview.schemes.*; import java.util.*; +import jalview.bin.Cache; public class AlignViewport { @@ -23,6 +24,9 @@ public class AlignViewport boolean renderGaps = true; boolean showSequenceFeatures = false; boolean showAnnotation = true; + boolean showConservation = true; + boolean showQuality = true; + boolean showIdentity = true; boolean colourAppliesToAllGroups = true; ColourSchemeI globalColourScheme = null; @@ -53,21 +57,67 @@ public class AlignViewport boolean scaleRightWrapped = true; - public AlignViewport(AlignmentI al, - boolean showText, - boolean showBoxes, - boolean wrapAlignment) { - + public AlignViewport(AlignmentI al) + { + setAlignment(al); this.startRes = 0; this.endRes = al.getWidth()-1; this.startSeq = 0; this.endSeq = al.getHeight()-1; - this.showText = showText; - this.showBoxes = showBoxes; - this.wrapAlignment = wrapAlignment; - setAlignment(al); - setFont( font ); + updateFromPreferences(); + + } + + public void updateFromPreferences() + { + String string = Cache.getProperty("SHOW_FULL_ID"); + if(string!=null) + showFullId = Boolean.valueOf(string).booleanValue(); + + string = Cache.getProperty("SHOW_ANNOTATIONS"); + if(string!=null) + showAnnotation = Boolean.valueOf(string).booleanValue(); + + string = Cache.getProperty("SHOW_CONSERVATION"); + if(string!=null) + showConservation = Boolean.valueOf(string).booleanValue(); + string = Cache.getProperty("SHOW_QUALITY"); + if(string!=null) + showQuality = Boolean.valueOf(string).booleanValue(); + string = Cache.getProperty("SHOW_IDENTITY"); + if(string!=null) + showIdentity = Boolean.valueOf(string).booleanValue(); + + string = Cache.getProperty("SHOW_FULL_ID"); + if(string!=null) + showFullId = Boolean.valueOf(string).booleanValue(); + + String fontName = Cache.getProperty("FONT_NAME"); + String fontStyle= Cache.getProperty("FONT_STYLE"); + String fontSize = Cache.getProperty("FONT_SIZE"); + if(fontName!=null && fontStyle!=null && fontSize!=null) + setFont( new Font(fontName,Integer.parseInt(fontStyle),Integer.parseInt(fontSize)) ); + else + setFont( font ); + + string = Cache.getProperty("GAP_SYMBOL"); + if(string!=null) + alignment.setGapCharacter( string.charAt(0) ); + + + // We must set conservation and consensus before setting colour, + // as Blosum and Clustal require this to be done + updateConservation(); + updateConsensus(); + string = Cache.getProperty("DEFAULT_COLOUR"); + if(string!=null) + { + globalColourScheme = ColourSchemeProperty.getColour(alignment, string); + if(globalColourScheme!=null) + globalColourScheme.setConsensus( vconsensus ); + } + } public void showSequenceFeatures(boolean b) @@ -137,6 +187,7 @@ public class AlignViewport 0f, // cons.qualityRange[0].floatValue(), 11f, // cons.qualityRange[1].floatValue() 1); + if(showConservation) alignment.addAnnotation(conservation); quality = new AlignmentAnnotation("Quality", "Alignment Quality based on Blosum62 scores", @@ -144,11 +195,13 @@ public class AlignViewport cons.qualityRange[0].floatValue(), cons.qualityRange[1].floatValue(), 1); - alignment.addAnnotation(quality); + if(showQuality) + alignment.addAnnotation(quality); } else { conservation.annotations = annotations; quality.annotations = qannotations; + quality.graphMax = cons.qualityRange[1].floatValue(); } @@ -198,7 +251,8 @@ public class AlignViewport { consensus = new AlignmentAnnotation("% Identity", "PID", annotations, 0f, 100f, 1); - alignment.addAnnotation(consensus); + if(showIdentity) + alignment.addAnnotation(consensus); } else consensus.annotations = annotations;