Browse Source

REPORT-65192 公式合法性检测错误字符位置返回不正确

1.如果返回错误位置,则模糊处理
bugfix/11.0
Hoky 3 years ago
parent
commit
d062899bf7
  1. 10
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  2. 2
      designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java

10
designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

@ -867,8 +867,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
if (checkResult.isValid()) {
showMessageDialog(checkResult.getTips(), checkResult.isValid());
} else {
String position = Toolkit.i18nText("Fine-Design_Basic_Formula_The") + (checkResult.getFormulaCoordinates().getColumns())
+ Toolkit.i18nText("Fine-Design_Basic_Formula_Error_Position") + " ";
int columns = checkResult.getFormulaCoordinates().getColumns();
String position = StringUtils.EMPTY;
if (columns >= 0) {
position = Toolkit.i18nText("Fine-Design_Basic_Formula_The") + columns
+ Toolkit.i18nText("Fine-Design_Basic_Formula_Error_Position") + " ";
}
int confirmDialog = FineJOptionPane.showConfirmDialog(
FormulaPane.this,
position + messageTips,
@ -879,7 +883,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
new String[]{Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Result"), Toolkit.i18nText("Fine-Design_Basic_Formula_Continue")},
Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Result"));
if (confirmDialog == 0) {
formulaTextArea.setCaretPosition(checkResult.getFormulaCoordinates().getColumns());
formulaTextArea.setCaretPosition(Math.max(columns, 0));
formulaTextArea.requestFocus();
return false;
}

2
designer-base/src/main/java/com/fr/design/formula/exception/function/FormulaCheckWrongFunction.java

@ -74,7 +74,7 @@ public class FormulaCheckWrongFunction implements Function<Exception, FormulaChe
invalidFormula = invalidFormula.substring(0, invalidFormula.indexOf(","));
}
int index = formulaText.indexOf(invalidFormula);
return Math.max(index, 0);
return index;
}
}

Loading…
Cancel
Save