X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fviewmodel%2Fseqfeatures%2FFeatureRendererModel.java;h=e812ed58c594ad5c3e890ab872344351800f9869;hb=e57f77dc13f5a295cf49a403da05770a68a6e22b;hp=937094b49dda95c2f53ff70b9b1cf84312fd80c5;hpb=96a5726c430b26ed83fc8ee3be0c7ea871519fa1;p=jalview.git diff --git a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java index 937094b..e812ed5 100644 --- a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java +++ b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java @@ -104,11 +104,11 @@ public abstract class FeatureRendererModel Map featureOrder = null; - protected PropertyChangeSupport changeSupport = new PropertyChangeSupport( - this); - protected AlignViewportI av; + private PropertyChangeSupport changeSupport = new PropertyChangeSupport( + this); + @Override public AlignViewportI getViewport() { @@ -301,14 +301,21 @@ public abstract class FeatureRendererModel { firing = Boolean.TRUE; findAllFeatures(true); // add all new features as visible - changeSupport.firePropertyChange("changeSupport", null, null); + notifyFeaturesChanged(); firing = Boolean.FALSE; } } } @Override - public List findFeaturesAtColumn(SequenceI sequence, int column) + public void notifyFeaturesChanged() + { + changeSupport.firePropertyChange("changeSupport", null, null); + } + + @Override + public List findFeaturesAtColumn(SequenceI sequence, + int column) { /* * include features at the position provided their feature type is @@ -402,8 +409,8 @@ public abstract class FeatureRendererModel } if (groupDisplayed) { - Set types = asq.getFeatures().getFeatureTypesForGroups( - true, group); + Set types = asq.getFeatures() + .getFeatureTypesForGroups(true, group); for (String type : types) { if (!allfeatures.contains(type)) // or use HashSet and no test? @@ -482,6 +489,7 @@ public abstract class FeatureRendererModel } } } + protected Boolean firing = Boolean.FALSE; /** @@ -622,8 +630,9 @@ public abstract class FeatureRendererModel */ public boolean showFeatureOfType(String type) { - return type == null ? false : (av.getFeaturesDisplayed() == null ? true - : av.getFeaturesDisplayed().isVisible(type)); + return type == null ? false + : (av.getFeaturesDisplayed() == null ? true + : av.getFeaturesDisplayed().isVisible(type)); } @Override @@ -701,15 +710,15 @@ public abstract class FeatureRendererModel } /** - * Sets the priority order for features, with the highest priority (displayed on - * top) at the start of the data array + * Sets the priority order for features, with the highest priority (displayed + * on top) at the start of the data array * * @param data * an array of { Type, Colour, Filter, Boolean } * @param visibleNew * when true current featureDisplay list will be cleared - * @return true if any visible features have been reordered or recoloured, else - * false (i.e. no need to repaint) + * @return true if any visible features have been reordered or recoloured, + * else false (i.e. no need to repaint) */ public boolean setFeaturePriority(FeatureSettingsBean[] data, boolean visibleNew) @@ -993,8 +1002,7 @@ public abstract class FeatureRendererModel */ public boolean featureGroupNotShown(final SequenceFeature sequenceFeature) { - return featureGroups != null - && sequenceFeature.featureGroup != null + return featureGroups != null && sequenceFeature.featureGroup != null && sequenceFeature.featureGroup.length() != 0 && featureGroups.containsKey(sequenceFeature.featureGroup) && !featureGroups.get(sequenceFeature.featureGroup) @@ -1022,9 +1030,9 @@ public abstract class FeatureRendererModel List visibleFeatures = getDisplayedFeatureTypes(); String[] visibleTypes = visibleFeatures .toArray(new String[visibleFeatures.size()]); - List features = sequence.getFeatures().findFeatures( - fromResNo, toResNo, visibleTypes); - + List features = sequence.getFeatures() + .findFeatures(fromResNo, toResNo, visibleTypes); + for (SequenceFeature sf : features) { if (!featureGroupNotShown(sf) && getColour(sf) != null) @@ -1084,8 +1092,7 @@ public abstract class FeatureRendererModel * (checking type and isContactFeature as a fail-safe here, although * currently they are guaranteed to match in this context) */ - if (lastFeature != null - && sf.getBegin() == lastFeature.getBegin() + if (lastFeature != null && sf.getBegin() == lastFeature.getBegin() && sf.getEnd() == lastFeature.getEnd() && sf.isContactFeature() == lastFeature.isContactFeature() && sf.getType().equals(lastFeature.getType())) @@ -1115,7 +1122,8 @@ public abstract class FeatureRendererModel } @Override - public void setFeatureFilter(String featureType, FeatureMatcherSetI filter) + public void setFeatureFilter(String featureType, + FeatureMatcherSetI filter) { if (filter == null || filter.isEmpty()) { @@ -1153,7 +1161,7 @@ public abstract class FeatureRendererModel { return null; } - + return fc.getColor(sf); } @@ -1244,8 +1252,8 @@ public abstract class FeatureRendererModel int fromRes = match.getStart(); int toRes = match.getEnd(); mapFrom = match.getSequence(); - List fs = findFeaturesAtResidue( - mapFrom, fromRes, toRes); + List fs = findFeaturesAtResidue(mapFrom, fromRes, + toRes); for (SequenceFeature sf : fs) { if (!found.contains(sf)) @@ -1290,8 +1298,9 @@ public abstract class FeatureRendererModel } } } - - return new MappedFeatures(mapping.getMapping(), mapFrom, pos, residue, result); + + return new MappedFeatures(mapping.getMapping(), mapFrom, pos, residue, + result); } @Override