Browse Source

Merge pull request #298 in BA/design from ~LEE/design:dev to dev

* commit '169782b7b185cfac24eb29888b3814de0502ccac':
  修复
  修改
  格式修改
  关闭窗口
  登录的退出逻辑修改,还有弹出的页面大小修改
master
superman 8 years ago
parent
commit
c61ac43a4a
  1. 2
      designer/src/com/fr/design/mainframe/bbs/LoginDialog.java
  2. 21
      designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java
  3. 13
      designer_base/src/com/fr/design/extra/LoginPane.java
  4. 4
      designer_base/src/com/fr/design/extra/LoginWebBridge.java
  5. 2
      designer_base/src/com/fr/design/extra/LoginWebPane.java
  6. 7
      designer_base/src/com/fr/design/extra/QQLoginWebBridge.java
  7. 2
      designer_base/src/com/fr/design/extra/QQLoginWebPane.java
  8. 5
      designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java

2
designer/src/com/fr/design/mainframe/bbs/LoginDialog.java

@ -15,7 +15,7 @@ import java.awt.*;
* Created by zhaohehe on 16/7/26. * Created by zhaohehe on 16/7/26.
*/ */
public class LoginDialog extends UIDialog { public class LoginDialog extends UIDialog {
private static final Dimension DEFAULT_SHOP = new Dimension(404, 234); private static final Dimension DEFAULT_SHOP = new Dimension(404, 204);
public LoginDialog(Frame frame, BasicPane pane) { public LoginDialog(Frame frame, BasicPane pane) {
super(frame); super(frame);

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

@ -54,7 +54,7 @@ public class UserInfoLabel extends UILabel{
private UserInfoPane userInfoPane; private UserInfoPane userInfoPane;
private BBSLoginDialog bbsLoginDialog; private BBSLoginDialog bbsLoginDialog;
public UserInfoPane getUserInfoPane() { public UserInfoPane getUserInfoPane() {
return userInfoPane; return userInfoPane;
} }
@ -101,9 +101,19 @@ public class UserInfoLabel extends UILabel{
LoginWebBridge.getHelper().setUILabel(UserInfoLabel.this); LoginWebBridge.getHelper().setUILabel(UserInfoLabel.this);
QQLoginWebBridge.getHelper().setLoginlabel(); QQLoginWebBridge.getHelper().setLoginlabel();
qqdlg.setVisible(true); qqdlg.setVisible(true);
clearLoingInformation();
updateInfoPane();
} }
}); });
}
private void clearLoingInformation(){
DesignerEnvManager.getEnvManager().setBBSName(StringUtils.EMPTY);
DesignerEnvManager.getEnvManager().setBBSPassword(StringUtils.EMPTY);
}
private void updateInfoPane(){
userInfoPane.markUnSignIn();
} }
/** /**
@ -117,9 +127,7 @@ public class UserInfoLabel extends UILabel{
if(!FRContext.isChineseEnv()){ if(!FRContext.isChineseEnv()){
return; return;
} }
String lastBBSNewsTime = DesignerEnvManager.getEnvManager().getLastShowBBSNewsTime(); String lastBBSNewsTime = DesignerEnvManager.getEnvManager().getLastShowBBSNewsTime();
try { try {
String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
if (ComparatorUtils.equals(lastBBSNewsTime, today)) { if (ComparatorUtils.equals(lastBBSNewsTime, today)) {
@ -129,25 +137,20 @@ public class UserInfoLabel extends UILabel{
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRContext.getLogger().error(e.getMessage()); FRContext.getLogger().error(e.getMessage());
} }
HttpClient hc = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("bbs.popup")); HttpClient hc = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("bbs.popup"));
if (!hc.isServerAlive()){ if (!hc.isServerAlive()){
return; return;
} }
String res = hc.getResponseText(); String res = hc.getResponseText();
if (res.indexOf(BBSConstants.UPDATE_KEY) == -1){ if (res.indexOf(BBSConstants.UPDATE_KEY) == -1){
return; return;
} }
try { try {
BBSDialog bbsLabel = new BBSDialog(DesignerContext.getDesignerFrame()); BBSDialog bbsLabel = new BBSDialog(DesignerContext.getDesignerFrame());
bbsLabel.showWindow(SiteCenter.getInstance().acquireUrlByKind("bbs.popup")); bbsLabel.showWindow(SiteCenter.getInstance().acquireUrlByKind("bbs.popup"));
DesignerEnvManager.getEnvManager().setLastShowBBSNewsTime(DateUtils.DATEFORMAT2.format(new Date())); DesignerEnvManager.getEnvManager().setLastShowBBSNewsTime(DateUtils.DATEFORMAT2.format(new Date()));
} catch (Throwable e) { } catch (Throwable e) {
} }
} }
}); });
showBBSThread.start(); showBBSThread.start();
@ -259,6 +262,7 @@ public class UserInfoLabel extends UILabel{
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
userName = DesignerEnvManager.getEnvManager().getBBSName();
if(StringUtils.isNotEmpty(userName)) { if(StringUtils.isNotEmpty(userName)) {
UIPopupMenu menu = new UIPopupMenu(); UIPopupMenu menu = new UIPopupMenu();
menu.setOnlyText(true); menu.setOnlyText(true);
@ -295,5 +299,4 @@ public class UserInfoLabel extends UILabel{
} }
} }
}; };
} }

13
designer_base/src/com/fr/design/extra/LoginPane.java

@ -4,6 +4,7 @@ import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -53,6 +54,7 @@ public class LoginPane extends BasicPane {
} }
} }
} else { } else {
initTraditionalStore();
} }
} }
@ -91,7 +93,6 @@ public class LoginPane extends BasicPane {
@Override @Override
protected void done() { protected void done() {
try { try {
if (get()) { if (get()) {
IOUtils.unzip(new File(StableUtils.pathJoin(PluginHelper.DOWNLOAD_PATH, PluginHelper.TEMP_FILE)), StableUtils.getInstallHome()); IOUtils.unzip(new File(StableUtils.pathJoin(PluginHelper.DOWNLOAD_PATH, PluginHelper.TEMP_FILE)), StableUtils.getInstallHome());
@ -112,7 +113,6 @@ public class LoginPane extends BasicPane {
} catch (InterruptedException | ExecutionException e) { } catch (InterruptedException | ExecutionException e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
} }
} }
}.execute(); }.execute();
} }
@ -140,4 +140,13 @@ public class LoginPane extends BasicPane {
} }
}.execute(); }.execute();
} }
private void initTraditionalStore() {
UITabbedPane tabbedPane = new UITabbedPane();
add(tabbedPane, BorderLayout.CENTER);
PluginInstalledPane installedPane = new PluginInstalledPane();
tabbedPane.addTab(installedPane.tabTitle(), installedPane);
tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_Update"), new PluginUpdatePane(tabbedPane));
tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_All_Plugins"), new PluginFromStorePane(tabbedPane));
}
} }

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

@ -28,7 +28,7 @@ public class LoginWebBridge {
private static final String LOGININ = "0"; private static final String LOGININ = "0";
private static final String LOGIN_INFO_EMPTY = "-1"; private static final String LOGIN_INFO_EMPTY = "-1";
private static final String DISCONNECTED = "-2"; private static final String DISCONNECTED = "-2";
private static final String UNKNOWN_ERROR = "-3"; private static final String LOGININFO_ERROR = "-3";
private static final int TIME_OUT = 10000; private static final int TIME_OUT = 10000;
private static com.fr.design.extra.LoginWebBridge helper; private static com.fr.design.extra.LoginWebBridge helper;
@ -115,7 +115,7 @@ public class LoginWebBridge {
loginSuccess(username); loginSuccess(username);
return LOGININ; return LOGININ;
}else { }else {
return UNKNOWN_ERROR; return LOGININFO_ERROR;
} }
} }

2
designer_base/src/com/fr/design/extra/LoginWebPane.java

@ -31,7 +31,7 @@ public class LoginWebPane extends JFXPanel {
LoginWebPane.this.setScene(scene); LoginWebPane.this.setScene(scene);
WebView webView = new WebView(); WebView webView = new WebView();
webEngine = webView.getEngine(); webEngine = webView.getEngine();
webEngine.load("file:///" + installHome + "/scripts/store/web/login.html"); webEngine.load("file:///" + installHome + "/scripts/qqLogin/web/login.html");
webEngine.setOnAlert(new EventHandler<WebEvent<String>>() { webEngine.setOnAlert(new EventHandler<WebEvent<String>>() {
@Override @Override
public void handle(WebEvent<String> event) { public void handle(WebEvent<String> event) {

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

@ -3,10 +3,13 @@ package com.fr.design.extra;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.general.SiteCenter;
import javafx.scene.web.WebEngine; import javafx.scene.web.WebEngine;
import org.json.JSONObject; import org.json.JSONObject;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
import java.net.URI;
/** /**
* Created by lp on 2016/8/10. * Created by lp on 2016/8/10.
@ -100,6 +103,10 @@ public class QQLoginWebBridge {
}else if (status.equals(LOGINFAILED)){ }else if (status.equals(LOGINFAILED)){
//账号没有QQ授权 //账号没有QQ授权
closeQQWindow(); closeQQWindow();
try {
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.default")));
}catch (Exception exp) {
}
} }
} }
} }

2
designer_base/src/com/fr/design/extra/QQLoginWebPane.java

@ -29,7 +29,7 @@ public class QQLoginWebPane extends JFXPanel {
QQLoginWebPane.this.setScene(scene); QQLoginWebPane.this.setScene(scene);
WebView webView = new WebView(); WebView webView = new WebView();
webEngine = webView.getEngine(); webEngine = webView.getEngine();
webEngine.load("file:///" + installHome + "/scripts/store/web/qqLogin.html"); webEngine.load("file:///" + installHome + "/scripts/qqLogin/web/qqLogin.html");
webEngine.setOnAlert(new EventHandler<WebEvent<String>>() { webEngine.setOnAlert(new EventHandler<WebEvent<String>>() {
@Override @Override
public void handle(WebEvent<String> event) { public void handle(WebEvent<String> event) {

5
designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java

@ -2,6 +2,7 @@ package com.fr.design.extra.exe;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.extra.Process; import com.fr.design.extra.Process;
import com.fr.stable.StringUtils;
/** /**
* Created by lp on 2016/8/16. * Created by lp on 2016/8/16.
@ -26,7 +27,7 @@ public class GetLoginInfoExecutor implements Executor {
@Override @Override
public void run(Process<String> process) { public void run(Process<String> process) {
String username = DesignerEnvManager.getEnvManager().getBBSName(); String username = DesignerEnvManager.getEnvManager().getBBSName();
if (username == null) { if (StringUtils.isEmpty(username)) {
}else { }else {
result = username; result = username;
} }
@ -34,4 +35,4 @@ public class GetLoginInfoExecutor implements Executor {
} }
}; };
} }
} }
Loading…
Cancel
Save