From 74d7f9cd4d02913b8885b2da6df5acf5c7207077 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Thu, 23 Dec 2021 14:38:20 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-64601=20=E5=85=AC=E5=BC=8F=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E9=A6=96=E6=AC=A1=E8=BF=9B=E5=85=A5=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E5=85=89=E6=A0=87=E4=BD=8D=E7=BD=AE=E4=B8=8D?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=201.=E5=8A=A0=E8=BD=BD=E5=AE=8C=E5=85=AC?= =?UTF-8?q?=E5=BC=8F=E7=BC=96=E8=BE=91=E5=99=A8=E5=90=8E=E5=BC=82=E6=AD=A5?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E4=B8=80=E4=B8=8B=E5=85=89=E6=A0=87=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/formula/FormulaPane.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index 27018e6e01..5b4842cfe0 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/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 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() { From 79bf7e442f7108f96e2769ffb0bceb487952476d Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Thu, 23 Dec 2021 14:44:32 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-64601=20=E5=85=AC=E5=BC=8F=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E9=A6=96=E6=AC=A1=E8=BF=9B=E5=85=A5=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E5=85=89=E6=A0=87=E4=BD=8D=E7=BD=AE=E4=B8=8D?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=201.=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/formula/FormulaPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index 5b4842cfe0..60d324112b 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -154,7 +154,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private FormulaPaneAutoCompletion autoCompletion; private DefaultCompletionProvider completionProvider; private static final Map PARAM_PREFIX_MAP = new HashMap<>(); - private ExecutorService executorService = Executors.newCachedThreadPool(new NamedThreadFactory("formula-pane-refocus")); public FormulaPane() { initComponents(); @@ -298,6 +297,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } private void refocusInWindow() { + ExecutorService executorService = Executors.newCachedThreadPool(new NamedThreadFactory("formula-pane-refocus")); executorService.execute(() -> { try { Thread.sleep(100); From 1977aa29d38702c832596ff621f5efc750dfaec4 Mon Sep 17 00:00:00 2001 From: Hoky <303455184@qq.com> Date: Thu, 23 Dec 2021 16:03:39 +0800 Subject: [PATCH 3/3] =?UTF-8?q?REPORT-64601=20=E5=85=AC=E5=BC=8F=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E9=A6=96=E6=AC=A1=E8=BF=9B=E5=85=A5=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E5=85=89=E6=A0=87=E4=BD=8D=E7=BD=AE=E4=B8=8D?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=201.=E6=94=BE=E5=88=B0swing=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E9=98=9F=E5=88=97=E9=98=9F=E5=B0=BE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/formula/FormulaPane.java | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index 60d324112b..74bf3fe76f 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -7,7 +7,6 @@ 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; @@ -116,8 +115,6 @@ 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; /** * 公式编辑面板 @@ -296,17 +293,8 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { refocusInWindow(); } - private void refocusInWindow() { - ExecutorService executorService = Executors.newCachedThreadPool(new NamedThreadFactory("formula-pane-refocus")); - executorService.execute(() -> { - try { - Thread.sleep(100); - formulaTextArea.requestFocusInWindow(); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - }); - executorService.shutdown(); + public void refocusInWindow() { + SwingUtilities.invokeLater(() -> formulaTextArea.requestFocusInWindow()); } private void initVariableTreeAndDescriptionArea() {