59 lines
1.6 KiB
59 lines
1.6 KiB
7 years ago
|
package com.fr.start.fx;
|
||
|
|
||
7 years ago
|
import com.fr.design.mainframe.DesignerContext;
|
||
|
import com.fr.start.SplashFxActionListener;
|
||
7 years ago
|
import com.fr.start.SplashStrategy;
|
||
|
import javafx.application.Application;
|
||
|
import javafx.application.Platform;
|
||
|
|
||
|
import java.util.concurrent.ExecutorService;
|
||
|
import java.util.concurrent.Executors;
|
||
|
|
||
|
/**
|
||
|
* JavaFx方式启动启动动画。这种方式在mac下与
|
||
|
* swing一起启动会会出现线程死锁,jvm等问题,
|
||
|
* 所以这个方式仅用于windows上。
|
||
|
*
|
||
|
* @author vito
|
||
|
* @date 2018/6/4
|
||
|
* @see com.fr.start.jni.SplashMac
|
||
|
*/
|
||
|
public class SplashFx implements SplashStrategy {
|
||
|
|
||
7 years ago
|
private SplashFxWindow fxWindow;
|
||
7 years ago
|
private static final ExecutorService SERVICE = Executors.newSingleThreadExecutor();
|
||
|
|
||
|
@Override
|
||
|
public void show() {
|
||
7 years ago
|
Platform.setImplicitExit(false);
|
||
7 years ago
|
SERVICE.execute(new Runnable() {
|
||
|
@Override
|
||
|
public void run() {
|
||
|
Application.launch(SplashFxWindow.class);
|
||
|
}
|
||
|
});
|
||
7 years ago
|
fxWindow = SplashFxWindow.waitForStartUpTest();
|
||
7 years ago
|
fxWindow.addSplashActionListener(new SplashFxActionListener() {
|
||
|
@Override
|
||
|
public void splashClose() {
|
||
|
DesignerContext.getDesignerFrame().setVisible(true);
|
||
|
}
|
||
|
});
|
||
7 years ago
|
}
|
||
|
|
||
|
@Override
|
||
|
public void hide() {
|
||
7 years ago
|
fxWindow.close();
|
||
7 years ago
|
}
|
||
|
|
||
|
@Override
|
||
7 years ago
|
public void updateModuleLog(final String text) {
|
||
7 years ago
|
fxWindow.updateModuleInfo(text);
|
||
7 years ago
|
}
|
||
|
|
||
|
@Override
|
||
7 years ago
|
public void updateThanksLog(final String text) {
|
||
7 years ago
|
fxWindow.updateThanks(text);
|
||
7 years ago
|
}
|
||
|
}
|