|
|
@ -555,6 +555,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
private void fixFunctionNameList(String functionName) { |
|
|
|
private void fixFunctionNameList(String functionName) { |
|
|
|
int signOfContinue = 1; |
|
|
|
int signOfContinue = 1; |
|
|
|
int indexOfFunction = 0; |
|
|
|
int indexOfFunction = 0; |
|
|
|
|
|
|
|
boolean found = false; |
|
|
|
for (int i = 0; i < functionTypeListModel.size(); i++) { |
|
|
|
for (int i = 0; i < functionTypeListModel.size(); i++) { |
|
|
|
int signOfType = 0; |
|
|
|
int signOfType = 0; |
|
|
|
FunctionGroup functionType = (FunctionGroup) functionTypeListModel.getElementAt(i); |
|
|
|
FunctionGroup functionType = (FunctionGroup) functionTypeListModel.getElementAt(i); |
|
|
@ -568,6 +569,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
signOfType = 1; |
|
|
|
signOfType = 1; |
|
|
|
signOfContinue = 0; |
|
|
|
signOfContinue = 0; |
|
|
|
indexOfFunction = k; |
|
|
|
indexOfFunction = k; |
|
|
|
|
|
|
|
found = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -577,8 +579,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (found) { |
|
|
|
functionNameList.setSelectedIndex(indexOfFunction); |
|
|
|
functionNameList.setSelectedIndex(indexOfFunction); |
|
|
|
functionNameList.ensureIndexIsVisible(indexOfFunction); |
|
|
|
functionNameList.ensureIndexIsVisible(indexOfFunction); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
functionTypeList.setSelectedIndex(0); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private int getBeginPosition() { |
|
|
|
private int getBeginPosition() { |
|
|
@ -808,10 +814,11 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
String formulaText = formulaTextArea.getText().trim(); |
|
|
|
String formulaText = formulaTextArea.getText().trim(); |
|
|
|
String unSupportFormula = containsUnsupportedSimulationFormulas(formulaText); |
|
|
|
String unSupportFormula = containsUnsupportedSimulationFormulas(formulaText); |
|
|
|
if (unSupportFormula != null) { |
|
|
|
if (unSupportFormula != null) { |
|
|
|
showMessageDialog(Toolkit.i18nText("Fine-Design_Basic_Formula_Unsupported_Formulas") + ":" + unSupportFormula, false); |
|
|
|
showMessageDialog(Toolkit.i18nText("Fine-Design_Basic_Formula_Unsupported_Formulas") + ":" + unSupportFormula, false, true); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean calException = false; |
|
|
|
String messageTips; |
|
|
|
String messageTips; |
|
|
|
FormulaCheckResult checkResult = FormulaChecker.check(formulaText); |
|
|
|
FormulaCheckResult checkResult = FormulaChecker.check(formulaText); |
|
|
|
if (checkResult.grammarValid()) { |
|
|
|
if (checkResult.grammarValid()) { |
|
|
@ -840,6 +847,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
} catch (Exception ce) { |
|
|
|
} catch (Exception ce) { |
|
|
|
//模拟计算如果出现错误,则抛出错误
|
|
|
|
//模拟计算如果出现错误,则抛出错误
|
|
|
|
calResult = ce.getMessage(); |
|
|
|
calResult = ce.getMessage(); |
|
|
|
|
|
|
|
calException = true; |
|
|
|
FineLoggerFactory.getLogger().error(ce.getMessage(), ce); |
|
|
|
FineLoggerFactory.getLogger().error(ce.getMessage(), ce); |
|
|
|
messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Error") + ":" + calResult; |
|
|
|
messageTips = messageTips + Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Error") + ":" + calResult; |
|
|
|
} |
|
|
|
} |
|
|
@ -848,7 +856,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
messageTips = checkResult.getTips(); |
|
|
|
messageTips = checkResult.getTips(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (checkResult.isValid()) { |
|
|
|
if (checkResult.isValid()) { |
|
|
|
showMessageDialog(messageTips, checkResult.isValid()); |
|
|
|
showMessageDialog(messageTips, checkResult.isValid(), calException); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
confirmCheckResult(checkResult, messageTips); |
|
|
|
confirmCheckResult(checkResult, messageTips); |
|
|
|
} |
|
|
|
} |
|
|
@ -865,7 +873,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
|
|
|
|
|
|
|
|
private boolean confirmCheckResult(FormulaCheckResult checkResult, String messageTips) { |
|
|
|
private boolean confirmCheckResult(FormulaCheckResult checkResult, String messageTips) { |
|
|
|
if (checkResult.isValid()) { |
|
|
|
if (checkResult.isValid()) { |
|
|
|
showMessageDialog(checkResult.getTips(), checkResult.isValid()); |
|
|
|
showMessageDialog(checkResult.getTips(), checkResult.isValid(), false); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
int columns = checkResult.getFormulaCoordinates().getColumns(); |
|
|
|
int columns = checkResult.getFormulaCoordinates().getColumns(); |
|
|
|
String position = StringUtils.EMPTY; |
|
|
|
String position = StringUtils.EMPTY; |
|
|
@ -891,8 +899,8 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void showMessageDialog(String message, boolean formulaValid) { |
|
|
|
private void showMessageDialog(String message, boolean formulaValid, boolean calException) { |
|
|
|
if (formulaValid) { |
|
|
|
if (formulaValid && !calException) { |
|
|
|
FineJOptionPane.showMessageDialog( |
|
|
|
FineJOptionPane.showMessageDialog( |
|
|
|
FormulaPane.this, |
|
|
|
FormulaPane.this, |
|
|
|
message); |
|
|
|
message); |
|
|
|