Browse Source

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

* commit '1451cbe930609f53bf1e1335d3e2ec1a8056c730':
  國際化
  REPORT-2354 验收bug修复(主要修改设计器和平台登录同步)
master
superman 7 years ago
parent
commit
ca2b0fddf4
  1. 6
      designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java
  2. 5
      designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java
  3. 48
      designer_base/src/com/fr/design/extra/PluginOperateUtils.java
  4. 20
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  5. 8
      designer_base/src/com/fr/design/extra/WebViewDlgHelper.java
  6. 2
      designer_base/src/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java

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

@ -16,6 +16,8 @@ import com.fr.general.DateUtils;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.plugin.manage.bbs.BBSPluginLogin;
import com.fr.plugin.manage.bbs.BBSUserInfo;
import com.fr.stable.EncodeConstants;
import com.fr.stable.OperatingSystem;
import com.fr.stable.StableUtils;
@ -236,7 +238,8 @@ public class UserInfoLabel extends UILabel {
@Override
public void mouseClicked(MouseEvent e) {
userName = DesignerEnvManager.getEnvManager().getBBSName();
BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo();
userName = bbsUserInfo == null ? "" : bbsUserInfo.getUserName();
if (StringUtils.isNotEmpty(userName)) {
UIPopupMenu menu = new UIPopupMenu();
menu.setOnlyText(true);
@ -262,6 +265,7 @@ public class UserInfoLabel extends UILabel {
UIMenuItem closeOther = new UIMenuItem(Inter.getLocText("FR-Designer-BBSLogin_Switch-Account"));
closeOther.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
BBSPluginLogin.getInstance().logOut();
UserLoginContext.fireLoginContextListener();
}

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

@ -14,11 +14,12 @@ import java.util.Date;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane;
import com.fr.design.extra.LoginWebBridge;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.DateUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.manage.bbs.BBSPluginLogin;
import com.fr.plugin.manage.bbs.BBSUserInfo;
import com.fr.stable.StringUtils;
@ -168,6 +169,8 @@ public class UserInfoPane extends BasicPane{
*
*/
public void markSignIn(String userName){
String password = DesignerEnvManager.getEnvManager().getBBSPassword();
BBSPluginLogin.getInstance().login(new BBSUserInfo(userName, password));
this.userInfoLabel.setText(userName);
this.userInfoLabel.setUserName(userName);
this.userInfoLabel.setOpaque(true);

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

@ -1,8 +1,8 @@
package com.fr.design.extra;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.extra.exe.callback.*;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
@ -33,15 +33,8 @@ public class PluginOperateUtils {
public static void installPluginOnline(final PluginMarker pluginMarker, JSCallback jsCallback) {
//下载插件
if (!BBSPluginLogin.getInstance().hasLogin()) {
UserLoginContext.fireLoginContextListener();
}
if (BBSPluginLogin.getInstance().hasLogin()) {
PluginTask pluginTask = PluginTask.installTask(pluginMarker);
PluginControllerHelper.installOnline(pluginMarker, new InstallOnlineCallback(pluginTask, jsCallback));
}else{
jsCallback.execute("success");
}
PluginTask pluginTask = PluginTask.installTask(pluginMarker);
PluginControllerHelper.installOnline(pluginMarker, new InstallOnlineCallback(pluginTask, jsCallback));
}
public static void installPluginFromDisk(File zipFile, JSCallback jsCallback) {
@ -50,13 +43,8 @@ public class PluginOperateUtils {
public static void updatePluginOnline(List<PluginMarker> pluginMarkerList, JSCallback jsCallback) {
if (!(BBSPluginLogin.getInstance().hasLogin())) {
LoginCheckContext.fireLoginCheckListener();
}
if (BBSPluginLogin.getInstance().hasLogin()) {
for (int i = 0; i < pluginMarkerList.size(); i++) {
updatePluginOnline(pluginMarkerList.get(i), jsCallback);
}
for (int i = 0; i < pluginMarkerList.size(); i++) {
updatePluginOnline(pluginMarkerList.get(i), jsCallback);
}
}
@ -76,8 +64,8 @@ public class PluginOperateUtils {
}
public static void updatePluginFromDisk(final String filePath, JSCallback jsCallback) {
PluginManager.getController().update(new File(filePath), new UpdateFromDiskCallback(new File(filePath), jsCallback));
public static void updatePluginFromDisk(File zipFile, JSCallback jsCallback) {
PluginManager.getController().update(zipFile, new UpdateFromDiskCallback(zipFile, jsCallback));
}
@ -101,7 +89,7 @@ public class PluginOperateUtils {
public void run() {
int rv = JOptionPane.showConfirmDialog(
null,
Inter.getLocText("FR-Designer-Plugin_Delete_Confirmed"),
Inter.getLocText("FR-Plugin_Delete_Confirmed"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE
@ -271,22 +259,16 @@ public class PluginOperateUtils {
}).start();
}
public static void getLoginInfo(JSCallback jsCallback) {
if (!BBSPluginLogin.getInstance().hasLogin()) {
String userName = DesignerEnvManager.getEnvManager().getBBSName();
String password = DesignerEnvManager.getEnvManager().getBBSPassword();
if (StringUtils.isNotBlank(userName)) {
BBSPluginLogin.getInstance().login(new BBSUserInfo(userName, password));
}
}
public static void getLoginInfo(JSCallback jsCallback, UILabel uiLabel) {
BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo();
String username = bbsUserInfo == null ? "" : bbsUserInfo.getUserName();
String inShowUsername = DesignerEnvManager.getEnvManager().getInShowBBsName();
if (StringUtils.isEmpty(username) && StringUtils.isEmpty(inShowUsername)) {
return;
if (StringUtils.isEmpty(username)) {
jsCallback.execute("");
uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn"));
} else {
String result = StringUtils.isEmpty(inShowUsername) ? username : inShowUsername;
uiLabel.setText(username);
String result = username;
jsCallback.execute(result);
}
}

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

@ -12,6 +12,8 @@ import com.fr.general.SiteCenter;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker;
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.StringUtils;
import javafx.scene.web.WebEngine;
@ -196,7 +198,8 @@ public class PluginWebBridge {
*/
public void updatePluginFromDisk(String filePath, final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, callback);
PluginOperateUtils.updatePluginFromDisk(filePath, jsCallback);
File file = new File(filePath);
PluginOperateUtils.updatePluginFromDisk(file, jsCallback);
}
/**
@ -377,9 +380,20 @@ public class PluginWebBridge {
*
* @param callback
*/
public void getLoginInfo(final JSObject callback) {
public String getLoginInfo(final JSObject callback) {
registerLoginInfo(callback);
BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo();
return bbsUserInfo == null ? "": bbsUserInfo.getUserName();
}
/**
* 系统登录注册
*
* @param callback
*/
public void registerLoginInfo(final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, callback);
PluginOperateUtils.getLoginInfo(jsCallback);
PluginOperateUtils.getLoginInfo(jsCallback, uiLabel);
}
/**

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

@ -39,7 +39,7 @@ public class WebViewDlgHelper {
public static void createPluginDialog() {
if (StableUtils.getMajorJavaVersion() >= VERSION_8) {
String relativePath = "/scripts/store/web/index.html";
String mainJsPath = StableUtils.pathJoin(FRContext.getCurrentEnv().getWebReportPath(), relativePath);
String mainJsPath = StableUtils.pathJoin(installHome, relativePath);
File file = new File(mainJsPath);
if (!file.exists()) {
int rv = JOptionPane.showConfirmDialog(
@ -54,7 +54,7 @@ public class WebViewDlgHelper {
}
} else {
String indexPath = "index.html";
String mainIndexPath = StableUtils.pathJoin(FRContext.getCurrentEnv().getWebReportPath(), indexPath);
String mainIndexPath = StableUtils.pathJoin(installHome, indexPath);
checkAndCopyMainFile(mainIndexPath, mainJsPath);
updateShopScripts(SHOP_SCRIPTS);
showPluginDlg(mainIndexPath);
@ -144,7 +144,7 @@ public class WebViewDlgHelper {
}
private static void showLoginDlg() {
LoginWebPane webPane = new LoginWebPane(FRContext.getCurrentEnv().getWebReportPath());
LoginWebPane webPane = new LoginWebPane(installHome);
UIDialog qqdlg = new LoginDialog(DesignerContext.getDesignerFrame(), webPane);
LoginWebBridge.getHelper().setDialogHandle(qqdlg);
qqdlg.setVisible(true);
@ -186,7 +186,7 @@ public class WebViewDlgHelper {
try {
if (get()) {
IOUtils.unzip(new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE)), FRContext.getCurrentEnv().getWebReportPath());
IOUtils.unzip(new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE)), installHome);
// TODO: 2017/4/17 删除之前存放在安装目录下的script
int rv = JOptionPane.showOptionDialog(
null,

2
designer_base/src/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java

@ -73,7 +73,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
return;
}
PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback);
PluginOperateUtils.updatePluginFromDisk(zipFile, jsCallback);
}else {
jsCallback.execute("failed");
FRLogger.getLogger().info(Inter.getLocText("FR-Plugin_Install_Failed"));

Loading…
Cancel
Save