Browse Source

分离marketconfig

master
XiaXiang 7 years ago
parent
commit
2627b23f21
  1. 3
      designer/src/com/fr/design/mainframe/ActiveKeyGenerator.java
  2. 8
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  3. 187
      designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java
  4. 31
      designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java
  5. 5
      designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java
  6. 22
      designer_base/src/com/fr/design/bbs/BBSLoginUtils.java
  7. 50
      designer_base/src/com/fr/design/extra/LoginWebBridge.java
  8. 15
      designer_base/src/com/fr/design/extra/PluginFromStorePane.java
  9. 7
      designer_base/src/com/fr/design/extra/PluginOperateUtils.java
  10. 12
      designer_base/src/com/fr/design/extra/PluginUpdatePane.java
  11. 12
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  12. 94
      designer_base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java

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

@ -1,4 +1,5 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.config.MarketConfig;
import com.fr.config.ServerConfig; import com.fr.config.ServerConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
@ -101,7 +102,7 @@ public class ActiveKeyGenerator {
HashMap<String, String> para = new HashMap<String, String>(); HashMap<String, String> para = new HashMap<String, String>();
para.put("uuid", envManager.getUUID()); para.put("uuid", envManager.getUUID());
para.put("key", key); para.put("key", key);
para.put("username", ServerConfig.getInstance().getBbsUsername()); para.put("username", MarketConfig.getInstance().getBbsUsername());
HttpClient hc = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("verify.code"), para); HttpClient hc = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("verify.code"), para);
if (timeout != -1) { if (timeout != -1) {
hc.setTimeout(timeout); hc.setTimeout(timeout);

8
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -2,7 +2,7 @@ package com.fr.design.mainframe.alphafine.component;
import com.bulenkov.iconloader.IconLoader; import com.bulenkov.iconloader.IconLoader;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.config.ServerConfig; import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
@ -26,8 +26,8 @@ import com.fr.design.mainframe.alphafine.preview.PluginPreviewPane;
import com.fr.design.mainframe.alphafine.search.manager.impl.ActionSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.ActionSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.DocumentSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.DocumentSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.FileSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.FileSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.RecentSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.PluginSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.PluginSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.RecentSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.RecommendSearchManager; import com.fr.design.mainframe.alphafine.search.manager.impl.RecommendSearchManager;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.main.FormIO; import com.fr.form.main.FormIO;
@ -402,6 +402,7 @@ public class AlphaFineDialog extends UIDialog {
/** /**
* 处理搜索字符串 * 处理搜索字符串
*
* @param searchText * @param searchText
*/ */
private void dealWithSearchText(String searchText) { private void dealWithSearchText(String searchText) {
@ -422,6 +423,7 @@ public class AlphaFineDialog extends UIDialog {
/** /**
* 截取字符串中关键词 * 截取字符串中关键词
*
* @param searchText * @param searchText
* @return * @return
*/ */
@ -775,7 +777,7 @@ public class AlphaFineDialog extends UIDialog {
*/ */
private void sendDataToServer(String searchKey, AlphaCellModel cellModel) { private void sendDataToServer(String searchKey, AlphaCellModel cellModel) {
if (cellModel.isNeedToSendToServer()) { if (cellModel.isNeedToSendToServer()) {
String username = ServerConfig.getInstance().getBbsUsername(); String username = MarketConfig.getInstance().getBbsUsername();
String uuid = DesignerEnvManager.getEnvManager().getUUID(); String uuid = DesignerEnvManager.getEnvManager().getUUID();
String activityKey = DesignerEnvManager.getEnvManager().getActivationKey(); String activityKey = DesignerEnvManager.getEnvManager().getActivationKey();
String createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(Calendar.getInstance().getTime()); String createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(Calendar.getInstance().getTime());

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

@ -4,7 +4,7 @@
package com.fr.design.mainframe.bbs; package com.fr.design.mainframe.bbs;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.config.ServerConfig; import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.bbs.BBSLoginUtils; import com.fr.design.bbs.BBSLoginUtils;
import com.fr.design.extra.LoginContextListener; import com.fr.design.extra.LoginContextListener;
@ -28,10 +28,8 @@ import com.fr.stable.OperatingSystem;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.SwingConstants; import javax.swing.*;
import java.awt.Cursor; import java.awt.*;
import java.awt.Desktop;
import java.awt.Frame;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
@ -71,54 +69,57 @@ public class UserInfoLabel extends UILabel {
private UserInfoPane userInfoPane; private UserInfoPane userInfoPane;
private BBSLoginDialog bbsLoginDialog; private BBSLoginDialog bbsLoginDialog;
private MouseAdapter userInfoAdapter = new MouseAdapter() {
public UserInfoPane getUserInfoPane() { @Override
return userInfoPane; public void mouseEntered(MouseEvent e) {
} UserInfoLabel.this.setCursor(new Cursor(Cursor.HAND_CURSOR));
public void setUserInfoPane(UserInfoPane userInfoPane) {
this.userInfoPane = userInfoPane;
} }
public BBSLoginDialog getBbsLoginDialog() { @Override
return bbsLoginDialog; public void mouseClicked(MouseEvent e) {
} userName = MarketConfig.getInstance().getBbsUsername();
if (StringUtils.isNotEmpty(userName)) {
UIPopupMenu menu = new UIPopupMenu();
menu.setOnlyText(true);
menu.setPopupSize(userInfoPane.getWidth(), userInfoPane.getHeight() * 3);
public void setBbsLoginDialog(BBSLoginDialog bbsLoginDialog) { //私人消息
this.bbsLoginDialog = bbsLoginDialog; UIMenuItem priviteMessage = new UIMenuItem(Inter.getLocText("FR-Designer-BBSLogin_Privite-Message"));
priviteMessage.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if (StringUtils.isNotEmpty(userName)) {
try {
String loginUrl = SiteCenter.getInstance().acquireUrlByKind("bbs.default");
Desktop.getDesktop().browse(new URI(loginUrl));
} catch (Exception exp) {
FRContext.getLogger().info(exp.getMessage());
} }
public UserInfoLabel(UserInfoPane userInfoPane) {
init(userInfoPane);
} }
private void init(UserInfoPane userInfoPane) {
this.userInfoPane = userInfoPane;
this.addMouseListener(userInfoAdapter);
this.setHorizontalAlignment(SwingConstants.CENTER);
if (StableUtils.getMajorJavaVersion() == VERSION_8) {
LoginWebBridge.getHelper().setUILabel(UserInfoLabel.this);
PluginWebBridge.getHelper().setUILabel(UserInfoLabel.this);
} }
UserLoginContext.addLoginContextListener(new LoginContextListener() { });
//切换账号
UIMenuItem closeOther = new UIMenuItem(Inter.getLocText("FR-Designer-BBSLogin_Switch-Account"));
closeOther.addMouseListener(new MouseAdapter() {
@Override @Override
public void showLoginContext() { public void mousePressed(MouseEvent e) {
WebViewDlgHelper.createLoginDialog(); BBSLoginUtils.bbsLogout();
clearLoginInformation(); UserLoginContext.fireLoginContextListener();
updateInfoPane();
} }
}); });
menu.add(priviteMessage);
menu.add(closeOther);
GUICoreUtils.showPopupMenu(menu, UserInfoLabel.this, 0, MENU_HEIGHT);
} else {
UserLoginContext.fireLoginContextListener();
} }
private void clearLoginInformation() {
BBSLoginUtils.bbsLogout();
} }
};
private void updateInfoPane() { public UserInfoLabel(UserInfoPane userInfoPane) {
userInfoPane.markUnSignIn(); init(userInfoPane);
} }
/** /**
@ -170,6 +171,51 @@ public class UserInfoLabel extends UILabel {
}); });
} }
public UserInfoPane getUserInfoPane() {
return userInfoPane;
}
public void setUserInfoPane(UserInfoPane userInfoPane) {
this.userInfoPane = userInfoPane;
}
public BBSLoginDialog getBbsLoginDialog() {
return bbsLoginDialog;
}
public void setBbsLoginDialog(BBSLoginDialog bbsLoginDialog) {
this.bbsLoginDialog = bbsLoginDialog;
}
private void init(UserInfoPane userInfoPane) {
this.userInfoPane = userInfoPane;
this.addMouseListener(userInfoAdapter);
this.setHorizontalAlignment(SwingConstants.CENTER);
if (StableUtils.getMajorJavaVersion() == VERSION_8) {
LoginWebBridge.getHelper().setUILabel(UserInfoLabel.this);
PluginWebBridge.getHelper().setUILabel(UserInfoLabel.this);
}
UserLoginContext.addLoginContextListener(new LoginContextListener() {
@Override
public void showLoginContext() {
WebViewDlgHelper.createLoginDialog();
clearLoginInformation();
updateInfoPane();
}
});
}
private void clearLoginInformation() {
BBSLoginUtils.bbsLogout();
}
private void updateInfoPane() {
userInfoPane.markUnSignIn();
}
private void sleep(long millis) { private void sleep(long millis) {
try { try {
Thread.sleep(millis); Thread.sleep(millis);
@ -182,13 +228,6 @@ public class UserInfoLabel extends UILabel {
return userName; return userName;
} }
/**
* 重置当前用户名
*/
public void resetUserName() {
this.userName = StringUtils.EMPTY;
}
public void setUserName(String userName) { public void setUserName(String userName) {
if (StringUtils.isEmpty(userName)) { if (StringUtils.isEmpty(userName)) {
return; return;
@ -197,6 +236,13 @@ public class UserInfoLabel extends UILabel {
this.userName = userName; this.userName = userName;
} }
/**
* 重置当前用户名
*/
public void resetUserName() {
this.userName = StringUtils.EMPTY;
}
private String encode(String str) { private String encode(String str) {
try { try {
return URLEncoder.encode(str, EncodeConstants.ENCODING_UTF_8); return URLEncoder.encode(str, EncodeConstants.ENCODING_UTF_8);
@ -228,53 +274,4 @@ public class UserInfoLabel extends UILabel {
//更新面板Text //更新面板Text
this.setText(sb); this.setText(sb);
} }
private MouseAdapter userInfoAdapter = new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
UserInfoLabel.this.setCursor(new Cursor(Cursor.HAND_CURSOR));
}
@Override
public void mouseClicked(MouseEvent e) {
userName = ServerConfig.getInstance().getBbsUsername();
if (StringUtils.isNotEmpty(userName)) {
UIPopupMenu menu = new UIPopupMenu();
menu.setOnlyText(true);
menu.setPopupSize(userInfoPane.getWidth(), userInfoPane.getHeight() * 3);
//私人消息
UIMenuItem priviteMessage = new UIMenuItem(Inter.getLocText("FR-Designer-BBSLogin_Privite-Message"));
priviteMessage.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if (StringUtils.isNotEmpty(userName)) {
try {
String loginUrl = SiteCenter.getInstance().acquireUrlByKind("bbs.default");
Desktop.getDesktop().browse(new URI(loginUrl));
} catch (Exception exp) {
FRContext.getLogger().info(exp.getMessage());
}
}
}
});
//切换账号
UIMenuItem closeOther = new UIMenuItem(Inter.getLocText("FR-Designer-BBSLogin_Switch-Account"));
closeOther.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
BBSLoginUtils.bbsLogout();
UserLoginContext.fireLoginContextListener();
}
});
menu.add(priviteMessage);
menu.add(closeOther);
GUICoreUtils.showPopupMenu(menu, UserInfoLabel.this, 0, MENU_HEIGHT);
} else {
UserLoginContext.fireLoginContextListener();
}
}
};
} }

31
designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java

@ -5,7 +5,7 @@ package com.fr.design.mainframe.bbs;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.config.DBEnv; import com.fr.config.DBEnv;
import com.fr.config.ServerConfig; import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
@ -17,9 +17,7 @@ import com.fr.general.Inter;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Color;
import java.awt.Dimension;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
@ -28,7 +26,6 @@ import java.util.Date;
/** /**
* @author neil * @author neil
*
* @date: 2015-3-5-上午11:19:50 * @date: 2015-3-5-上午11:19:50
*/ */
public class UserInfoPane extends BasicPane { public class UserInfoPane extends BasicPane {
@ -50,15 +47,6 @@ public class UserInfoPane extends BasicPane{
private UserInfoLabel userInfoLabel; private UserInfoLabel userInfoLabel;
public UserInfoLabel getUserInfoLabel() {
return userInfoLabel;
}
public void setUserInfoLabel(UserInfoLabel userInfoLabel) {
this.userInfoLabel = userInfoLabel;
}
/** /**
* 构造函数 * 构造函数
*/ */
@ -75,12 +63,20 @@ public class UserInfoPane extends BasicPane{
this.add(userInfoLabel, BorderLayout.CENTER); this.add(userInfoLabel, BorderLayout.CENTER);
} }
public UserInfoLabel getUserInfoLabel() {
return userInfoLabel;
}
public void setUserInfoLabel(UserInfoLabel userInfoLabel) {
this.userInfoLabel = userInfoLabel;
}
private void addEnvChangedListener() { private void addEnvChangedListener() {
GeneralContext.addEnvChangedListener(new EnvChangedListener() { GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@Override @Override
public void envChanged() { public void envChanged() {
if (DBEnv.isDBEnvAvailable()) { if (DBEnv.isDBEnvAvailable()) {
String username = ServerConfig.getInstance().getBbsUsername(); String username = MarketConfig.getInstance().getBbsUsername();
if (StringUtils.isEmpty(username)) { if (StringUtils.isEmpty(username)) {
markUnSignIn(); markUnSignIn();
} else { } else {
@ -136,7 +132,7 @@ public class UserInfoPane extends BasicPane{
FRContext.getLogger().error(e.getMessage()); FRContext.getLogger().error(e.getMessage());
} }
String userName = ServerConfig.getInstance().getBbsUsername(); String userName = MarketConfig.getInstance().getBbsUsername();
if (StringUtils.isNotEmpty(userName)) { if (StringUtils.isNotEmpty(userName)) {
return; return;
} }
@ -157,7 +153,6 @@ public class UserInfoPane extends BasicPane{
/** /**
* 标志未登录状态, 面板设置为灰色 * 标志未登录状态, 面板设置为灰色
*
*/ */
public void markUnSignIn() { public void markUnSignIn() {
this.userInfoLabel.setText(Inter.getLocText("FR-Base_UnSignIn")); this.userInfoLabel.setText(Inter.getLocText("FR-Base_UnSignIn"));
@ -168,8 +163,8 @@ public class UserInfoPane extends BasicPane{
/** /**
* 标志登陆状态, 面包设置为蓝色 * 标志登陆状态, 面包设置为蓝色
* @param userName 用户名
* *
* @param userName 用户名
*/ */
public void markSignIn(String userName) { public void markSignIn(String userName) {
this.userInfoLabel.setText(userName); this.userInfoLabel.setText(userName);

5
designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java

@ -3,9 +3,8 @@ package com.fr.design.mainframe.errorinfo;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.io.IOFile; import com.fr.base.io.IOFile;
import com.fr.base.io.XMLReadHelper; import com.fr.base.io.XMLReadHelper;
import com.fr.config.ServerConfig; import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.general.FRLogLevel;
import com.fr.general.FRLogManager; import com.fr.general.FRLogManager;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.LogDuration; import com.fr.general.LogDuration;
@ -39,7 +38,7 @@ public class ErrorInfoLogAppender extends AppenderSkeleton {
this.layout = new com.fr.third.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n"); this.layout = new com.fr.third.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n");
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
this.username = ServerConfig.getInstance().getBbsUsername(); this.username = MarketConfig.getInstance().getBbsUsername();
this.uuid = envManager.getUUID(); this.uuid = envManager.getUUID();
this.activekey = envManager.getActivationKey(); this.activekey = envManager.getActivationKey();
} }

22
designer_base/src/com/fr/design/bbs/BBSLoginUtils.java

@ -1,7 +1,7 @@
package com.fr.design.bbs; package com.fr.design.bbs;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.config.ServerConfig; import com.fr.config.MarketConfig;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.util.List; import java.util.List;
@ -13,8 +13,8 @@ public class BBSLoginUtils {
public static void bbsLogin(String username, String password) { public static void bbsLogin(String username, String password) {
try { try {
ServerConfig.getInstance().setBbsUsername(username); MarketConfig.getInstance().setBbsUsername(username);
ServerConfig.getInstance().setBbsPassword(password); MarketConfig.getInstance().setBbsPassword(password);
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage()); FRContext.getLogger().error(e.getMessage());
} }
@ -25,10 +25,10 @@ public class BBSLoginUtils {
String uid = list.get(0); String uid = list.get(0);
String username = list.get(1); String username = list.get(1);
String password = list.get(2); String password = list.get(2);
ServerConfig.getInstance().setBbsUsername(username); MarketConfig.getInstance().setBbsUsername(username);
ServerConfig.getInstance().setBbsPassword(password); MarketConfig.getInstance().setBbsPassword(password);
ServerConfig.getInstance().setBbsUid(Integer.parseInt(uid)); MarketConfig.getInstance().setBbsUid(Integer.parseInt(uid));
ServerConfig.getInstance().setInShowBBsName(username); MarketConfig.getInstance().setInShowBBsName(username);
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage()); FRContext.getLogger().error(e.getMessage());
} }
@ -36,10 +36,10 @@ public class BBSLoginUtils {
public static void bbsLogout() { public static void bbsLogout() {
try { try {
ServerConfig.getInstance().setBbsUsername(StringUtils.EMPTY); MarketConfig.getInstance().setBbsUsername(StringUtils.EMPTY);
ServerConfig.getInstance().setBbsPassword(StringUtils.EMPTY); MarketConfig.getInstance().setBbsPassword(StringUtils.EMPTY);
ServerConfig.getInstance().setBbsUid(0); MarketConfig.getInstance().setBbsUid(0);
ServerConfig.getInstance().setInShowBBsName(StringUtils.EMPTY); MarketConfig.getInstance().setInShowBBsName(StringUtils.EMPTY);
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage()); FRContext.getLogger().error(e.getMessage());
} }

50
designer_base/src/com/fr/design/extra/LoginWebBridge.java

@ -1,7 +1,7 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.config.ServerConfig; import com.fr.config.MarketConfig;
import com.fr.design.bbs.BBSLoginUtils; import com.fr.design.bbs.BBSLoginUtils;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.exe.PluginLoginExecutor; import com.fr.design.extra.exe.PluginLoginExecutor;
@ -18,8 +18,7 @@ import javafx.concurrent.Task;
import javafx.scene.web.WebEngine; import javafx.scene.web.WebEngine;
import netscape.javascript.JSObject; import netscape.javascript.JSObject;
import javax.swing.JDialog; import javax.swing.*;
import javax.swing.SwingUtilities;
import java.awt.*; import java.awt.*;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URI; import java.net.URI;
@ -38,8 +37,6 @@ public class LoginWebBridge {
private static final String SUCCESS_MESSAGE_STATUS = "ok"; private static final String SUCCESS_MESSAGE_STATUS = "ok";
//数据通讯失败 //数据通讯失败
private static final String FAILED_MESSAGE_STATUS = "error"; private static final String FAILED_MESSAGE_STATUS = "error";
//消息条数
private int messageCount;
//最低消息的条数 //最低消息的条数
private static final int MIN_MESSAGE_COUNT = 0; private static final int MIN_MESSAGE_COUNT = 0;
//登录成功 //登录成功
@ -58,8 +55,9 @@ public class LoginWebBridge {
private static final String LOGIN_SUCCESS = "ok"; private static final String LOGIN_SUCCESS = "ok";
private static final String LOGIN_FAILED = "failed"; private static final String LOGIN_FAILED = "failed";
private static final Color LOGIN_BACKGROUND = new Color(184, 220, 242); private static final Color LOGIN_BACKGROUND = new Color(184, 220, 242);
private static LoginWebBridge helper; private static LoginWebBridge helper;
//消息条数
private int messageCount;
private UIDialog uiDialog; private UIDialog uiDialog;
private UIDialog qqDialog; private UIDialog qqDialog;
private UILabel uiLabel; private UILabel uiLabel;
@ -94,6 +92,26 @@ public class LoginWebBridge {
return messageCount; return messageCount;
} }
/**
* 设置获取的消息长度并设置显示
*
* @param count
*/
public void setMessageCount(int count) {
if (count == MIN_MESSAGE_COUNT) {
uiLabel.setText(MarketConfig.getInstance().getBbsUsername());
MarketConfig.getInstance().setInShowBBsName(MarketConfig.getInstance().getBbsUsername());
return;
}
this.messageCount = count;
StringBuilder sb = new StringBuilder();
sb.append(StringUtils.BLANK).append(MarketConfig.getInstance().getBbsUsername())
.append("(").append(this.messageCount)
.append(")").append(StringUtils.BLANK);
MarketConfig.getInstance().setInShowBBsName(sb.toString());
uiLabel.setText(sb.toString());
}
public void setQQDialog(UIDialog qqDialog) { public void setQQDialog(UIDialog qqDialog) {
closeQQWindow(); closeQQWindow();
this.qqDialog = qqDialog; this.qqDialog = qqDialog;
@ -118,26 +136,6 @@ public class LoginWebBridge {
return client.isServerAlive(); return client.isServerAlive();
} }
/**
* 设置获取的消息长度并设置显示
*
* @param count
*/
public void setMessageCount(int count) {
if (count == MIN_MESSAGE_COUNT) {
uiLabel.setText(ServerConfig.getInstance().getBbsUsername());
ServerConfig.getInstance().setInShowBBsName(ServerConfig.getInstance().getBbsUsername());
return;
}
this.messageCount = count;
StringBuilder sb = new StringBuilder();
sb.append(StringUtils.BLANK).append(ServerConfig.getInstance().getBbsUsername())
.append("(").append(this.messageCount)
.append(")").append(StringUtils.BLANK);
ServerConfig.getInstance().setInShowBBsName(sb.toString());
uiLabel.setText(sb.toString());
}
private String encode(String str) { private String encode(String str) {
try { try {
return URLEncoder.encode(str, EncodeConstants.ENCODING_UTF_8); return URLEncoder.encode(str, EncodeConstants.ENCODING_UTF_8);

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

@ -1,7 +1,7 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.config.ServerConfig; import com.fr.config.MarketConfig;
import com.fr.design.extra.tradition.callback.UpdateOnlineCallback; import com.fr.design.extra.tradition.callback.UpdateOnlineCallback;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -14,6 +14,7 @@ import com.fr.plugin.manage.control.PluginTaskResult;
import com.fr.plugin.manage.control.ProgressCallback; import com.fr.plugin.manage.control.ProgressCallback;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.filechooser.FileNameExtensionFilter;
import java.io.File; import java.io.File;
@ -25,13 +26,12 @@ import java.util.List;
* @since 8.0 * @since 8.0
*/ */
public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<PluginView>, Void> { public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<PluginView>, Void> {
private static final int LISTNUM1 = 1;
private static final int LISTNUM100 = 100;
private UILabel errorMsgLabel; private UILabel errorMsgLabel;
private UITabbedPane tabbedPane; private UITabbedPane tabbedPane;
private PluginControlPane controlPane; private PluginControlPane controlPane;
private static final int LISTNUM1 = 1;
private static final int LISTNUM100 = 100;
public PluginFromStorePane(final UITabbedPane tabbedPane) { public PluginFromStorePane(final UITabbedPane tabbedPane) {
super(tabbedPane); super(tabbedPane);
@ -180,7 +180,8 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful"));
} else { } else {
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} } }
}
}); });
} catch (Exception e1) { } catch (Exception e1) {
JOptionPane.showMessageDialog(PluginFromStorePane.this, e1.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(PluginFromStorePane.this, e1.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
@ -188,10 +189,10 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
} }
private void doUpdateOnline(final PluginStatusCheckCompletePane pane) { private void doUpdateOnline(final PluginStatusCheckCompletePane pane) {
if (!StringUtils.isNotEmpty(ServerConfig.getInstance().getBbsUsername())) { if (!StringUtils.isNotEmpty(MarketConfig.getInstance().getBbsUsername())) {
LoginCheckContext.fireLoginCheckListener(); LoginCheckContext.fireLoginCheckListener();
} }
if (StringUtils.isNotEmpty(ServerConfig.getInstance().getBbsUsername())) { if (StringUtils.isNotEmpty(MarketConfig.getInstance().getBbsUsername())) {
PluginView plugin = controlPane.getSelectedPlugin(); PluginView plugin = controlPane.getSelectedPlugin();
String id = null; String id = null;
if (plugin != null) { if (plugin != null) {

7
designer_base/src/com/fr/design/extra/PluginOperateUtils.java

@ -1,7 +1,7 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.config.ServerConfig; import com.fr.config.MarketConfig;
import com.fr.design.extra.exe.callback.InstallFromDiskCallback; import com.fr.design.extra.exe.callback.InstallFromDiskCallback;
import com.fr.design.extra.exe.callback.InstallOnlineCallback; import com.fr.design.extra.exe.callback.InstallOnlineCallback;
import com.fr.design.extra.exe.callback.JSCallback; import com.fr.design.extra.exe.callback.JSCallback;
@ -26,8 +26,7 @@ import com.fr.plugin.manage.control.PluginTaskResult;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.JOptionPane; import javax.swing.*;
import javax.swing.SwingUtilities;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
@ -167,7 +166,7 @@ public class PluginOperateUtils {
} }
public static void getLoginInfo(JSCallback jsCallback, UILabel uiLabel) { public static void getLoginInfo(JSCallback jsCallback, UILabel uiLabel) {
String username = ServerConfig.getInstance().getBbsUsername(); String username = MarketConfig.getInstance().getBbsUsername();
if (StringUtils.isEmpty(username)) { if (StringUtils.isEmpty(username)) {
jsCallback.execute(StringUtils.EMPTY); jsCallback.execute(StringUtils.EMPTY);
uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn")); uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn"));

12
designer_base/src/com/fr/design/extra/PluginUpdatePane.java

@ -1,6 +1,6 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.config.ServerConfig; import com.fr.config.MarketConfig;
import com.fr.design.extra.tradition.callback.UpdateOnlineCallback; import com.fr.design.extra.tradition.callback.UpdateOnlineCallback;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -26,12 +26,11 @@ import java.util.List;
*/ */
public class PluginUpdatePane extends PluginAbstractLoadingViewPane<List<PluginView>, Void> { public class PluginUpdatePane extends PluginAbstractLoadingViewPane<List<PluginView>, Void> {
private static final int PERSENT = 100;
private PluginControlPane controlPane; private PluginControlPane controlPane;
private JLabel errorMsgLabel; private JLabel errorMsgLabel;
private UITabbedPane tabbedPane; private UITabbedPane tabbedPane;
private static final int PERSENT = 100;
public PluginUpdatePane(UITabbedPane tabbedPane) { public PluginUpdatePane(UITabbedPane tabbedPane) {
super(tabbedPane); super(tabbedPane);
this.tabbedPane = tabbedPane; this.tabbedPane = tabbedPane;
@ -171,10 +170,10 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<List<PluginV
} }
private void doUpdateOnline(final PluginStatusCheckCompletePane pane) { private void doUpdateOnline(final PluginStatusCheckCompletePane pane) {
if (!StringUtils.isNotEmpty(ServerConfig.getInstance().getBbsUsername())) { if (!StringUtils.isNotEmpty(MarketConfig.getInstance().getBbsUsername())) {
LoginCheckContext.fireLoginCheckListener(); LoginCheckContext.fireLoginCheckListener();
} }
if (StringUtils.isNotEmpty(ServerConfig.getInstance().getBbsUsername())) { if (StringUtils.isNotEmpty(MarketConfig.getInstance().getBbsUsername())) {
try { try {
PluginView plugin = controlPane.getSelectedPlugin(); PluginView plugin = controlPane.getSelectedPlugin();
PluginMarker pluginMarker = PluginMarker.create(plugin.getID(), plugin.getVersion()); PluginMarker pluginMarker = PluginMarker.create(plugin.getID(), plugin.getVersion());
@ -182,7 +181,8 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<List<PluginV
String latestPluginVersion = (String) latestPluginInfo.get("version"); String latestPluginVersion = (String) latestPluginInfo.get("version");
PluginMarker toPluginMarker = PluginMarker.create(pluginMarker.getPluginID(), latestPluginVersion); PluginMarker toPluginMarker = PluginMarker.create(pluginMarker.getPluginID(), latestPluginVersion);
PluginManager.getController().download(pluginMarker, new UpdateOnlineCallback(pluginMarker, toPluginMarker, pane)); PluginManager.getController().download(pluginMarker, new UpdateOnlineCallback(pluginMarker, toPluginMarker, pane));
}catch (Exception e){} } catch (Exception e) {
}
} }

12
designer_base/src/com/fr/design/extra/PluginWebBridge.java

@ -1,7 +1,7 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.config.ServerConfig; import com.fr.config.MarketConfig;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.bbs.BBSLoginUtils; import com.fr.design.bbs.BBSLoginUtils;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
@ -30,10 +30,8 @@ import javafx.stage.FileChooser;
import javafx.stage.Stage; import javafx.stage.Stage;
import netscape.javascript.JSObject; import netscape.javascript.JSObject;
import javax.swing.JDialog; import javax.swing.*;
import javax.swing.JOptionPane; import java.awt.*;
import javax.swing.SwingUtilities;
import java.awt.Desktop;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
@ -422,7 +420,7 @@ public class PluginWebBridge {
*/ */
public String getLoginInfo(final JSObject callback) { public String getLoginInfo(final JSObject callback) {
registerLoginInfo(callback); registerLoginInfo(callback);
return ServerConfig.getInstance().getBbsUsername(); return MarketConfig.getInstance().getBbsUsername();
} }
/** /**
@ -557,7 +555,7 @@ public class PluginWebBridge {
* 清除用户信息 * 清除用户信息
*/ */
public void clearUserInfo() { public void clearUserInfo() {
ServerConfig.getInstance().setInShowBBsName(StringUtils.EMPTY); MarketConfig.getInstance().setInShowBBsName(StringUtils.EMPTY);
BBSLoginUtils.bbsLogout(); BBSLoginUtils.bbsLogout();
uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn")); uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn"));
} }

94
designer_base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java

@ -2,39 +2,59 @@ package com.fr.design.mainframe.templateinfo;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.io.IOFile; import com.fr.base.io.IOFile;
import com.fr.config.ServerConfig; import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.SiteCenterToken; import com.fr.design.mainframe.SiteCenterToken;
import com.fr.env.RemoteEnv; import com.fr.env.RemoteEnv;
import com.fr.general.*; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.stable.*;
import com.fr.stable.xml.*;
import com.fr.third.javax.xml.stream.XMLStreamException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.stable.EncodeConstants;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.third.javax.xml.stream.XMLStreamException;
import java.io.*; import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
/** /**
* 做模板的过程和耗时收集辅助类 * 做模板的过程和耗时收集辅助类
* Created by plough on 2017/2/21. * Created by plough on 2017/2/21.
*/ */
public class TemplateInfoCollector<T extends IOFile> implements Serializable, XMLReadable, XMLWriter { public class TemplateInfoCollector<T extends IOFile> implements Serializable, XMLReadable, XMLWriter {
static final long serialVersionUID = 2007L;
private static final String FILE_NAME = "tpl.info"; private static final String FILE_NAME = "tpl.info";
private static final String OBJECT_FILE_NAME = "tplInfo.ser"; private static final String OBJECT_FILE_NAME = "tplInfo.ser";
private static TemplateInfoCollector instance;
private Map<String, HashMap<String, Object>> templateInfoList;
private String designerOpenDate; //设计器最近一次打开日期
private static final int VALID_CELL_COUNT = 5; // 有效报表模板的格子数 private static final int VALID_CELL_COUNT = 5; // 有效报表模板的格子数
private static final int VALID_WIDGET_COUNT = 5; // 有效报表模板的控件数 private static final int VALID_WIDGET_COUNT = 5; // 有效报表模板的控件数
private static final int COMPLETE_DAY_COUNT = 15; // 判断模板是否完成的天数 private static final int COMPLETE_DAY_COUNT = 15; // 判断模板是否完成的天数
private static final int ONE_THOUSAND = 1000; private static final int ONE_THOUSAND = 1000;
static final long serialVersionUID = 2007L;
private static final String XML_DESIGNER_OPEN_DATE = "DesignerOpenDate"; private static final String XML_DESIGNER_OPEN_DATE = "DesignerOpenDate";
private static final String XML_TEMPLATE_INFO_LIST = "TemplateInfoList"; private static final String XML_TEMPLATE_INFO_LIST = "TemplateInfoList";
private static final String XML_TEMPLATE_INFO = "TemplateInfo"; private static final String XML_TEMPLATE_INFO = "TemplateInfo";
@ -57,6 +77,9 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable, XM
private static final String ATTR_USERNAME = "username"; private static final String ATTR_USERNAME = "username";
private static final String JSON_CONSUMING_MAP = "jsonConsumingMap"; private static final String JSON_CONSUMING_MAP = "jsonConsumingMap";
private static final String JSON_PROCESS_MAP = "jsonProcessMap"; private static final String JSON_PROCESS_MAP = "jsonProcessMap";
private static TemplateInfoCollector instance;
private Map<String, HashMap<String, Object>> templateInfoList;
private String designerOpenDate; //设计器最近一次打开日期
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -65,21 +88,6 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable, XM
setDesignerOpenDate(); setDesignerOpenDate();
} }
/**
* 把设计器最近打开日期设定为当前日期
*/
private void setDesignerOpenDate() {
designerOpenDate = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
}
/**
* 判断今天是否第一次打开设计器
*/
private boolean designerOpenFirstTime() {
String today = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
return !ComparatorUtils.equals(today, designerOpenDate);
}
/** /**
* 获取缓存文件存放路径 * 获取缓存文件存放路径
*/ */
@ -138,6 +146,26 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable, XM
return IOUtils.inputStream2String(is); return IOUtils.inputStream2String(is);
} }
public static void main(String[] args) {
TemplateInfoCollector tic = TemplateInfoCollector.getInstance();
tic.sendTemplateInfo();
}
/**
* 把设计器最近打开日期设定为当前日期
*/
private void setDesignerOpenDate() {
designerOpenDate = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
}
/**
* 判断今天是否第一次打开设计器
*/
private boolean designerOpenFirstTime() {
String today = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
return !ComparatorUtils.equals(today, designerOpenDate);
}
private boolean shouldCollectInfo() { private boolean shouldCollectInfo() {
if (FRContext.getCurrentEnv() instanceof RemoteEnv) { // 远程设计不收集数据 if (FRContext.getCurrentEnv() instanceof RemoteEnv) { // 远程设计不收集数据
return false; return false;
@ -218,8 +246,7 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable, XM
HashMap<String, Object> consumingMap = (HashMap<String, Object>) templateInfo.get(XML_CONSUMING_MAP); HashMap<String, Object> consumingMap = (HashMap<String, Object>) templateInfo.get(XML_CONSUMING_MAP);
timeConsume += (long) consumingMap.get(ATTR_TIME_CONSUME); // 加上之前的累计编辑时间 timeConsume += (long) consumingMap.get(ATTR_TIME_CONSUME); // 加上之前的累计编辑时间
consumingMap.put(ATTR_TIME_CONSUME, timeConsume); consumingMap.put(ATTR_TIME_CONSUME, timeConsume);
} } else { // 新增
else { // 新增
templateInfo = new HashMap<>(); templateInfo = new HashMap<>();
templateInfo.put(XML_CONSUMING_MAP, getNewConsumingMap(templateID, openTime, timeConsume)); templateInfo.put(XML_CONSUMING_MAP, getNewConsumingMap(templateID, openTime, timeConsume));
} }
@ -238,7 +265,7 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable, XM
private HashMap<String, Object> getNewConsumingMap(String templateID, long openTime, long timeConsume) { private HashMap<String, Object> getNewConsumingMap(String templateID, long openTime, long timeConsume) {
HashMap<String, Object> consumingMap = new HashMap<>(); HashMap<String, Object> consumingMap = new HashMap<>();
String username = ServerConfig.getInstance().getBbsUsername(); String username = MarketConfig.getInstance().getBbsUsername();
String uuid = DesignerEnvManager.getEnvManager().getUUID(); String uuid = DesignerEnvManager.getEnvManager().getUUID();
String activitykey = DesignerEnvManager.getEnvManager().getActivationKey(); String activitykey = DesignerEnvManager.getEnvManager().getActivationKey();
String createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(Calendar.getInstance().getTime()); String createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(Calendar.getInstance().getTime());
@ -435,7 +462,8 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable, XM
this.templateID = (String) processMap.get(ATTR_TEMPLATE_ID); this.templateID = (String) processMap.get(ATTR_TEMPLATE_ID);
} }
public TemplateInfo() {} public TemplateInfo() {
}
public String getTemplateID() { public String getTemplateID() {
return templateID; return templateID;
@ -518,10 +546,4 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable, XM
} }
} }
public static void main(String[] args) {
TemplateInfoCollector tic = TemplateInfoCollector.getInstance();
tic.sendTemplateInfo();
}
} }

Loading…
Cancel
Save