* @return
*/
MappedFeatures findComplementFeaturesAtResidue(SequenceI sequence, int pos);
+
+ /**
+ * Sends a message to let any registered parties know that something about
+ * feature rendering has changed
+ */
+ void notifyFeaturesChanged();
+
}
// interface, simplifying instantiating classes
/**
- * Answers true if the specified feature type is displayed
+ * Answers true if the specified feature type is to be displayed, false if no
+ * preference
*
* @param type
* @return
boolean isFeatureDisplayed(String type);
/**
+ * Answers true if the specified feature type is to be hidden, false if no
+ * preference
+ *
+ * @param type
+ * @return
+ */
+ boolean isFeatureHidden(String type);
+
+ /**
* Answers true if the specified feature group is displayed
*
* @param group
void setVisible(String featureType);
+ void setHidden(String featureType);
+
/**
* Sets all the specified feature types to visible. Visibility of other
* feature types is not changed.
import jalview.api.AlignmentViewPanel;
import jalview.api.FeatureRenderer;
+import jalview.api.FeatureSettingsModelI;
import jalview.api.SequenceRenderer;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
+import jalview.gui.AppJmol;
import jalview.gui.IProgressIndicator;
import jalview.io.DataSourceType;
import jalview.io.StructureFile;
import jalview.structure.StructureSelectionManager;
import jalview.structures.models.AAStructureBindingModel;
import jalview.util.MessageManager;
+import jalview.ws.dbsources.Pdb;
import java.awt.Color;
import java.awt.Container;
FeatureRenderer fr = getFeatureRenderer(null);
if (fr != null)
{
+ // JAL-1842 ensure FeatureRenderer knows about RESNUM
fr.featuresAdded();
+ // ... apply feature settings (e.g. to hide RESNUM)
+ FeatureSettingsModelI colours = new Pdb().getFeatureColourScheme();
+ ((AppJmol) getViewer()).getAlignmentPanel().av
+ .applyFeaturesStyle(colours);
+ // ... and refresh again to ensure FeatureSettings is in synch!
+ fr.notifyFeaturesChanged();
}
refreshGUI();
loadNotifiesHandled++;
FeatureRenderer fr = getAlignPanel().getSeqPanel().seqCanvas
.getFeatureRenderer();
- List<String> origRenderOrder = new ArrayList(),
- origGroups = new ArrayList();
+ List<String> origRenderOrder = new ArrayList<>();
+ List<String> origGroups = new ArrayList<>();
// preserve original render order - allows differentiation between user configured colours and autogenerated ones
origRenderOrder.addAll(fr.getRenderOrder());
origGroups.addAll(fr.getFeatureGroups());
if (!mergeOnly)
{
// only clear displayed features if we are mergeing
- displayed.clear();
+ // displayed.clear();
}
// TODO this clears displayed.featuresRegistered - do we care?
//
{
displayed.setVisible(type);
}
+ else if (featureSettings.isFeatureHidden(type))
+ {
+ displayed.setHidden(type);
+ }
}
}
AlignmentPanel ap = (alignment == null)
? appJmolWindow.getAlignmentPanel()
: (AlignmentPanel) alignment;
- if (ap.av.isShowSequenceFeatures())
- {
- return ap.av.getAlignPanel().getSeqPanel().seqCanvas.fr;
- }
-
- return null;
+ return ap.av.getAlignPanel().getFeatureRenderer();
}
}
/*
* ensure that any newly discovered features (e.g. RESNUM)
- * are added to any open feature settings dialog
+ * are notified to the FeatureRenderer (and added to any
+ * open feature settings dialog)
*/
FeatureRenderer fr = getBinding().getFeatureRenderer(null);
if (fr != null)
private static final String FEATURE_RES_NUM = PDBChain.RESNUM_FEATURE;
@Override
- public boolean isFeatureDisplayed(String type)
+ public boolean isFeatureHidden(String type)
{
- return type.equalsIgnoreCase(FEATURE_INSERTION)
- || type.equalsIgnoreCase(FEATURE_RES_NUM);
+ return type.equalsIgnoreCase(FEATURE_RES_NUM);
}
@Override
}
@Override
+ public boolean isFeatureHidden(String type)
+ {
+ return false;
+ }
+
+ @Override
public boolean isGroupDisplayed(String group)
{
return true;
Map<String, Float> featureOrder = null;
- protected PropertyChangeSupport changeSupport = new PropertyChangeSupport(
- this);
-
protected AlignViewportI av;
+ private PropertyChangeSupport changeSupport = new PropertyChangeSupport(
+ this);
+
@Override
public AlignViewportI getViewport()
{
{
firing = Boolean.TRUE;
findAllFeatures(true); // add all new features as visible
- changeSupport.firePropertyChange("changeSupport", null, null);
+ notifyFeaturesChanged();
firing = Boolean.FALSE;
}
}
}
@Override
+ public void notifyFeaturesChanged()
+ {
+ changeSupport.firePropertyChange("changeSupport", null, null);
+ }
+
+ @Override
public List<SequenceFeature> findFeaturesAtColumn(SequenceI sequence, int column)
{
/*
public class FeaturesDisplayed implements FeaturesDisplayedI
{
- private Set<String> featuresDisplayed = new HashSet<String>();
+ private Set<String> featuresDisplayed = new HashSet<>();
- private Set<String> featuresRegistered = new HashSet<String>();
+ private Set<String> featuresRegistered = new HashSet<>();
public FeaturesDisplayed(FeaturesDisplayedI featuresDisplayed2)
{
}
@Override
+ public void setHidden(String featureType)
+ {
+ featuresDisplayed.remove(featureType);
+ featuresRegistered.add(featureType);
+ }
+
+ @Override
public boolean isRegistered(String type)
{
return featuresRegistered.contains(type);