Browse Source

REPORT-64601 公式编辑器首次进入的时候光标位置不正确

1.加载完公式编辑器后异步请求一下光标;
feature/x
Hoky 3 years ago
parent
commit
74d7f9cd4d
  1. 17
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

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

@ -7,6 +7,7 @@ import com.fr.base.ParameterMapNameSpace;
import com.fr.base.TableDataNameSpace;
import com.fr.base.Utils;
import com.fr.base.io.IOFile;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.data.TableDataSource;
import com.fr.design.actions.UpdateAction;
import com.fr.design.border.UIRoundedBorder;
@ -115,6 +116,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* 公式编辑面板
@ -151,6 +154,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
private FormulaPaneAutoCompletion autoCompletion;
private DefaultCompletionProvider completionProvider;
private static final Map<String, String> PARAM_PREFIX_MAP = new HashMap<>();
private ExecutorService executorService = Executors.newCachedThreadPool(new NamedThreadFactory("formula-pane-refocus"));
public FormulaPane() {
initComponents();
@ -290,6 +294,19 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
initTextPane();
initTipsPane();
initVariableTreeAndDescriptionArea();
refocusInWindow();
}
private void refocusInWindow() {
executorService.execute(() -> {
try {
Thread.sleep(100);
formulaTextArea.requestFocusInWindow();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
});
executorService.shutdown();
}
private void initVariableTreeAndDescriptionArea() {

Loading…
Cancel
Save