From ce540ef97b54a4c4e5eef3876009b45481567df9 Mon Sep 17 00:00:00 2001 From: Yvan Date: Wed, 9 Sep 2020 17:50:19 +0800 Subject: [PATCH 1/9] =?UTF-8?q?REPORT-39341=20=E3=80=90=E5=9B=9E=E5=BD=92?= =?UTF-8?q?=E3=80=91=E3=80=90jdk11=E3=80=91=E6=96=87=E4=BB=B6=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=AF=BB=E5=86=99=E6=9D=83=E9=99=90=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E6=98=AF=E8=8B=B1=E6=96=87=201.=20bug?= =?UTF-8?q?=E5=8E=9F=E5=9B=A0=EF=BC=9A=E5=9C=A8=E4=B8=AD=E6=96=87=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E4=B8=8B=EF=BC=8C=E8=BF=99=E8=BE=B9=E4=BC=A0=E8=BF=87?= =?UTF-8?q?=E6=9D=A5=E7=9A=84Locale=E6=98=AFzh-Hans-CN=EF=BC=8C=E8=BF=9B?= =?UTF-8?q?=E5=85=A5isSupport=E6=96=B9=E6=B3=95=E4=B8=AD=E6=97=B6=E4=BC=9A?= =?UTF-8?q?=E5=8F=91=E7=8E=B0=E4=B8=8D=E5=8C=B9=E9=85=8D=EF=BC=8C=E7=84=B6?= =?UTF-8?q?=E5=90=8ELocale=E8=A2=AB=E8=AE=BE=E7=BD=AE=E6=88=90en=5FUS?= =?UTF-8?q?=EF=BC=8C=E7=84=B6=E5=90=8E=E5=9C=A8=E6=8A=A5=E9=94=99=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E9=87=8C=E9=9D=A2=E7=9A=84=E5=86=85=E5=AE=B9=E5=B0=B1?= =?UTF-8?q?=E9=83=BD=E6=98=AF=E8=8B=B1=E6=96=87=E4=BA=86=202.=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=96=B9=E6=A1=88=EF=BC=9A=E5=A2=9E=E5=8A=A0=E5=88=A4?= =?UTF-8?q?=E6=96=AD=EF=BC=8C=E5=B0=86=E4=BC=A0=E8=BF=87=E6=9D=A5=E7=9A=84?= =?UTF-8?q?Locale=E7=9A=84script=E6=8A=B9=E5=8E=BB=EF=BC=8C=E5=8F=AA?= =?UTF-8?q?=E4=BF=9D=E7=95=99language=E5=92=8Cregion=EF=BC=8C=E8=B7=9F?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=87=8C=E9=9D=A2=E4=BF=9D=E5=AD=98=E7=9A=84?= =?UTF-8?q?Locale=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/DesignerEnvManager.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 88d2625d0..375e40e4c 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -163,7 +163,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { * alphafine */ private AlphaFineConfigManager alphaFineConfigManager = AlphaFineConfigManager.getInstance(); - + /** * 阅后即焚的配置项 */ @@ -1424,6 +1424,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { * @return */ private Locale checkLocale(Locale locale) { + // Yvan: REPORT-39341,有一些情况下,获取到的是zh-Hans-CN,转成zh_CN + if (locale != null) { + locale = new Locale(locale.getLanguage(), locale.getCountry()); + } return SupportLocale.getInstance().isSupport(locale) ? locale : Locale.US; } @@ -1578,7 +1582,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } } } - + private void readSnapChatConfig(XMLableReader reader) { reader.readXMLObject(this.snapChatConfig = SnapChatConfig.getInstance()); } @@ -1801,14 +1805,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { writeSnapChatConfig(writer); writer.end(); } - + private void writeSnapChatConfig(XMLPrintWriter writer) { - + if (this.snapChatConfig != null) { this.snapChatConfig.writeXML(writer); } } - + private void writeAlphaFineAttr(XMLPrintWriter writer) { if (this.alphaFineConfigManager != null) { this.alphaFineConfigManager.writeXML(writer); From ba7a9e3aa8f1d381b442272dec823f84828fca18 Mon Sep 17 00:00:00 2001 From: Yvan Date: Wed, 9 Sep 2020 18:56:46 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/fr/design/DesignerEnvManagerTest.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java b/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java index b7d123d66..1e16a1d7c 100644 --- a/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java +++ b/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java @@ -1,5 +1,6 @@ package com.fr.design; +import com.fr.invoke.Reflect; import junit.framework.TestCase; import java.util.Locale; @@ -17,4 +18,10 @@ public class DesignerEnvManagerTest extends TestCase{ assertEquals("下边界", envManager.getLanguage(), Locale.SIMPLIFIED_CHINESE); } + + public void testCheckLocale() { + DesignerEnvManager envManager = new DesignerEnvManager(); + Locale checkLocale = Reflect.on(envManager).call("checkLocale", Locale.getDefault()).get(); + assertEquals(Locale.SIMPLIFIED_CHINESE, checkLocale); + } } From 63ce4a6d720af6085aee9bf1eac849b3337769f3 Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 10 Sep 2020 14:56:43 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManagerTest.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java b/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java index 1e16a1d7c..2707d73dd 100644 --- a/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java +++ b/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java @@ -2,6 +2,7 @@ package com.fr.design; import com.fr.invoke.Reflect; import junit.framework.TestCase; +import org.easymock.EasyMock; import java.util.Locale; @@ -20,8 +21,18 @@ public class DesignerEnvManagerTest extends TestCase{ } public void testCheckLocale() { - DesignerEnvManager envManager = new DesignerEnvManager(); - Locale checkLocale = Reflect.on(envManager).call("checkLocale", Locale.getDefault()).get(); - assertEquals(Locale.SIMPLIFIED_CHINESE, checkLocale); + DesignerEnvManager envManager = EasyMock.createMock(DesignerEnvManager.class); + Reflect on = Reflect.on(envManager); + + //验证zh-Hans-CN + Locale locale = Reflect.on(Locale.class).call("getInstance", "zh", "", "CN", "", null).get(); + assertEquals(Locale.SIMPLIFIED_CHINESE, locale); + + //验证其它语言 + assertEquals(Locale.SIMPLIFIED_CHINESE, on.call("checkLocale", Locale.SIMPLIFIED_CHINESE).get()); + assertEquals(Locale.TRADITIONAL_CHINESE, on.call("checkLocale", Locale.TRADITIONAL_CHINESE).get()); + assertEquals(Locale.US, on.call("checkLocale", Locale.US).get()); + assertEquals(Locale.JAPAN, on.call("checkLocale", Locale.JAPAN).get()); + assertEquals(Locale.KOREA, on.call("checkLocale", Locale.KOREA).get()); } } From 19e4eb426f4cc8c96725db25b3ac9143d508b758 Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 10 Sep 2020 15:00:35 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/test/java/com/fr/design/DesignerEnvManagerTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java b/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java index 2707d73dd..f1e991579 100644 --- a/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java +++ b/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java @@ -26,7 +26,7 @@ public class DesignerEnvManagerTest extends TestCase{ //验证zh-Hans-CN Locale locale = Reflect.on(Locale.class).call("getInstance", "zh", "", "CN", "", null).get(); - assertEquals(Locale.SIMPLIFIED_CHINESE, locale); + assertEquals(Locale.SIMPLIFIED_CHINESE, on.call("checkLocale", locale).get()); //验证其它语言 assertEquals(Locale.SIMPLIFIED_CHINESE, on.call("checkLocale", Locale.SIMPLIFIED_CHINESE).get()); From fe6973e495f9b322690a60eb8dce29f2f724f0ea Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 10 Sep 2020 16:02:08 +0800 Subject: [PATCH 5/9] =?UTF-8?q?REPORT-39341=20=E3=80=90=E5=9B=9E=E5=BD=92?= =?UTF-8?q?=E3=80=91=E6=96=87=E4=BB=B6=E6=B2=A1=E6=9C=89=E8=AF=BB=E5=86=99?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=8A=A5=E5=91=8A=E5=BC=B9=E7=AA=97=E6=98=AF?= =?UTF-8?q?=E8=8B=B1=E6=96=87=20=E4=BF=AE=E6=94=B9=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E6=96=B9=E6=A1=88=EF=BC=9A=E7=BB=8F=E8=BF=87=E5=A4=9A=E4=BD=8D?= =?UTF-8?q?=E5=A4=A7=E4=BD=AC=E6=8F=90=E9=86=92=EF=BC=8C=E6=9C=80=E5=A5=BD?= =?UTF-8?q?=E4=B8=8D=E8=A6=81=E7=9B=B4=E6=8E=A5=E4=BF=AE=E6=94=B9=E4=BC=A0?= =?UTF-8?q?=E8=BF=87=E6=9D=A5=E7=9A=84Locale=EF=BC=8C=E5=9B=A0=E6=AD=A4?= =?UTF-8?q?=E8=BD=AC=E5=8F=98=E6=80=9D=E8=B7=AF=E4=B8=BA=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E6=8E=A5=E6=94=B6=E5=88=B0=E4=BA=86=E6=AF=94=E8=BE=83=E5=A5=87?= =?UTF-8?q?=E6=80=AA=E7=9A=84Locale=EF=BC=8C=E5=B0=BD=E9=87=8F=E6=89=BE?= =?UTF-8?q?=E5=88=B0=E4=B8=80=E4=B8=AA=E5=9C=A8=E6=9C=AC=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E4=B8=AD=E4=BD=BF=E7=94=A8=E7=9A=84=E6=9C=80=E6=8E=A5=E8=BF=91?= =?UTF-8?q?=E7=9A=84Locale=E8=BF=94=E5=9B=9E=EF=BC=8C=E5=A6=82=E4=BC=A0?= =?UTF-8?q?=E5=85=A5=E5=8F=82=E6=95=B0=E4=B8=BAzh-Hans-CN=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E8=BF=94=E5=9B=9Ezh=5FCN=EF=BC=8C=E8=80=8C=E4=B8=8D?= =?UTF-8?q?=E6=98=AF=E4=B9=8B=E5=89=8D=E7=9A=84en=5FUS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/DesignerEnvManager.java | 8 +++----- .../com/fr/design/DesignerEnvManagerTest.java | 18 ------------------ 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 375e40e4c..68bb91711 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -1424,11 +1424,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { * @return */ private Locale checkLocale(Locale locale) { - // Yvan: REPORT-39341,有一些情况下,获取到的是zh-Hans-CN,转成zh_CN - if (locale != null) { - locale = new Locale(locale.getLanguage(), locale.getCountry()); - } - return SupportLocale.getInstance().isSupport(locale) ? locale : Locale.US; + // Yvan: REPORT-39341,有一些情况下,获取到的是zh-Hans-CN这种,需要找到项目中最匹配的Locale + return SupportLocale.getInstance().isSupport(locale) ? + locale : SupportLocale.getInstance().getSuitableLocale(locale); } private void readReportLengthUnit(XMLableReader reader) { diff --git a/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java b/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java index f1e991579..b7d123d66 100644 --- a/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java +++ b/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java @@ -1,8 +1,6 @@ package com.fr.design; -import com.fr.invoke.Reflect; import junit.framework.TestCase; -import org.easymock.EasyMock; import java.util.Locale; @@ -19,20 +17,4 @@ public class DesignerEnvManagerTest extends TestCase{ assertEquals("下边界", envManager.getLanguage(), Locale.SIMPLIFIED_CHINESE); } - - public void testCheckLocale() { - DesignerEnvManager envManager = EasyMock.createMock(DesignerEnvManager.class); - Reflect on = Reflect.on(envManager); - - //验证zh-Hans-CN - Locale locale = Reflect.on(Locale.class).call("getInstance", "zh", "", "CN", "", null).get(); - assertEquals(Locale.SIMPLIFIED_CHINESE, on.call("checkLocale", locale).get()); - - //验证其它语言 - assertEquals(Locale.SIMPLIFIED_CHINESE, on.call("checkLocale", Locale.SIMPLIFIED_CHINESE).get()); - assertEquals(Locale.TRADITIONAL_CHINESE, on.call("checkLocale", Locale.TRADITIONAL_CHINESE).get()); - assertEquals(Locale.US, on.call("checkLocale", Locale.US).get()); - assertEquals(Locale.JAPAN, on.call("checkLocale", Locale.JAPAN).get()); - assertEquals(Locale.KOREA, on.call("checkLocale", Locale.KOREA).get()); - } } From 4e104128f1682f385eb11f1d0c3ae3abf15ba7b3 Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 10 Sep 2020 17:36:42 +0800 Subject: [PATCH 6/9] =?UTF-8?q?REPORT-39338=20=E3=80=90=E5=9B=9E=E5=BD=92?= =?UTF-8?q?=E3=80=91=E5=86=85=E7=BD=AE=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E8=BF=9B=E5=BA=A6=E6=9D=A1=E4=BC=9A=E5=85=88=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E4=B8=8A=E6=AC=A1=E7=9A=84=E8=BF=9B=E5=BA=A6=E5=86=8D?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=201.=20bug=E5=8E=9F=E5=9B=A0?= =?UTF-8?q?=EF=BC=9A=EF=BC=8C=E6=AF=8F=E6=AC=A1=E5=86=85=E7=BD=AE=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8=E5=90=AF=E5=8A=A8=E4=BD=BF=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E8=BF=9B=E5=BA=A6=E6=9D=A1=E5=BC=B9=E7=AA=97=E9=83=BD=E6=98=AF?= =?UTF-8?q?=E5=90=8C=E4=B8=80=E4=B8=AA=EF=BC=8C=E5=8F=AA=E6=98=AF=E5=9C=A8?= =?UTF-8?q?=E5=8F=AF=E8=A7=81=E4=B8=8E=E4=B8=8D=E5=8F=AF=E8=A7=81=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=B9=8B=E9=97=B4=E5=88=87=E6=8D=A2=EF=BC=8C=E8=80=8C?= =?UTF-8?q?=E5=9C=A8=E5=90=AF=E5=8A=A8=E6=88=90=E5=8A=9F=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E6=B2=A1=E6=9C=89=E6=B8=85=E7=A9=BA=E4=B8=8A=E6=AC=A1?= =?UTF-8?q?=E8=BF=9B=E5=BA=A6=EF=BC=8C=E6=89=80=E4=BB=A5=E4=BC=9A=E5=85=88?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=8A=E6=AC=A1=E8=BF=9B=E5=BA=A6=202.=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B9=E6=A1=88=EF=BC=9A=E4=B8=BA=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E6=9D=A1=E7=9A=84value=E7=BD=AE0=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E5=88=B7=E6=96=B0UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/iprogressbar/ProgressDialog.java | 4 ++++ .../main/java/com/fr/design/mainframe/DesignerFrame.java | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java index 29214984c..34407945f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java +++ b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java @@ -103,4 +103,8 @@ public class ProgressDialog extends UIDialog { } this.text.setText(text); } + + public void repaintProgressBar() { + progressBar.update(progressBar.getGraphics()); + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 8de3d89f3..ab4d03a87 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -1309,4 +1309,11 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta public boolean isDesignerOpened() { return designerOpened; } + + /** + * 刷新进度框的UI部分 + */ + public void repaintProgressDialog() { + progressDialog.repaintProgressBar(); + } } From 6c8283ccad1beb1cf5aeeadf89b25c6704a05534 Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 10 Sep 2020 17:38:53 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/start/server/FineEmbedServerMonitor.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java index 7e95c48d2..da8400c17 100644 --- a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java +++ b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java @@ -92,6 +92,9 @@ public class FineEmbedServerMonitor { public void run() { if (isComplete()) { scheduler.shutdown(); + // 在进度条满了之后,将进度条置0并清空进度,不然下一次打开进度条会先显示上一次的进度 + DesignerContext.getDesignerFrame().updateProgress(0); + DesignerContext.getDesignerFrame().repaintProgressDialog(); DesignerContext.getDesignerFrame().hideProgressDialog(); return; } From a5caa2b1c81bc73d8cc63634a958f29511851ad5 Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 11 Sep 2020 10:09:10 +0800 Subject: [PATCH 8/9] =?UTF-8?q?REPORT-39338=20=E3=80=90=E5=9B=9E=E5=BD=92?= =?UTF-8?q?=E3=80=91=E5=86=85=E7=BD=AE=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E8=BF=9B=E5=BA=A6=E6=9D=A1=E4=BC=9A=E5=85=88=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E4=B8=8A=E6=AC=A1=E7=9A=84=E8=BF=9B=E5=BA=A6=E5=86=8D?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=201.=20=E6=9B=B4=E6=96=B0=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=96=B9=E6=A1=88=EF=BC=9A=E7=A1=AE=E5=AE=9A=E4=BA=86?= =?UTF-8?q?=E4=B8=80=E7=9B=B4=E7=BB=B4=E6=8A=A4=E5=90=8C=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E8=BF=9B=E5=BA=A6=E6=9D=A1dialog=E6=B2=A1=E6=9C=89=E7=89=B9?= =?UTF-8?q?=E6=AE=8A=E6=84=8F=E4=B9=89=E4=B9=8B=E5=90=8E=EF=BC=8C=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=9C=A8=E6=AF=8F=E4=B8=80=E6=AC=A1=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=88=96=E8=80=85=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E5=90=AF=E5=8A=A8=E5=AE=8C=E6=88=90=E5=90=8Edialog?= =?UTF-8?q?=E5=BA=9F=E5=BC=83=E6=8E=89=EF=BC=8C=E7=84=B6=E5=90=8E=E5=9C=A8?= =?UTF-8?q?=E6=AF=8F=E4=B8=80=E6=AC=A1=E9=9C=80=E8=A6=81=E6=89=93=E5=BC=80?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E6=A1=86=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E4=B8=80=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/iprogressbar/ProgressDialog.java | 4 ---- .../com/fr/design/mainframe/DesignerFrame.java | 18 ++---------------- .../start/server/FineEmbedServerMonitor.java | 9 +++------ 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java index 34407945f..29214984c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java +++ b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java @@ -103,8 +103,4 @@ public class ProgressDialog extends UIDialog { } this.text.setText(text); } - - public void repaintProgressBar() { - progressBar.update(progressBar.getGraphics()); - } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index ab4d03a87..4eda4e18b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -1269,20 +1269,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta return progressDialog; } - public void showProgressDialog() { - + public void openProgressDialog() { + progressDialog = new ProgressDialog(this); progressDialog.setVisible(true); } - /** - * 隐藏进度框 - */ - public void hideProgressDialog() { - - progressDialog.setVisible(false); - } - /** * 更新进度框进度 * @@ -1310,10 +1302,4 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta return designerOpened; } - /** - * 刷新进度框的UI部分 - */ - public void repaintProgressDialog() { - progressDialog.repaintProgressBar(); - } } diff --git a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java index da8400c17..2c7733058 100644 --- a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java +++ b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java @@ -47,7 +47,7 @@ public class FineEmbedServerMonitor { @Override public void on(Event event, Null aNull) { getInstance().reset(); - DesignerContext.getDesignerFrame().hideProgressDialog(); + DesignerContext.getDesignerFrame().disposeProgressDialog(); } }); } @@ -92,14 +92,11 @@ public class FineEmbedServerMonitor { public void run() { if (isComplete()) { scheduler.shutdown(); - // 在进度条满了之后,将进度条置0并清空进度,不然下一次打开进度条会先显示上一次的进度 - DesignerContext.getDesignerFrame().updateProgress(0); - DesignerContext.getDesignerFrame().repaintProgressDialog(); - DesignerContext.getDesignerFrame().hideProgressDialog(); + DesignerContext.getDesignerFrame().disposeProgressDialog(); return; } if (!DesignerContext.getDesignerFrame().getProgressDialog().isVisible()) { - DesignerContext.getDesignerFrame().showProgressDialog(); + DesignerContext.getDesignerFrame().openProgressDialog(); //如果为韩文则改变字体 LocaleCenter.buildAction(new LocaleAction() { @Override From 9e42bed9aa88cf0f440bffa6b6d4848d8430bad0 Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 11 Sep 2020 14:01:17 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E8=80=83=E8=99=91=E5=88=B0progressDialog?= =?UTF-8?q?=E7=9B=AE=E5=89=8D=E5=8F=AA=E5=9C=A8FineEmbedServerMonitor?= =?UTF-8?q?=E4=B8=AD=E4=BD=BF=E7=94=A8=EF=BC=8C=E6=89=80=E4=BB=A5=E5=B0=86?= =?UTF-8?q?=E5=8E=9F=E6=9C=AC=E7=BB=B4=E6=8A=A4=E5=9C=A8DesignerFrame?= =?UTF-8?q?=E4=B8=AD=E7=9A=84progressDialog=E6=94=BE=E5=88=B0FineEmbedServ?= =?UTF-8?q?erMonitor=E4=B8=AD=EF=BC=8C=E8=80=8CDesignerFrame=E5=8E=9F?= =?UTF-8?q?=E6=9C=AC=E7=9A=84=E6=88=90=E5=91=98=E5=8F=98=E9=87=8F=E5=92=8C?= =?UTF-8?q?=E7=9B=B8=E5=BA=94=E5=88=9D=E5=A7=8B=E5=8C=96=E5=88=A0=E9=99=A4?= =?UTF-8?q?=EF=BC=8C=E4=B8=80=E4=BA=9B=E7=9B=B8=E5=85=B3=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E5=85=88=E5=81=9A=E6=88=90=E7=A9=BA=E5=AE=9E=E7=8E=B0=EF=BC=8C?= =?UTF-8?q?=E7=84=B6=E5=90=8E=E6=A0=87=E8=AE=B0=E4=B8=BA=E5=BA=9F=E5=BC=83?= =?UTF-8?q?=EF=BC=8C=E8=BF=99=E4=BA=9B=E6=96=B9=E6=B3=95=E5=85=B7=E4=BD=93?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E5=92=8C=E4=BD=BF=E7=94=A8=E9=83=BD=E6=94=BE?= =?UTF-8?q?=E5=88=B0FineEmbedServerMonitor=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrame.java | 13 +++++------- .../start/server/FineEmbedServerMonitor.java | 21 ++++++++++--------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 4eda4e18b..fe0276b38 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -257,8 +257,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } }; - private ProgressDialog progressDialog; - public DesignerFrame(ToolBarMenuDock ad) { setName(DESIGNER_FRAME_NAME); @@ -338,7 +336,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta this.setDropTarget(new DropTarget(this, DnDConstants.ACTION_MOVE, new FileDropTargetListener(), true)); closeMode = UIConstants.CLOSE_OF_AUTHORITY; initMenuPane(); - this.progressDialog = new ProgressDialog(this); } public void resizeFrame() { @@ -1264,14 +1261,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } } + @Deprecated public ProgressDialog getProgressDialog() { - return progressDialog; + return new ProgressDialog(this); } + @Deprecated public void openProgressDialog() { - progressDialog = new ProgressDialog(this); - progressDialog.setVisible(true); } @@ -1280,17 +1277,17 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * * @param progress 进度值 */ + @Deprecated public void updateProgress(int progress) { - progressDialog.setProgressValue(progress); } /** * 释放进度框 */ + @Deprecated public void disposeProgressDialog() { - progressDialog.dispose(); } /** diff --git a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java index 2c7733058..f8f7a13ea 100644 --- a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java +++ b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java @@ -32,7 +32,7 @@ public class FineEmbedServerMonitor { */ private static final int STEP_HEARTBEAT = 40; private static volatile FineEmbedServerMonitor monitor; - private static ProgressDialog progressBar = DesignerContext.getDesignerFrame().getProgressDialog(); + private static ProgressDialog progressDialog = new ProgressDialog(DesignerContext.getDesignerFrame()); //由于默认值的字体不支持韩文,所以要对韩文单独生成字体 private FRFont font = null; private static final int FONT_RGB = 333334; @@ -47,7 +47,7 @@ public class FineEmbedServerMonitor { @Override public void on(Event event, Null aNull) { getInstance().reset(); - DesignerContext.getDesignerFrame().disposeProgressDialog(); + progressDialog.dispose(); } }); } @@ -64,7 +64,7 @@ public class FineEmbedServerMonitor { } public int getProgress() { - if (progress == progressBar.getProgressMaximum()) { + if (progress == progressDialog.getProgressMaximum()) { return progress; } else { progress += STEP; @@ -73,7 +73,7 @@ public class FineEmbedServerMonitor { } public void setComplete() { - this.progress = progressBar.getProgressMaximum(); + this.progress = progressDialog.getProgressMaximum(); } public void reset() { @@ -81,7 +81,7 @@ public class FineEmbedServerMonitor { } public boolean isComplete() { - return this.progress >= progressBar.getProgressMaximum(); + return this.progress >= progressDialog.getProgressMaximum(); } public void monitor() { @@ -92,11 +92,12 @@ public class FineEmbedServerMonitor { public void run() { if (isComplete()) { scheduler.shutdown(); - DesignerContext.getDesignerFrame().disposeProgressDialog(); + progressDialog.dispose(); return; } - if (!DesignerContext.getDesignerFrame().getProgressDialog().isVisible()) { - DesignerContext.getDesignerFrame().openProgressDialog(); + if (!progressDialog.isVisible()) { + progressDialog = new ProgressDialog(DesignerContext.getDesignerFrame()); + progressDialog.setVisible(true); //如果为韩文则改变字体 LocaleCenter.buildAction(new LocaleAction() { @Override @@ -105,9 +106,9 @@ public class FineEmbedServerMonitor { } }, SupportLocaleImpl.SUPPORT_KOREA); String text = Toolkit.i18nText("Fine-Design_Basic_Loading_Embed_Server"); - DesignerContext.getDesignerFrame().getProgressDialog().updateLoadingText(text, font); + progressDialog.updateLoadingText(text, font); } - DesignerContext.getDesignerFrame().updateProgress(getProgress()); + progressDialog.setProgressValue(getProgress()); } }, 0, STEP_HEARTBEAT, TimeUnit.MILLISECONDS);