/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
import java.awt.event.*;
-import jalview.appletgui.FeatureSettings.MyCheckbox;
import jalview.datamodel.*;
import jalview.schemes.AnnotationColourGradient;
import jalview.schemes.GraduatedColor;
featureGroups = fr.featureGroups;
featureColours = fr.featureColours;
transparency = fr.transparency;
+ if (av != null && fr.av != null && fr.av != av)
+ {
+ if (fr.av.featuresDisplayed != null)
+ {
+ if (av.featuresDisplayed == null)
+ {
+ av.featuresDisplayed = new Hashtable();
+ }
+ else
+ {
+ av.featuresDisplayed.clear();
+ }
+ Enumeration en = fr.av.featuresDisplayed.keys();
+ while (en.hasMoreElements())
+ {
+ av.featuresDisplayed.put(en.nextElement(), Boolean.TRUE);
+ }
+ }
+ }
}
static String lastFeatureAdded;
else if (sequenceFeatures[sfindex].type.equals("disulfide bond"))
{
- renderFeature(g, seq, seq
- .findIndex(sequenceFeatures[sfindex].begin) - 1, seq
- .findIndex(sequenceFeatures[sfindex].begin) - 1,
+ renderFeature(g, seq,
+ seq.findIndex(sequenceFeatures[sfindex].begin) - 1,
+ seq.findIndex(sequenceFeatures[sfindex].begin) - 1,
getColour(sequenceFeatures[sfindex])
// new Color(((Integer) av.featuresDisplayed
// .get(sequenceFeatures[sfindex].type)).intValue())
, start, end, y1);
- renderFeature(g, seq, seq
- .findIndex(sequenceFeatures[sfindex].end) - 1, seq
- .findIndex(sequenceFeatures[sfindex].end) - 1,
+ renderFeature(g, seq,
+ seq.findIndex(sequenceFeatures[sfindex].end) - 1,
+ seq.findIndex(sequenceFeatures[sfindex].end) - 1,
getColour(sequenceFeatures[sfindex])
// new Color(((Integer) av.featuresDisplayed
// .get(sequenceFeatures[sfindex].type)).intValue())
{
if (showFeature(sequenceFeatures[sfindex]))
{
- renderFeature(g, seq, seq
- .findIndex(sequenceFeatures[sfindex].begin) - 1, seq
- .findIndex(sequenceFeatures[sfindex].end) - 1,
+ renderFeature(g, seq,
+ seq.findIndex(sequenceFeatures[sfindex].begin) - 1,
+ seq.findIndex(sequenceFeatures[sfindex].end) - 1,
getColour(sequenceFeatures[sfindex]), start, end, y1);
}
}
}
Hashtable minmax = null;
+
/**
* Called when alignment in associated view has new/modified features to
* discover and display.
lastSeq = null;
findAllFeatures();
}
+
/**
* find all features on the alignment
*/
av.featuresDisplayed = new Hashtable();
Vector allfeatures = new Vector();
minmax = new Hashtable();
-
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ AlignmentI alignment = av.getAlignment();
+ for (int i = 0; i < alignment.getHeight(); i++)
{
- SequenceFeature[] features = av.alignment.getSequenceAt(i)
+ SequenceFeature[] features = alignment.getSequenceAt(i)
.getSequenceFeatures();
if (features == null)
{
if (getColour(features[index].getType()) == null)
{
- featureColours.put(features[index].getType(), ucs
- .createColourFromName(features[index].getType()));
+ featureColours.put(features[index].getType(),
+ ucs.createColourFromName(features[index].getType()));
}
av.featuresDisplayed.put(features[index].getType(), new Integer(
for (int i = 0; i < toset.length; i++)
{
Object st = featureGroups.get(toset[i]);
+ featureGroups.put(toset[i], new Boolean(visible));
if (st != null)
{
- featureGroups.put(toset[i], new Boolean(visible));
rdrw = rdrw || (visible != ((Boolean) st).booleanValue());
}
}
}
}
+ ArrayList<String> hiddenGroups = new ArrayList<String>();
+
/**
* analyse alignment for groups and hash tables (used to be embedded in
* FeatureSettings.setTableData)
{
featureGroups = new Hashtable();
}
- Vector allFeatures = new Vector();
- Vector allGroups = new Vector();
+ hiddenGroups = new ArrayList<String>();
+ hiddenGroups.addAll(featureGroups.keySet());
+ ArrayList allFeatures = new ArrayList();
+ ArrayList allGroups = new ArrayList();
SequenceFeature[] tmpfeatures;
String group;
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ AlignmentI alignment = av.getAlignment();
+ for (int i = 0; i < alignment.getHeight(); i++)
{
- if (av.alignment.getSequenceAt(i).getSequenceFeatures() == null)
+ if (alignment.getSequenceAt(i).getSequenceFeatures() == null)
{
continue;
}
alignmentHasFeatures = true;
- tmpfeatures = av.alignment.getSequenceAt(i).getSequenceFeatures();
+ tmpfeatures = alignment.getSequenceAt(i).getSequenceFeatures();
int index = 0;
while (index < tmpfeatures.length)
{
if (tmpfeatures[index].getFeatureGroup() != null)
{
group = tmpfeatures[index].featureGroup;
+ // Remove group from the hiddenGroup list
+ hiddenGroups.remove(group);
if (!allGroups.contains(group))
{
- allGroups.addElement(group);
+ allGroups.add(group);
boolean visible = true;
if (featureGroups.containsKey(group))
if (!allFeatures.contains(tmpfeatures[index].getType()))
{
- allFeatures.addElement(tmpfeatures[index].getType());
+ allFeatures.add(tmpfeatures[index].getType());
}
index++;
}
Vector allFeatures = new Vector();
SequenceFeature[] tmpfeatures;
String group;
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ AlignmentI alignment = av.getAlignment();
+ for (int i = 0; i < alignment.getHeight(); i++)
{
- if (av.alignment.getSequenceAt(i).getSequenceFeatures() == null)
+ if (alignment.getSequenceAt(i).getSequenceFeatures() == null)
{
continue;
}
alignmentHasFeatures = true;
- tmpfeatures = av.alignment.getSequenceAt(i).getSequenceFeatures();
+ tmpfeatures = alignment.getSequenceAt(i).getSequenceFeatures();
int index = 0;
while (index < tmpfeatures.length)
{