diff --git a/designer-realize/src/com/fr/design/images/splash_10.gif b/designer-realize/src/com/fr/design/images/splash_10.gif new file mode 100644 index 000000000..0f099397e Binary files /dev/null and b/designer-realize/src/com/fr/design/images/splash_10.gif differ diff --git a/designer-realize/src/com/fr/start/fx/SplashFx.java b/designer-realize/src/com/fr/start/fx/SplashFx.java index 34990509d..b69de8946 100644 --- a/designer-realize/src/com/fr/start/fx/SplashFx.java +++ b/designer-realize/src/com/fr/start/fx/SplashFx.java @@ -38,12 +38,23 @@ public class SplashFx implements SplashStrategy { } @Override - public void updateModuleLog(String text) { - test.updateModuleInfo(text); + public void updateModuleLog(final String text) { + Platform.runLater(new Runnable() { + @Override + public void run() { + test.updateModuleInfo(text); + } + }); + } @Override - public void updateThanksLog(String text) { - test.updateThanks(text); + public void updateThanksLog(final String text) { + Platform.runLater(new Runnable() { + @Override + public void run() { + test.updateThanks(text); + } + }); } } diff --git a/designer-realize/src/com/fr/start/fx/SplashFxWindow.java b/designer-realize/src/com/fr/start/fx/SplashFxWindow.java index 0685943d9..f048cebd5 100644 --- a/designer-realize/src/com/fr/start/fx/SplashFxWindow.java +++ b/designer-realize/src/com/fr/start/fx/SplashFxWindow.java @@ -36,7 +36,9 @@ public class SplashFxWindow extends Application { private static final int WINDOW_WIDTH = 640; private static final int WINDOW_HEIGHT = 360; private static final int FONT = 12; + private static final int FRAME_COUNT = 254; private static final String THINKS_COLOR = "#82b1ce"; + private static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif"; private static final CountDownLatch LATCH = new CountDownLatch(1); private static SplashFxWindow app = null; @@ -75,8 +77,7 @@ public class SplashFxWindow extends Application { public void start(Stage primaryStage) { AnchorPane root = new AnchorPane(); primaryStage.initStyle(StageStyle.TRANSPARENT); - long t = System.currentTimeMillis(); - Image image = new FastGifImage("com/fr/base/images/oem/splash_10.gif", 254, WINDOW_WIDTH, WINDOW_HEIGHT); + Image image = new FastGifImage(SPLASH_PATH, FRAME_COUNT, WINDOW_WIDTH, WINDOW_HEIGHT); ImageView gif = new ImageView(image); diff --git a/designer-realize/src/com/fr/start/jni/SplashMac.java b/designer-realize/src/com/fr/start/jni/SplashMac.java index 16ff8fc50..c5c8ee63e 100644 --- a/designer-realize/src/com/fr/start/jni/SplashMac.java +++ b/designer-realize/src/com/fr/start/jni/SplashMac.java @@ -1,7 +1,9 @@ package com.fr.start.jni; +import com.fr.base.FRContext; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; import com.fr.start.SplashContext; import com.fr.start.SplashStrategy; @@ -21,7 +23,7 @@ import java.io.InputStream; public class SplashMac implements SplashStrategy { private static final String SPLASH_CACHE_NAME = "splash_10.gif"; - private static final String SPLASH_PATH = "/com/fr/base/images/oem/splash_10.gif"; + private static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif"; private SplashJNI jni; @@ -33,11 +35,14 @@ public class SplashMac implements SplashStrategy { * 将jar中的资源拷贝到缓存文件夹 * * @return 路径 - * @throws IOException 拷贝失败 */ - private static String loadResFromJar() throws UnsatisfiedLinkError { + private static String loadResFromJar() { File tempLib = null; try (InputStream inputStream = SplashContext.class.getResourceAsStream(SplashMac.SPLASH_PATH)) { + if (inputStream == null) { + FRContext.getLogger().error("Unable to copy " + SplashMac.SPLASH_PATH + " from jar file."); + return StringUtils.EMPTY; + } tempLib = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), SPLASH_CACHE_NAME)); byte[] buffer = new byte[1024]; int read = -1; @@ -48,8 +53,11 @@ public class SplashMac implements SplashStrategy { } return tempLib.getAbsolutePath(); } catch (IOException e) { - tempLib.deleteOnExit(); - throw new UnsatisfiedLinkError("Unable to open " + SplashMac.SPLASH_PATH + " from jar file."); + if (tempLib != null) { + tempLib.deleteOnExit(); + } + // 直接抛异常 + throw new RuntimeException("Unable to copy " + SplashMac.SPLASH_PATH + " from jar file."); } }