From: Jim Procter Date: Tue, 17 Sep 2019 10:53:42 +0000 (+0100) Subject: JAL-3432 hide the slider when validator has no min or max X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7de3af7bca846ded382b548fbcf358e36331aebc;p=jalview.git JAL-3432 hide the slider when validator has no min or max --- 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); } }