X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fviewmodel%2FAlignmentViewport.java;fp=src%2Fjalview%2Fviewmodel%2FAlignmentViewport.java;h=4aec9d247e5ec49258976adeafece3c1222fd30f;hb=586ade46bdcd05ff028a1cff82c3c527326d28ec;hp=4311d144b8aafcffdc69e132d6279c71557b9500;hpb=adcef27f5747b4e70e89a56c3735bc3afb8ce9bf;p=jalview.git diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 4311d14..4aec9d2 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -87,6 +87,9 @@ import java.util.Map; public abstract class AlignmentViewport implements AlignViewportI, CommandListener, VamsasSource { + public static final String PROPERTY_ALIGNMENT = "alignment"; + public static final String PROPERTY_SEQUENCE = "sequence"; + protected ViewportRanges ranges; protected ViewStyleI viewStyle = new ViewStyle(); @@ -630,10 +633,31 @@ public abstract class AlignmentViewport protected ColumnSelection colSel = new ColumnSelection(); - public boolean autoCalculateConsensus = true; + protected boolean autoCalculateConsensusAndConservation = true; + + public boolean getAutoCalculateConsensusAndConservation() + { // BH 2019.07.24 + return autoCalculateConsensusAndConservation; + } + + public void setAutoCalculateConsensusAndConservation(boolean b) + { + autoCalculateConsensusAndConservation = b; + } protected boolean autoCalculateStrucConsensus = true; + public boolean getAutoCalculateStrucConsensus() + { // BH 2019.07.24 + return autoCalculateStrucConsensus; + } + + public void setAutoCalculateStrucConsensus(boolean b) + { + autoCalculateStrucConsensus = b; + } + + protected boolean ignoreGapsInConsensusCalculation = false; protected ResidueShaderI residueShading = new ResidueShader(); @@ -861,7 +885,7 @@ public abstract class AlignmentViewport // see note in mantis : issue number 8585 if (alignment.isNucleotide() || (conservation == null && quality == null) - || !autoCalculateConsensus) + || !autoCalculateConsensusAndConservation) { return; } @@ -879,7 +903,7 @@ public abstract class AlignmentViewport public void updateConsensus(final AlignmentViewPanel ap) { // see note in mantis : issue number 8585 - if (consensus == null || !autoCalculateConsensus) + if (consensus == null || !autoCalculateConsensusAndConservation) { return; } @@ -1389,21 +1413,22 @@ public abstract class AlignmentViewport * checks current colsel against record of last hash value, and optionally * updates record. * - * @param b + * @param updateHash * update the record of last hash value * @return true if colsel changed since last call (when b is true) */ - public boolean isColSelChanged(boolean b) + public boolean isColSelChanged(boolean updateHash) { int hc = (colSel == null || colSel.isEmpty()) ? -1 : colSel.hashCode(); if (hc != -1 && hc != colselhash) { - if (b) + if (updateHash) { colselhash = hc; } return true; } + notifySequence(); return false; } @@ -1476,22 +1501,6 @@ public abstract class AlignmentViewport } } - /** - * 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); - } - // common hide/show column stuff public void hideSelectedColumns() @@ -1556,13 +1565,14 @@ public abstract class AlignmentViewport ranges.setStartEndSeq(startSeq, endSeq + tmp.size()); - firePropertyChange("alignment", null, alignment.getSequences()); // used to set hasHiddenRows/hiddenRepSequences here, after the property // changed event + notifySequence(); sendSelection(); } } + public void showSequence(int index) { int startSeq = ranges.getStartSeq(); @@ -1585,8 +1595,7 @@ public abstract class AlignmentViewport } ranges.setStartEndSeq(startSeq, endSeq + tmp.size()); - - firePropertyChange("alignment", null, alignment.getSequences()); + notifyAlignment(); sendSelection(); } } @@ -1620,7 +1629,7 @@ public abstract class AlignmentViewport setSequenceAnnotationsVisible(seq[i], false); } ranges.setStartSeq(startSeq); - firePropertyChange("alignment", null, alignment.getSequences()); + notifyAlignment(); } } @@ -1985,11 +1994,11 @@ public abstract class AlignmentViewport { alignment.padGaps(); } - if (autoCalculateConsensus) + if (autoCalculateConsensusAndConservation) { updateConsensus(ap); } - if (hconsensus != null && autoCalculateConsensus) + if (hconsensus != null && autoCalculateConsensusAndConservation) { updateConservation(ap); } @@ -3244,7 +3253,6 @@ public abstract class AlignmentViewport codingComplement.setUpdateStructures(needToUpdateStructureViews); } } - /** * Filters out sequences with an eValue higher than the specified value. The * filtered sequences are hidden or deleted. Sequences with no eValues are also @@ -3285,5 +3293,21 @@ public abstract class AlignmentViewport hideSequence(new SequenceI[] { seq }); } } + } + + /** + * Notify TreePanel and AlignmentPanel of some sort of alignment change. + */ + public void notifyAlignment() + { + changeSupport.firePropertyChange(PROPERTY_ALIGNMENT, null, alignment.getSequences()); + } + + /** + * Notify AlignmentPanel of a sequence column selection or visibility changes. + */ + public void notifySequence() + { + changeSupport.firePropertyChange(PROPERTY_SEQUENCE, null, null); } }