diff --git a/designer-base/src/com/fr/start/BaseDesigner.java b/designer-base/src/com/fr/start/BaseDesigner.java index 3c5ede5e32..e374f25998 100644 --- a/designer-base/src/com/fr/start/BaseDesigner.java +++ b/designer-base/src/com/fr/start/BaseDesigner.java @@ -25,8 +25,6 @@ import com.fr.module.ModuleEvent; import com.fr.stable.OperatingSystem; import java.awt.Window; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; import java.io.File; import java.lang.reflect.Method; import java.util.concurrent.ExecutorService; @@ -76,20 +74,12 @@ public abstract class BaseDesigner extends ToolBarMenuDock { } public void show(final String[] args) { - ExecutorService executorService = Executors.newSingleThreadExecutor(); - executorService.submit(new Runnable() { - @Override - public void run() { - collectUserInformation(); - showDesignerFrame(args, DesignerContext.getDesignerFrame(), false); - DesignerContext.getDesignerFrame().refreshEnv(); - for (int i = 0; !TemplateTreePane.getInstance().getTemplateFileTree().isTemplateShowing() && i < LOAD_TREE_MAXNUM; i++) { - TemplateTreePane.getInstance().getTemplateFileTree().refresh(); - } - } - }); - executorService.shutdown(); - DesignerContext.getDesignerFrame().setVisible(true); + collectUserInformation(); + showDesignerFrame(args, DesignerContext.getDesignerFrame(), false); + DesignerContext.getDesignerFrame().refreshEnv(); + for (int i = 0; !TemplateTreePane.getInstance().getTemplateFileTree().isTemplateShowing() && i < LOAD_TREE_MAXNUM; i++) { + TemplateTreePane.getInstance().getTemplateFileTree().refresh(); + } } @@ -160,11 +150,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock { if (OperatingSystem.isMacOS()) { enableFullScreenMode(df); } - df.addWindowListener(new WindowAdapter() { - public void windowOpened(WindowEvent e) { - df.getSelectedJTemplate().requestGridFocus(); - } - }); + df.getSelectedJTemplate().requestGridFocus(); return isException; } diff --git a/designer-base/src/com/fr/start/SplashFxActionListener.java b/designer-base/src/com/fr/start/SplashFxActionListener.java new file mode 100644 index 0000000000..35cd766e11 --- /dev/null +++ b/designer-base/src/com/fr/start/SplashFxActionListener.java @@ -0,0 +1,13 @@ +package com.fr.start; + +/** + * 启动动画监听 + * Created by zack on 2018/6/14. + */ +public interface SplashFxActionListener { + /** + * 启动动画关闭 + */ + void splashClose(); + +} diff --git a/designer-realize/src/com/fr/start/fx/SplashFx.java b/designer-realize/src/com/fr/start/fx/SplashFx.java index aef6d81b20..fc657f6596 100644 --- a/designer-realize/src/com/fr/start/fx/SplashFx.java +++ b/designer-realize/src/com/fr/start/fx/SplashFx.java @@ -1,5 +1,7 @@ package com.fr.start.fx; +import com.fr.design.mainframe.DesignerContext; +import com.fr.start.SplashFxActionListener; import com.fr.start.SplashStrategy; import javafx.application.Application; import javafx.application.Platform; @@ -31,6 +33,12 @@ public class SplashFx implements SplashStrategy { } }); fxWindow = SplashFxWindow.waitForStartUpTest(); + fxWindow.addSplashActionListener(new SplashFxActionListener() { + @Override + public void splashClose() { + DesignerContext.getDesignerFrame().setVisible(true); + } + }); } @Override diff --git a/designer-realize/src/com/fr/start/fx/SplashFxWindow.java b/designer-realize/src/com/fr/start/fx/SplashFxWindow.java index e4d845d271..5342762a12 100644 --- a/designer-realize/src/com/fr/start/fx/SplashFxWindow.java +++ b/designer-realize/src/com/fr/start/fx/SplashFxWindow.java @@ -4,6 +4,7 @@ import com.bulenkov.iconloader.util.JBUI; import com.fr.base.FRContext; import com.fr.stable.OperatingSystem; import com.fr.start.SplashContext; +import com.fr.start.SplashFxActionListener; import javafx.application.Application; import javafx.application.Platform; import javafx.scene.Scene; @@ -16,6 +17,8 @@ import javafx.scene.text.Text; import javafx.stage.Stage; import javafx.stage.StageStyle; +import java.util.ArrayList; +import java.util.List; import java.util.concurrent.CountDownLatch; @@ -46,6 +49,7 @@ public class SplashFxWindow extends Application { private Text moduleInfo; private Text thanks; + private List listeners = new ArrayList(); private static int uiScale(int i) { return (int) (i * JBUI_INIT_SCALE); @@ -121,6 +125,7 @@ public class SplashFxWindow extends Application { public void run() { try { ((Stage) moduleInfo.getScene().getWindow()).close(); + fireSplashClose(); } catch (Exception e) { FRContext.getLogger().error(e.getMessage(), e); } @@ -161,4 +166,17 @@ public class SplashFxWindow extends Application { }); } + /** + * 添加一个动画状态监听 + * @param listener + */ + public void addSplashActionListener(SplashFxActionListener listener) { + listeners.add(listener); + } + + public void fireSplashClose() { + for (SplashFxActionListener listener : listeners) { + listener.splashClose(); + } + } } diff --git a/designer-realize/src/com/fr/start/module/DesignerStartup.java b/designer-realize/src/com/fr/start/module/DesignerStartup.java index eb1cc85d72..b33e77c821 100644 --- a/designer-realize/src/com/fr/start/module/DesignerStartup.java +++ b/designer-realize/src/com/fr/start/module/DesignerStartup.java @@ -2,6 +2,7 @@ package com.fr.start.module; import com.fr.core.env.EnvConfig; import com.fr.core.env.EnvEvent; +import com.fr.design.mainframe.DesignerContext; import com.fr.event.Event; import com.fr.event.Listener; import com.fr.module.Activator; @@ -27,10 +28,11 @@ public class DesignerStartup extends Activator { startSub(EnvBasedModule.class); getRoot().getSingleton(EnvSwitcher.class).switch2LastEnv(); registerEnvListener(); - //启动设计器界面 - designer.show(args); + DesignerContext.getDesignerFrame().setVisible(true); //启动画面结束 SplashContext.getInstance().hide(); + //启动设计器界面 + designer.show(args); startSub(StartFinishActivator.class); }