|
|
@ -2,7 +2,6 @@ package com.fr.design.formula; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.BaseFormula; |
|
|
|
import com.fr.base.BaseFormula; |
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
import com.fr.base.FRContext; |
|
|
|
|
|
|
|
import com.fr.design.actions.UpdateAction; |
|
|
|
import com.fr.design.actions.UpdateAction; |
|
|
|
import com.fr.design.border.UIRoundedBorder; |
|
|
|
import com.fr.design.border.UIRoundedBorder; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
@ -25,7 +24,6 @@ import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.parser.FRLexer; |
|
|
|
import com.fr.parser.FRLexer; |
|
|
|
import com.fr.parser.FRParser; |
|
|
|
import com.fr.parser.FRParser; |
|
|
|
import com.fr.stable.EncodeConstants; |
|
|
|
import com.fr.stable.EncodeConstants; |
|
|
|
import com.fr.stable.ProductConstants; |
|
|
|
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.script.Expression; |
|
|
|
import com.fr.stable.script.Expression; |
|
|
|
|
|
|
|
|
|
|
@ -54,7 +52,10 @@ import java.io.InputStream; |
|
|
|
import java.io.InputStreamReader; |
|
|
|
import java.io.InputStreamReader; |
|
|
|
import java.io.Reader; |
|
|
|
import java.io.Reader; |
|
|
|
import java.io.StringReader; |
|
|
|
import java.io.StringReader; |
|
|
|
import java.util.Locale; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.Collections; |
|
|
|
|
|
|
|
import java.util.Comparator; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 公式编辑面板 |
|
|
|
* 公式编辑面板 |
|
|
@ -413,14 +414,19 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
if (keyWord.length() != 0) { |
|
|
|
if (keyWord.length() != 0) { |
|
|
|
NameAndDescription[] descriptions = FunctionConstants.ALL.getDescriptions(); |
|
|
|
NameAndDescription[] descriptions = FunctionConstants.ALL.getDescriptions(); |
|
|
|
int lengthOfDes = descriptions.length; |
|
|
|
int lengthOfDes = descriptions.length; |
|
|
|
|
|
|
|
List<String> list = new ArrayList<>(); |
|
|
|
for (int i = 0; i < lengthOfDes; i++) { |
|
|
|
for (int i = 0; i < lengthOfDes; i++) { |
|
|
|
NameAndDescription and = descriptions[i]; |
|
|
|
NameAndDescription and = descriptions[i]; |
|
|
|
|
|
|
|
|
|
|
|
String functionName = and.searchResult(keyWord, findDescription); |
|
|
|
String functionName = and.searchResult(keyWord, findDescription); |
|
|
|
if (StringUtils.isNotBlank(functionName)) { |
|
|
|
if (StringUtils.isNotBlank(functionName)) { |
|
|
|
listModel.addElement(functionName); |
|
|
|
list.add(functionName); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Collections.sort(list, new SimilarComparator(keyWord)); |
|
|
|
|
|
|
|
for (String name : list) { |
|
|
|
|
|
|
|
listModel.addElement(name); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!listModel.isEmpty()) { |
|
|
|
if (!listModel.isEmpty()) { |
|
|
|
tipsList.setSelectedIndex(0); |
|
|
|
tipsList.setSelectedIndex(0); |
|
|
@ -969,6 +975,26 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static class SimilarComparator implements Comparator<String> { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String searchKey; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public SimilarComparator(String searchKey) { |
|
|
|
|
|
|
|
this.searchKey = searchKey.toLowerCase(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public int compare(String o1, String o2) { |
|
|
|
|
|
|
|
if (o1.toLowerCase().startsWith(searchKey)) { |
|
|
|
|
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (o2.toLowerCase().startsWith(searchKey)) { |
|
|
|
|
|
|
|
return 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return o2.compareTo(o1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static class TextFolderUserObject { |
|
|
|
public static class TextFolderUserObject { |
|
|
|
|
|
|
|
|
|
|
|
private String text; |
|
|
|
private String text; |
|
|
|