Browse Source

Merge pull request #1236 in BA/design from ~VITO/design:release/9.0 to release/9.0

* commit 'db4e94986a6c5974ad84beaadc2d5c862ab362f3':
  REPORT-3262 splash
master
superman 7 years ago
parent
commit
5a55c7b7af
  1. 52
      designer/src/com/fr/start/ReportSplashPane.java
  2. 3
      designer_base/src/com/fr/design/gui/UILookAndFeel.java
  3. 8
      designer_base/src/com/fr/start/SplashPane.java
  4. 2
      designer_base/src/com/fr/start/SplashWindow.java

52
designer/src/com/fr/start/ReportSplashPane.java

@ -3,6 +3,7 @@
*/ */
package com.fr.start; package com.fr.start;
import com.bulenkov.iconloader.IconLoader;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
@ -10,8 +11,6 @@ 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.Inter;
import com.fr.general.ModuleContext; import com.fr.general.ModuleContext;
import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.module.ModuleAdapter; import com.fr.stable.module.ModuleAdapter;
@ -19,9 +18,6 @@ import com.fr.stable.module.ModuleListener;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.font.FontRenderContext;
import java.awt.font.LineMetrics;
import java.awt.image.BufferedImage;
import java.util.Locale; import java.util.Locale;
import java.util.Random; import java.util.Random;
import java.util.TimerTask; import java.util.TimerTask;
@ -36,12 +32,12 @@ public class ReportSplashPane extends SplashPane {
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";
private static final Color MODULE_COLOR = new Color(230, 230, 230); private static final Color MODULE_COLOR = new Color(255, 255, 255);
private static final int MODULE_INFO_X = 25; private static final int MODULE_INFO_X = 54;
private static final int MODULE_INFO_Y = 270; private static final int MODULE_INFO_Y = 340;
private static final Color THANK_COLOR = new Color(72, 216, 249); private static final Color THANK_COLOR = new Color(255, 255, 255, (int) (0.4 * 255 + 0.5));
private static final int THANK_INFO_X = 460; private static final int THANK_INFO_Y = 382;
private static final String GUEST = getRandomUser(); private static final String GUEST = getRandomUser();
@ -80,52 +76,34 @@ public class ReportSplashPane extends SplashPane {
} }
protected void paintComponent(Graphics g) { protected void paintComponent(Graphics g) {
super.paintComponent(g); Icon icon = IconLoader.getIcon(StableUtils.pathJoin(OEM_PATH, getImageName()));
Graphics2D g2d = (Graphics2D) g; icon.paintIcon(null, g, 0, 0);
Image image = getSplashImage(); paintShowText((Graphics2D) g);
ImageIcon imageIcon = new ImageIcon(image);
GraphHelper.paintImage(g2d, imageIcon.getIconWidth(), imageIcon.getIconHeight(), image, Constants.IMAGE_DEFAULT, Constants.NULL, Constants.CENTER, -1, -1);
} }
public void setShowText(String text) { public void setShowText(String text) {
this.showText = text; this.showText = text;
} }
public BufferedImage getSplashImage() { public Image getSplashImage() {
// p:初始化splashImage,其中画了字符. Icon icon = IconLoader.getIcon(StableUtils.pathJoin(OEM_PATH, getImageName()));
Image image = createSplashBackground(); return ((ImageIcon) IconLoader.getIconSnapshot(icon)).getImage();
BufferedImage splashBuffedImage = CoreGraphHelper.toBufferedImage(image);
Graphics2D splashG2d = splashBuffedImage.createGraphics();
splashG2d.setPaint(new Color(230, 230, 230));
splashG2d.setFont(new Font("Dialog", Font.PLAIN, 11));
//绘制需要显示的文本
paintShowText(splashG2d);
return splashBuffedImage;
} }
private void paintShowText(Graphics2D splashG2d) { private void paintShowText(Graphics2D splashG2d) {
FontRenderContext fontRenderContext = splashG2d.getFontRenderContext(); GraphHelper.applyRenderingHints(splashG2d);
LineMetrics fm = splashG2d.getFont().getLineMetrics("",
fontRenderContext);
double leading = fm.getLeading();
double ascent = fm.getAscent();
double height = fm.getHeight();
splashG2d.setPaint(MODULE_COLOR); splashG2d.setPaint(MODULE_COLOR);
splashG2d.setFont(new Font("Dialog", Font.PLAIN, 12)); splashG2d.setFont(new Font("Dialog", Font.PLAIN, 12));
//加载模块信息 //加载模块信息
double y = MODULE_INFO_Y + height + leading + ascent; GraphHelper.drawString(splashG2d, showText, MODULE_INFO_X, MODULE_INFO_Y);
GraphHelper.drawString(splashG2d, showText, MODULE_INFO_X, y);
//每次随机感谢一位论坛用户 //每次随机感谢一位论坛用户
if (shouldShowThanks()) { if (shouldShowThanks()) {
splashG2d.setPaint(THANK_COLOR); splashG2d.setPaint(THANK_COLOR);
String content = Inter.getLocText("FR-Designer_Thanks-To") + GUEST; String content = Inter.getLocText("FR-Designer_Thanks-To") + GUEST;
GraphHelper.drawString(splashG2d, content, THANK_INFO_X, y); GraphHelper.drawString(splashG2d, content, MODULE_INFO_X, THANK_INFO_Y);
} }
} }

3
designer_base/src/com/fr/design/gui/UILookAndFeel.java

@ -1,6 +1,5 @@
package com.fr.design.gui; package com.fr.design.gui;
import com.fr.base.BaseUtils;
import com.fr.design.gui.borders.*; import com.fr.design.gui.borders.*;
import com.fr.design.gui.frpane.UIBasicOptionPaneUI; import com.fr.design.gui.frpane.UIBasicOptionPaneUI;
import com.fr.design.gui.ibutton.UIBasicButtonUI; import com.fr.design.gui.ibutton.UIBasicButtonUI;
@ -110,8 +109,6 @@ public class UILookAndFeel extends MetalLookAndFeel {
table.put("RadioButtonMenuItem.border", border); table.put("RadioButtonMenuItem.border", border);
table.put("ToolTip.border", new BorderUIResource(new UIToolTipBorder(true))); table.put("ToolTip.border", new BorderUIResource(new UIToolTipBorder(true)));
table.put("ToolTip.borderInactive", new BorderUIResource(new UIToolTipBorder(false))); table.put("ToolTip.borderInactive", new BorderUIResource(new UIToolTipBorder(false)));
table.put("Tree.expandedIcon", BaseUtils.readIcon("/com/fr/design/images/tree/open.png"));
table.put("Tree.collapsedIcon", BaseUtils.readIcon("/com/fr/design/images/tree/close.png"));
table.put("PopupMenu.border", new UIPopupMenuBorder()); table.put("PopupMenu.border", new UIPopupMenuBorder());
table.put("PopupMenu.foreground", new ColorUIResource(255, 0, 0)); table.put("PopupMenu.foreground", new ColorUIResource(255, 0, 0));
table.put("SplitPane.dividerSize", new Integer(7)); table.put("SplitPane.dividerSize", new Integer(7));

8
designer_base/src/com/fr/start/SplashPane.java

@ -6,7 +6,6 @@ package com.fr.start;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Image; import java.awt.Image;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -19,7 +18,6 @@ import com.fr.stable.CoreGraphHelper;
/** /**
* @author neil * @author neil
*
* @date: 2015-3-13-上午10:20:43 * @date: 2015-3-13-上午10:20:43
*/ */
public class SplashPane extends JPanel { public class SplashPane extends JPanel {
@ -28,9 +26,8 @@ public class SplashPane extends JPanel{
* 获取已经绘制完毕的启动画面 * 获取已经绘制完毕的启动画面
* *
* @return 绘制完毕的启动画面 * @return 绘制完毕的启动画面
*
*/ */
public BufferedImage getSplashImage() { public Image getSplashImage() {
Image image = createSplashBackground(); Image image = createSplashBackground();
return CoreGraphHelper.toBufferedImage(image); return CoreGraphHelper.toBufferedImage(image);
} }
@ -47,7 +44,6 @@ public class SplashPane extends JPanel{
* 设置在启动过程中, 动态改变的文本, 当前启动的模块信息 * 设置在启动过程中, 动态改变的文本, 当前启动的模块信息
* *
* @param text 指定的文本 * @param text 指定的文本
*
*/ */
public void setShowText(String text) { public void setShowText(String text) {
@ -57,7 +53,6 @@ public class SplashPane extends JPanel{
* 创建启动画面的背景图片 * 创建启动画面的背景图片
* *
* @return 背景图片 * @return 背景图片
*
*/ */
public Image createSplashBackground() { public Image createSplashBackground() {
if (GeneralContext.isChineseEnv()) { if (GeneralContext.isChineseEnv()) {
@ -69,7 +64,6 @@ public class SplashPane extends JPanel{
/** /**
* 窗口关闭后取消定时获取模块信息的timer * 窗口关闭后取消定时获取模块信息的timer
*
*/ */
public void releaseTimer() { public void releaseTimer() {

2
designer_base/src/com/fr/start/SplashWindow.java

@ -14,6 +14,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.sun.awt.AWTUtilities;
public class SplashWindow extends JFrame { public class SplashWindow extends JFrame {
@ -45,6 +46,7 @@ public class SplashWindow extends JFrame {
this.setAlwaysOnTop(false); this.setAlwaysOnTop(false);
this.setUndecorated(true); this.setUndecorated(true);
AWTUtilities.setWindowOpaque(this, false);
//使窗体背景透明 //使窗体背景透明
if (OperatingSystem.isWindows()) { if (OperatingSystem.isWindows()) {

Loading…
Cancel
Save