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
JAL-1563 JAL-2071 Update and completed implementation for UniProt FTS support
[jalview.git]
/
src
/
jalview
/
gui
/
FeatureColourChooser.java
diff --git
a/src/jalview/gui/FeatureColourChooser.java
b/src/jalview/gui/FeatureColourChooser.java
index
4f5e7ea
..
064d58b
100644
(file)
--- a/
src/jalview/gui/FeatureColourChooser.java
+++ b/
src/jalview/gui/FeatureColourChooser.java
@@
-76,9
+76,11
@@
public class FeatureColourChooser extends JalviewDialog
boolean adjusting = false;
boolean adjusting = false;
- private float min;
+ final private float min;
- private float max;
+ final private float max;
+
+ final private float scaleFactor;
String type = null;
String type = null;
@@
-107,7
+109,7
@@
public class FeatureColourChooser extends JalviewDialog
{
if (!adjusting)
{
{
if (!adjusting)
{
- thresholdValue.setText((slider.getValue() / 1000f) + "");
+ thresholdValue.setText((slider.getValue() / scaleFactor) + "");
valueChanged();
}
}
valueChanged();
}
}
@@
-128,6
+130,14
@@
public class FeatureColourChooser extends JalviewDialog
float mm[] = ((float[][]) fr.getMinMax().get(type))[0];
min = mm[0];
max = mm[1];
float mm[] = ((float[][]) fr.getMinMax().get(type))[0];
min = mm[0];
max = mm[1];
+
+ /*
+ * ensure scale factor allows a scaled range with
+ * 10 integer divisions ('ticks'); if we have got here,
+ * we should expect that max != min
+ */
+ scaleFactor = (max == min) ? 1f : 100f / (max - min);
+
oldcs = fr.getFeatureColours().get(type);
if (oldcs instanceof GraduatedColor)
{
oldcs = fr.getFeatureColours().get(type);
if (oldcs instanceof GraduatedColor)
{
@@
-185,17
+195,6
@@
public class FeatureColourChooser extends JalviewDialog
waitForInput();
}
waitForInput();
}
- public FeatureColourChooser()
- {
- try
- {
- jbInit();
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
private void jbInit() throws Exception
{
private void jbInit() throws Exception
{
@@
-441,11
+440,11
@@
public class FeatureColourChooser extends JalviewDialog
adjusting = true;
acg.setThresh(threshline.value);
adjusting = true;
acg.setThresh(threshline.value);
- float range = max * 1000f - min * 1000f;
+ float range = (max - min) * scaleFactor;
- slider.setMinimum((int) (min * 1000));
- slider.setMaximum((int) (max * 1000));
- slider.setValue((int) (threshline.value * 1000));
+ slider.setMinimum((int) (min * scaleFactor));
+ slider.setMaximum((int) (max * scaleFactor));
+ slider.setValue((int) (threshline.value * scaleFactor));
thresholdValue.setText(threshline.value + "");
slider.setMajorTickSpacing((int) (range / 10f));
slider.setEnabled(true);
thresholdValue.setText(threshline.value + "");
slider.setMajorTickSpacing((int) (range / 10f));
slider.setEnabled(true);
@@
-545,7
+544,7
@@
public class FeatureColourChooser extends JalviewDialog
try
{
float f = Float.parseFloat(thresholdValue.getText());
try
{
float f = Float.parseFloat(thresholdValue.getText());
- slider.setValue((int) (f * 1000));
+ slider.setValue((int) (f * scaleFactor));
threshline.value = f;
} catch (NumberFormatException ex)
{
threshline.value = f;
} catch (NumberFormatException ex)
{
@@
-554,7
+553,7
@@
public class FeatureColourChooser extends JalviewDialog
public void valueChanged()
{
public void valueChanged()
{
- threshline.value = slider.getValue() / 1000f;
+ threshline.value = slider.getValue() / scaleFactor;
cs.setThresh(threshline.value);
changeColour();
ap.paintAlignment(false);
cs.setThresh(threshline.value);
changeColour();
ap.paintAlignment(false);