From d99b7c3c0e5d4fd001a724b1309885e583541e32 Mon Sep 17 00:00:00 2001 From: Yvan Date: Mon, 21 Sep 2020 13:45:15 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-40154=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=85=B1=E4=BA=AB=E6=95=B0=E6=8D=AE=E9=9B=86=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E5=88=B0=E7=A3=81=E7=9B=98=E8=AE=B0=E5=BD=95=E6=95=B0=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E6=A1=86=E5=A4=AA=E7=9F=AD=201.=20bug=E5=8E=9F?= =?UTF-8?q?=E5=9B=A0=EF=BC=9A=E4=B9=8B=E5=89=8D=E7=9A=84UISpinner=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E5=AD=97=E6=A1=86=E9=BB=98=E8=AE=A4=E7=9A=84?= =?UTF-8?q?columns=E5=8F=AA=E6=9C=892=EF=BC=8C=E6=89=80=E4=BB=A5=E5=BD=93?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=95=B0=E5=AD=97=E8=B6=85=E8=BF=87=E4=B8=89?= =?UTF-8?q?=E4=BD=8D=E6=95=B0=E6=97=B6=EF=BC=8C=E4=BC=9A=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E5=85=A8=202.=20=E4=BF=AE=E6=94=B9=E6=96=B9=E6=A1=88?= =?UTF-8?q?=EF=BC=9A=E4=B8=8E=E4=BA=A7=E5=93=81=E5=8F=8A=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E5=90=8E=EF=BC=8C=E4=B8=BAUISpinner=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=B8=80=E7=A7=8D=E6=9E=84=E9=80=A0=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=8C=E5=8F=AF=E4=BB=A5=E6=8C=87=E5=AE=9A=E5=85=B6=E6=95=B0?= =?UTF-8?q?=E5=AD=97=E6=A1=86=E7=9A=84columns=EF=BC=8C=E5=B0=86MaxMemRowCo?= =?UTF-8?q?untPanel=E4=B8=AD=E7=9A=84UISpinner=E7=9A=84columns=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=B8=BA4=EF=BC=8C=E5=8D=B3=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E6=9C=80=E5=A4=9A=E5=B1=95=E7=A4=BA5=E4=BD=8D=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tabledatapane/MaxMemRowCountPanel.java | 2 +- .../com/fr/design/gui/ispinner/UISpinner.java | 26 ++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java index d43e6bdee..2df6cda02 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java @@ -72,7 +72,7 @@ public class MaxMemRowCountPanel extends UIToolbar { this.setBackground(UIConstants.NORMAL_BACKGROUND); switchCache = new UIComboBox(CACHE_LIST); switchCache.addActionListener(switchStateL); - numberSpinner = new UISpinner(0, Integer.MAX_VALUE, 1); + numberSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 4); } private void showAllPanel() { diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java index fb6752ac1..a418a2b37 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java @@ -30,6 +30,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver private static final int LEN = 13; private static final int WIDTH = 13; private static final int HEIGHT = 10; + private static final int DEFAULT_NUMBERFIELD_COLUMNS = 2; private UINumberField textField; private UIButton preButton; private UIButton nextButton; @@ -40,9 +41,26 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver private UIObserverListener uiObserverListener; private GlobalNameListener globalNameListener = null; private boolean lessMinValue = false; + /** + * Spinner内的数字文本框长度 + */ + private int numberFieldColumns; public UISpinner(double minValue, double maxValue, double dierta) { + init(minValue, maxValue, dierta); + } + + public UISpinner(double minValue, double maxValue, double dierta, double defaultValue) { + init(minValue, maxValue, dierta); + textField.setValue(defaultValue); + } + + public UISpinner(double minValue, double maxValue, double dierta, int numberFieldColumns) { + this.numberFieldColumns = numberFieldColumns; + init(minValue, maxValue, dierta); + } + private void init(double minValue, double maxValue, double dierta) { this.minValue = minValue; this.maxValue = maxValue; this.dierta = dierta; @@ -50,11 +68,6 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver iniListener(); } - public UISpinner(double minValue, double maxValue, double dierta, double defaultValue) { - this(minValue, maxValue, dierta); - textField.setValue(defaultValue); - } - private void iniListener() { if (shouldResponseChangeListener()) { this.addChangeListener(new ChangeListener() { @@ -308,7 +321,8 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver } protected UINumberField initNumberField() { - return new UINumberField(2) { + int columns = this.numberFieldColumns == 0 ? DEFAULT_NUMBERFIELD_COLUMNS : this.numberFieldColumns; + return new UINumberField(columns) { public boolean shouldResponseChangeListener() { return false; }