X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignViewport.java;h=f95179203d2bf94f45d5b4d2f0572c1838a32935;hb=f2d10e204281911d5da924b7aa4cdb93102a4e24;hp=904e1e2d05bda4359742efa1b52566e57505cbb1;hpb=ba2255324de03f4f66ed1883c105404c4c97c66b;p=jalview.git diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index 904e1e2..f951792 100755 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -85,6 +85,8 @@ public class AlignViewport // JBPNote Prolly only need this in the applet version. private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(this); + boolean ignoreGapsInConsensusCalculation = false; + /** * Creates a new AlignViewport object. * @@ -106,52 +108,48 @@ public class AlignViewport */ public void updateFromPreferences() { - showFullId = Preferences.showFullId; - showAnnotation = Preferences.showAnnotation; - showConservation = Preferences.showConservation; - showQuality = Preferences.showQuality; - showIdentity = Preferences.showIdentity; - showFullId = Preferences.showFullId; + showFullId = Cache.getDefault("SHOW_FULL_ID", true); + showAnnotation = Cache.getDefault("SHOW_ANNOTATIONS", true); + showConservation = Cache.getDefault("SHOW_CONSERVATION", true); - String fontName = Preferences.fontName; - String fontStyle = Preferences.fontStyle; - String fontSize = Cache.getProperty("FONT_SIZE"); + showQuality = Cache.getDefault("SHOW_QUALITY", true); + showIdentity = Cache.getDefault("SHOW_IDENTITY", true); - if ((fontName != null) && (fontStyle != null) && (fontSize != null)) - { - int style = 0; + String fontName = Cache.getDefault("FONT_NAME", "SansSerif"); + String fontStyle = Cache.getDefault("FONT_STYLE", Font.PLAIN + "") ; + String fontSize = Cache.getDefault("FONT_SIZE", "10"); - if (fontStyle.equals("bold")) - { - style = 1; - } - else if (fontStyle.equals("italic")) - { - style = 2; - } + int style = 0; - setFont(new Font(fontName, style, Integer.parseInt(fontSize))); - } - else - { - setFont(font); - } + if (fontStyle.equals("bold")) + { + style = 1; + } + else if (fontStyle.equals("italic")) + { + style = 2; + } + + setFont(new Font(fontName, style, Integer.parseInt(fontSize))); + + + alignment.setGapCharacter( Cache.getDefault("GAP_SYMBOL", "-").charAt(0) ); - alignment.setGapCharacter(Preferences.gapSymbol); // We must set conservation and consensus before setting colour, // as Blosum and Clustal require this to be done updateConservation(); updateConsensus(); - if (Preferences.defaultColour != null) + if (jalview.bin.Cache.getProperty("DEFAULT_COLOUR") != null) { - globalColourScheme = ColourSchemeProperty.getColour(alignment, - Preferences.defaultColour); + globalColourScheme = ColourSchemeProperty.getColour(alignment, + jalview.bin.Cache.getProperty("DEFAULT_COLOUR")); if (globalColourScheme instanceof UserColourScheme) { globalColourScheme = UserDefinedColours.loadDefaultColours(); + ((UserColourScheme)globalColourScheme).setThreshold(0, getIgnoreGapsConsensus()); } if (globalColourScheme != null) @@ -161,6 +159,8 @@ public class AlignViewport } } + + /** * DOCUMENT ME! * @@ -307,18 +307,19 @@ public class AlignViewport { hash = (Hashtable) vconsensus.elementAt(i); - float value = Float.parseFloat(hash.get("maxCount").toString()); - value /= Float.parseFloat(hash.get("size").toString()); - - value *= 100; + float value = 0; + if(ignoreGapsInConsensusCalculation) + value = ((Float)hash.get("pid_nogaps")).floatValue(); + else + value = ((Float)hash.get("pid_gaps")).floatValue(); - String maxRes = hash.get("maxResidue") + " "; - String mouseOver = hash.get("maxResidue") + " "; + String maxRes = hash.get("maxResidue").toString(); + String mouseOver = hash.get("maxResidue")+" "; - if (maxRes.length() > 2) + if (maxRes.length() > 1) { mouseOver = "[" + maxRes + "] "; - maxRes = "+ "; + maxRes = "+"; } mouseOver += ((int) value + "%"); @@ -339,6 +340,9 @@ public class AlignViewport { consensus.annotations = annotations; } + + if(globalColourScheme!=null) + globalColourScheme.setConsensus(vconsensus); } /** @@ -998,7 +1002,7 @@ public class AlignViewport } /** - * DOCUMENT ME! + * Property change listener for changes in alignment * * @param listener DOCUMENT ME! */ @@ -1020,7 +1024,7 @@ public class AlignViewport } /** - * DOCUMENT ME! + * Property change listener for changes in alignment * * @param prop DOCUMENT ME! * @param oldvalue DOCUMENT ME! @@ -1030,4 +1034,20 @@ public class AlignViewport { changeSupport.firePropertyChange(prop, oldvalue, newvalue); } + + public void setIgnoreGapsConsensus(boolean b) + { + ignoreGapsInConsensusCalculation = b; + updateConsensus(); + if(globalColourScheme!=null) + { + globalColourScheme.setThreshold(globalColourScheme.getThreshold(), ignoreGapsInConsensusCalculation); + } + + } + + public boolean getIgnoreGapsConsensus() + { + return ignoreGapsInConsensusCalculation; + } }