Browse Source

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

* commit '1d4a172a87a34b9b492b1afe6707aabcff912e07':
  REPORT-8393 10.0启动动画 1.动图放到designer模块; 2.win下启动画面报错的问题
master
superman 7 years ago
parent
commit
97f3376637
  1. BIN
      designer-realize/src/com/fr/design/images/splash_10.gif
  2. 15
      designer-realize/src/com/fr/start/fx/SplashFx.java
  3. 5
      designer-realize/src/com/fr/start/fx/SplashFxWindow.java
  4. 16
      designer-realize/src/com/fr/start/jni/SplashMac.java

BIN
designer-realize/src/com/fr/design/images/splash_10.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 MiB

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

@ -38,12 +38,23 @@ public class SplashFx implements SplashStrategy {
} }
@Override @Override
public void updateModuleLog(String text) { public void updateModuleLog(final String text) {
Platform.runLater(new Runnable() {
@Override
public void run() {
test.updateModuleInfo(text); test.updateModuleInfo(text);
} }
});
}
@Override @Override
public void updateThanksLog(String text) { public void updateThanksLog(final String text) {
Platform.runLater(new Runnable() {
@Override
public void run() {
test.updateThanks(text); test.updateThanks(text);
} }
});
}
} }

5
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_WIDTH = 640;
private static final int WINDOW_HEIGHT = 360; private static final int WINDOW_HEIGHT = 360;
private static final int FONT = 12; private static final int FONT = 12;
private static final int FRAME_COUNT = 254;
private static final String THINKS_COLOR = "#82b1ce"; 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 final CountDownLatch LATCH = new CountDownLatch(1);
private static SplashFxWindow app = null; private static SplashFxWindow app = null;
@ -75,8 +77,7 @@ public class SplashFxWindow extends Application {
public void start(Stage primaryStage) { public void start(Stage primaryStage) {
AnchorPane root = new AnchorPane(); AnchorPane root = new AnchorPane();
primaryStage.initStyle(StageStyle.TRANSPARENT); primaryStage.initStyle(StageStyle.TRANSPARENT);
long t = System.currentTimeMillis(); Image image = new FastGifImage(SPLASH_PATH, FRAME_COUNT, WINDOW_WIDTH, WINDOW_HEIGHT);
Image image = new FastGifImage("com/fr/base/images/oem/splash_10.gif", 254, WINDOW_WIDTH, WINDOW_HEIGHT);
ImageView gif = new ImageView(image); ImageView gif = new ImageView(image);

16
designer-realize/src/com/fr/start/jni/SplashMac.java

@ -1,7 +1,9 @@
package com.fr.start.jni; package com.fr.start.jni;
import com.fr.base.FRContext;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.start.SplashContext; import com.fr.start.SplashContext;
import com.fr.start.SplashStrategy; import com.fr.start.SplashStrategy;
@ -21,7 +23,7 @@ import java.io.InputStream;
public class SplashMac implements SplashStrategy { public class SplashMac implements SplashStrategy {
private static final String SPLASH_CACHE_NAME = "splash_10.gif"; 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; private SplashJNI jni;
@ -33,11 +35,14 @@ public class SplashMac implements SplashStrategy {
* 将jar中的资源拷贝到缓存文件夹 * 将jar中的资源拷贝到缓存文件夹
* *
* @return 路径 * @return 路径
* @throws IOException 拷贝失败
*/ */
private static String loadResFromJar() throws UnsatisfiedLinkError { private static String loadResFromJar() {
File tempLib = null; File tempLib = null;
try (InputStream inputStream = SplashContext.class.getResourceAsStream(SplashMac.SPLASH_PATH)) { 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)); tempLib = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), SPLASH_CACHE_NAME));
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024];
int read = -1; int read = -1;
@ -48,8 +53,11 @@ public class SplashMac implements SplashStrategy {
} }
return tempLib.getAbsolutePath(); return tempLib.getAbsolutePath();
} catch (IOException e) { } catch (IOException e) {
if (tempLib != null) {
tempLib.deleteOnExit(); tempLib.deleteOnExit();
throw new UnsatisfiedLinkError("Unable to open " + SplashMac.SPLASH_PATH + " from jar file."); }
// 直接抛异常
throw new RuntimeException("Unable to copy " + SplashMac.SPLASH_PATH + " from jar file.");
} }
} }

Loading…
Cancel
Save