Browse Source

REPORT-62809 && REPORT-62814 && REPORT-62815 && REPORT-62816 && REPORT-62817

1.修改布局与一些错误
feature/x
Hoky 3 years ago
parent
commit
7c550df360
  1. 7
      designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java
  2. 36
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  3. 2
      designer-base/src/main/java/com/fr/design/formula/exception/function/NoViableAltForCharFunction.java

7
designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java

@ -7,6 +7,7 @@ import com.fr.parser.FRParser;
import com.fr.script.checker.FunctionCheckerDispatcher;
import com.fr.script.checker.result.FormulaCheckResult;
import com.fr.script.checker.result.FormulaCoordinates;
import com.fr.stable.StringUtils;
import com.fr.stable.script.Expression;
import com.fr.stable.script.Node;
import com.fr.third.antlr.TokenStreamRecognitionException;
@ -23,6 +24,9 @@ public class FormulaChecker {
private static FormulaExceptionTipsProcessor processor = FormulaExceptionTipsProcessor.getProcessor();
public static FormulaCheckResult check(String formulaText) {
if (StringUtils.isEmpty(formulaText) || formulaText.equals(Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Tips"))) {
return new FormulaCheckResult(true, VALID_FORMULA, FormulaCoordinates.INVALID);
}
//过滤一些空格等符号
StringReader in = new StringReader(formulaText);
FRLexer lexer = new FRLexer(in);
@ -32,7 +36,8 @@ public class FormulaChecker {
Expression expression = parser.parse();
Node node = expression.getConditionalExpression();
boolean valid = FunctionCheckerDispatcher.getInstance().getFunctionChecker(node).checkFunction(formulaText, node);
return new FormulaCheckResult(valid, valid ? VALID_FORMULA : INVALID_FORMULA, FormulaCoordinates.INVALID);
return new FormulaCheckResult(valid, valid ? Toolkit.i18nText("Fine-Design_Basic_FormulaD_Valid_Formula") :
Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula"), FormulaCoordinates.INVALID);
} catch (Exception e) {
if (e instanceof TokenStreamRecognitionException) {
return processor.getExceptionTips(((TokenStreamRecognitionException) e).recog);

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

@ -88,6 +88,7 @@ import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
@ -124,8 +125,8 @@ import java.util.Set;
public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
public static final int DEFUAL_FOMULA_LENGTH = 103;
public static final String ELLIPSIS = "...";
public static final int KEY_CODE_A = 64;
public static final int KEY_CODE_Z = 91;
public static final char KEY_CODE_A = 'A';
public static final char KEY_CODE_Z = 'z';
public static final String NEWLINE = "\n";
public static final String FORMULA_ICON = "/com/fr/design/images/m_file/formula.png";
public static final String PARAM_ICON = "/com/fr/design/images/m_file/param.png";
@ -166,7 +167,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
}
private boolean inKeyCodeRange(KeyEvent e) {
return (e.getExtendedKeyCode() > KEY_CODE_A && e.getExtendedKeyCode() < KEY_CODE_Z);
return (e.getKeyChar() >= KEY_CODE_A && e.getKeyChar() <= KEY_CODE_Z);
}
@Override
@ -248,16 +249,25 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
private void initTipsPane() {
// tipsPane
JPanel containerSPane = new JPanel(new BorderLayout(4, 1));
JPanel labelPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0), true);
JPanel searchPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0), true);
containerSPane.setPreferredSize(new Dimension(892, 23));
this.add(containerSPane, BorderLayout.NORTH);
JPanel searchPane = new JPanel(new BorderLayout(4, 1));
this.add(searchPane, BorderLayout.NORTH);
searchPane.add(keyWordTextField, BorderLayout.CENTER);
UIButton searchButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Search"));
UILabel formulaLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Input_Formula_In_The_Text_Area_Below") + ":"
+ " ");
UILabel formulaLabel = new UILabel(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Input_Formula_In_The_Text_Area_Below") + ":");
formulaLabel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
labelPane.add(formulaLabel, BorderLayout.WEST);
keyWordTextField.setPreferredSize(new Dimension(240, 23));
searchPane.add(keyWordTextField, BorderLayout.EAST);
searchPane.add(searchButton, BorderLayout.EAST);
searchPane.add(formulaLabel, BorderLayout.WEST);
containerSPane.add(labelPane, BorderLayout.WEST);
containerSPane.add(searchPane, BorderLayout.EAST);
initKeyWordTextFieldKeyListener();
tipsList = new JList(listModel);
tipsList.addMouseListener(new DoubleClick());
@ -835,10 +845,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 confirmDialog = FineJOptionPane.showConfirmDialog(
FormulaPane.this,
checkResult.getTips() + ", " + Toolkit.i18nText("Fine-Design_Basic_Formula_Error_Position") + ":" + (checkResult.getFormulaCoordinates().getColumns()) + ".",
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"),
position + checkResult.getTips(),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE,
null,
@ -1265,7 +1277,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
};
basicPane.setLayout(FRGUIPaneFactory.createBorderLayout());
UITextArea desArea = new UITextArea();
// desArea。setEnabled(false);
desArea.setText(this.getTextAreaText());
basicPane.add(new UIScrollPane(desArea), BorderLayout.CENTER);
BasicDialog dialog = basicPane.showWindow(DesignerContext.getDesignerFrame());
@ -1339,6 +1350,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
};
public void refreshText(String line) {
fixFunctionNameList(line);
refreshDescriptionTextArea(line);
}

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

@ -36,7 +36,7 @@ public class NoViableAltForCharFunction implements Function<Exception, FormulaCh
mesg = mesg + exception.foundChar;
mesg = mesg + '\'';
} else {
mesg = mesg + exception.foundChar + "(0x" + Integer.toHexString(exception.foundChar).toUpperCase() + ")";
mesg = mesg + exception.foundChar;
}
return mesg;

Loading…
Cancel
Save