Browse Source

Merge remote-tracking branch 'origin/release/9.0' into release/9.0

master
momeak 7 years ago
parent
commit
d90bdab28c
  1. 52
      designer/src/com/fr/start/ReportSplashPane.java
  2. 3
      designer_base/src/com/fr/design/gui/UILookAndFeel.java
  3. 72
      designer_base/src/com/fr/start/SplashPane.java
  4. 6
      designer_base/src/com/fr/start/SplashWindow.java

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

@ -3,6 +3,7 @@
*/
package com.fr.start;
import com.bulenkov.iconloader.IconLoader;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
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.Inter;
import com.fr.general.ModuleContext;
import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.module.ModuleAdapter;
@ -19,9 +18,6 @@ import com.fr.stable.module.ModuleListener;
import javax.swing.*;
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.Random;
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_EN = "splash_english_mac.png";
private static final Color MODULE_COLOR = new Color(230, 230, 230);
private static final int MODULE_INFO_X = 25;
private static final int MODULE_INFO_Y = 270;
private static final Color MODULE_COLOR = new Color(255, 255, 255);
private static final int MODULE_INFO_X = 54;
private static final int MODULE_INFO_Y = 340;
private static final Color THANK_COLOR = new Color(72, 216, 249);
private static final int THANK_INFO_X = 460;
private static final Color THANK_COLOR = new Color(255, 255, 255, (int) (0.4 * 255 + 0.5));
private static final int THANK_INFO_Y = 382;
private static final String GUEST = getRandomUser();
@ -80,52 +76,34 @@ public class ReportSplashPane extends SplashPane {
}
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
Image image = getSplashImage();
ImageIcon imageIcon = new ImageIcon(image);
GraphHelper.paintImage(g2d, imageIcon.getIconWidth(), imageIcon.getIconHeight(), image, Constants.IMAGE_DEFAULT, Constants.NULL, Constants.CENTER, -1, -1);
Icon icon = IconLoader.getIcon(StableUtils.pathJoin(OEM_PATH, getImageName()));
icon.paintIcon(null, g, 0, 0);
paintShowText((Graphics2D) g);
}
public void setShowText(String text) {
this.showText = text;
}
public BufferedImage getSplashImage() {
// p:初始化splashImage,其中画了字符.
Image image = createSplashBackground();
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;
public Image getSplashImage() {
Icon icon = IconLoader.getIcon(StableUtils.pathJoin(OEM_PATH, getImageName()));
return ((ImageIcon) IconLoader.getIconSnapshot(icon)).getImage();
}
private void paintShowText(Graphics2D splashG2d) {
FontRenderContext fontRenderContext = splashG2d.getFontRenderContext();
LineMetrics fm = splashG2d.getFont().getLineMetrics("",
fontRenderContext);
double leading = fm.getLeading();
double ascent = fm.getAscent();
double height = fm.getHeight();
GraphHelper.applyRenderingHints(splashG2d);
splashG2d.setPaint(MODULE_COLOR);
splashG2d.setFont(new Font("Dialog", Font.PLAIN, 12));
//加载模块信息
double y = MODULE_INFO_Y + height + leading + ascent;
GraphHelper.drawString(splashG2d, showText, MODULE_INFO_X, y);
GraphHelper.drawString(splashG2d, showText, MODULE_INFO_X, MODULE_INFO_Y);
//每次随机感谢一位论坛用户
if (shouldShowThanks()) {
splashG2d.setPaint(THANK_COLOR);
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;
import com.fr.base.BaseUtils;
import com.fr.design.gui.borders.*;
import com.fr.design.gui.frpane.UIBasicOptionPaneUI;
import com.fr.design.gui.ibutton.UIBasicButtonUI;
@ -110,8 +109,6 @@ public class UILookAndFeel extends MetalLookAndFeel {
table.put("RadioButtonMenuItem.border", border);
table.put("ToolTip.border", new BorderUIResource(new UIToolTipBorder(true)));
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.foreground", new ColorUIResource(255, 0, 0));
table.put("SplitPane.dividerSize", new Integer(7));

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

@ -1,12 +1,11 @@
/**
*
*
*/
package com.fr.start;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
@ -19,22 +18,20 @@ import com.fr.stable.CoreGraphHelper;
/**
* @author neil
*
* @date: 2015-3-13-上午10:20:43
*/
public class SplashPane extends JPanel{
public class SplashPane extends JPanel {
/**
* 获取已经绘制完毕的启动画面
*
* @return 绘制完毕的启动画面
*/
public Image getSplashImage() {
Image image = createSplashBackground();
return CoreGraphHelper.toBufferedImage(image);
}
/**
* 获取已经绘制完毕的启动画面
*
* @return 绘制完毕的启动画面
*
*/
public BufferedImage getSplashImage() {
Image image = createSplashBackground();
return CoreGraphHelper.toBufferedImage(image);
}
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
@ -44,35 +41,32 @@ public class SplashPane extends JPanel{
}
/**
* 设置在启动过程中, 动态改变的文本, 当前启动的模块信息
*
* @param text 指定的文本
*
*/
public void setShowText(String text) {
}
* 设置在启动过程中, 动态改变的文本, 当前启动的模块信息
*
* @param text 指定的文本
*/
public void setShowText(String text) {
}
/**
* 创建启动画面的背景图片
*
* @return 背景图片
*
*/
public Image createSplashBackground() {
/**
* 创建启动画面的背景图片
*
* @return 背景图片
*/
public Image createSplashBackground() {
if (GeneralContext.isChineseEnv()) {
return BaseUtils.readImage("/com/fr/base/images/oem/splash_chinese.png");
}
return BaseUtils.readImage("/com/fr/base/images/oem/splash_english.png");
}
/**
* 窗口关闭后取消定时获取模块信息的timer
*
*/
public void releaseTimer() {
}
* 窗口关闭后取消定时获取模块信息的timer
*/
public void releaseTimer() {
}
}

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

@ -14,13 +14,14 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.OperatingSystem;
import com.sun.awt.AWTUtilities;
public class SplashWindow extends JFrame {
private SplashPane splash = null;
@SuppressWarnings("LeakingThisInConstructor")
public SplashWindow(SplashPane splashPane) {
public SplashWindow(SplashPane splashPane) {
// alex:必须设置这个属性为true,才可以用透明背景
System.setProperty("sun.java2d.noddraw", "true");
@ -45,7 +46,8 @@ public class SplashWindow extends JFrame {
this.setAlwaysOnTop(false);
this.setUndecorated(true);
AWTUtilities.setWindowOpaque(this, false);
//使窗体背景透明
if (OperatingSystem.isWindows()) {
this.setBackground(new Color(0,0,0,0));

Loading…
Cancel
Save