fr_shine 9 years ago
parent
commit
33f98054aa
  1. 3
      designer/src/com/fr/design/mainframe/ActiveKeyGenerator.java
  2. 2
      designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java
  3. 6
      designer/src/com/fr/design/mainframe/InformationCollector.java
  4. 14
      designer/src/com/fr/design/mainframe/bbs/BBSConstants.java
  5. 19
      designer/src/com/fr/design/mainframe/bbs/BBSDialog.java
  6. 9
      designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java
  7. 3
      designer/src/com/fr/design/report/share/ShareButton.java
  8. 2
      designer_base/designer_base.iml
  9. 3
      designer_base/src/com/fr/design/actions/help/ForumAction.java
  10. 16
      designer_base/src/com/fr/design/extra/PluginConstants.java
  11. 10
      designer_base/src/com/fr/design/extra/PluginHelper.java
  12. 15
      designer_base/src/com/fr/design/extra/PluginManagerPane.java
  13. 5
      designer_base/src/com/fr/design/extra/PluginsReaderFromStore.java
  14. 7
      designer_base/src/com/fr/design/fun/DesignerEnvProcessor.java
  15. 4
      designer_base/src/com/fr/design/fun/impl/AbstractDesignerEnvProcessor.java
  16. 15
      designer_base/src/com/fr/design/utils/DesignUtils.java

3
designer/src/com/fr/design/mainframe/ActiveKeyGenerator.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.bbs.BBSConstants;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.stable.StringUtils;
import com.fr.stable.core.UUID;
@ -101,7 +102,7 @@ public class ActiveKeyGenerator {
para.put("uuid", envManager.getUUID());
para.put("key", key);
para.put("username", envManager.getBBSName());
HttpClient hc = new HttpClient(BBSConstants.VERIFY_URL, para);
HttpClient hc = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("verify.code"), para);
if (timeout != -1) {
hc.setTimeout(timeout);
}

2
designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java

File diff suppressed because one or more lines are too long

6
designer/src/com/fr/design/mainframe/InformationCollector.java

@ -51,8 +51,6 @@ public class InformationCollector implements XMLReadable, XMLWriter {
private static final String XML_KEY = "ActiveKey";
private static final String XML_OS = "OS";
public static final String FUNCTIONS_INFO = "http://feedback.finedevelop.com:3000/monitor/function/record";
public static final String USER_INFO = "http://feedback.finedevelop.com:3000/monitor/userinfo/record";
public static final String TABLE_NAME = "fr_functionrecord";
public static final String FUNC_COLUMNNAME = "func";
@ -154,7 +152,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
return;
}
byte[] content = getJSONContentAsByte();
HttpClient hc = new HttpClient(USER_INFO);
HttpClient hc = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("user.info"));
hc.setContent(content);
if (!hc.isServerAlive()) {
return;
@ -192,7 +190,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
DBUtils.closeConnection(conn);
}
HttpClient httpClient = new HttpClient(FUNCTIONS_INFO);
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("functions.info"));
httpClient.setContent(content);
httpClient.setTimeout(5000);

14
designer/src/com/fr/design/mainframe/bbs/BBSConstants.java

@ -14,20 +14,6 @@ import java.util.Properties;
*/
public class BBSConstants {
//获取当前登陆用户未读取消息条数
public static final String GET_MESSAGE_URL = loadAttribute("GET_MESSAGE_URL", "http://feedback.finedevelop.com:3000/bbs/message/count");
//默认打开的论坛窗口
public static final String DEFAULT_URL = loadAttribute("DEFAULT_URL", "http://bbs.finereport.com/home.php?mod=space&do=pm");
//默认模板分享的url
public static final String SHARE_URL = loadAttribute("SHARE_URL", "http://bbs.finereport.com/");
//收集设计器的信息url
public static final String COLLECT_URL = loadAttribute("COLLECT_URL", "http://bbs.finereport.com/");
//在线验证激活码
public static final String VERIFY_URL = loadAttribute("VERIFY_URL", "http://bbs.finereport.com/");
//获取论坛更新信息, 判断是否需要弹窗
public static final String UPDATE_INFO_URL = loadAttribute("UPDATE_INFO_URL", "http://bbs.finereport.com/");
//论坛手机版
public static final String BBS_MOBILE_MOD = loadAttribute("BBS_MOBILE_MOD", "http://bbs.finereport.com/forum.php?mobile=1");
//判断是否更新的关键字
public static final String UPDATE_KEY = loadAttribute("UPDATE_KEY", "newIsPopup");

19
designer/src/com/fr/design/mainframe/bbs/BBSDialog.java

@ -5,6 +5,7 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.SiteCenter;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
@ -14,6 +15,7 @@ import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import netscape.javascript.JSObject;
import javax.swing.*;
@ -30,8 +32,8 @@ public class BBSDialog extends UIDialog {
private static final int WIDTH = 600;
private static final int HEIGHT = 400;
private static final int OUTER_WIDTH = 605;
private static final int OUTER_HEIGHT = 428;
private static final int OUTER_WIDTH = 600;
private static final int OUTER_HEIGHT = 400;
private JFXPanel jfxPanel;
@ -39,7 +41,7 @@ public class BBSDialog extends UIDialog {
public BBSDialog(Frame parent) {
super(parent);
//setUndecorated(true);
setUndecorated(true);
JPanel panel = (JPanel) getContentPane();
initComponents(panel);
setSize(new Dimension(OUTER_WIDTH, OUTER_HEIGHT));
@ -95,7 +97,7 @@ public class BBSDialog extends UIDialog {
{
disableLink(eng);
// webView好像默认以手机版显示网页,浏览器里过滤掉这个跳转
if(ComparatorUtils.equals(newValue, url) || ComparatorUtils.equals(newValue, BBSConstants.BBS_MOBILE_MOD)){
if(ComparatorUtils.equals(newValue, url) || ComparatorUtils.equals(newValue, SiteCenter.getInstance().acquireUrlByKind("bbs.mobile"))){
return;
}
openUrlAtLocalWebBrowser(eng,newValue);
@ -105,6 +107,8 @@ public class BBSDialog extends UIDialog {
@Override
public void changed(ObservableValue<? extends Worker.State> observable, Worker.State oldValue, Worker.State newValue) {
if (newValue == Worker.State.SUCCEEDED){
JSObject obj = (JSObject) eng.executeScript("window");
obj.setMember("BBSWebBridge", BBSDialog.this);
setVisible(true);
}
}
@ -136,6 +140,13 @@ public class BBSDialog extends UIDialog {
}
}
/**
* 提供给web页面调用的关闭窗口
*/
public void closeWindow() {
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
this.setVisible(false);
}
/**
*
*/

9
designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java

@ -11,6 +11,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils;
import com.fr.general.DateUtils;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils;
@ -112,7 +113,7 @@ public class UserInfoLabel extends UILabel{
FRContext.getLogger().error(e.getMessage());
}
HttpClient hc = new HttpClient(BBSConstants.UPDATE_INFO_URL);
HttpClient hc = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("bbs.popup"));
if (!hc.isServerAlive()){
return;
}
@ -124,7 +125,7 @@ public class UserInfoLabel extends UILabel{
try {
BBSDialog bbsLabel = new BBSDialog(DesignerContext.getDesignerFrame());
bbsLabel.showWindow(BBSConstants.UPDATE_INFO_URL);
bbsLabel.showWindow(SiteCenter.getInstance().acquireUrlByKind("bbs.popup"));
DesignerEnvManager.getEnvManager().setLastShowBBSNewsTime(DateUtils.DATEFORMAT2.format(new Date()));
} catch (Throwable e) {
@ -181,7 +182,7 @@ public class UserInfoLabel extends UILabel{
while(StringUtils.isNotEmpty(DesignerEnvManager.getEnvManager().getBBSName())){
HashMap<String, String> para = new HashMap<String, String>();
para.put("username", encode(encode(userName)));
HttpClient getMessage = new HttpClient(BBSConstants.GET_MESSAGE_URL, para);
HttpClient getMessage = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("bbs.message"), para);
getMessage.asGet();
if(getMessage.isServerAlive()){
try {
@ -243,7 +244,7 @@ public class UserInfoLabel extends UILabel{
public void mouseClicked(MouseEvent e) {
if(StringUtils.isNotEmpty(userName)){
try {
Desktop.getDesktop().browse(new URI(BBSConstants.DEFAULT_URL));
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.default")));
} catch (Exception exp) {
}

3
designer/src/com/fr/design/report/share/ShareButton.java

@ -20,6 +20,7 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.FILE;
import com.fr.general.Inter;
import com.fr.general.NameObject;
import com.fr.general.SiteCenter;
import com.fr.io.exporter.ImageExporter;
import com.fr.main.TemplateWorkBook;
import com.fr.main.workbook.ResultWorkBook;
@ -56,7 +57,7 @@ public class ShareButton extends UIButton{
//打开论坛, url可在bbs.properties中配置
private void openBBS(){
try {
Desktop.getDesktop().browse(new URI(BBSConstants.SHARE_URL));
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.share")));
} catch (Exception e1) {
FRContext.getLogger().error(e1.getMessage());
}

2
designer_base/designer_base.iml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/../../../env/8.0/WebReport/WEB-INF/classes" />
<output url="file://$MODULE_DIR$/../../env/WebReport/WEB-INF/classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>

3
designer_base/src/com/fr/design/actions/help/ForumAction.java

@ -9,6 +9,7 @@ import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.stable.StringUtils;
import javax.swing.*;
@ -38,7 +39,7 @@ public class ForumAction extends UpdateAction {
* @param e 事件
*/
public void actionPerformed(ActionEvent e) {
String url = "http://bbs.finereport.com/";
String url = SiteCenter.getInstance().acquireUrlByKind("bbs");
if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!");
return;

16
designer_base/src/com/fr/design/extra/PluginConstants.java

@ -7,22 +7,6 @@ package com.fr.design.extra;
*/
public class PluginConstants {
public static final String PLUGIN_INSTALL_INFO = "http://feedback.finedevelop.com:3000/plugin";
/**
* 获取所有插件的服务器地址
*/
public static final String PLUGIN_STORE_URL = "http://shop.finereport.com/ShopServer?pg=all_plugin";
/**
* 获取插件更新信息的服务器地址
*/
public static final String PLUGIN_CHECK_UPDATE_URL = "http://shop.finereport.com/ShopServer?pg=all_plugin";
/**
* 插件下载服务器地址
*/
public static final String PLUGIN_DOWNLOAD_URL = "http://shop.finereport.com/ShopServer?pg=plugin";
public static final int BYTES_NUM = 1024;

10
designer_base/src/com/fr/design/extra/PluginHelper.java

@ -3,11 +3,7 @@ package com.fr.design.extra;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.general.*;
import com.fr.general.http.HttpClient;
import com.fr.plugin.Plugin;
import com.fr.plugin.PluginLoader;
@ -73,7 +69,7 @@ public class PluginHelper {
map.put("id", id);
map.put("username", username);
map.put("password", password);
HttpClient httpClient = new HttpClient(PluginConstants.PLUGIN_DOWNLOAD_URL, map);
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.download"), map);
String resText = httpClient.getResponseText();
String charSet = EncodeConstants.ENCODING_UTF_8;
resText = URLDecoder.decode(URLDecoder.decode(resText, charSet), charSet);
@ -288,7 +284,7 @@ public class PluginHelper {
map.put("detail", plugin.toJSONObject().toString());
map.put("build", GeneralUtils.readBuildNO());
//第三个参数encode, nodejs服务器那边如果参数不encode, 带了空格会报错, 直接用urlconnection也是一样, jetty没能还原.
HttpClient httpClient = new HttpClient(PluginConstants.PLUGIN_INSTALL_INFO, map, true);
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.install"), map, true);
httpClient.setTimeout(TIME_OUT);
httpClient.asGet();
return httpClient.getResponseText();

15
designer_base/src/com/fr/design/extra/PluginManagerPane.java

@ -37,15 +37,16 @@ public class PluginManagerPane extends BasicPane {
public PluginManagerPane() {
setLayout(new BorderLayout());
if (StableUtils.isDebug()) {
URL url = ClassLoader.getSystemResource("");
String installHome = url.getPath();
PluginWebPane webPane = new PluginWebPane(installHome);
add(webPane, BorderLayout.CENTER);
} else {
// if (StableUtils.isDebug()) {
// URL url = ClassLoader.getSystemResource("");
// String installHome = url.getPath();
// PluginWebPane webPane = new PluginWebPane(installHome);
// add(webPane, BorderLayout.CENTER);
// } else {
//
// }
initTraditionalStore();
}
}
private void initTraditionalStore() {
UITabbedPane tabbedPane = new UITabbedPane();

5
designer_base/src/com/fr/design/extra/PluginsReaderFromStore.java

@ -2,6 +2,7 @@ package com.fr.design.extra;
import com.fr.general.GeneralUtils;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
@ -32,7 +33,7 @@ public class PluginsReaderFromStore {
public static Plugin[] readPlugins() throws Exception {
String resText;
try {
HttpClient httpClient = new HttpClient(PluginConstants.PLUGIN_STORE_URL);
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.store"));
resText = httpClient.getResponseText();
String charSet = EncodeConstants.ENCODING_UTF_8;
resText = URLDecoder.decode(URLDecoder.decode(resText, charSet), charSet);
@ -70,7 +71,7 @@ public class PluginsReaderFromStore {
para.put("plugins", PluginLoader.getLoader().pluginsToString());
//只有当前设计器的jar高于插件新版本需要的jarTime时, 才提示更新该插件.
para.put("jarTime", GeneralUtils.readBuildNO());
HttpClient httpClient = new HttpClient(PluginConstants.PLUGIN_CHECK_UPDATE_URL, para);
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.update"), para);
resText = httpClient.getResponseText();
String charSet = EncodeConstants.ENCODING_UTF_8;
resText = URLDecoder.decode(URLDecoder.decode(resText, charSet), charSet);

7
designer_base/src/com/fr/design/fun/DesignerEnvProcessor.java

@ -21,4 +21,11 @@ public interface DesignerEnvProcessor extends Level{
* @return 修改后的jsessionid
*/
String changeEnvPathBeforeConnect(String userName, String password, String path);
/**
* web端预览的时候不需要jsessionid, 他会默认跳转到登陆页面, 如果带上了, 反而会因为里面资源文件加载不到而出问题.
*
* @return web端预览地址
*/
String getWebBrowserURL(String envPath);
}

4
designer_base/src/com/fr/design/fun/impl/AbstractDesignerEnvProcessor.java

@ -15,4 +15,8 @@ public abstract class AbstractDesignerEnvProcessor implements DesignerEnvProcess
return path;
}
public String getWebBrowserURL(String envPath){
return envPath;
}
}

15
designer_base/src/com/fr/design/utils/DesignUtils.java

@ -5,6 +5,8 @@ import com.fr.base.remote.RemoteDeziConstants;
import com.fr.dav.DavXMLUtils;
import com.fr.dav.LocalEnv;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.gui.UILookAndFeel;
import com.fr.design.mainframe.DesignerContext;
import com.fr.env.RemoteEnv;
@ -303,7 +305,8 @@ public class DesignUtils {
postfixOfUri = isUserPrivilege ? postfixOfUri + "&fr_check_url=" + time + "&id=" + FRContext.getCurrentEnv().getUserID(): postfixOfUri ;
}
Desktop.getDesktop().browse(new URI(FRContext.getCurrentEnv().getPath() + postfixOfUri));
String urlPath = getWebBrowserPath();
Desktop.getDesktop().browse(new URI(urlPath + postfixOfUri));
} catch (Exception e) {
FRContext.getLogger().error("cannot open the url Successful", e);
}
@ -319,6 +322,16 @@ public class DesignUtils {
}
}
private static String getWebBrowserPath() {
String urlPath = FRContext.getCurrentEnv().getPath();
DesignerEnvProcessor processor = ExtraDesignClassManager.getInstance().getEnvProcessor();
if (processor != null) {
//cas访问的时候, url要处理下.
urlPath = processor.getWebBrowserURL(urlPath);
}
return urlPath;
}
//TODO:august:下个版本,要把下面的图片都放在一个preload文件夹下,表示可以预先加载。然后遍历一下就可以了,不用这么一个一个的写了
/**

Loading…
Cancel
Save