From d5a216c38e99ab3e294233b9fab4d85ecc78bed9 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 14 Oct 2019 11:15:29 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=901004=E5=9B=9E=E5=BD=92=E3=80=91?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E9=9D=A2=E6=9D=BF-=E8=B6=85=E7=BA=A7?= =?UTF-8?q?=E9=93=BE=E6=8E=A5-=E7=BD=91=E7=BB=9C=E6=8A=A5=E8=A1=A8-?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E6=A1=86=E8=AE=BE=E7=BD=AE=20=E7=A6=81?= =?UTF-8?q?=E6=AD=A2=E8=BE=93=E5=85=A5=E8=B4=9F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/gui/itextfield/UINumberField.java | 8 ++++++++ .../com/fr/design/hyperlink/ReportletHyperNorthPane.java | 2 ++ 2 files changed, 10 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java index 1ffb3c1dde..f71a11f43d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java @@ -35,6 +35,7 @@ public class UINumberField extends UITextField { private double maxValue = Double.MAX_VALUE; private boolean isContentChanged = false; + private boolean fillNegativeNumbers = true; public UINumberField() { this(MAX_INTEGERLENGTH_32, MAX_DECIMALLENGTH); @@ -62,6 +63,10 @@ public class UINumberField extends UITextField { initListener(); } + public void canFillNegativeNumber(boolean canFillNegativeNumbers) { + this.fillNegativeNumbers = canFillNegativeNumbers; + } + public int getMaxIntegerLength() { return maxIntegerLength; } @@ -185,6 +190,9 @@ public class UINumberField extends UITextField { // kunsnat: 这种限制输入 有个不好的地方, 比如删除时: 10.1 最大值限定100, 那么就删除中间的小数点之后变为101, 超出了100. // 但是直接限制不能删除中间类似小数点, 那么也可能遇到: 最小值10 , 从100变化到其中的19, 就很难.. private boolean notChange(String strNew) { + if (!fillNegativeNumbers && strNew.contains("-")) { + return true; + } boolean noChange = false; boolean isMinus = strNew.startsWith("-"); strNew = strNew.replaceFirst("-", StringUtils.EMPTY); // 控制能输入负数 diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java index c1e454f1b0..43710cd0f2 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java @@ -368,6 +368,7 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane