/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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
jalview.datamodel.AlignmentAnnotation currentAnnotation;
boolean adjusting = false;
+ /**
+ * enabled if the user is dragging the slider - try to keep updates to a minimun
+ */
+ boolean sliderDragging = false;
public AnnotationColourChooser(AlignViewport av, final AlignmentPanel ap)
{
if (!adjusting)
{
thresholdValue.setText(((float) slider.getValue() / 1000f) + "");
- valueChanged();
+ valueChanged(!sliderDragging);
}
}
});
slider.addMouseListener(new MouseAdapter()
{
+ @Override
+ public void mousePressed(MouseEvent e)
+ {
+ sliderDragging=true;
+ super.mousePressed(e);
+ }
+
+ @Override
+ public void mouseDragged(MouseEvent e)
+ {
+ sliderDragging=true;
+ super.mouseDragged(e);
+ }
public void mouseReleased(MouseEvent evt)
{
+ if (sliderDragging)
+ {
+ sliderDragging=false;
+ valueChanged(true);
+ }
ap.paintAlignment(true);
}
});
System.arraycopy(anmap, 0, annmap, 0, annmap.length);
return list;
}
-
private void setDefaultMinMax()
{
minColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN",
}
}
- public void valueChanged()
+ public void valueChanged(boolean updateAllAnnotation)
{
if (currentColours.isSelected()
&& !(av.getGlobalColourScheme() instanceof AnnotationColourGradient))
{
changeColour();
}
-
currentAnnotation.threshold.value = (float) slider.getValue() / 1000f;
+ propagateSeqAssociatedThreshold(updateAllAnnotation);
ap.paintAlignment(false);
}
+ private void propagateSeqAssociatedThreshold(boolean allAnnotation)
+ {
+ if (currentAnnotation.sequenceRef == null
+ || currentAnnotation.threshold == null)
+ {
+ return;
+ }
+ // TODO: JAL-1327 only update visible annotation thresholds if allAnnotation is false, since we only need to provide a quick visual indicator
+
+ float thr = currentAnnotation.threshold.value;
+ for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
+ {
+ AlignmentAnnotation aa = av.getAlignment().getAlignmentAnnotation()[i];
+ if (aa.label.equals(currentAnnotation.label))
+ {
+ aa.threshold.value = thr;
+ }
+ }
+ }
+
public void currentColours_actionPerformed(ActionEvent e)
{
if (currentColours.isSelected())