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 4eda4e18b7..fe0276b384 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 2c77330589..f8f7a13ea2 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);