From eaeadfffb82199088b275fd02027c5d672c187c8 Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 13 Sep 2017 11:07:24 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-4483=200909=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=8A=A0=E5=9B=9E=E9=B8=A3=E8=B0=A2=E5=92=8C=E5=85=B3=E4=BA=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/bbs/BBSConstants.java | 92 +++++++------ .../fr/design/mainframe/bbs/BBSGuestPane.java | 24 ++-- .../fr/design/mainframe/bbs/bbs.properties | 12 +- .../src/com/fr/start/ReportSplashPane.java | 123 +++++++++--------- .../com/fr/design/actions/help/AboutPane.java | 66 +++++----- .../design/locale/designer_zh_CN.properties | 2 +- .../src/com/fr/start/BaseDesigner.java | 2 + 7 files changed, 168 insertions(+), 153 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/bbs/BBSConstants.java b/designer/src/com/fr/design/mainframe/bbs/BBSConstants.java index 21d815727b..d48ce08324 100644 --- a/designer/src/com/fr/design/mainframe/bbs/BBSConstants.java +++ b/designer/src/com/fr/design/mainframe/bbs/BBSConstants.java @@ -1,59 +1,69 @@ /** - * + * */ package com.fr.design.mainframe.bbs; import com.fr.general.IOUtils; +import com.fr.general.SiteCenter; import com.fr.stable.StringUtils; import java.util.Properties; /** * @author neil - * * @date: 2015-3-10-上午9:50:13 */ public class BBSConstants { //判断是否更新的关键字 public static final String UPDATE_KEY = loadAttribute("UPDATE_KEY", "newIsPopup"); - - - private static final String GUEST_KEY = "USER"; - private static final String LINK_KEY = "LINK"; - private static final int GUEST_NUM = 5; - - //用户名信息数组 - public static final String[] ALL_GUEST = loadAllGuestsInfo(GUEST_KEY); - //用户论坛链接信息 - public static final String[] ALL_LINK = loadAllGuestsInfo(LINK_KEY); - - private static Properties PROP = null; - - //加载所有用户的信息, 用户名, 论坛连接 - private static String[] loadAllGuestsInfo(String key){ - String[] allGuests = new String[GUEST_NUM]; - for (int i = 0; i < GUEST_NUM; i++) { - allGuests[i] = loadAttribute(key + i, StringUtils.EMPTY); - } - - return allGuests; - } - //如果要定制, 直接改bbs.properties就行了 - private static String loadAttribute(String key, String defaultValue) { - if (PROP == null) { - PROP = new Properties(); - try { - PROP.load(IOUtils.getResourceAsStream("/com/fr/design/mainframe/bbs/bbs.properties", BBSConstants.class)); - } catch (Exception e) { - } - } - - String p = PROP.getProperty(key); - if (StringUtils.isEmpty(p)) { - p = defaultValue; - } - return p; - } - + + + private static final String GUEST_KEY = "USER"; + private static final String GUEST_KEY_ONLINE = "guest.user"; + private static final String LINK_KEY = "LINK"; + private static final String LINK_KEY_ONLINE = "guest.link"; + + private static Properties PROP = null; + + public static String[] getAllGuest() { + return loadAllGuestsInfoOnline(GUEST_KEY_ONLINE, loadAllGuestsInfo(GUEST_KEY)); + } + + public static String[] getAllLink() { + return loadAllGuestsInfoOnline(LINK_KEY_ONLINE, loadAllGuestsInfo(LINK_KEY)); + } + + //加载所有用户的信息, 用户名, 论坛连接 + private static String loadAllGuestsInfo(String key) { + return loadAttribute(key, StringUtils.EMPTY); + } + + //加载所有用户的信息, 用户名, 论坛连接 + private static String[] loadAllGuestsInfoOnline(String key, String defaultValue) { + String[] allGuests = new String[0]; + String guest = SiteCenter.getInstance().acquireUrlByKind(key, defaultValue); + if (StringUtils.isNotEmpty(guest)) { + allGuests = guest.split("\\|"); + } + return allGuests; + } + + //如果要定制, 直接改bbs.properties就行了 + private static String loadAttribute(String key, String defaultValue) { + if (PROP == null) { + PROP = new Properties(); + try { + PROP.load(IOUtils.getResourceAsStream("/com/fr/design/mainframe/bbs/bbs.properties", BBSConstants.class)); + } catch (Exception e) { + } + } + + String p = PROP.getProperty(key); + if (StringUtils.isEmpty(p)) { + p = defaultValue; + } + return p; + } + } \ No newline at end of file diff --git a/designer/src/com/fr/design/mainframe/bbs/BBSGuestPane.java b/designer/src/com/fr/design/mainframe/bbs/BBSGuestPane.java index b86a0cc5c2..2fe20b9015 100644 --- a/designer/src/com/fr/design/mainframe/bbs/BBSGuestPane.java +++ b/designer/src/com/fr/design/mainframe/bbs/BBSGuestPane.java @@ -3,15 +3,6 @@ */ package com.fr.design.mainframe.bbs; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Desktop; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.net.URI; - -import javax.swing.JPanel; - import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; @@ -21,6 +12,12 @@ import com.fr.general.Inter; import com.fr.stable.StringUtils; import com.fr.start.BBSGuestPaneProvider; +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.net.URI; + /** * @author neil * @@ -54,9 +51,12 @@ public class BBSGuestPane extends JPanel implements BBSGuestPaneProvider{ double[] colSize = {p}; Component[][] components = new Component[rowSize.length][colSize.length]; - for (int i = 0; i < components.length; i++) { - String userName = BBSConstants.ALL_GUEST[i]; - String url = BBSConstants.ALL_LINK[i]; + String[] allGuest = BBSConstants.getAllGuest(); + String[] allLink = BBSConstants.getAllLink(); + int min = Math.min(allGuest.length, components.length); + for (int i = 0; i < min; i++) { + String userName = allGuest[i]; + String url = allLink[i]; components[i][0] = getURLActionLabel(userName, url); } diff --git a/designer/src/com/fr/design/mainframe/bbs/bbs.properties b/designer/src/com/fr/design/mainframe/bbs/bbs.properties index 44db03d46e..dc2ee5d737 100644 --- a/designer/src/com/fr/design/mainframe/bbs/bbs.properties +++ b/designer/src/com/fr/design/mainframe/bbs/bbs.properties @@ -4,16 +4,8 @@ COLLECT_URL=http://www.finereporthelp.com:8081/bbs/ReportServer?op=bbs&cmd=colle DEFAULT_URL=http\://bbs.finereport.com/home.php?mod=space&do=notice GET_MESSAGE_URL=http://feedback.finedevelop.com:3000/bbs/message/count GET_SIGN_INFO_URL=http\://bbs.finereport.com -LINK0=http\://bbs.finereport.com/space-uid-55823.html -LINK1=http\://bbs.finereport.com/space-uid-56940.html -LINK2=http\://bbs.finereport.com/space-uid-51621.html -LINK3=http\://bbs.finereport.com/space-uid-52618.html -LINK4=http\://bbs.finereport.com/space-uid-48993.html +LLINK= http\://bbs.fanruan.com/home.php?mod=space&uid=66470&do=profile|http\://bbs.fanruan.com/home.php?mod=space&uid=67190&do=profile|http\://bbs.fanruan.com/home.php?mod=space&uid=65659&do=profile|http\://bbs.fanruan.com/home.php?mod=space&uid=60352&do=profile|http\://bbs.fanruan.com/home.php?mod=space&uid=78157&do=profile SHARE_URL=http\://bbs.finereport.com -USER0=\u6590\u6CE2\u90A3\u5951(\u5B59\u70B3\u6DA6) -USER1=deafire(\u674E\u5FD7\u4F1F) -USER2=\u963F\u8FEA(\u8C22\u8FEA) -USER3=bingjie(\u5F20\u8BB0\u82B1) -USER4=\u6D77\u7EF5\u5B9D\u5B9D(\u90DD\u6B63) +UUSER=cherishdqy\uFF08\u9093\u79CB\u4E91\uFF09|yets11\uFF08\u9676\u5B5D\u6587\uFF09|\u661F\u75D5\uFF08\u71D5\u5B8F\u4F1F\uFF09|\u9759\u542C\u7985\u9E23\uFF08\u674E\u51A0\u519B\uFF09|yiyemeiying\uFF08\u5218\u4F73\uFF09 VERIFY_URL=http://www.finereporthelp.com:8081/bbs/ReportServer?op=bbs&cmd=verify UPDATE_INFO_URL=http://bbs.finereport.com/source/plugin/infor/infor.html diff --git a/designer/src/com/fr/start/ReportSplashPane.java b/designer/src/com/fr/start/ReportSplashPane.java index 6bf8a6a4c1..211fb36e3a 100644 --- a/designer/src/com/fr/start/ReportSplashPane.java +++ b/designer/src/com/fr/start/ReportSplashPane.java @@ -1,5 +1,5 @@ /** - * + * */ package com.fr.start; @@ -8,6 +8,7 @@ import com.fr.base.FRContext; import com.fr.base.GraphHelper; 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; @@ -27,36 +28,37 @@ import java.util.TimerTask; /** * @author neil - * * @date: 2015-3-13-上午9:47:58 */ -public class ReportSplashPane extends SplashPane{ - - 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_EN = "splash_english_mac.png"; - - private static final Color MODULE_COLOR = new Color(230, 230, 230); +public class ReportSplashPane extends SplashPane { + + private static final String OEM_PATH = "/com/fr/base/images/oem"; + 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 THANK_COLOR = new Color(72, 216, 249); private static final int THANK_INFO_X = 460; - + private static final String GUEST = getRandomUser(); - + private String showText = ""; - + private String moduleID = ""; private int loadingIndex = 0; private String[] loading = new String[]{"..", "....", "......"}; private java.util.Timer timer = new java.util.Timer(); public ReportSplashPane() { + init(); + } + + private void init() { this.setBackground(null); - + timer.schedule(new TimerTask() { public void run() { loadingIndex++; @@ -64,19 +66,18 @@ public class ReportSplashPane extends SplashPane{ ReportSplashPane.this.repaint(); } }, 0, 300); - + + ModuleListener moduleListener = new ModuleAdapter() { + @Override + public void onStartBefore(String moduleName, String moduleI18nName) { + moduleID = moduleI18nName; + loadingIndex++; + ReportSplashPane.this.setShowText(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); + ReportSplashPane.this.repaint(); + } + }; ModuleContext.registerModuleListener(moduleListener); } - - private ModuleListener moduleListener = new ModuleAdapter() { - @Override - public void onStartBefore(String moduleName, String moduleI18nName) { - moduleID = moduleI18nName; - loadingIndex++; - ReportSplashPane.this.setShowText(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); - ReportSplashPane.this.repaint(); - } - }; protected void paintComponent(Graphics g) { super.paintComponent(g); @@ -104,8 +105,8 @@ public class ReportSplashPane extends SplashPane{ return splashBuffedImage; } - - private void paintShowText(Graphics2D splashG2d){ + + private void paintShowText(Graphics2D splashG2d) { FontRenderContext fontRenderContext = splashG2d.getFontRenderContext(); LineMetrics fm = splashG2d.getFont().getLineMetrics("", fontRenderContext); @@ -119,6 +120,13 @@ public class ReportSplashPane extends SplashPane{ //加载模块信息 double y = MODULE_INFO_Y + height + leading + ascent; 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); + } } // 是否显示鸣谢文字 @@ -131,38 +139,37 @@ public class ReportSplashPane extends SplashPane{ } return true; } - - private static String getRandomUser(){ - int num = new Random().nextInt(BBSConstants.ALL_GUEST.length); - return StringUtils.BLANK + BBSConstants.ALL_GUEST[num]; + + private static String getRandomUser() { + String[] allGuest = BBSConstants.getAllGuest(); + if (allGuest.length == 0) { + return StringUtils.EMPTY; + } + int num = new Random().nextInt(allGuest.length); + return StringUtils.BLANK + allGuest[num]; } - + /** - * 窗口关闭后取消定时获取模块信息的timer - * - */ - public void releaseTimer() { + * 窗口关闭后取消定时获取模块信息的timer + */ + public void releaseTimer() { timer.cancel(); - } - - /** - * 创建启动画面的背景图片 - * - * @return 背景图片 - * - */ - public Image createSplashBackground() { - String fileName = getImageName(); - return BaseUtils.readImage(StableUtils.pathJoin(OEM_PATH, fileName)); } - - //获取图片文件名 - private String getImageName(){ - boolean isChina = GeneralContext.isChineseEnv(); - //jdk1.8下透明有bug, 设置了setWindowTransparent后, JFrame直接最小化了, 先用mac下的加载图片 - return isChina ? SPLASH_MAC_CN : SPLASH_MAC_EN; - } + /** + * 创建启动画面的背景图片 + * + * @return 背景图片 + */ + public Image createSplashBackground() { + String fileName = getImageName(); + return BaseUtils.readImage(StableUtils.pathJoin(OEM_PATH, fileName)); + } - -} \ No newline at end of file + //获取图片文件名 + private String getImageName() { + boolean isChina = GeneralContext.isChineseEnv(); + //jdk1.8下透明有bug, 设置了setWindowTransparent后, JFrame直接最小化了, 先用mac下的加载图片 + return isChina ? SPLASH_MAC_CN : SPLASH_MAC_EN; + } +} diff --git a/designer_base/src/com/fr/design/actions/help/AboutPane.java b/designer_base/src/com/fr/design/actions/help/AboutPane.java index 851e869cd0..b55161a167 100644 --- a/designer_base/src/com/fr/design/actions/help/AboutPane.java +++ b/designer_base/src/com/fr/design/actions/help/AboutPane.java @@ -34,15 +34,15 @@ public class AboutPane extends JPanel { private static final int DEFAULT_GAP = 12; private static final String COPYRIGHT_LABEL = "\u00A9 "; private static final String BUILD_PREFIX = " Build #"; - + public AboutPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); //center panel - JPanel centerPane=FRGUIPaneFactory.createBorderLayout_L_Pane(); + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); this.add(centerPane, BorderLayout.CENTER); - JPanel contentPane=FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); centerPane.add(contentPane, BorderLayout.NORTH); BoxCenterAlignmentCopyablePane buildCopyPane = new BoxCenterAlignmentCopyablePane( @@ -68,8 +68,8 @@ public class AboutPane extends JPanel { Inter.getLocText("FR-Designer-Basic_Activation_Key_Copy_OK") })); - if (shouldShowPhoneAndQQ()){ - if(ComparatorUtils.equals(ProductConstants.APP_NAME,FINEREPORT)){ + if (shouldShowPhoneAndQQ()) { + if (ComparatorUtils.equals(ProductConstants.APP_NAME, FINEREPORT)) { boxCenterAlignmentPane = new BoxCenterAligmentPane(Inter.getLocText("FR-Designer_Service_Phone") + ProductConstants.COMPARE_TELEPHONE); contentPane.add(boxCenterAlignmentPane); } @@ -79,15 +79,19 @@ public class AboutPane extends JPanel { BoxCenterAligmentPane actionLabel = getURLActionLabel(SiteCenter.getInstance().acquireUrlByKind("website." + FRContext.getLocale(), ProductConstants.WEBSITE_URL)); BoxCenterAligmentPane emailLabel = getEmailActionLabel(SiteCenter.getInstance().acquireUrlByKind("support.email", ProductConstants.SUPPORT_EMAIL)); - + contentPane.add(actionLabel); contentPane.add(emailLabel); + if (shouldShowThanks()) { + addThankPane(contentPane); + } } // 是否显示服务电话和 qq private boolean shouldShowPhoneAndQQ() { return !FRContext.getLocale().equals(Locale.US); } + // 是否显示鸣谢面板 private boolean shouldShowThanks() { Locale[] hideLocales = {Locale.US, Locale.KOREA, Locale.JAPAN}; @@ -98,40 +102,40 @@ public class AboutPane extends JPanel { } return true; } - + //添加鸣谢面板 - private void addThankPane(JPanel contentPane){ + private void addThankPane(JPanel contentPane) { BBSGuestPaneProvider pane = StableFactory.getMarkedInstanceObjectFromClass(BBSGuestPaneProvider.XML_TAG, BBSGuestPaneProvider.class); - if(pane == null){ - return; + if (pane == null) { + return; } contentPane.add(Box.createVerticalStrut(DEFAULT_GAP)); contentPane.add((Component) pane); } - - private String append(String...strs){ - StringBuilder sb = new StringBuilder(); - for(String str : strs){ - sb.append(str); - } - - return sb.toString(); + + private String append(String... strs) { + StringBuilder sb = new StringBuilder(); + for (String str : strs) { + sb.append(str); + } + + return sb.toString(); } - - private String getCopyRight(){ - return append(Inter.getLocText("FR-Designer_About_CopyRight"), COPYRIGHT_LABEL, - ProductConstants.HISTORY, StringUtils.BLANK, SiteCenter.getInstance().acquireUrlByKind("company.name", ProductConstants.COMPANY_NAME)); + + private String getCopyRight() { + return append(Inter.getLocText("FR-Designer_About_CopyRight"), COPYRIGHT_LABEL, + ProductConstants.HISTORY, StringUtils.BLANK, SiteCenter.getInstance().acquireUrlByKind("company.name", ProductConstants.COMPANY_NAME)); } private String getBuildTitle() { return append(ProductConstants.APP_NAME, Inter.getLocText("FR-Designer_About_Version"), StringUtils.BLANK, ProductConstants.RELEASE_VERSION, BUILD_PREFIX); } - - private BoxCenterAligmentPane getEmailActionLabel(final String mailTo){ + + private BoxCenterAligmentPane getEmailActionLabel(final String mailTo) { ActionLabel emailLabel = new ActionLabel(mailTo); - + emailLabel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -142,12 +146,12 @@ public class AboutPane extends JPanel { } } }); - + return new BoxCenterAligmentPane(emailLabel); } - - private BoxCenterAligmentPane getURLActionLabel(final String url){ - ActionLabel actionLabel = new ActionLabel(url); + + private BoxCenterAligmentPane getURLActionLabel(final String url) { + ActionLabel actionLabel = new ActionLabel(url); actionLabel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -158,7 +162,7 @@ public class AboutPane extends JPanel { } } }); - + return new BoxCenterAligmentPane(actionLabel); } @@ -184,7 +188,7 @@ public class AboutPane extends JPanel { class BoxCenterAligmentPane extends JPanel { private UILabel textLabel; - + public BoxCenterAligmentPane(String text) { this(new UILabel(text)); } diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index da5090740e..99db2255d6 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -183,7 +183,7 @@ FR-Designer_Support_QQ=\u6280\u672FQQ FR-Designer_Swatch=\u6837\u54C1 FR-Designer_Tab_title=tab\u6807\u9898 FR-Designer_TableData=\u6570\u636E\u96C6 -FR-Designer_Thank_guest=\u7279\u522B\u9E23\u8C22\u4EE5\u4E0B\u8BBA\u575B\u5E06\u85AF\u5BF9\u8BE5\u7248\u672C\u8BBE\u8BA1\u5668\u6613\u7528\u6027\u505A\u51FA\u7684\u7A81\u51FA\u8D21\u732E +FR-Designer_Thank_guest=\u7279\u522B\u9E23\u8C22\u4EE5\u4E0B\u756A\u85AF\u5BF9\u5E06\u8F6F\u4EA7\u54C1\u3001\u6587\u5316\u3001\u751F\u6001\u5EFA\u8BBE\u505A\u51FA\u7684\u7A81\u51FA\u8D21\u732E FR-Designer_Thanks-To=\u9E23\u8C22 FR-Designer_Title=\u6807\u9898 FR-Designer_Total=\u603B\u5171 diff --git a/designer_base/src/com/fr/start/BaseDesigner.java b/designer_base/src/com/fr/start/BaseDesigner.java index 7e746251b9..0e3f4fdb83 100644 --- a/designer_base/src/com/fr/start/BaseDesigner.java +++ b/designer_base/src/com/fr/start/BaseDesigner.java @@ -64,6 +64,8 @@ public abstract class BaseDesigner extends ToolBarMenuDock { } RestartHelper.deleteRecordFilesWhenStart(); + SiteCenter.getInstance(); + DesignUtils.setPort(getStartPort()); // 如果端口被占用了 说明程序已经运行了一次,也就是说,已经建立一个监听服务器,现在只要给服务器发送命令就好了 if (DesignUtils.isStarted()) {