Browse Source

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

* commit '1451cbe930609f53bf1e1335d3e2ec1a8056c730':
  國際化
  REPORT-2354 验收bug修复(主要修改设计器和平台登录同步)
master
superman 8 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. 40
      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.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.plugin.manage.bbs.BBSUserInfo;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -236,7 +238,8 @@ public class UserInfoLabel extends UILabel {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
userName = DesignerEnvManager.getEnvManager().getBBSName(); BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo();
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);
@ -262,6 +265,7 @@ 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();
UserLoginContext.fireLoginContextListener(); 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.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.extra.LoginWebBridge;
import com.fr.design.mainframe.DesignerContext; 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;
@ -168,6 +169,8 @@ 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);

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

@ -1,8 +1,8 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.extra.exe.callback.*; import com.fr.design.extra.exe.callback.*;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
@ -33,15 +33,8 @@ public class PluginOperateUtils {
public static void installPluginOnline(final PluginMarker pluginMarker, JSCallback jsCallback) { public static void installPluginOnline(final PluginMarker pluginMarker, JSCallback jsCallback) {
//下载插件 //下载插件
if (!BBSPluginLogin.getInstance().hasLogin()) {
UserLoginContext.fireLoginContextListener();
}
if (BBSPluginLogin.getInstance().hasLogin()) {
PluginTask pluginTask = PluginTask.installTask(pluginMarker); PluginTask pluginTask = PluginTask.installTask(pluginMarker);
PluginControllerHelper.installOnline(pluginMarker, new InstallOnlineCallback(pluginTask, jsCallback)); PluginControllerHelper.installOnline(pluginMarker, new InstallOnlineCallback(pluginTask, jsCallback));
}else{
jsCallback.execute("success");
}
} }
public static void installPluginFromDisk(File zipFile, JSCallback jsCallback) { public static void installPluginFromDisk(File zipFile, JSCallback jsCallback) {
@ -50,15 +43,10 @@ public class PluginOperateUtils {
public static void updatePluginOnline(List<PluginMarker> pluginMarkerList, JSCallback jsCallback) { 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++) { for (int i = 0; i < pluginMarkerList.size(); i++) {
updatePluginOnline(pluginMarkerList.get(i), jsCallback); updatePluginOnline(pluginMarkerList.get(i), jsCallback);
} }
} }
}
public static void updatePluginOnline(PluginMarker pluginMarker, JSCallback jsCallback) { public static void updatePluginOnline(PluginMarker pluginMarker, JSCallback jsCallback) {
try { try {
@ -76,8 +64,8 @@ public class PluginOperateUtils {
} }
public static void updatePluginFromDisk(final String filePath, JSCallback jsCallback) { public static void updatePluginFromDisk(File zipFile, JSCallback jsCallback) {
PluginManager.getController().update(new File(filePath), new UpdateFromDiskCallback(new File(filePath), jsCallback)); PluginManager.getController().update(zipFile, new UpdateFromDiskCallback(zipFile, jsCallback));
} }
@ -101,7 +89,7 @@ public class PluginOperateUtils {
public void run() { public void run() {
int rv = JOptionPane.showConfirmDialog( int rv = JOptionPane.showConfirmDialog(
null, null,
Inter.getLocText("FR-Designer-Plugin_Delete_Confirmed"), Inter.getLocText("FR-Plugin_Delete_Confirmed"),
Inter.getLocText("FR-Designer-Plugin_Warning"), Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION, JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE JOptionPane.INFORMATION_MESSAGE
@ -271,22 +259,16 @@ public class PluginOperateUtils {
}).start(); }).start();
} }
public static void getLoginInfo(JSCallback jsCallback) { public static void getLoginInfo(JSCallback jsCallback, UILabel uiLabel) {
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));
}
}
BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo(); BBSUserInfo bbsUserInfo = BBSPluginLogin.getInstance().getUserInfo();
String username = bbsUserInfo == null ? "" : bbsUserInfo.getUserName(); String username = bbsUserInfo == null ? "" : bbsUserInfo.getUserName();
String inShowUsername = DesignerEnvManager.getEnvManager().getInShowBBsName();
if (StringUtils.isEmpty(username) && StringUtils.isEmpty(inShowUsername)) { if (StringUtils.isEmpty(username)) {
return; jsCallback.execute("");
uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn"));
} else { } else {
String result = StringUtils.isEmpty(inShowUsername) ? username : inShowUsername; uiLabel.setText(username);
String result = username;
jsCallback.execute(result); 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.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;
@ -196,7 +198,8 @@ public class PluginWebBridge {
*/ */
public void updatePluginFromDisk(String filePath, final JSObject callback) { public void updatePluginFromDisk(String filePath, final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, 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 * @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); 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() { public static void createPluginDialog() {
if (StableUtils.getMajorJavaVersion() >= VERSION_8) { if (StableUtils.getMajorJavaVersion() >= VERSION_8) {
String relativePath = "/scripts/store/web/index.html"; 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); File file = new File(mainJsPath);
if (!file.exists()) { if (!file.exists()) {
int rv = JOptionPane.showConfirmDialog( int rv = JOptionPane.showConfirmDialog(
@ -54,7 +54,7 @@ public class WebViewDlgHelper {
} }
} else { } else {
String indexPath = "index.html"; String indexPath = "index.html";
String mainIndexPath = StableUtils.pathJoin(FRContext.getCurrentEnv().getWebReportPath(), indexPath); String mainIndexPath = StableUtils.pathJoin(installHome, indexPath);
checkAndCopyMainFile(mainIndexPath, mainJsPath); checkAndCopyMainFile(mainIndexPath, mainJsPath);
updateShopScripts(SHOP_SCRIPTS); updateShopScripts(SHOP_SCRIPTS);
showPluginDlg(mainIndexPath); showPluginDlg(mainIndexPath);
@ -144,7 +144,7 @@ public class WebViewDlgHelper {
} }
private static void showLoginDlg() { private static void showLoginDlg() {
LoginWebPane webPane = new LoginWebPane(FRContext.getCurrentEnv().getWebReportPath()); LoginWebPane webPane = new LoginWebPane(installHome);
UIDialog qqdlg = new LoginDialog(DesignerContext.getDesignerFrame(), webPane); UIDialog qqdlg = new LoginDialog(DesignerContext.getDesignerFrame(), webPane);
LoginWebBridge.getHelper().setDialogHandle(qqdlg); LoginWebBridge.getHelper().setDialogHandle(qqdlg);
qqdlg.setVisible(true); qqdlg.setVisible(true);
@ -186,7 +186,7 @@ public class WebViewDlgHelper {
try { try {
if (get()) { 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 // TODO: 2017/4/17 删除之前存放在安装目录下的script
int rv = JOptionPane.showOptionDialog( int rv = JOptionPane.showOptionDialog(
null, 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) { if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
return; return;
} }
PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback); PluginOperateUtils.updatePluginFromDisk(zipFile, jsCallback);
}else { }else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FRLogger.getLogger().info(Inter.getLocText("FR-Plugin_Install_Failed")); FRLogger.getLogger().info(Inter.getLocText("FR-Plugin_Install_Failed"));

Loading…
Cancel
Save