From 43e7113f7e02dd79b392e68d0ef8f8f775a896e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=94=80?= Date: Mon, 22 Aug 2016 21:07:16 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E7=99=BB=E5=BD=95=E7=9A=84=E9=80=80?= =?UTF-8?q?=E5=87=BA=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9=EF=BC=8C=E8=BF=98?= =?UTF-8?q?=E6=9C=89=E5=BC=B9=E5=87=BA=E7=9A=84=E9=A1=B5=E9=9D=A2=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/bbs/LoginDialog.java | 2 +- .../design/mainframe/bbs/UserInfoLabel.java | 21 +++++++++++-------- .../src/com/fr/design/extra/LoginPane.java | 13 ++++++++++-- .../com/fr/design/extra/LoginWebBridge.java | 4 ++-- .../src/com/fr/design/extra/LoginWebPane.java | 2 +- .../com/fr/design/extra/QQLoginWebBridge.java | 8 ++++++- .../com/fr/design/extra/QQLoginWebPane.java | 2 +- .../extra/exe/GetLoginInfoExecutor.java | 4 ++-- 8 files changed, 37 insertions(+), 19 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/bbs/LoginDialog.java b/designer/src/com/fr/design/mainframe/bbs/LoginDialog.java index 1d1926bf9e..b5fe200ea1 100644 --- a/designer/src/com/fr/design/mainframe/bbs/LoginDialog.java +++ b/designer/src/com/fr/design/mainframe/bbs/LoginDialog.java @@ -15,7 +15,7 @@ import java.awt.*; * Created by zhaohehe on 16/7/26. */ 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) { super(frame); diff --git a/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java b/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java index a2e0946c53..7be5f1fc27 100644 --- a/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java +++ b/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java @@ -54,7 +54,7 @@ public class UserInfoLabel extends UILabel{ private UserInfoPane userInfoPane; private BBSLoginDialog bbsLoginDialog; - + public UserInfoPane getUserInfoPane() { return userInfoPane; } @@ -101,9 +101,19 @@ public class UserInfoLabel extends UILabel{ LoginWebBridge.getHelper().setUILabel(UserInfoLabel.this); QQLoginWebBridge.getHelper().setLoginlabel(); 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()){ return; } - String lastBBSNewsTime = DesignerEnvManager.getEnvManager().getLastShowBBSNewsTime(); - try { String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); if (ComparatorUtils.equals(lastBBSNewsTime, today)) { @@ -129,25 +137,20 @@ public class UserInfoLabel extends UILabel{ } catch (InterruptedException e) { FRContext.getLogger().error(e.getMessage()); } - HttpClient hc = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("bbs.popup")); if (!hc.isServerAlive()){ return; } - String res = hc.getResponseText(); if (res.indexOf(BBSConstants.UPDATE_KEY) == -1){ return; } - try { BBSDialog bbsLabel = new BBSDialog(DesignerContext.getDesignerFrame()); bbsLabel.showWindow(SiteCenter.getInstance().acquireUrlByKind("bbs.popup")); DesignerEnvManager.getEnvManager().setLastShowBBSNewsTime(DateUtils.DATEFORMAT2.format(new Date())); } catch (Throwable e) { - } - } }); showBBSThread.start(); @@ -259,6 +262,7 @@ public class UserInfoLabel extends UILabel{ @Override public void mouseClicked(MouseEvent e) { + userName = DesignerEnvManager.getEnvManager().getBBSName(); if(StringUtils.isNotEmpty(userName)) { UIPopupMenu menu = new UIPopupMenu(); menu.setOnlyText(true); @@ -295,5 +299,4 @@ public class UserInfoLabel extends UILabel{ } } }; - } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/extra/LoginPane.java b/designer_base/src/com/fr/design/extra/LoginPane.java index c8c231b24b..41a2ce8ce4 100644 --- a/designer_base/src/com/fr/design/extra/LoginPane.java +++ b/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.RestartHelper; import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.frpane.UITabbedPane; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; import com.fr.general.Inter; @@ -53,6 +54,7 @@ public class LoginPane extends BasicPane { } } } else { + initTraditionalStore(); } } @@ -91,7 +93,6 @@ public class LoginPane extends BasicPane { @Override protected void done() { - try { if (get()) { 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) { FRContext.getLogger().error(e.getMessage(), e); } - } }.execute(); } @@ -140,4 +140,13 @@ public class LoginPane extends BasicPane { } }.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)); + } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/extra/LoginWebBridge.java b/designer_base/src/com/fr/design/extra/LoginWebBridge.java index 5149676937..855ed447ad 100644 --- a/designer_base/src/com/fr/design/extra/LoginWebBridge.java +++ b/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 LOGIN_INFO_EMPTY = "-1"; 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 com.fr.design.extra.LoginWebBridge helper; @@ -115,7 +115,7 @@ public class LoginWebBridge { loginSuccess(username); return LOGININ; }else { - return UNKNOWN_ERROR; + return LOGININFO_ERROR; } } diff --git a/designer_base/src/com/fr/design/extra/LoginWebPane.java b/designer_base/src/com/fr/design/extra/LoginWebPane.java index f31889c28c..b49db6ace7 100644 --- a/designer_base/src/com/fr/design/extra/LoginWebPane.java +++ b/designer_base/src/com/fr/design/extra/LoginWebPane.java @@ -31,7 +31,7 @@ public class LoginWebPane extends JFXPanel { LoginWebPane.this.setScene(scene); WebView webView = new WebView(); 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>() { @Override public void handle(WebEvent event) { diff --git a/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java b/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java index a038d56ce0..f566d2e696 100644 --- a/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java @@ -7,6 +7,8 @@ import javafx.scene.web.WebEngine; import org.json.JSONObject; import javax.swing.*; +import java.awt.*; +import java.net.URI; /** * Created by lp on 2016/8/10. @@ -17,6 +19,7 @@ public class QQLoginWebBridge { private WebEngine webEngine; private static String LOGINSUCCESS = "ok"; private static String LOGINFAILED = "failed"; + private static String BBS_URL = "http://bbs.fanruan.com"; private UIDialog uiDialog; private UILabel uiLabel; private UIDialog qqDialog; @@ -99,7 +102,10 @@ public class QQLoginWebBridge { DesignerEnvManager.getEnvManager().setBBSName(username); }else if (status.equals(LOGINFAILED)){ //账号没有QQ授权 - closeQQWindow(); + try { + Desktop.getDesktop().browse(new URI(BBS_URL)); + }catch (Exception exp) { + } } } } diff --git a/designer_base/src/com/fr/design/extra/QQLoginWebPane.java b/designer_base/src/com/fr/design/extra/QQLoginWebPane.java index 9644f06663..229e92f12b 100644 --- a/designer_base/src/com/fr/design/extra/QQLoginWebPane.java +++ b/designer_base/src/com/fr/design/extra/QQLoginWebPane.java @@ -29,7 +29,7 @@ public class QQLoginWebPane extends JFXPanel { QQLoginWebPane.this.setScene(scene); WebView webView = new WebView(); 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>() { @Override public void handle(WebEvent event) { diff --git a/designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java b/designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java index 79fb20dce5..52211c757f 100644 --- a/designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java +++ b/designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java @@ -26,7 +26,7 @@ public class GetLoginInfoExecutor implements Executor { @Override public void run(Process process) { String username = DesignerEnvManager.getEnvManager().getBBSName(); - if (username == null) { + if (username == null || username.equals("")) { }else { result = username; } @@ -34,4 +34,4 @@ public class GetLoginInfoExecutor implements Executor { } }; } -} +} \ No newline at end of file From bfdab077d8edeaa0852f223f161d017c2e07abe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=94=80?= Date: Mon, 22 Aug 2016 21:12:21 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=85=B3=E9=97=AD=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关闭窗口 --- designer_base/src/com/fr/design/extra/QQLoginWebBridge.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java b/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java index f566d2e696..d37b2fea18 100644 --- a/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java @@ -102,6 +102,7 @@ public class QQLoginWebBridge { DesignerEnvManager.getEnvManager().setBBSName(username); }else if (status.equals(LOGINFAILED)){ //账号没有QQ授权 + closeQQWindow(); try { Desktop.getDesktop().browse(new URI(BBS_URL)); }catch (Exception exp) { From c772852a9c08a2e18121589833a7926ed89eab69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=94=80?= Date: Tue, 30 Aug 2016 17:44:32 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/extra/QQLoginWebBridge.java | 4 ++-- .../src/com/fr/design/extra/exe/GetLoginInfoExecutor.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java b/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java index d37b2fea18..3ee043493f 100644 --- a/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java @@ -3,6 +3,7 @@ package com.fr.design.extra; import com.fr.design.DesignerEnvManager; import com.fr.design.dialog.UIDialog; import com.fr.design.gui.ilable.UILabel; +import com.fr.general.SiteCenter; import javafx.scene.web.WebEngine; import org.json.JSONObject; @@ -19,7 +20,6 @@ public class QQLoginWebBridge { private WebEngine webEngine; private static String LOGINSUCCESS = "ok"; private static String LOGINFAILED = "failed"; - private static String BBS_URL = "http://bbs.fanruan.com"; private UIDialog uiDialog; private UILabel uiLabel; private UIDialog qqDialog; @@ -104,7 +104,7 @@ public class QQLoginWebBridge { //账号没有QQ授权 closeQQWindow(); try { - Desktop.getDesktop().browse(new URI(BBS_URL)); + Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.default"))); }catch (Exception exp) { } } diff --git a/designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java b/designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java index 52211c757f..a7649be645 100644 --- a/designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java +++ b/designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java @@ -26,7 +26,7 @@ public class GetLoginInfoExecutor implements Executor { @Override public void run(Process process) { String username = DesignerEnvManager.getEnvManager().getBBSName(); - if (username == null || username.equals("")) { + if (username == null || username.isEmpty()) { }else { result = username; } From 0f670e4abaf89635519e345a021be06fc50f63c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=94=80?= Date: Wed, 31 Aug 2016 13:31:26 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/extra/exe/GetLoginInfoExecutor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java b/designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java index a7649be645..c3d03daa76 100644 --- a/designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java +++ b/designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java @@ -26,7 +26,7 @@ public class GetLoginInfoExecutor implements Executor { @Override public void run(Process process) { String username = DesignerEnvManager.getEnvManager().getBBSName(); - if (username == null || username.isEmpty()) { + if (username.isEmpty()) { }else { result = username; } From 169782b7b185cfac24eb29888b3814de0502ccac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=94=80?= Date: Wed, 31 Aug 2016 14:10:51 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/extra/exe/GetLoginInfoExecutor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java b/designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java index c3d03daa76..6258d02331 100644 --- a/designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java +++ b/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.extra.Process; +import com.fr.stable.StringUtils; /** * Created by lp on 2016/8/16. @@ -26,7 +27,7 @@ public class GetLoginInfoExecutor implements Executor { @Override public void run(Process process) { String username = DesignerEnvManager.getEnvManager().getBBSName(); - if (username.isEmpty()) { + if (StringUtils.isEmpty(username)) { }else { result = username; }