|
|
@ -8,6 +8,7 @@ import com.fr.base.FRContext; |
|
|
|
import com.fr.base.GraphHelper; |
|
|
|
import com.fr.base.GraphHelper; |
|
|
|
import com.fr.design.mainframe.bbs.BBSConstants; |
|
|
|
import com.fr.design.mainframe.bbs.BBSConstants; |
|
|
|
import com.fr.general.GeneralContext; |
|
|
|
import com.fr.general.GeneralContext; |
|
|
|
|
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.ModuleContext; |
|
|
|
import com.fr.general.ModuleContext; |
|
|
|
import com.fr.stable.Constants; |
|
|
|
import com.fr.stable.Constants; |
|
|
|
import com.fr.stable.CoreGraphHelper; |
|
|
|
import com.fr.stable.CoreGraphHelper; |
|
|
@ -27,14 +28,11 @@ import java.util.TimerTask; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author neil |
|
|
|
* @author neil |
|
|
|
* |
|
|
|
|
|
|
|
* @date: 2015-3-13-上午9:47:58 |
|
|
|
* @date: 2015-3-13-上午9:47:58 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class ReportSplashPane extends SplashPane{ |
|
|
|
public class ReportSplashPane extends SplashPane { |
|
|
|
|
|
|
|
|
|
|
|
private static final String OEM_PATH = "/com/fr/base/images/oem"; |
|
|
|
private static final String OEM_PATH = "/com/fr/base/images/oem"; |
|
|
|
private static final String SPLASH_CN = "splash_chinese.png"; |
|
|
|
|
|
|
|
private static final String SPLASH_EN = "splash_english.png"; |
|
|
|
|
|
|
|
private static final String SPLASH_MAC_CN = "splash_chinese_mac.png"; |
|
|
|
private static final String SPLASH_MAC_CN = "splash_chinese_mac.png"; |
|
|
|
private static final String SPLASH_MAC_EN = "splash_english_mac.png"; |
|
|
|
private static final String SPLASH_MAC_EN = "splash_english_mac.png"; |
|
|
|
|
|
|
|
|
|
|
@ -55,6 +53,10 @@ public class ReportSplashPane extends SplashPane{ |
|
|
|
private java.util.Timer timer = new java.util.Timer(); |
|
|
|
private java.util.Timer timer = new java.util.Timer(); |
|
|
|
|
|
|
|
|
|
|
|
public ReportSplashPane() { |
|
|
|
public ReportSplashPane() { |
|
|
|
|
|
|
|
init(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void init() { |
|
|
|
this.setBackground(null); |
|
|
|
this.setBackground(null); |
|
|
|
|
|
|
|
|
|
|
|
timer.schedule(new TimerTask() { |
|
|
|
timer.schedule(new TimerTask() { |
|
|
@ -65,10 +67,7 @@ public class ReportSplashPane extends SplashPane{ |
|
|
|
} |
|
|
|
} |
|
|
|
}, 0, 300); |
|
|
|
}, 0, 300); |
|
|
|
|
|
|
|
|
|
|
|
ModuleContext.registerModuleListener(moduleListener); |
|
|
|
ModuleListener moduleListener = new ModuleAdapter() { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ModuleListener moduleListener = new ModuleAdapter() { |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onStartBefore(String moduleName, String moduleI18nName) { |
|
|
|
public void onStartBefore(String moduleName, String moduleI18nName) { |
|
|
|
moduleID = moduleI18nName; |
|
|
|
moduleID = moduleI18nName; |
|
|
@ -77,6 +76,8 @@ public class ReportSplashPane extends SplashPane{ |
|
|
|
ReportSplashPane.this.repaint(); |
|
|
|
ReportSplashPane.this.repaint(); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
ModuleContext.registerModuleListener(moduleListener); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void paintComponent(Graphics g) { |
|
|
|
protected void paintComponent(Graphics g) { |
|
|
|
super.paintComponent(g); |
|
|
|
super.paintComponent(g); |
|
|
@ -105,7 +106,7 @@ public class ReportSplashPane extends SplashPane{ |
|
|
|
return splashBuffedImage; |
|
|
|
return splashBuffedImage; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void paintShowText(Graphics2D splashG2d){ |
|
|
|
private void paintShowText(Graphics2D splashG2d) { |
|
|
|
FontRenderContext fontRenderContext = splashG2d.getFontRenderContext(); |
|
|
|
FontRenderContext fontRenderContext = splashG2d.getFontRenderContext(); |
|
|
|
LineMetrics fm = splashG2d.getFont().getLineMetrics("", |
|
|
|
LineMetrics fm = splashG2d.getFont().getLineMetrics("", |
|
|
|
fontRenderContext); |
|
|
|
fontRenderContext); |
|
|
@ -119,6 +120,13 @@ public class ReportSplashPane extends SplashPane{ |
|
|
|
//加载模块信息
|
|
|
|
//加载模块信息
|
|
|
|
double y = MODULE_INFO_Y + height + leading + ascent; |
|
|
|
double y = MODULE_INFO_Y + height + leading + ascent; |
|
|
|
GraphHelper.drawString(splashG2d, showText, MODULE_INFO_X, y); |
|
|
|
GraphHelper.drawString(splashG2d, showText, MODULE_INFO_X, y); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//每次随机感谢一位论坛用户
|
|
|
|
|
|
|
|
if (shouldShowThanks()) { |
|
|
|
|
|
|
|
splashG2d.setPaint(THANK_COLOR); |
|
|
|
|
|
|
|
String content = Inter.getLocText("FR-Designer_Thanks-To") + GUEST; |
|
|
|
|
|
|
|
GraphHelper.drawString(splashG2d, content, THANK_INFO_X, y); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 是否显示鸣谢文字
|
|
|
|
// 是否显示鸣谢文字
|
|
|
@ -132,14 +140,17 @@ public class ReportSplashPane extends SplashPane{ |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static String getRandomUser(){ |
|
|
|
private static String getRandomUser() { |
|
|
|
int num = new Random().nextInt(BBSConstants.ALL_GUEST.length); |
|
|
|
String[] allGuest = BBSConstants.getAllGuest(); |
|
|
|
return StringUtils.BLANK + BBSConstants.ALL_GUEST[num]; |
|
|
|
if (allGuest.length == 0) { |
|
|
|
|
|
|
|
return StringUtils.EMPTY; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int num = new Random().nextInt(allGuest.length); |
|
|
|
|
|
|
|
return StringUtils.BLANK + allGuest[num]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 窗口关闭后取消定时获取模块信息的timer |
|
|
|
* 窗口关闭后取消定时获取模块信息的timer |
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void releaseTimer() { |
|
|
|
public void releaseTimer() { |
|
|
|
timer.cancel(); |
|
|
|
timer.cancel(); |
|
|
@ -149,7 +160,6 @@ public class ReportSplashPane extends SplashPane{ |
|
|
|
* 创建启动画面的背景图片 |
|
|
|
* 创建启动画面的背景图片 |
|
|
|
* |
|
|
|
* |
|
|
|
* @return 背景图片 |
|
|
|
* @return 背景图片 |
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public Image createSplashBackground() { |
|
|
|
public Image createSplashBackground() { |
|
|
|
String fileName = getImageName(); |
|
|
|
String fileName = getImageName(); |
|
|
@ -157,12 +167,9 @@ public class ReportSplashPane extends SplashPane{ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//获取图片文件名
|
|
|
|
//获取图片文件名
|
|
|
|
private String getImageName(){ |
|
|
|
private String getImageName() { |
|
|
|
boolean isChina = GeneralContext.isChineseEnv(); |
|
|
|
boolean isChina = GeneralContext.isChineseEnv(); |
|
|
|
//jdk1.8下透明有bug, 设置了setWindowTransparent后, JFrame直接最小化了, 先用mac下的加载图片
|
|
|
|
//jdk1.8下透明有bug, 设置了setWindowTransparent后, JFrame直接最小化了, 先用mac下的加载图片
|
|
|
|
return isChina ? SPLASH_MAC_CN : SPLASH_MAC_EN; |
|
|
|
return isChina ? SPLASH_MAC_CN : SPLASH_MAC_EN; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |