From 7de3af7bca846ded382b548fbcf358e36331aebc Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 17 Sep 2019 11:53:42 +0100 Subject: [PATCH] JAL-3432 hide the slider when validator has no min or max --- src/jalview/gui/OptsAndParamsPage.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/jalview/gui/OptsAndParamsPage.java b/src/jalview/gui/OptsAndParamsPage.java index 5b411b4..d66ec1c 100644 --- a/src/jalview/gui/OptsAndParamsPage.java +++ b/src/jalview/gui/OptsAndParamsPage.java @@ -903,6 +903,11 @@ public class OptsAndParamsPage return valueField.getText().trim(); } + if (validator.getMin() == null || validator.getMax() == null) + { + slider.setVisible(false); + } + valueField.setText(valueField.getText().trim()); /* @@ -951,7 +956,7 @@ public class OptsAndParamsPage { slider.setVisible(false); } - return new Integer(iVal); + return Integer.valueOf(iVal); } if (isLogarithmicParameter) @@ -960,7 +965,7 @@ public class OptsAndParamsPage try { double eValue = Double.valueOf(valueField.getText()); - dVal = Math.log(eValue) * sliderScaleFactor; + dVal = Math.log(eValue); } catch (Exception e) { // shouldn't be possible here @@ -973,14 +978,15 @@ public class OptsAndParamsPage * sliderScaleFactor; double scaleMax = Math.log(validator.getMax().doubleValue()) * sliderScaleFactor; - slider.getModel().setRangeProperties((int) (dVal), 1, + slider.getModel().setRangeProperties( + (int) (sliderScaleFactor * dVal), 1, (int) scaleMin, 1 + (int) scaleMax, true); } else { slider.setVisible(false); } - return new Double(dVal); + return Double.valueOf(dVal); } float fVal = 0f; @@ -1005,7 +1011,7 @@ public class OptsAndParamsPage { slider.setVisible(false); } - return new Float(fVal); + return Float.valueOf(fVal); } } -- 1.7.10.2