From 55e30fc5792fa3cc0dc7eb69513c4e62966f5785 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 16 Nov 2022 11:26:47 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-83391=20=E9=A1=B6=E9=83=A8=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E9=9D=A2=E6=9D=BF=E4=BD=93=E9=AA=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=20=E4=BA=A4=E4=BA=92=E6=9B=B4=E6=96=B0=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=81=94=E5=8A=A8=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/ispinner/UISpinner.java | 9 ++++++++ .../ui/topparam/MobileTopParamPane.java | 21 ++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) 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 4a722fc50d..18207011fe 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 @@ -312,6 +312,15 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver componentInitListeners(); } + /** + * 设置最大值 + * @param maxValue 最大值 + */ + public void setMaxValue(double maxValue) { + this.maxValue = maxValue; + textField.setMaxValue(maxValue); + } + private void componentInitListeners() { preButton.addActionListener(new ActionListener() { @Override diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/topparam/MobileTopParamPane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/topparam/MobileTopParamPane.java index f367365f75..6bef041371 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/topparam/MobileTopParamPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/topparam/MobileTopParamPane.java @@ -11,15 +11,20 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.mobile.impl.MobileTopParamStyle; import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.Component; import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; public class MobileTopParamPane extends BasicBeanPane { private UICheckBox autoCommitCheckBox; private UISpinner maxDirectShowCountSpinner; private UILabel showCountTextField; private static final int MAX_VALUE = 4; + private static final int MAX_VALUE_AUTO = 3; private static final int MIN_VALUE = 0; private static final int DEFAULT_DIERTA = 1; private static final int DEFAULT_VALUE = 0; @@ -34,7 +39,7 @@ public class MobileTopParamPane extends BasicBeanPane { JPanel panel = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Plugin-TopParam_Setting")); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); autoCommitCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Plugin-TopParam_AutoCommit"), true); - maxDirectShowCountSpinner = new UISpinner(MIN_VALUE, MAX_VALUE, DEFAULT_DIERTA, DEFAULT_VALUE); + maxDirectShowCountSpinner = new UISpinner(MIN_VALUE, MAX_VALUE_AUTO, DEFAULT_DIERTA, DEFAULT_VALUE); showCountTextField = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Show_Count")); Component[][] components = {{autoCommitCheckBox},{showCountTextField, maxDirectShowCountSpinner}}; double p = TableLayout.PREFERRED; @@ -44,6 +49,20 @@ public class MobileTopParamPane extends BasicBeanPane { JPanel paraPane = TableLayoutHelper.createCommonTableLayoutPane(components, rowSize, columnSize, GAP); panel.add(paraPane); this.add(panel, BorderLayout.CENTER); + + autoCommitCheckBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (autoCommitCheckBox.isSelected()) { + maxDirectShowCountSpinner.setMaxValue(MAX_VALUE_AUTO); + if (maxDirectShowCountSpinner.getValue() >= MAX_VALUE) { + maxDirectShowCountSpinner.setValue(MAX_VALUE_AUTO); + } + } else { + maxDirectShowCountSpinner.setMaxValue(MAX_VALUE); + } + } + }); } @Override