git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fd67556
)
JAL-2432 honour percentage checkbox when entering values in text box
author
Jim Procter
<jprocter@issues.jalview.org>
Wed, 3 May 2017 10:47:16 +0000
(11:47 +0100)
committer
Jim Procter
<jprocter@issues.jalview.org>
Wed, 3 May 2017 10:47:39 +0000
(11:47 +0100)
src/jalview/appletgui/AnnotationColumnChooser.java
patch
|
blob
|
history
src/jalview/appletgui/AnnotationRowFilter.java
patch
|
blob
|
history
src/jalview/gui/AnnotationColumnChooser.java
patch
|
blob
|
history
src/jalview/gui/AnnotationRowFilter.java
patch
|
blob
|
history
diff --git
a/src/jalview/appletgui/AnnotationColumnChooser.java
b/src/jalview/appletgui/AnnotationColumnChooser.java
index
36f8a84
..
77bb6bb
100644
(file)
--- a/
src/jalview/appletgui/AnnotationColumnChooser.java
+++ b/
src/jalview/appletgui/AnnotationColumnChooser.java
@@
-320,7
+320,7
@@
public class AnnotationColumnChooser extends AnnotationRowFilter implements
{
if (!adjusting)
{
{
if (!adjusting)
{
- thresholdValue.setText((slider.getValue() / 1000f) + "");
+ setThresholdValueText();
valueChanged(!sliderDragging);
}
}
valueChanged(!sliderDragging);
}
}
@@
-895,19
+895,8
@@
public class AnnotationColumnChooser extends AnnotationRowFilter implements
@Override
public void actionPerformed(ActionEvent evt)
{
@Override
public void actionPerformed(ActionEvent evt)
{
- if (evt.getSource() == thresholdValue)
- {
- try
- {
- float f = new Float(thresholdValue.getText()).floatValue();
- slider.setValue((int) (f * 1000));
- adjustmentValueChanged(null);
- } catch (NumberFormatException ex)
- {
- }
- }
- else if (evt.getSource() == ok)
+ if (evt.getSource() == ok)
{
ok_actionPerformed(null);
}
{
ok_actionPerformed(null);
}
diff --git
a/src/jalview/appletgui/AnnotationRowFilter.java
b/src/jalview/appletgui/AnnotationRowFilter.java
index
6ea0fed
..
315ce3b
100644
(file)
--- a/
src/jalview/appletgui/AnnotationRowFilter.java
+++ b/
src/jalview/appletgui/AnnotationRowFilter.java
@@
-133,21
+133,26
@@
public abstract class AnnotationRowFilter extends Panel
updateView();
}
updateView();
}
+ /**
+ * update the text field from the threshold slider. preserves state of
+ * 'adjusting' so safe to call in init.
+ */
protected void setThresholdValueText()
{
protected void setThresholdValueText()
{
+ boolean oldadj = adjusting;
adjusting = true;
if (percentThreshold.getState())
{
double scl = slider.getMaximum() - slider.getMinimum();
scl = (slider.getValue() - slider.getMinimum()) / scl;
adjusting = true;
if (percentThreshold.getState())
{
double scl = slider.getMaximum() - slider.getMinimum();
scl = (slider.getValue() - slider.getMinimum()) / scl;
- thresholdValue.setText(100 * scl + "");
+ thresholdValue.setText(100f * scl + "");
}
else
{
thresholdValue.setText((slider.getValue() / 1000f) + "");
}
thresholdValue.setCaretPosition(0);
}
else
{
thresholdValue.setText((slider.getValue() / 1000f) + "");
}
thresholdValue.setCaretPosition(0);
- adjusting = false;
+ adjusting = oldadj;
}
public void thresholdValue_actionPerformed(ActionEvent e)
}
public void thresholdValue_actionPerformed(ActionEvent e)
@@
-157,15
+162,15
@@
public abstract class AnnotationRowFilter extends Panel
float f = Float.parseFloat(thresholdValue.getText());
if (percentThreshold.getState())
{
float f = Float.parseFloat(thresholdValue.getText());
if (percentThreshold.getState())
{
- slider.setValue(slider.getMinimum()
- + ((int) ((f / 100f) * (slider.getMaximum() - slider
- .getMinimum()))));
+ int pos = slider.getMinimum()
+ + (int) ((slider.getMaximum() - slider.getMinimum()) * f / 100f);
+ slider.setValue(pos);
}
else
{
slider.setValue((int) (f * 1000));
}
}
else
{
slider.setValue((int) (f * 1000));
}
- updateView();
+ valueChanged(false);
} catch (NumberFormatException ex)
{
}
} catch (NumberFormatException ex)
{
}
diff --git
a/src/jalview/gui/AnnotationColumnChooser.java
b/src/jalview/gui/AnnotationColumnChooser.java
index
d0f1247
..
d5bc7d1
100644
(file)
--- a/
src/jalview/gui/AnnotationColumnChooser.java
+++ b/
src/jalview/gui/AnnotationColumnChooser.java
@@
-318,16
+318,7
@@
public class AnnotationColumnChooser extends AnnotationRowFilter implements
slider.setMaximum((int) (getCurrentAnnotation().graphMax * 1000));
slider.setValue((int) (getCurrentAnnotation().threshold.value * 1000));
slider.setMaximum((int) (getCurrentAnnotation().graphMax * 1000));
slider.setValue((int) (getCurrentAnnotation().threshold.value * 1000));
- if (percentThreshold.isSelected())
- {
- thresholdValue
- .setText(""
- + ((getCurrentAnnotation().threshold.value - getCurrentAnnotation().graphMin) * 100f / (getCurrentAnnotation().graphMax - getCurrentAnnotation().graphMin)));
- }
- else
- {
- thresholdValue.setText(getCurrentAnnotation().threshold.value + "");
- }
+ setThresholdValueText();
slider.setMajorTickSpacing((int) (range / 10f));
slider.setEnabled(true);
slider.setMajorTickSpacing((int) (range / 10f));
slider.setEnabled(true);
diff --git
a/src/jalview/gui/AnnotationRowFilter.java
b/src/jalview/gui/AnnotationRowFilter.java
index
1035a6c
..
a3ce528
100644
(file)
--- a/
src/jalview/gui/AnnotationRowFilter.java
+++ b/
src/jalview/gui/AnnotationRowFilter.java
@@
-129,8
+129,13
@@
public abstract class AnnotationRowFilter extends JPanel
});
}
});
}
+ /**
+ * update the text field from the threshold slider. preserves state of
+ * 'adjusting' so safe to call in init.
+ */
protected void setThresholdValueText()
{
protected void setThresholdValueText()
{
+ boolean oldadj = adjusting;
adjusting = true;
if (percentThreshold.isSelected())
{
adjusting = true;
if (percentThreshold.isSelected())
{
@@
-141,7
+146,7
@@
public abstract class AnnotationRowFilter extends JPanel
{
thresholdValue.setText((slider.getValue() / 1000f) + "");
}
{
thresholdValue.setText((slider.getValue() / 1000f) + "");
}
- adjusting = false;
+ adjusting = oldadj;
}
protected void addSliderMouseListeners()
{
}
protected void addSliderMouseListeners()
{
@@
-291,7
+296,7
@@
public abstract class AnnotationRowFilter extends JPanel
try
{
float f = Float.parseFloat(thresholdValue.getText());
try
{
float f = Float.parseFloat(thresholdValue.getText());
- if (percentThreshold.isEnabled())
+ if (percentThreshold.isSelected())
{
slider.setValue(slider.getMinimum()
+ ((int) ((f / 100f) * (slider.getMaximum() - slider
{
slider.setValue(slider.getMinimum()
+ ((int) ((f / 100f) * (slider.getMaximum() - slider