git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove variables not used
[jalview.git]
/
src
/
jalview
/
gui
/
AnnotationColourChooser.java
diff --git
a/src/jalview/gui/AnnotationColourChooser.java
b/src/jalview/gui/AnnotationColourChooser.java
index
49e835d
..
f499217
100755
(executable)
--- a/
src/jalview/gui/AnnotationColourChooser.java
+++ b/
src/jalview/gui/AnnotationColourChooser.java
@@
-1,6
+1,6
@@
/*
\r
* Jalview - A Sequence Alignment Editor and Viewer
\r
/*
\r
* Jalview - A Sequence Alignment Editor and Viewer
\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
+* Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
*
\r
* This program is free software; you can redistribute it and/or
\r
* modify it under the terms of the GNU General Public License
\r
*
\r
* This program is free software; you can redistribute it and/or
\r
* modify it under the terms of the GNU General Public License
\r
@@
-36,6
+36,7
@@
public class AnnotationColourChooser
ColourSchemeI oldcs;
\r
Hashtable oldgroupColours;
\r
jalview.datamodel.AlignmentAnnotation currentAnnotation;
\r
ColourSchemeI oldcs;
\r
Hashtable oldgroupColours;
\r
jalview.datamodel.AlignmentAnnotation currentAnnotation;
\r
+ boolean adjusting = false;
\r
\r
public AnnotationColourChooser(AlignViewport av, AlignmentPanel ap)
\r
{
\r
\r
public AnnotationColourChooser(AlignViewport av, AlignmentPanel ap)
\r
{
\r
@@
-48,7
+49,8
@@
public class AnnotationColourChooser
for (int g = 0; g < allGroups.size(); g++)
\r
{
\r
sg = (SequenceGroup) allGroups.get(g);
\r
for (int g = 0; g < allGroups.size(); g++)
\r
{
\r
sg = (SequenceGroup) allGroups.get(g);
\r
- oldgroupColours.put(sg, sg.cs);
\r
+ if(sg.cs!=null)
\r
+ oldgroupColours.put(sg, sg.cs);
\r
}
\r
}
\r
this.av = av;
\r
}
\r
}
\r
this.av = av;
\r
@@
-56,7
+58,7
@@
public class AnnotationColourChooser
frame = new JInternalFrame();
\r
frame.setContentPane(this);
\r
frame.setLayer(JLayeredPane.PALETTE_LAYER);
\r
frame = new JInternalFrame();
\r
frame.setContentPane(this);
\r
frame.setLayer(JLayeredPane.PALETTE_LAYER);
\r
- Desktop.addInternalFrame(frame, "Colour by Annotation", 480, 145, false);
\r
+ Desktop.addInternalFrame(frame, "Colour by Annotation", 480, 145);
\r
\r
try
\r
{
\r
\r
try
\r
{
\r
@@
-69,8
+71,11
@@
public class AnnotationColourChooser
{
\r
public void stateChanged(ChangeEvent evt)
\r
{
\r
{
\r
public void stateChanged(ChangeEvent evt)
\r
{
\r
- thresholdValue.setText( ( (float) slider.getValue() / 1000f) + "");
\r
- valueChanged();
\r
+ if(!adjusting)
\r
+ {
\r
+ thresholdValue.setText( ( (float) slider.getValue() / 1000f) + "");
\r
+ valueChanged();
\r
+ }
\r
}
\r
});
\r
\r
}
\r
});
\r
\r
@@
-89,6
+94,7
@@
public class AnnotationColourChooser
maxColour.setBackground(Color.red);
\r
}
\r
\r
maxColour.setBackground(Color.red);
\r
}
\r
\r
+ adjusting = true;
\r
for (int i = 0; i < av.alignment.getAlignmentAnnotation().length; i++)
\r
{
\r
if (av.alignment.getAlignmentAnnotation()[i].graph > 0)
\r
for (int i = 0; i < av.alignment.getAlignmentAnnotation().length; i++)
\r
{
\r
if (av.alignment.getAlignmentAnnotation()[i].graph > 0)
\r
@@
-99,6
+105,10
@@
public class AnnotationColourChooser
threshold.addItem("Above Threshold");
\r
threshold.addItem("Below Threshold");
\r
\r
threshold.addItem("Above Threshold");
\r
threshold.addItem("Below Threshold");
\r
\r
+ adjusting = false;
\r
+
\r
+ changeColour();
\r
+
\r
}
\r
\r
public AnnotationColourChooser()
\r
}
\r
\r
public AnnotationColourChooser()
\r
@@
-181,10
+191,12
@@
public class AnnotationColourChooser
thresholdValue_actionPerformed(e);
\r
}
\r
});
\r
thresholdValue_actionPerformed(e);
\r
}
\r
});
\r
+ slider.setPaintLabels(false);
\r
slider.setPaintTicks(true);
\r
slider.setBackground(Color.white);
\r
slider.setEnabled(false);
\r
slider.setOpaque(false);
\r
slider.setPaintTicks(true);
\r
slider.setBackground(Color.white);
\r
slider.setEnabled(false);
\r
slider.setOpaque(false);
\r
+ slider.setPreferredSize(new Dimension(150, 32));
\r
thresholdValue.setEnabled(false);
\r
thresholdValue.setColumns(10);
\r
jPanel3.setBackground(Color.white);
\r
thresholdValue.setEnabled(false);
\r
thresholdValue.setColumns(10);
\r
jPanel3.setBackground(Color.white);
\r
@@
-253,7
+265,7
@@
public class AnnotationColourChooser
void changeColour()
\r
{
\r
// Check if combobox is still adjusting
\r
void changeColour()
\r
{
\r
// Check if combobox is still adjusting
\r
- if (threshold.getSelectedIndex() == -1)
\r
+ if (adjusting)
\r
return;
\r
\r
// We removed the non-graph annotations when filling the combobox
\r
return;
\r
\r
// We removed the non-graph annotations when filling the combobox
\r
@@
-278,9
+290,11
@@
public class AnnotationColourChooser
else if (threshold.getSelectedItem().equals("Below Threshold"))
\r
aboveThreshold = AnnotationColourGradient.BELOW_THRESHOLD;
\r
\r
else if (threshold.getSelectedItem().equals("Below Threshold"))
\r
aboveThreshold = AnnotationColourGradient.BELOW_THRESHOLD;
\r
\r
+ slider.setEnabled(true);
\r
+ thresholdValue.setEnabled(true);
\r
+
\r
if (aboveThreshold == AnnotationColourGradient.NO_THRESHOLD)
\r
{
\r
if (aboveThreshold == AnnotationColourGradient.NO_THRESHOLD)
\r
{
\r
- currentAnnotation.threshold = null;
\r
slider.setEnabled(false);
\r
thresholdValue.setEnabled(false);
\r
thresholdValue.setText("");
\r
slider.setEnabled(false);
\r
thresholdValue.setEnabled(false);
\r
thresholdValue.setText("");
\r
@@
-293,6
+307,11
@@
public class AnnotationColourChooser
currentAnnotation.graphMin) / 2f,
\r
"Threshold",
\r
Color.black));
\r
currentAnnotation.graphMin) / 2f,
\r
"Threshold",
\r
Color.black));
\r
+ }
\r
+
\r
+ if(aboveThreshold != AnnotationColourGradient.NO_THRESHOLD)
\r
+ {
\r
+ adjusting = true;
\r
float range = currentAnnotation.graphMax * 1000 -
\r
currentAnnotation.graphMin * 1000;
\r
\r
float range = currentAnnotation.graphMax * 1000 -
\r
currentAnnotation.graphMin * 1000;
\r
\r
@@
-301,9
+320,9
@@
public class AnnotationColourChooser
slider.setValue( (int) (currentAnnotation.threshold.value * 1000));
\r
thresholdValue.setText(currentAnnotation.threshold.value + "");
\r
slider.setMajorTickSpacing( (int) (range / 10f));
\r
slider.setValue( (int) (currentAnnotation.threshold.value * 1000));
\r
thresholdValue.setText(currentAnnotation.threshold.value + "");
\r
slider.setMajorTickSpacing( (int) (range / 10f));
\r
- slider.setMinorTickSpacing( (int) (range / 100f));
\r
slider.setEnabled(true);
\r
thresholdValue.setEnabled(true);
\r
slider.setEnabled(true);
\r
thresholdValue.setEnabled(true);
\r
+ adjusting = false;
\r
}
\r
\r
AnnotationColourGradient acg = null;
\r
}
\r
\r
AnnotationColourGradient acg = null;
\r
@@
-396,8
+415,6
@@
public class AnnotationColourChooser
\r
public void annotations_actionPerformed(ActionEvent e)
\r
{
\r
\r
public void annotations_actionPerformed(ActionEvent e)
\r
{
\r
- if(currentAnnotation!=null)
\r
- currentAnnotation.threshold = null;
\r
changeColour();
\r
}
\r
\r
changeColour();
\r
}
\r
\r
@@
-419,6
+436,12
@@
public class AnnotationColourChooser
\r
public void valueChanged()
\r
{
\r
\r
public void valueChanged()
\r
{
\r
+ if (currentColours.isSelected()
\r
+ && !(av.getGlobalColourScheme() instanceof AnnotationColourGradient))
\r
+ {
\r
+ changeColour();
\r
+ }
\r
+
\r
currentAnnotation.threshold.value = (float)slider.getValue()/1000f;
\r
ap.repaint();
\r
}
\r
currentAnnotation.threshold.value = (float)slider.getValue()/1000f;
\r
ap.repaint();
\r
}
\r