Browse Source

REPORT-83391 顶部参数面板体验优化 交互更新,增加联动效果

feature/x
Destiny.Lin 2 years ago
parent
commit
55e30fc579
  1. 9
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java
  2. 21
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/topparam/MobileTopParamPane.java

9
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(); componentInitListeners();
} }
/**
* 设置最大值
* @param maxValue 最大值
*/
public void setMaxValue(double maxValue) {
this.maxValue = maxValue;
textField.setMaxValue(maxValue);
}
private void componentInitListeners() { private void componentInitListeners() {
preButton.addActionListener(new ActionListener() { preButton.addActionListener(new ActionListener() {
@Override @Override

21
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 com.fr.form.ui.mobile.impl.MobileTopParamStyle;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class MobileTopParamPane extends BasicBeanPane<MobileTopParamStyle> { public class MobileTopParamPane extends BasicBeanPane<MobileTopParamStyle> {
private UICheckBox autoCommitCheckBox; private UICheckBox autoCommitCheckBox;
private UISpinner maxDirectShowCountSpinner; private UISpinner maxDirectShowCountSpinner;
private UILabel showCountTextField; private UILabel showCountTextField;
private static final int MAX_VALUE = 4; 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 MIN_VALUE = 0;
private static final int DEFAULT_DIERTA = 1; private static final int DEFAULT_DIERTA = 1;
private static final int DEFAULT_VALUE = 0; private static final int DEFAULT_VALUE = 0;
@ -34,7 +39,7 @@ public class MobileTopParamPane extends BasicBeanPane<MobileTopParamStyle> {
JPanel panel = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Plugin-TopParam_Setting")); JPanel panel = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Plugin-TopParam_Setting"));
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
autoCommitCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Plugin-TopParam_AutoCommit"), true); 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")); showCountTextField = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Show_Count"));
Component[][] components = {{autoCommitCheckBox},{showCountTextField, maxDirectShowCountSpinner}}; Component[][] components = {{autoCommitCheckBox},{showCountTextField, maxDirectShowCountSpinner}};
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
@ -44,6 +49,20 @@ public class MobileTopParamPane extends BasicBeanPane<MobileTopParamStyle> {
JPanel paraPane = TableLayoutHelper.createCommonTableLayoutPane(components, rowSize, columnSize, GAP); JPanel paraPane = TableLayoutHelper.createCommonTableLayoutPane(components, rowSize, columnSize, GAP);
panel.add(paraPane); panel.add(paraPane);
this.add(panel, BorderLayout.CENTER); 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 @Override

Loading…
Cancel
Save