Browse Source

REPORT-65502 【外包验收】分页设置-按行分页,设置超过500时值会保存为空而不是1或500

final/11.0
pengda 3 years ago
parent
commit
48d5306788
  1. 17
      designer-realize/src/main/java/com/fr/design/webattr/PageToolBarPane.java
  2. 17
      designer-realize/src/main/java/com/fr/design/webattr/PageWebSettingPane.java

17
designer-realize/src/main/java/com/fr/design/webattr/PageToolBarPane.java

@ -60,7 +60,7 @@ public class PageToolBarPane extends AbstractEditToolBarPane {
private UICheckBox isPageFixedRowBox;
private UITextField pageFixedRowCountTextField;
private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92);
private static final Pattern ROW_COUNT = Pattern.compile("^[1-9][\\d]{0,2}$");
private static final Pattern ROW_COUNT = Pattern.compile("^[1-9][\\d]*$|^0");
//固定行数分页,每页最多500行,最少1行数据
private static final int MAX_ROW_COUNT = 500;
@ -275,18 +275,21 @@ public class PageToolBarPane extends AbstractEditToolBarPane {
@Override
public void keyReleased(KeyEvent e) {
String rowCount = pageFixedRowCountTextField.getText();
if (!isRowCountValid(rowCount)) {
pageFixedRowCountTextField.setText(StringUtils.EMPTY);
}
pageFixedRowCountTextField.setText(convert2ValidRowCount(rowCount));
}
};
private boolean isRowCountValid(String rowCount) {
private String convert2ValidRowCount(String rowCount) {
Matcher matcher = ROW_COUNT.matcher(rowCount);
if (matcher.find()) {
int count = Integer.parseInt(matcher.group());
return count >= MIN_ROW_COUNT && count <= MAX_ROW_COUNT;
if (count > MAX_ROW_COUNT) {
count = MAX_ROW_COUNT;
} else if (count < MIN_ROW_COUNT) {
count = MIN_ROW_COUNT;
}
return String.valueOf(count);
}
return false;
return StringUtils.EMPTY;
}
}

17
designer-realize/src/main/java/com/fr/design/webattr/PageWebSettingPane.java

@ -41,7 +41,7 @@ public class PageWebSettingPane extends WebSettingPane<WebPage> {
private UICheckBox isPageFixedRowBox;
private UITextField pageFixedRowCountTextField;
private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92);
private static final Pattern ROW_COUNT = Pattern.compile("^[1-9][\\d]{0,2}$");
private static final Pattern ROW_COUNT = Pattern.compile("^[1-9][\\d]*$|^0");
private static final String DEFAULT_ROW_COUNT = "30";
//固定行数分页,每页最多500行,最少1行数据
@ -82,9 +82,7 @@ public class PageWebSettingPane extends WebSettingPane<WebPage> {
@Override
public void keyReleased(KeyEvent e) {
String rowCount = pageFixedRowCountTextField.getText();
if (!isRowCountValid(rowCount)) {
pageFixedRowCountTextField.setText(StringUtils.EMPTY);
}
pageFixedRowCountTextField.setText(convert2ValidRowCount(rowCount));
}
});
pageFixedRowCountTextField.addInputMethodListener(new InputMethodListener() {
@ -207,12 +205,17 @@ public class PageWebSettingPane extends WebSettingPane<WebPage> {
reportWebAttr.setWebPage(webContent);
}
private boolean isRowCountValid(String rowCount) {
private String convert2ValidRowCount(String rowCount) {
Matcher matcher = ROW_COUNT.matcher(rowCount);
if (matcher.find()) {
int count = Integer.parseInt(matcher.group());
return count >= MIN_ROW_COUNT && count <= MAX_ROW_COUNT;
if (count > MAX_ROW_COUNT) {
count = MAX_ROW_COUNT;
} else if (count < MIN_ROW_COUNT) {
count = MIN_ROW_COUNT;
}
return String.valueOf(count);
}
return false;
return StringUtils.EMPTY;
}
}

Loading…
Cancel
Save