Browse Source

Merge pull request #95 in DESIGN/design from ~VITO/c-design:feature/10.0 to feature/10.0

* commit 'd1bac490e2cbc8738fc432ac402c1f3c0ad932ae':
  REPORT-8393 监听放后
master
superman 7 years ago
parent
commit
897b2cfe54
  1. 7
      designer-realize/src/com/fr/start/SplashContext.java
  2. 19
      designer-realize/src/com/fr/start/fx/SplashFx.java
  3. 21
      designer-realize/src/com/fr/start/fx/SplashFxWindow.java

7
designer-realize/src/com/fr/start/SplashContext.java

@ -57,18 +57,18 @@ public class SplashContext {
* 展示启动动画
*/
public void show() {
splashStrategy.show();
//监听
initListener();
splashStrategy.show();
}
/**
* 隐藏启动动画
*/
public void hide() {
splashStrategy.hide();
//取消监听
EventDispatcher.stopListen(listener);
splashStrategy.hide();
// 窗口关闭后取消定时获取模块信息的timer
scheduler.shutdown();
// 一次性
@ -88,14 +88,13 @@ public class SplashContext {
@Override
public void on(Event event, String i18n) {
showThanks();
moduleID = i18n;
loadingIndex++;
updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]);
}
};
EventDispatcher.listen(ModuleEvent.MajorModuleStarting, listener);
showThanks();
}
private void updateModuleLog(String text) {

19
designer-realize/src/com/fr/start/fx/SplashFx.java

@ -18,7 +18,7 @@ import java.util.concurrent.Executors;
*/
public class SplashFx implements SplashStrategy {
private SplashFxWindow test;
private SplashFxWindow fxWindow;
private static final ExecutorService SERVICE = Executors.newSingleThreadExecutor();
@Override
@ -29,7 +29,7 @@ public class SplashFx implements SplashStrategy {
Application.launch(SplashFxWindow.class);
}
});
test = SplashFxWindow.waitForStartUpTest();
fxWindow = SplashFxWindow.waitForStartUpTest();
}
@Override
@ -39,22 +39,11 @@ public class SplashFx implements SplashStrategy {
@Override
public void updateModuleLog(final String text) {
Platform.runLater(new Runnable() {
@Override
public void run() {
test.updateModuleInfo(text);
}
});
fxWindow.updateModuleInfo(text);
}
@Override
public void updateThanksLog(final String text) {
Platform.runLater(new Runnable() {
@Override
public void run() {
test.updateThanks(text);
}
});
fxWindow.updateThanks(text);
}
}

21
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 javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
@ -119,16 +120,32 @@ public class SplashFxWindow extends Application {
*
* @param s 文字
*/
public void updateModuleInfo(String s) {
public void updateModuleInfo(final String s) {
Platform.runLater(new Runnable() {
@Override
public void run() {
if (moduleInfo != null) {
moduleInfo.setText(s);
}
}
});
}
/**
* 更新欢迎信息
*
* @param s 文字
*/
public void updateThanks(String s) {
public void updateThanks(final String s) {
Platform.runLater(new Runnable() {
@Override
public void run() {
if (thanks != null) {
thanks.setText(s);
}
}
});
}
}

Loading…
Cancel
Save