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() { public void show() {
splashStrategy.show();
//监听 //监听
initListener(); initListener();
splashStrategy.show();
} }
/** /**
* 隐藏启动动画 * 隐藏启动动画
*/ */
public void hide() { public void hide() {
splashStrategy.hide();
//取消监听 //取消监听
EventDispatcher.stopListen(listener); EventDispatcher.stopListen(listener);
splashStrategy.hide();
// 窗口关闭后取消定时获取模块信息的timer // 窗口关闭后取消定时获取模块信息的timer
scheduler.shutdown(); scheduler.shutdown();
// 一次性 // 一次性
@ -88,14 +88,13 @@ public class SplashContext {
@Override @Override
public void on(Event event, String i18n) { public void on(Event event, String i18n) {
showThanks();
moduleID = i18n; moduleID = i18n;
loadingIndex++; loadingIndex++;
updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]);
} }
}; };
EventDispatcher.listen(ModuleEvent.MajorModuleStarting, listener); EventDispatcher.listen(ModuleEvent.MajorModuleStarting, listener);
showThanks();
} }
private void updateModuleLog(String text) { 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 { public class SplashFx implements SplashStrategy {
private SplashFxWindow test; private SplashFxWindow fxWindow;
private static final ExecutorService SERVICE = Executors.newSingleThreadExecutor(); private static final ExecutorService SERVICE = Executors.newSingleThreadExecutor();
@Override @Override
@ -29,7 +29,7 @@ public class SplashFx implements SplashStrategy {
Application.launch(SplashFxWindow.class); Application.launch(SplashFxWindow.class);
} }
}); });
test = SplashFxWindow.waitForStartUpTest(); fxWindow = SplashFxWindow.waitForStartUpTest();
} }
@Override @Override
@ -39,22 +39,11 @@ public class SplashFx implements SplashStrategy {
@Override @Override
public void updateModuleLog(final String text) { public void updateModuleLog(final String text) {
Platform.runLater(new Runnable() { fxWindow.updateModuleInfo(text);
@Override
public void run() {
test.updateModuleInfo(text);
}
});
} }
@Override @Override
public void updateThanksLog(final String text) { public void updateThanksLog(final String text) {
Platform.runLater(new Runnable() { fxWindow.updateThanks(text);
@Override
public void run() {
test.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.base.FRContext;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import javafx.application.Application; import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.scene.image.ImageView; import javafx.scene.image.ImageView;
@ -119,16 +120,32 @@ public class SplashFxWindow extends Application {
* *
* @param s 文字 * @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); moduleInfo.setText(s);
} }
}
});
}
/** /**
* 更新欢迎信息 * 更新欢迎信息
* *
* @param 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); thanks.setText(s);
} }
} }
});
}
}

Loading…
Cancel
Save