Browse Source

Merge pull request #1096 in BA/design from ~KERRY/design:release/9.0 to release/9.0

* commit '85e6c4bb2d0a9995ed2ec922124b2cb2c2b940ae':
  REPORT-2354 将原来存在finereportEnv中的登录信息移到config.xml中
master
superman 7 years ago
parent
commit
8ed748db48
  1. 5
      designer/src/com/fr/design/mainframe/ActiveKeyGenerator.java
  2. 5
      designer/src/com/fr/design/mainframe/InformationCollector.java
  3. 3
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  4. 8
      designer/src/com/fr/design/mainframe/bbs/BBSLoginDialog.java
  5. 6
      designer/src/com/fr/design/mainframe/bbs/ExitLabel.java
  6. 26
      designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java
  7. 12
      designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java
  8. 3
      designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoLogAppender.java
  9. 68
      designer_base/src/com/fr/design/DesignerEnvManager.java
  10. 31
      designer_base/src/com/fr/design/bbs/BBSLoginUtils.java
  11. 36
      designer_base/src/com/fr/design/extra/LoginWebBridge.java
  12. 8
      designer_base/src/com/fr/design/extra/PluginFromStorePane.java
  13. 7
      designer_base/src/com/fr/design/extra/PluginOperateUtils.java
  14. 7
      designer_base/src/com/fr/design/extra/PluginUpdatePane.java
  15. 20
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  16. 3
      designer_base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java

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

@ -1,7 +1,6 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.ConfigManager;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.bbs.BBSConstants;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -102,7 +101,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", envManager.getBBSName()); para.put("username", ConfigManager.getProviderInstance().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);

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

@ -3,6 +3,7 @@
*/ */
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.ConfigManager;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.data.core.db.DBUtils; import com.fr.data.core.db.DBUtils;
import com.fr.data.core.db.dialect.DialectFactory; import com.fr.data.core.db.dialect.DialectFactory;
@ -134,7 +135,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
content.put(XML_UUID, envManager.getUUID()); content.put(XML_UUID, envManager.getUUID());
content.put(XML_JAR, GeneralUtils.readBuildNO()); content.put(XML_JAR, GeneralUtils.readBuildNO());
content.put(XML_VERSION, ProductConstants.RELEASE_VERSION); content.put(XML_VERSION, ProductConstants.RELEASE_VERSION);
content.put(XML_USERNAME, envManager.getBBSName()); content.put(XML_USERNAME, ConfigManager.getProviderInstance().getBbsUsername());
content.put(XML_KEY, envManager.getActivationKey()); content.put(XML_KEY, envManager.getActivationKey());
content.put(XML_OS, System.getProperty("os.name")); content.put(XML_OS, System.getProperty("os.name"));
@ -254,7 +255,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
} }
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
content.put("username", envManager.getBBSName()); content.put("username", ConfigManager.getProviderInstance().getBbsUsername());
content.put("uuid", envManager.getUUID()); content.put("uuid", envManager.getUUID());
content.put("functions", functionArray); content.put("functions", functionArray);

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

@ -1,5 +1,6 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fr.base.ConfigManager;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
@ -776,7 +777,7 @@ public class AlphaFineDialog extends UIDialog {
*/ */
private void sendToServer(String searchKey, AlphaCellModel cellModel) { private void sendToServer(String searchKey, AlphaCellModel cellModel) {
if (cellModel.isNeedToSendToServer()) { if (cellModel.isNeedToSendToServer()) {
String username = DesignerEnvManager.getEnvManager().getBBSName(); String username = ConfigManager.getProviderInstance().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());

8
designer/src/com/fr/design/mainframe/bbs/BBSLoginDialog.java

@ -1,6 +1,8 @@
package com.fr.design.mainframe.bbs; package com.fr.design.mainframe.bbs;
import com.fr.design.DesignerEnvManager; import com.fr.base.ConfigManager;
import com.fr.base.FRContext;
import com.fr.design.bbs.BBSLoginUtils;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.ActionLabel;
@ -207,8 +209,8 @@ public class BBSLoginDialog extends UIDialog {
// 登录成功 // 登录成功
private void loginSuccess() { private void loginSuccess() {
DesignerEnvManager.getEnvManager().setBBSPassword(String.valueOf(passField.getPassword())); String password = String.valueOf(passField.getPassword());
userInfoLabel.setUserName(nameField.getText()); BBSLoginUtils.bbsLogin(nameField.getText(), password);
userInfoLabel.getUserInfoPane().markSignIn(nameField.getText()); userInfoLabel.getUserInfoPane().markSignIn(nameField.getText());
BBSLoginDialog.this.setVisible(false); BBSLoginDialog.this.setVisible(false);
} }

6
designer/src/com/fr/design/mainframe/bbs/ExitLabel.java

@ -9,14 +9,13 @@ import java.awt.event.MouseEvent;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager; import com.fr.design.bbs.BBSLoginUtils;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils;
/** /**
* @author neil * @author neil
@ -61,8 +60,7 @@ public class ExitLabel extends UILabel{
} }
private void clearLoingInformation(){ private void clearLoingInformation(){
DesignerEnvManager.getEnvManager().setBBSName(StringUtils.EMPTY); BBSLoginUtils.bbsLogout();
DesignerEnvManager.getEnvManager().setBBSPassword(StringUtils.EMPTY);
} }
private void updateInfoPane(){ private void updateInfoPane(){

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

@ -3,8 +3,10 @@
*/ */
package com.fr.design.mainframe.bbs; package com.fr.design.mainframe.bbs;
import com.fr.base.ConfigManager;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.bbs.BBSLoginUtils;
import com.fr.design.extra.*; import com.fr.design.extra.*;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
@ -16,12 +18,7 @@ import com.fr.general.DateUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.plugin.manage.bbs.BBSPluginLogin; import com.fr.stable.*;
import com.fr.plugin.manage.bbs.BBSUserInfo;
import com.fr.stable.EncodeConstants;
import com.fr.stable.OperatingSystem;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -77,7 +74,7 @@ public class UserInfoLabel extends UILabel {
public UserInfoLabel(UserInfoPane userInfoPane) { public UserInfoLabel(UserInfoPane userInfoPane) {
this.userInfoPane = userInfoPane; this.userInfoPane = userInfoPane;
String userName = DesignerEnvManager.getEnvManager().getBBSName(); String userName = ConfigManager.getProviderInstance().getBbsUsername();
this.addMouseListener(userInfoAdapter); this.addMouseListener(userInfoAdapter);
this.setHorizontalAlignment(SwingConstants.CENTER); this.setHorizontalAlignment(SwingConstants.CENTER);
this.setText(userName); this.setText(userName);
@ -117,10 +114,9 @@ public class UserInfoLabel extends UILabel {
} }
private void clearLoginInformation() { private void clearLoginInformation() {
DesignerEnvManager.getEnvManager().setBBSName(StringUtils.EMPTY); ConfigManager.getProviderInstance().setInShowBBsName(StringUtils.EMPTY);
DesignerEnvManager.getEnvManager().setBBSPassword(StringUtils.EMPTY); ConfigManager.getProviderInstance().setBbsUid(DEFAULT_BBS_UID);
DesignerEnvManager.getEnvManager().setInShowBBsName(StringUtils.EMPTY); BBSLoginUtils.bbsLogout();
DesignerEnvManager.getEnvManager().setBbsUid(DEFAULT_BBS_UID);
} }
private void updateInfoPane() { private void updateInfoPane() {
@ -192,8 +188,6 @@ public class UserInfoLabel extends UILabel {
return; return;
} }
//往designerenvmanger里写一下
DesignerEnvManager.getEnvManager().setBBSName(userName);
this.userName = userName; this.userName = userName;
} }
@ -238,8 +232,7 @@ public class UserInfoLabel extends UILabel {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo(); userName = ConfigManager.getProviderInstance().getBbsUsername();
userName = bbsUserInfo == null ? "" : bbsUserInfo.getUserName();
if (StringUtils.isNotEmpty(userName)) { if (StringUtils.isNotEmpty(userName)) {
UIPopupMenu menu = new UIPopupMenu(); UIPopupMenu menu = new UIPopupMenu();
menu.setOnlyText(true); menu.setOnlyText(true);
@ -265,10 +258,9 @@ public class UserInfoLabel extends UILabel {
UIMenuItem closeOther = new UIMenuItem(Inter.getLocText("FR-Designer-BBSLogin_Switch-Account")); UIMenuItem closeOther = new UIMenuItem(Inter.getLocText("FR-Designer-BBSLogin_Switch-Account"));
closeOther.addMouseListener(new MouseAdapter() { closeOther.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
BBSPluginLogin.getInstance().logOut(); BBSLoginUtils.bbsLogout();
UserLoginContext.fireLoginContextListener(); UserLoginContext.fireLoginContextListener();
} }
}); });
menu.add(priviteMessage); menu.add(priviteMessage);
menu.add(closeOther); menu.add(closeOther);

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

@ -11,6 +11,7 @@ import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import com.fr.base.ConfigManager;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
@ -18,8 +19,6 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.general.DateUtils; import com.fr.general.DateUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.manage.bbs.BBSPluginLogin;
import com.fr.plugin.manage.bbs.BBSUserInfo;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -77,9 +76,8 @@ public class UserInfoPane extends BasicPane{
@Override @Override
public void run() { public void run() {
String username = DesignerEnvManager.getEnvManager().getBBSName(); String username = ConfigManager.getProviderInstance().getBbsUsername();
String inShowUsername = DesignerEnvManager.getEnvManager().getInShowBBsName(); if (StringUtils.isEmpty(username)){
if (StringUtils.isEmpty(username) && StringUtils.isEmpty(inShowUsername)){
markUnSignIn(); markUnSignIn();
} else { } else {
markSignIn(username); markSignIn(username);
@ -133,7 +131,7 @@ public class UserInfoPane extends BasicPane{
FRContext.getLogger().error(e.getMessage()); FRContext.getLogger().error(e.getMessage());
} }
String userName = DesignerEnvManager.getEnvManager().getBBSName(); String userName = ConfigManager.getProviderInstance().getBbsUsername();
if(StringUtils.isNotEmpty(userName)){ if(StringUtils.isNotEmpty(userName)){
return; return;
} }
@ -169,8 +167,6 @@ public class UserInfoPane extends BasicPane{
* *
*/ */
public void markSignIn(String userName){ public void markSignIn(String userName){
String password = DesignerEnvManager.getEnvManager().getBBSPassword();
BBSPluginLogin.getInstance().login(new BBSUserInfo(userName, password));
this.userInfoLabel.setText(userName); this.userInfoLabel.setText(userName);
this.userInfoLabel.setUserName(userName); this.userInfoLabel.setUserName(userName);
this.userInfoLabel.setOpaque(true); this.userInfoLabel.setOpaque(true);

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

@ -1,5 +1,6 @@
package com.fr.design.mainframe.errorinfo; package com.fr.design.mainframe.errorinfo;
import com.fr.base.ConfigManager;
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;
@ -38,7 +39,7 @@ public class ErrorInfoLogAppender extends AppenderSkeleton {
this.layout = new org.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n"); this.layout = new org.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n");
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
this.username = envManager.getBBSName(); this.username = ConfigManager.getProviderInstance().getBbsUsername();
this.uuid = envManager.getUUID(); this.uuid = envManager.getUUID();
this.activekey = envManager.getActivationKey(); this.activekey = envManager.getActivationKey();
} }

68
designer_base/src/com/fr/design/DesignerEnvManager.java

@ -89,14 +89,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private int westRegionContainerWidth = 240; private int westRegionContainerWidth = 240;
private String encryptionKey; private String encryptionKey;
private String jdkHome; private String jdkHome;
//当前设计器用户的论坛昵称
private String bbsName;
//当前设计器用户的论坛密码
private String bbsPassword;
//当前设计器用户的论坛ID
private int bbsUid;
//当前设计器用户的昵称显示(带消息)
private String inShowBBsName;
//上一次登录弹窗的时间, 为了控制一天只弹一次窗口 //上一次登录弹窗的时间, 为了控制一天只弹一次窗口
private String lastShowBBSTime; private String lastShowBBSTime;
//上一次资讯弹窗时间, 为了控制一天只弹一次 //上一次资讯弹窗时间, 为了控制一天只弹一次
@ -1145,37 +1138,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.jdkHome = home; this.jdkHome = home;
} }
public String getBBSName() {
return bbsName;
}
public void setBBSName(String bbsName) {
this.bbsName = bbsName;
}
public String getBBSPassword() {
return bbsPassword;
}
public void setBBSPassword(String bbsPassword) {
this.bbsPassword = bbsPassword;
}
public int getBbsUid() {
return bbsUid;
}
public void setBbsUid(int bbsUid) {
this.bbsUid = bbsUid;
}
public void setInShowBBsName(String inShowBBsName) {
this.inShowBBsName = inShowBBsName;
}
public String getInShowBBsName() {
return inShowBBsName;
}
public String getLastShowBBSTime() { public String getLastShowBBSTime() {
return lastShowBBSTime; return lastShowBBSTime;
@ -1256,19 +1218,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
} }
} }
private void readBBSName(XMLableReader reader){
String tmpVal;
if (StringUtils.isNotBlank(tmpVal = reader.getElementValue())) {
this.bbsName = tmpVal;
}
}
private void readBBSPassword(XMLableReader reader){
String tmpVal;
if (StringUtils.isNotBlank(tmpVal = reader.getElementValue())) {
this.bbsPassword = CodeUtils.passwordDecode(tmpVal);
}
}
private void readLastBBSTime(XMLableReader reader){ private void readLastBBSTime(XMLableReader reader){
String tmpVal; String tmpVal;
@ -1325,10 +1275,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
readEncrytionKey(reader); readEncrytionKey(reader);
} else if ("jdkHome".equals(name)) { } else if ("jdkHome".equals(name)) {
this.jdkHome = reader.getElementValue(); this.jdkHome = reader.getElementValue();
} else if ("bbsName".equals(name)){
readBBSName(reader);
} else if ("bbsPassword".equals(name)){
readBBSPassword(reader);
}else if ("lastBBSTime".equals(name)){ }else if ("lastBBSTime".equals(name)){
readLastBBSTime(reader); readLastBBSTime(reader);
} else if ("lastBBSNewsTime".equals(name)){ } else if ("lastBBSNewsTime".equals(name)){
@ -1736,18 +1682,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
//写论坛相关的两个属性 //写论坛相关的两个属性
private void writeBBSRelated(XMLPrintWriter writer){ private void writeBBSRelated(XMLPrintWriter writer){
if (StringUtils.isNotBlank(bbsName)) {
writer.startTAG("bbsName");
writer.textNode(bbsName);
writer.end();
}
if (StringUtils.isNotBlank(bbsPassword)){
writer.startTAG("bbsPassword");
writer.textNode(CodeUtils.passwordEncode(bbsPassword));
writer.end();
}
if (StringUtils.isNotEmpty(this.lastShowBBSTime)){ if (StringUtils.isNotEmpty(this.lastShowBBSTime)){
writer.startTAG("lastBBSTime"); writer.startTAG("lastBBSTime");
writer.textNode(lastShowBBSTime); writer.textNode(lastShowBBSTime);

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

@ -0,0 +1,31 @@
package com.fr.design.bbs;
import com.fr.base.ConfigManager;
import com.fr.base.FRContext;
import com.fr.stable.StringUtils;
/**
* Created by ibm on 2017/8/21.
*/
public class BBSLoginUtils {
public static void bbsLogin(String username, String password){
try{
ConfigManager.getProviderInstance().setBbsUsername(username);
ConfigManager.getProviderInstance().setBbsPassword(password);
FRContext.getCurrentEnv().writeResource(ConfigManager.getProviderInstance());
}catch (Exception e){
FRContext.getLogger().error(e.getMessage());
}
}
public static void bbsLogout(){
try{
ConfigManager.getProviderInstance().setBbsUsername(StringUtils.EMPTY);
ConfigManager.getProviderInstance().setBbsPassword(StringUtils.EMPTY);
FRContext.getCurrentEnv().writeResource(ConfigManager.getProviderInstance());
}catch (Exception e){
FRContext.getLogger().error(e.getMessage());
}
}
}

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

@ -1,16 +1,15 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.ConfigManager;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.bbs.BBSLoginUtils;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.ucenter.Client; import com.fr.design.extra.ucenter.Client;
import com.fr.design.extra.ucenter.XMLHelper; import com.fr.design.extra.ucenter.XMLHelper;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONObject;
import com.fr.plugin.manage.bbs.BBSPluginLogin;
import com.fr.plugin.manage.bbs.BBSUserInfo;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javafx.scene.web.WebEngine; import javafx.scene.web.WebEngine;
@ -20,7 +19,6 @@ import java.awt.*;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URI; import java.net.URI;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
public class LoginWebBridge { public class LoginWebBridge {
@ -59,7 +57,7 @@ public class LoginWebBridge {
private String userName; private String userName;
public LoginWebBridge() { public LoginWebBridge() {
String username = DesignerEnvManager.getEnvManager().getBBSName(); String username = ConfigManager.getProviderInstance().getBbsUsername();
setUserName(username, uiLabel); setUserName(username, uiLabel);
} }
@ -130,16 +128,16 @@ public class LoginWebBridge {
*/ */
public void setMessageCount(int count) { public void setMessageCount(int count) {
if (count == MIN_MESSAGE_COUNT) { if (count == MIN_MESSAGE_COUNT) {
uiLabel.setText(DesignerEnvManager.getEnvManager().getBBSName()); uiLabel.setText(ConfigManager.getProviderInstance().getBbsUsername());
DesignerEnvManager.getEnvManager().setInShowBBsName(DesignerEnvManager.getEnvManager().getBBSName()); ConfigManager.getProviderInstance().setInShowBBsName(ConfigManager.getProviderInstance().getBbsUsername());
return; return;
} }
this.messageCount = count; this.messageCount = count;
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(StringUtils.BLANK).append(DesignerEnvManager.getEnvManager().getBBSName()) sb.append(StringUtils.BLANK).append(ConfigManager.getProviderInstance().getBbsUsername())
.append("(").append(this.messageCount) .append("(").append(this.messageCount)
.append(")").append(StringUtils.BLANK); .append(")").append(StringUtils.BLANK);
DesignerEnvManager.getEnvManager().setInShowBBsName(sb.toString()); ConfigManager.getProviderInstance().setInShowBBsName(sb.toString());
uiLabel.setText(sb.toString()); uiLabel.setText(sb.toString());
} }
@ -278,11 +276,9 @@ public class LoginWebBridge {
if (list.size() > 0) { if (list.size() > 0) {
int $uid = Integer.parseInt(list.get(0)); int $uid = Integer.parseInt(list.get(0));
if ($uid > 0) { if ($uid > 0) {
DesignerEnvManager.getEnvManager().setBbsUid($uid); ConfigManager.getProviderInstance().setBbsUid($uid);
DesignerEnvManager.getEnvManager().setBBSName(username); ConfigManager.getProviderInstance().setInShowBBsName(username);
DesignerEnvManager.getEnvManager().setInShowBBsName(username); BBSLoginUtils.bbsLogin(username, password);
DesignerEnvManager.getEnvManager().setBBSPassword(password);
BBSPluginLogin.getInstance().login(new BBSUserInfo(username, password));
return LOGININ;//登录成功,0 return LOGININ;//登录成功,0
} else if ($uid == -1) { } else if ($uid == -1) {
return USERNAME_NOT_EXSIT;//用户名不存在,-1 return USERNAME_NOT_EXSIT;//用户名不存在,-1
@ -318,16 +314,16 @@ public class LoginWebBridge {
public void getLoginInfo(String userInfo) { public void getLoginInfo(String userInfo) {
org.json.JSONObject jo = new org.json.JSONObject(userInfo); org.json.JSONObject jo = new org.json.JSONObject(userInfo);
String status = jo.get("status").toString(); String status = jo.get("status").toString();
try{
if (status.equals(LOGIN_SUCCESS)) { if (status.equals(LOGIN_SUCCESS)) {
String username = jo.get("username").toString(); String username = jo.get("username").toString();
int uid = Integer.parseInt(jo.get("uid") == null ? "" : jo.get("uid").toString()); int uid = Integer.parseInt(jo.get("uid") == null ? "" : jo.get("uid").toString());
closeWindow(); closeWindow();
closeQQWindow(); closeQQWindow();
pluginuiLabel.setText(username); pluginuiLabel.setText(username);
DesignerEnvManager.getEnvManager().setBBSName(username); ConfigManager.getProviderInstance().setBbsUid(uid);
DesignerEnvManager.getEnvManager().setBbsUid(uid); ConfigManager.getProviderInstance().setInShowBBsName(username);
DesignerEnvManager.getEnvManager().setInShowBBsName(username); BBSLoginUtils.bbsLogin(username, "");
BBSPluginLogin.getInstance().login(new BBSUserInfo(username, ""));
} else if (status.equals(LOGIN_FAILED)) { } else if (status.equals(LOGIN_FAILED)) {
//账号没有QQ授权 //账号没有QQ授权
closeQQWindow(); closeQQWindow();
@ -336,6 +332,10 @@ public class LoginWebBridge {
} catch (Exception exp) { } catch (Exception exp) {
} }
} }
}catch (Exception e){
FRContext.getLogger().error(e.getMessage());
}
} }
public void openUrlAtLocalWebBrowser(WebEngine eng, String url) { public void openUrlAtLocalWebBrowser(WebEngine eng, String url) {

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

@ -1,5 +1,6 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.ConfigManager;
import com.fr.base.FRContext; import com.fr.base.FRContext;
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;
@ -9,11 +10,10 @@ import com.fr.general.Inter;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.bbs.BBSPluginLogin;
import com.fr.plugin.manage.control.PluginTaskResult; 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 javax.swing.*; import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.filechooser.FileNameExtensionFilter;
import java.io.File; import java.io.File;
@ -188,10 +188,10 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
} }
private void doUpdateOnline(final PluginStatusCheckCompletePane pane) { private void doUpdateOnline(final PluginStatusCheckCompletePane pane) {
if (!BBSPluginLogin.getInstance().hasLogin()) { if (!StringUtils.isNotEmpty(ConfigManager.getProviderInstance().getBbsUsername())) {
LoginCheckContext.fireLoginCheckListener(); LoginCheckContext.fireLoginCheckListener();
} }
if (BBSPluginLogin.getInstance().hasLogin()) { if (StringUtils.isNotEmpty(ConfigManager.getProviderInstance().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,5 +1,6 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.ConfigManager;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.extra.exe.callback.*; import com.fr.design.extra.exe.callback.*;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -12,8 +13,6 @@ import com.fr.json.JSONObject;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.bbs.BBSPluginLogin;
import com.fr.plugin.manage.bbs.BBSUserInfo;
import com.fr.plugin.manage.control.PluginControllerHelper; import com.fr.plugin.manage.control.PluginControllerHelper;
import com.fr.plugin.manage.control.PluginTask; import com.fr.plugin.manage.control.PluginTask;
import com.fr.plugin.manage.control.PluginTaskCallback; import com.fr.plugin.manage.control.PluginTaskCallback;
@ -260,9 +259,7 @@ public class PluginOperateUtils {
} }
public static void getLoginInfo(JSCallback jsCallback, UILabel uiLabel) { public static void getLoginInfo(JSCallback jsCallback, UILabel uiLabel) {
BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo(); String username = ConfigManager.getProviderInstance().getBbsUsername();
String username = bbsUserInfo == null ? "" : bbsUserInfo.getUserName();
if (StringUtils.isEmpty(username)) { if (StringUtils.isEmpty(username)) {
jsCallback.execute(""); jsCallback.execute("");
uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn")); uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn"));

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

@ -1,5 +1,6 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.ConfigManager;
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;
@ -8,10 +9,10 @@ import com.fr.general.Inter;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.bbs.BBSPluginLogin;
import com.fr.plugin.manage.control.PluginTaskResult; 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 javax.swing.*; import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.filechooser.FileNameExtensionFilter;
@ -170,10 +171,10 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<List<PluginV
} }
private void doUpdateOnline(final PluginStatusCheckCompletePane pane) { private void doUpdateOnline(final PluginStatusCheckCompletePane pane) {
if (!BBSPluginLogin.getInstance().hasLogin()) { if (!StringUtils.isNotEmpty(ConfigManager.getProviderInstance().getBbsUsername())) {
LoginCheckContext.fireLoginCheckListener(); LoginCheckContext.fireLoginCheckListener();
} }
if (BBSPluginLogin.getInstance().hasLogin()) { if (StringUtils.isNotEmpty(ConfigManager.getProviderInstance().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());

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

@ -1,8 +1,9 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.ConfigManager;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.bbs.BBSLoginUtils;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.exe.callback.JSCallback; import com.fr.design.extra.exe.callback.JSCallback;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -12,8 +13,6 @@ import com.fr.general.SiteCenter;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.bbs.BBSPluginLogin;
import com.fr.plugin.manage.bbs.BBSUserInfo;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javafx.scene.web.WebEngine; import javafx.scene.web.WebEngine;
@ -382,8 +381,7 @@ public class PluginWebBridge {
*/ */
public String getLoginInfo(final JSObject callback) { public String getLoginInfo(final JSObject callback) {
registerLoginInfo(callback); registerLoginInfo(callback);
BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo(); return ConfigManager.getProviderInstance().getBbsUsername();
return bbsUserInfo == null ? "" : bbsUserInfo.getUserName();
} }
/** /**
@ -511,8 +509,11 @@ public class PluginWebBridge {
//通过QQ登录后通知登录 //通过QQ登录后通知登录
public void ucsynLogin(long uid, String username, String password, final JSONObject callback) { public void ucsynLogin(long uid, String username, String password, final JSONObject callback) {
BBSUserInfo bbsUserInfo = new BBSUserInfo(username, password); try{
BBSPluginLogin.getInstance().login(bbsUserInfo); FRContext.getCurrentEnv().writeResource(ConfigManager.getProviderInstance());
}catch (Exception e){
FRContext.getLogger().error(e.getMessage());
}
uiLabel.setText(username); uiLabel.setText(username);
} }
@ -520,9 +521,8 @@ public class PluginWebBridge {
* 清除用户信息 * 清除用户信息
*/ */
public void clearUserInfo() { public void clearUserInfo() {
DesignerEnvManager.getEnvManager().setBBSName(StringUtils.EMPTY); ConfigManager.getProviderInstance().setInShowBBsName(StringUtils.EMPTY);
DesignerEnvManager.getEnvManager().setBBSPassword(StringUtils.EMPTY); BBSLoginUtils.bbsLogout();
DesignerEnvManager.getEnvManager().setInShowBBsName(StringUtils.EMPTY);
uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn")); uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn"));
} }

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

@ -1,5 +1,6 @@
package com.fr.design.mainframe.templateinfo; package com.fr.design.mainframe.templateinfo;
import com.fr.base.ConfigManager;
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.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
@ -236,7 +237,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 = DesignerEnvManager.getEnvManager().getBBSName(); String username = ConfigManager.getProviderInstance().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());

Loading…
Cancel
Save