Browse Source

REPORT-31834 && REPORT-31874

feature/big-screen
hades 5 years ago
parent
commit
6b5301b490
  1. 34
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  2. 10
      designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java
  3. 9
      designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java
  4. 25
      designer-base/src/test/java/com/fr/design/formula/FormulaPaneTest.java

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

@ -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;

10
designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java

@ -24,11 +24,13 @@ public class DatabaseDialogAction implements OSBasedAction {
@Override @Override
public void execute(Object... objects) { public void execute(Object... objects) {
if (ServerPreferenceConfig.getInstance().isUseUniverseDBM() && !OperatingSystem.isLinux()) { // if (ServerPreferenceConfig.getInstance().isUseUniverseDBM() && !OperatingSystem.isLinux()) {
UniversalDatabaseOpener.showUniverseDatabaseDialog(); // UniversalDatabaseOpener.showUniverseDatabaseDialog();
} else { // } else {
// }
// 直接这里屏蔽掉 防止有设置过 导致配置数据库值为true 即使设置界面屏蔽也没用
openDesignDatabaseManager(); openDesignDatabaseManager();
}
} }
private void openDesignDatabaseManager() { private void openDesignDatabaseManager() {

9
designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java

@ -21,11 +21,10 @@ public class PMDialogAction implements OSBasedAction {
DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null); DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null);
return; return;
} }
// if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() && !OperatingSystem.isLinux()) { if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() && !OperatingSystem.isLinux()) {
// UpmFinder.showUPMDialog(); UpmFinder.showUPMDialog();
// } else { } else {
// }
// 直接这里屏蔽掉 防止有设置过 导致配置数据库值为true 即使设置界面屏蔽也没用
WebViewDlgHelper.createPluginDialog(); WebViewDlgHelper.createPluginDialog();
} }
}
} }

25
designer-base/src/test/java/com/fr/design/formula/FormulaPaneTest.java

@ -0,0 +1,25 @@
package com.fr.design.formula;
import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test;
import java.util.Arrays;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/5/20
*/
public class FormulaPaneTest extends TestCase {
@Test
public void testSimilarComparator() {
String[] strs = new String[] {"ScriptEval", "SPLIT", "SUMPRECISE"};
String[] result = new String[] {"SPLIT", "ScriptEval", "SUMPRECISE"};
Arrays.sort(strs, new FormulaPane.SimilarComparator("sp"));
Assert.assertArrayEquals(result, strs);
}
}
Loading…
Cancel
Save