Browse Source

REPORT-40154 设计器共享数据集缓存到磁盘记录数输入框太短

1. bug原因:之前的UISpinner中的数字框默认的columns只有2,所以当输入数字超过三位数时,会显示不全
2. 修改方案:与产品及交互确认后,为UISpinner添加一种构造方法,可以指定其数字框的columns,将MaxMemRowCountPanel中的UISpinner的columns设置为4,即可以最多展示5位数
feature/big-screen
Yvan 4 years ago
parent
commit
d99b7c3c0e
  1. 2
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java
  2. 26
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java

2
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() {

26
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;
}

Loading…
Cancel
Save