*/
public class FeatureRenderer
{
+ AlignmentPanel ap;
AlignViewport av;
Color resBoxColour;
float transparency = 1.0f;
* @param av
* DOCUMENT ME!
*/
- public FeatureRenderer(AlignViewport av)
+ public FeatureRenderer(AlignmentPanel ap)
{
- this.av = av;
+ this.ap = ap;
+ this.av = ap.av;
}
+
public void transferSettings(FeatureRenderer fr)
{
- renderOrder = fr.renderOrder;
- featureGroups = fr.featureGroups;
- featureColours = fr.featureColours;
- transparency = fr.transparency;
- featureOrder = fr.featureOrder;
+ this.renderOrder = fr.renderOrder;
+ this.featureGroups = fr.featureGroups;
+ this.featureColours = fr.featureColours;
+ this.transparency = fr.transparency;
+ this.featureOrder = fr.featureOrder;
}
BufferedImage offscreenImage;
if (featureGroups != null
&& sequenceFeatures[sfindex].featureGroup != null
- &&
+ &&
sequenceFeatures[sfindex].featureGroup.length()!=0
&& featureGroups.containsKey(sequenceFeatures[sfindex].featureGroup)
&&
{
if (!av.featuresDisplayed.containsKey(features[index].getType()))
{
+ if(featureGroups.containsKey(features[index].getType()))
+ {
+ boolean visible = ( (Boolean) featureGroups.get(
+ features[index].featureGroup)).booleanValue();
+
+ if(!visible)
+ {
+ System.out.println(features[index].featureGroup
+ +" not visible");
+ index++;
+ continue;
+ }
+ }
+
+
if (! (features[index].begin == 0 && features[index].end == 0))
{
// If beginning and end are 0, the feature is for the whole sequence
}
public Color getColour(String featureType)
{
- if (featureColours.get(featureType) == null)
+ if (!featureColours.containsKey(featureType))
{
jalview.schemes.UserColourScheme ucs = new
jalview.schemes.UserColourScheme();
static String lastFeatureGroupAdded;
static String lastDescriptionAdded;
- public boolean createNewFeatures(SequenceI[] sequences,
- SequenceFeature[] features)
- {
- return amendFeatures(sequences, features, true, null);
- }
-
int featureIndex = 0;
boolean amendFeatures(final SequenceI[] sequences,
final SequenceFeature[] features,
boolean newFeatures,
final AlignmentPanel ap)
{
- findAllFeatures();
featureIndex = 0;
{
public void mousePressed(MouseEvent evt)
{
- colour.setBackground(
- JColorChooser.showDialog(Desktop.desktop,
- "Select Feature Colour",
- colour.getBackground()));
+ Color col = JColorChooser.showDialog(Desktop.desktop,
+ "Select Feature Colour",
+ colour.getBackground());
+ if (col != null)
+ colour.setBackground(col);
+
}
});
sf.type = lastFeatureAdded;
sf.featureGroup = lastFeatureGroupAdded;
sf.description = lastDescriptionAdded;
+
setColour(sf.type, colour.getBackground());
+ av.featuresDisplayed.put(sf.type,
+ new Integer(colour.getBackground().getRGB()));
+
try
{
sf.begin = ( (Integer) start.getValue()).intValue();
ffile.parseDescriptionHTML(sf, false);
}
}
- else
+ else //NEW FEATURES ADDED
{
if (reply == JOptionPane.OK_OPTION
- && name.getText() != null
- && source.getText() != null)
+ && lastFeatureAdded.length()>0)
{
for (int i = 0; i < sequences.length; i++)
{
features[i].type = lastFeatureAdded;
- features[i].featureGroup = lastFeatureGroupAdded;
+ if (lastFeatureGroupAdded!=null)
+ features[i].featureGroup = lastFeatureGroupAdded;
features[i].description = lastDescriptionAdded;
sequences[i].addSequenceFeature(features[i]);
ffile.parseDescriptionHTML(features[i], false);
av.featuresDisplayed = new Hashtable();
}
- if (featureGroups == null)
+ if (lastFeatureGroupAdded != null)
{
- featureGroups = new Hashtable();
+ if (featureGroups == null)
+ featureGroups = new Hashtable();
+ featureGroups.put(lastFeatureGroupAdded, new Boolean(true));
}
-
Color col = colour.getBackground();
setColour(lastFeatureAdded, colour.getBackground());
-
- if(lastFeatureGroupAdded!=null)
- {
- featureGroups.put(lastFeatureGroupAdded, new Boolean(true));
- av.featuresDisplayed.put(lastFeatureGroupAdded,
+ av.featuresDisplayed.put(lastFeatureAdded,
new Integer(col.getRGB()));
- }
- findAllFeatures();
+
+ findAllFeatures(false);
+
+ ap.paintAlignment(true);
+
return true;
}
}
}
- findAllFeatures();
+ ap.paintAlignment(true);
return true;
}