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 01/10] =?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 02/10] =?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 03/10] =?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 04/10] =?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 05/10] =?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; } From 4ecfc1c9269ac4b7383d614327b77db3ca743931 Mon Sep 17 00:00:00 2001 From: richie Date: Wed, 31 Aug 2016 15:57:02 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E6=9F=90=E4=BA=9B=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=BC=80=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/toolbar/ToolBarMenuDock.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index d0177d4046..b04e1e5b12 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -284,7 +284,7 @@ public abstract class ToolBarMenuDock { return processor == null ? new GlobalTableDataAction() : processor.createServerTDAction(); } - private boolean shouldShowPlugin() { + protected boolean shouldShowPlugin() { return FRContext.isChineseEnv() || ComparatorUtils.equals(GeneralContext.getLocale(), Locale.TAIWAN); } @@ -326,7 +326,8 @@ public abstract class ToolBarMenuDock { shortCuts.add(new SignAction()); return shortCuts.toArray(new ShortCut[shortCuts.size()]); } - private MenuDef createHelpMenuDef() { + + public MenuDef createHelpMenuDef() { MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_Help"), 'H'); ShortCut[] otherHelpShortCuts = createHelpShortCuts(); for (ShortCut shortCut : otherHelpShortCuts) { @@ -335,7 +336,8 @@ public abstract class ToolBarMenuDock { insertMenu(menuDef, MenuHandler.HELP); return menuDef; } - private MenuDef createCommunityMenuDef() { + + public MenuDef createCommunityMenuDef() { MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_COMMUNITY"), 'C'); ShortCut[] otherCommunityShortCuts = createCommunityShortCuts(); for (ShortCut shortCut : otherCommunityShortCuts) { From 0d2ad4464118aac3cba767c58dce7fa532f8f0ee Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 1 Sep 2016 10:54:08 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E5=A1=AB=E6=8A=A5=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=94=AF=E6=8C=81=E5=85=AC=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E6=8A=8A=E5=89=8D=E9=9D=A2=E7=9A=84=E6=9D=A1=E4=BB=B6=E6=A1=86?= =?UTF-8?q?=E4=B9=9F=E6=94=B9=E6=88=90=E5=85=AC=E5=BC=8F=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/report/ValueVerifierEditPane.java | 11 ++- .../UIArrayFormulaTableModel.java | 68 +++++++++++++++++++ 2 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 designer_base/src/com/fr/design/gui/itableeditorpane/UIArrayFormulaTableModel.java diff --git a/designer/src/com/fr/design/report/ValueVerifierEditPane.java b/designer/src/com/fr/design/report/ValueVerifierEditPane.java index ebbc9901b5..0490ea7829 100644 --- a/designer/src/com/fr/design/report/ValueVerifierEditPane.java +++ b/designer/src/com/fr/design/report/ValueVerifierEditPane.java @@ -3,13 +3,14 @@ package com.fr.design.report; import com.fr.base.Formula; import com.fr.data.VerifyItem; import com.fr.design.gui.itableeditorpane.ActionStyle; -import com.fr.design.gui.itableeditorpane.UIArrayTableModel; +import com.fr.design.gui.itableeditorpane.UIArrayFormulaTableModel; import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.GeneralUtils; import com.fr.general.Inter; import com.fr.report.write.ValueVerifier; import com.fr.stable.FormulaProvider; +import com.fr.stable.StableUtils; import javax.swing.*; import java.awt.*; @@ -23,7 +24,7 @@ public class ValueVerifierEditPane extends JPanel { public ValueVerifierEditPane() { // ben:UITableEditorPane; this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); - tableEditorPane = new UITableEditorPane(new UIArrayTableModel(columnNames, new int[] { + tableEditorPane = new UITableEditorPane(new UIArrayFormulaTableModel(columnNames, new int[] { ActionStyle.ADDSTYLE, ActionStyle.DELETESTYLE, ActionStyle.MOVEUPSTYLE, ActionStyle.MOVEDOWNSTYLE})); this.add(tableEditorPane, BorderLayout.CENTER); @@ -45,7 +46,11 @@ public class ValueVerifierEditPane extends JPanel { if (formula == null) { continue; } - os[tableDataCount++] = new Object[]{formula.getPureContent(), item.getMessage()}; + String msg = item.getMessage(); + if (!StableUtils.canBeFormula(msg)) { + msg = "\"" + msg + "\""; + } + os[tableDataCount++] = new Object[]{formula, new Formula(msg)}; } this.tableEditorPane.populate(os); } diff --git a/designer_base/src/com/fr/design/gui/itableeditorpane/UIArrayFormulaTableModel.java b/designer_base/src/com/fr/design/gui/itableeditorpane/UIArrayFormulaTableModel.java new file mode 100644 index 0000000000..a3106b2711 --- /dev/null +++ b/designer_base/src/com/fr/design/gui/itableeditorpane/UIArrayFormulaTableModel.java @@ -0,0 +1,68 @@ +package com.fr.design.gui.itableeditorpane; + +import com.fr.design.editor.ValueEditorPane; +import com.fr.design.editor.ValueEditorPaneFactory; + +import javax.swing.*; +import javax.swing.event.CellEditorListener; +import javax.swing.event.ChangeEvent; +import javax.swing.table.TableCellEditor; +import java.awt.*; + +/** + * 全部是公式编辑的model + * Coder: zack + * Date: 2016/8/31 + * Time: 18:58 + */ +public class UIArrayFormulaTableModel extends UIArrayTableModel { + public UIArrayFormulaTableModel(String[] s, int[] array) { + super(s, array); + setDefaultEditors(); + } + + public void setDefaultEditors() { + for (int i = 0; i < getColumnCount(); i++) { + setDefaultEditor(Object.class, new FormulaValueEditor()); + } + } + + private class FormulaValueEditor extends AbstractCellEditor implements TableCellEditor { + private static final long serialVersionUID = 1L; + private ValueEditorPane editor; + + public FormulaValueEditor() { + + editor = ValueEditorPaneFactory.createFormulaValueEditorPane(); + + this.addCellEditorListener(new CellEditorListener() { + + @Override + public void editingCanceled(ChangeEvent e) { + } + + @Override + public void editingStopped(ChangeEvent e) { + if (table.getSelectedRow() == -1 || table.getSelectedColumn() == -1) { + return; + } + Object[] para = getList().get(table.getSelectedRow()); + para[table.getSelectedColumn()] = getCellEditorValue(); + fireTableDataChanged(); + } + }); + } + + @Override + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + editor.clearComponentsData(); + editor.populate(value == null ? "" : value); + return editor; + } + + @Override + public Object getCellEditorValue() { + return editor.update(); + } + } +} From 7ad696659067d15b56b18d2ea9789cee1c0b755f Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 1 Sep 2016 10:58:55 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E8=A1=A5=E4=B8=AA=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/design/report/ValueVerifierEditPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer/src/com/fr/design/report/ValueVerifierEditPane.java b/designer/src/com/fr/design/report/ValueVerifierEditPane.java index 0490ea7829..f3ebda61a5 100644 --- a/designer/src/com/fr/design/report/ValueVerifierEditPane.java +++ b/designer/src/com/fr/design/report/ValueVerifierEditPane.java @@ -48,7 +48,7 @@ public class ValueVerifierEditPane extends JPanel { } String msg = item.getMessage(); if (!StableUtils.canBeFormula(msg)) { - msg = "\"" + msg + "\""; + msg = "\"" + msg + "\"";//如果报错信息是以前的写法(字符串)就拼上"" } os[tableDataCount++] = new Object[]{formula, new Formula(msg)}; } From e920c7757a2d14b77a8db494453a58ebb877e84f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=94=80?= Date: Thu, 1 Sep 2016 21:39:13 +0800 Subject: [PATCH 09/10] =?UTF-8?q?bugfix=EF=BC=9AQQ=E6=8E=88=E6=9D=83?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=B6=85=E9=93=BE=E9=97=AE=E9=A2=98=EF=BC=9B?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86=E5=86=85=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.现在改成捕捉授权部分,强制关闭当前窗口,且在浏览器上面给一个新的url地址处理。 2.之前的处理方案可能是webview的一个bug,现在完全改成html处理,把之前用到的也尽可能的移植过来。 --- .../design/mainframe/bbs/UserInfoLabel.java | 7 +- .../com/fr/design/extra/LoginWebBridge.java | 20 ++++++ .../com/fr/design/extra/PluginWebBridge.java | 67 +++++++++++++++++-- .../com/fr/design/extra/QQLoginWebBridge.java | 34 +++++++++- .../com/fr/design/extra/QQLoginWebPane.java | 32 +++++++++ 5 files changed, 153 insertions(+), 7 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java b/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java index 7be5f1fc27..727539d889 100644 --- a/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java +++ b/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java @@ -92,6 +92,9 @@ public class UserInfoLabel extends UILabel{ } }); + PluginWebBridge.getHelper().setUILabel(UserInfoLabel.this); + QQLoginWebBridge.getHelper().setUILabelInPlugin(UserInfoLabel.this); + UserLoginContext.addLoginContextListener(new LoginContextListener() { @Override public void showLoginContext() { @@ -101,13 +104,13 @@ public class UserInfoLabel extends UILabel{ LoginWebBridge.getHelper().setUILabel(UserInfoLabel.this); QQLoginWebBridge.getHelper().setLoginlabel(); qqdlg.setVisible(true); - clearLoingInformation(); + clearLoginInformation(); updateInfoPane(); } }); } - private void clearLoingInformation(){ + private void clearLoginInformation(){ DesignerEnvManager.getEnvManager().setBBSName(StringUtils.EMPTY); DesignerEnvManager.getEnvManager().setBBSPassword(StringUtils.EMPTY); } diff --git a/designer_base/src/com/fr/design/extra/LoginWebBridge.java b/designer_base/src/com/fr/design/extra/LoginWebBridge.java index 855ed447ad..9546dbc41b 100644 --- a/designer_base/src/com/fr/design/extra/LoginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/LoginWebBridge.java @@ -119,6 +119,25 @@ public class LoginWebBridge { } } + /* + 插件管理那边的登录 + */ + public String pluginManageLogin(String username, String password, UILabel uiLabel) { + if (!StringUtils.isNotBlank(username) && !StringUtils.isNotBlank(password)) { + return LOGIN_INFO_EMPTY; + } + if (!testConnection()) { + return DISCONNECTED; + } + if (login(username, password)) { + updateUserInfo(username, password); + uiLabel.setText(username); + return LOGININ; + }else { + return LOGININFO_ERROR; + } + } + /** * 关闭窗口 */ @@ -126,6 +145,7 @@ public class LoginWebBridge { if (uiDialog != null) { uiDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); uiDialog.setVisible(false); + uiDialog.dispose(); } } diff --git a/designer_base/src/com/fr/design/extra/PluginWebBridge.java b/designer_base/src/com/fr/design/extra/PluginWebBridge.java index 82dd4cf356..3dd9f3ee0a 100644 --- a/designer_base/src/com/fr/design/extra/PluginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/PluginWebBridge.java @@ -1,9 +1,11 @@ package com.fr.design.extra; import com.fr.base.FRContext; +import com.fr.design.DesignerEnvManager; import com.fr.design.RestartHelper; import com.fr.design.dialog.UIDialog; import com.fr.design.extra.exe.*; +import com.fr.design.gui.ilable.UILabel; import com.fr.general.FRLogger; import com.fr.general.Inter; import com.fr.general.SiteCenter; @@ -41,6 +43,13 @@ public class PluginWebBridge { private String KEYWORD = "keyword"; private Map config; + private static final String LOGININ = "0"; + private static final String LOGIN_INFO_EMPTY = "-1"; + private static final String DISCONNECTED = "-2"; + private static final String LOGININFO_ERROR = "-3"; + + private UILabel uiLabel; + /** * 动作枚举 */ @@ -394,10 +403,6 @@ public class PluginWebBridge { }); } - public void getUsername() { - - } - /** * 在本地浏览器里打开url * tips:重载的时候,需要给js调用的方法需要放在前面,否则可能不会被调用(此乃坑) @@ -490,4 +495,58 @@ public class PluginWebBridge { JOptionPane.showMessageDialog(null, e1.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); } } + + + /*-------------------------------登录部分的处理----------------------------------*/ + /** + * 注册页面 + */ + public void registerHref() { + try { + Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.default"))); + }catch (Exception e) { + FRContext.getLogger().info(e.getMessage()); + } + } + + /** + * 忘记密码 + */ + public void forgetHref() { + try { + Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.default"))); + }catch (Exception e) { + FRContext.getLogger().info(e.getMessage()); + } + } + + public void setUILabel(UILabel uiLabel) { + this.uiLabel = uiLabel; + } + + /** + * 登录操作的回调 + * @param username + * @param password + * @return + */ + public String defaultLogin(String username, String password) { + return LoginWebBridge.getHelper().pluginManageLogin(username, password, uiLabel); + } + + /** + * 弹出QQ授权页面 + */ + public void showQQ() { + LoginWebBridge.getHelper().showQQ(); + } + + /** + * 清除用户信息 + */ + public void clearUserInfo() { + DesignerEnvManager.getEnvManager().setBBSName(StringUtils.EMPTY); + DesignerEnvManager.getEnvManager().setBBSPassword(StringUtils.EMPTY); + uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn")); + } } diff --git a/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java b/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java index 3ee043493f..b386e836c2 100644 --- a/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java @@ -3,12 +3,14 @@ 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.FRLogger; import com.fr.general.SiteCenter; import javafx.scene.web.WebEngine; import org.json.JSONObject; import javax.swing.*; import java.awt.*; +import java.io.IOException; import java.net.URI; /** @@ -22,6 +24,7 @@ public class QQLoginWebBridge { private static String LOGINFAILED = "failed"; private UIDialog uiDialog; private UILabel uiLabel; + private UILabel pluginuiLabel; private UIDialog qqDialog; private String username; @@ -57,6 +60,10 @@ public class QQLoginWebBridge { this.uiLabel = uiLabel; } + public void setUILabelInPlugin(UILabel uiLabel) { + this.pluginuiLabel = uiLabel; + } + public void setLoginlabel() { username = DesignerEnvManager.getEnvManager().getBBSName(); } @@ -98,7 +105,7 @@ public class QQLoginWebBridge { String username = jo.get("username").toString(); closeQQWindow(); closeParentWindow(); - uiLabel.setText(username); + pluginuiLabel.setText(username); DesignerEnvManager.getEnvManager().setBBSName(username); }else if (status.equals(LOGINFAILED)){ //账号没有QQ授权 @@ -109,4 +116,29 @@ public class QQLoginWebBridge { } } } + + public void openUrlAtLocalWebBrowser(WebEngine eng, String url) { + if (url.indexOf("qqLogin.html") > 0) { + return; + } + if (Desktop.isDesktopSupported()) { + try { + //创建一个URI实例,注意不是URL + URI uri = URI.create(url); + //获取当前系统桌面扩展 + Desktop desktop = Desktop.getDesktop(); + //判断系统桌面是否支持要执行的功能 + if (desktop.isSupported(Desktop.Action.BROWSE)) { + //获取系统默认浏览器打开链接 + desktop.browse(uri); + } + } catch (NullPointerException e) { + //此为uri为空时抛出异常 + FRLogger.getLogger().error(e.getMessage()); + } catch (IOException e) { + //此为无法获取系统默认浏览器 + FRLogger.getLogger().error(e.getMessage()); + } + } + } } diff --git a/designer_base/src/com/fr/design/extra/QQLoginWebPane.java b/designer_base/src/com/fr/design/extra/QQLoginWebPane.java index 229e92f12b..cdb1d17483 100644 --- a/designer_base/src/com/fr/design/extra/QQLoginWebPane.java +++ b/designer_base/src/com/fr/design/extra/QQLoginWebPane.java @@ -1,6 +1,11 @@ package com.fr.design.extra; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRLogger; +import com.fr.general.SiteCenter; import javafx.application.Platform; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; import javafx.embed.swing.JFXPanel; import javafx.event.EventHandler; import javafx.scene.Scene; @@ -30,6 +35,17 @@ public class QQLoginWebPane extends JFXPanel { WebView webView = new WebView(); webEngine = webView.getEngine(); webEngine.load("file:///" + installHome + "/scripts/qqLogin/web/qqLogin.html"); + webEngine.locationProperty().addListener(new ChangeListener() { + @Override + public void changed(ObservableValue observable, final String oldValue, String newValue) { + disableLink(webEngine); + // webView好像默认以手机版显示网页,浏览器里过滤掉这个跳转 + if (ComparatorUtils.equals(newValue, "file:///" + installHome + "/scripts/qqLogin/web/qqLogin.html") || ComparatorUtils.equals(newValue, SiteCenter.getInstance().acquireUrlByKind("bbs.mobile"))) { + return; + } + QQLoginWebBridge.getHelper().openUrlAtLocalWebBrowser(webEngine, newValue); + } + }); webEngine.setOnAlert(new EventHandler>() { @Override public void handle(WebEvent event) { @@ -52,4 +68,20 @@ public class QQLoginWebPane extends JFXPanel { } }); } + + private void disableLink(final WebEngine eng) { + try { + // webView端不跳转 虽然webView可以指定本地浏览器打开某个链接,但是当本地浏览器跳转到指定链接的同时,webView也做了跳转, + // 为了避免出现在一个600*400的资讯框里加载整个网页的情况,webView不跳转到新网页 + Platform.runLater(new Runnable() { + @Override + public void run() { + eng.executeScript("location.reload()"); + QQLoginWebBridge.getHelper().closeQQWindow(); + } + }); + } catch (Exception e) { + FRLogger.getLogger().error(e.getMessage()); + } + } } \ No newline at end of file From 845cfd0527bb448629793ca67109e2fdf1be656a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=94=80?= Date: Sat, 3 Sep 2016 19:21:48 +0800 Subject: [PATCH 10/10] =?UTF-8?q?bugfix=EF=BC=9A=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/extra/LoginWebBridge.java | 2 +- designer_base/src/com/fr/design/extra/PluginWebBridge.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/LoginWebBridge.java b/designer_base/src/com/fr/design/extra/LoginWebBridge.java index 9546dbc41b..4e1e93b761 100644 --- a/designer_base/src/com/fr/design/extra/LoginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/LoginWebBridge.java @@ -80,7 +80,7 @@ public class LoginWebBridge { */ public void registerHref() { try { - Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.default"))); + Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.register"))); }catch (Exception e) { FRContext.getLogger().info(e.getMessage()); } diff --git a/designer_base/src/com/fr/design/extra/PluginWebBridge.java b/designer_base/src/com/fr/design/extra/PluginWebBridge.java index 3dd9f3ee0a..bcd1aea706 100644 --- a/designer_base/src/com/fr/design/extra/PluginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/PluginWebBridge.java @@ -503,7 +503,7 @@ public class PluginWebBridge { */ public void registerHref() { try { - Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.default"))); + Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.register"))); }catch (Exception e) { FRContext.getLogger().info(e.getMessage()); }