X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAlignViewport.java;h=152966e78dd90a414e0bde79b58eb96da71f29eb;hb=cd71fb9ef1a21678ad648ba13564b658b53ab834;hp=e7cae4434305e6beea837c9fc87f28067a0db551;hpb=9fff97021c2c637e426f6971d54dcf3fd4191985;p=jalview.git diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index e7cae44..152966e 100755 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -36,7 +36,10 @@ public class AlignViewport int startSeq; int endSeq; - boolean showFullId = true; + + boolean cursorMode = false; + + boolean showJVSuffix = true; boolean showText = true; boolean showColourText = false; boolean showBoxes = true; @@ -57,10 +60,10 @@ public class AlignViewport int charHeight; int charWidth; - int chunkWidth; - int chunkHeight; + int wrappedWidth; Font font = new Font("SansSerif", Font.PLAIN, 10); + boolean validCharWidth = true; AlignmentI alignment; ColumnSelection colSel = new ColumnSelection(); @@ -74,6 +77,21 @@ public class AlignViewport boolean scaleLeftWrapped = true; boolean scaleRightWrapped = true; + // The following vector holds the features which are + // currently visible, in the correct order or rendering + Hashtable featuresDisplayed; + + + public Vector vconsensus; + AlignmentAnnotation consensus; + AlignmentAnnotation conservation; + AlignmentAnnotation quality; + + boolean autocalculateConsensus = true; + + public int ConsPercGaps = 25; // JBPNote : This should be a scalable property! + + private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(this); boolean ignoreGapsInConsensusCalculation = false; @@ -91,7 +109,7 @@ public class AlignViewport String param = applet.getParameter("showFullId"); if (param != null) { - showFullId = Boolean.valueOf(param).booleanValue(); + showJVSuffix = Boolean.valueOf(param).booleanValue(); } param = applet.getParameter("showAnnotation"); @@ -139,15 +157,17 @@ public class AlignViewport showSequenceFeatures = b; } - public Vector vconsensus; - AlignmentAnnotation consensus; - AlignmentAnnotation conservation; - AlignmentAnnotation quality; + public boolean getShowSequenceFeatures() + { + return showSequenceFeatures; + } - public int ConsPercGaps = 25; // JBPNote : This should be a scalable property! public void updateConservation() { + if(alignment.isNucleotide()) + return; + Conservation cons = new jalview.analysis.Conservation("All", jalview.schemes.ResidueProperties.propHash, 3, alignment.getSequences(), 0, @@ -217,7 +237,7 @@ public class AlignViewport annotations, 0f, // cons.qualityRange[0].floatValue(), 11f, // cons.qualityRange[1].floatValue() - 1); + AlignmentAnnotation.BAR_GRAPH); if (showConservation) { alignment.addAnnotation(conservation); @@ -227,7 +247,7 @@ public class AlignViewport qannotations, cons.qualityRange[0].floatValue(), cons.qualityRange[1].floatValue(), - 1); + AlignmentAnnotation.BAR_GRAPH); if (showQuality) { alignment.addAnnotation(quality); @@ -290,7 +310,7 @@ public class AlignViewport if (consensus == null) { consensus = new AlignmentAnnotation("Consensus", - "PID", annotations, 0f, 100f, 1); + "PID", annotations, 0f, 100f, AlignmentAnnotation.BAR_GRAPH); if (showConsensus) { alignment.addAnnotation(consensus); @@ -301,6 +321,9 @@ public class AlignViewport consensus.annotations = annotations; } + if(globalColourScheme!=null) + globalColourScheme.setConsensus(vconsensus); + } public SequenceGroup getSelectionGroup() @@ -400,12 +423,17 @@ public class AlignViewport return endSeq; } + java.awt.Frame nullFrame; public void setFont(Font f) { font = f; - java.awt.Frame temp = new java.awt.Frame(); - temp.addNotify(); - java.awt.FontMetrics fm = temp.getGraphics().getFontMetrics(font); + if(nullFrame == null) + { + nullFrame = new java.awt.Frame(); + nullFrame.addNotify(); + } + + java.awt.FontMetrics fm = nullFrame.getGraphics().getFontMetrics(font); setCharHeight(fm.getHeight()); setCharWidth(fm.charWidth('M')); } @@ -435,24 +463,14 @@ public class AlignViewport return charHeight; } - public void setChunkWidth(int w) - { - this.chunkWidth = w; - } - - public int getChunkWidth() - { - return chunkWidth; - } - - public void setChunkHeight(int h) + public void setWrappedWidth(int w) { - this.chunkHeight = h; + this.wrappedWidth = w; } - public int getChunkHeight() + public int getwrappedWidth() { - return chunkHeight; + return wrappedWidth; } public AlignmentI getAlignment() @@ -599,14 +617,14 @@ public class AlignViewport return colourAppliesToAllGroups; } - public boolean getShowFullId() + public boolean getShowJVSuffix() { - return showFullId; + return showJVSuffix; } - public void setShowFullId(boolean b) + public void setShowJVSuffix(boolean b) { - showFullId = b; + showJVSuffix = b; } public boolean getShowAnnotation() @@ -653,16 +671,50 @@ public class AlignViewport { ignoreGapsInConsensusCalculation = b; updateConsensus(); - if (globalColourScheme!=null && globalColourScheme instanceof ResidueColourScheme) + if (globalColourScheme!=null) { - ( (ResidueColourScheme) globalColourScheme).setThreshold( - ( (ResidueColourScheme) globalColourScheme).getThreshold(), + globalColourScheme.setThreshold(globalColourScheme.getThreshold(), ignoreGapsInConsensusCalculation); } + } + + /** + * Property change listener for changes in alignment + * + * @param listener DOCUMENT ME! + */ + public void addPropertyChangeListener( + java.beans.PropertyChangeListener listener) + { + changeSupport.addPropertyChangeListener(listener); + } + + /** + * DOCUMENT ME! + * + * @param listener DOCUMENT ME! + */ + public void removePropertyChangeListener( + java.beans.PropertyChangeListener listener) + { + changeSupport.removePropertyChangeListener(listener); + } + /** + * Property change listener for changes in alignment + * + * @param prop DOCUMENT ME! + * @param oldvalue DOCUMENT ME! + * @param newvalue DOCUMENT ME! + */ + public void firePropertyChange(String prop, Object oldvalue, Object newvalue) + { + changeSupport.firePropertyChange(prop, oldvalue, newvalue); } + + public boolean getIgnoreGapsConsensus() { return ignoreGapsInConsensusCalculation;