Browse Source

REPORT-35259 当参数栏参数过多时是否有下拉框 删除无用提交

bugfix/10.0
Henry.Wang 4 years ago
parent
commit
087dd93905
  1. 89
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

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

@ -246,70 +246,43 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
} }
public class DoubleClick extends MouseAdapter { public class DoubleClick extends MouseAdapter {
String singlePressContent;
String doublePressContent;
@Override @Override
public void mousePressed(MouseEvent e) { public void mouseClicked(MouseEvent e) {
int index = tipsList.getSelectedIndex(); int index = tipsList.getSelectedIndex();
if (index != -1) { if (index != -1) {
if (e.getClickCount() == 1) { String currentLineContent = (String) listModel.getElementAt(index);
singlePressContent = (String) listModel.getElementAt(index); if (e.getClickCount() == 2) {
} else if (e.getClickCount() == 2) { if (ifHasBeenWriten == 0) {
doublePressContent = (String) listModel.getElementAt(index); formulaTextArea.setForeground(Color.black);
} formulaTextArea.setText("");
}
}
@Override
public void mouseReleased(MouseEvent e) {
int index = tipsList.getSelectedIndex();
if (index != -1) {
if (e.getClickCount() == 1) {
if (ComparatorUtils.equals((String) listModel.getElementAt(index), singlePressContent)) {
singleClickActuator(singlePressContent);
} }
} else if (e.getClickCount() == 2) { formulaTextArea.setForeground(Color.black);
if (ComparatorUtils.equals((String) listModel.getElementAt(index), doublePressContent)) { currentPosition = formulaTextArea.getCaretPosition();
doubleClickActuator(doublePressContent); String output = currentLineContent + "()";
String textAll = formulaTextArea.getText();
String textReplaced;
int position = 0;
if (insertPosition <= currentPosition) {
textReplaced = textAll.substring(0, insertPosition) + output + textAll.substring(currentPosition);
position = insertPosition + output.length() - 1;
} else {
textReplaced = textAll.substring(0, currentPosition) + output + textAll.substring(insertPosition);
position = currentPosition + output.length() - 1;
} }
} formulaTextArea.setText(textReplaced);
} formulaTextArea.requestFocusInWindow();
} formulaTextArea.setCaretPosition(position);
insertPosition = position;
private void singleClickActuator(String currentLineContent) { ifHasBeenWriten = 1;
refreshDescriptionTextArea(currentLineContent); listModel.removeAllElements();
} else if (e.getClickCount() == 1) {
formulaTextArea.requestFocusInWindow(); refreshDescriptionTextArea(currentLineContent);
fixFunctionNameList();
}
private void doubleClickActuator(String currentLineContent) { formulaTextArea.requestFocusInWindow();
if (ifHasBeenWriten == 0) { fixFunctionNameList();
formulaTextArea.setForeground(Color.black); }
formulaTextArea.setText("");
}
formulaTextArea.setForeground(Color.black);
currentPosition = formulaTextArea.getCaretPosition();
String output = currentLineContent + "()";
String textAll = formulaTextArea.getText();
String textReplaced;
int position = 0;
if (insertPosition <= currentPosition) {
textReplaced = textAll.substring(0, insertPosition) + output + textAll.substring(currentPosition);
position = insertPosition + output.length() - 1;
} else {
textReplaced = textAll.substring(0, currentPosition) + output + textAll.substring(insertPosition);
position = currentPosition + output.length() - 1;
} }
formulaTextArea.setText(textReplaced);
formulaTextArea.requestFocusInWindow();
formulaTextArea.setCaretPosition(position);
insertPosition = position;
ifHasBeenWriten = 1;
listModel.removeAllElements();
} }
} }
@ -807,13 +780,13 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
public void valueChanged(TreeSelectionEvent e) { public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode selectedTreeNode = (DefaultMutableTreeNode) variablesTree.getLastSelectedPathComponent(); DefaultMutableTreeNode selectedTreeNode = (DefaultMutableTreeNode) variablesTree.getLastSelectedPathComponent();
Object selectedValue = selectedTreeNode.getUserObject(); Object selectedValue = selectedTreeNode.getUserObject();
Object selectedParentValue = ((DefaultMutableTreeNode) selectedTreeNode.getParent()).getUserObject(); Object selectedParentValue = ((DefaultMutableTreeNode)selectedTreeNode.getParent()).getUserObject();
if (selectedValue == null) { if (selectedValue == null) {
return; return;
} }
if (selectedValue instanceof TextUserObject) { if (selectedValue instanceof TextUserObject) {
//有公式说明的条件:1.属于TextUserObject 2.parent是系统参数 //有公式说明的条件:1.属于TextUserObject 2.parent是系统参数
if (ComparatorUtils.equals(((TextFolderUserObject) selectedParentValue).getText(), if (ComparatorUtils.equals(((TextFolderUserObject) selectedParentValue).getText(),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Variables"))) { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Variables"))) {

Loading…
Cancel
Save