From abb2b1554bf90807bd487890af69410a2a8da8c8 Mon Sep 17 00:00:00 2001 From: Lanlan Date: Sat, 9 Oct 2021 11:17:26 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-60288=20=E7=94=A8=E6=88=B7=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E9=80=BB=E8=BE=91=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/DesignerPassportManager.java | 9 ++++++ .../design/mainframe/bbs/UserInfoLabel.java | 28 +++++++++++++++++++ .../fr/design/mainframe/bbs/UserInfoPane.java | 6 ++++ 3 files changed, 43 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/login/service/DesignerPassportManager.java b/designer-base/src/main/java/com/fr/design/login/service/DesignerPassportManager.java index 446a30f8b1..19eefa85d1 100644 --- a/designer-base/src/main/java/com/fr/design/login/service/DesignerPassportManager.java +++ b/designer-base/src/main/java/com/fr/design/login/service/DesignerPassportManager.java @@ -5,6 +5,7 @@ import com.fr.design.login.DesignerLoginType; import com.fr.design.upm.event.CertificateEvent; import com.fr.event.EventDispatcher; import com.fr.json.JSONObject; +import com.fr.stable.StringUtils; /** * @author Lanlan @@ -96,6 +97,14 @@ public class DesignerPassportManager { return uid; } + /** + * 登出帆软通行证 + */ + public void logout() { + saveUserInfo(-1, StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY, DesignerLoginType.UNKNOWN, StringUtils.EMPTY); + EventDispatcher.fire(CertificateEvent.LOGOUT, StringUtils.EMPTY); + } + /** * 保存登录信息 */ diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java index 29180c09db..3ba44743df 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java @@ -6,6 +6,7 @@ package com.fr.design.mainframe.bbs; import com.fr.design.DesignerEnvManager; import com.fr.design.bbs.BBSLoginUtils; import com.fr.design.constants.UIConstants; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.extra.LoginContextListener; import com.fr.design.extra.UserLoginContext; import com.fr.design.gui.ilable.UILabel; @@ -14,6 +15,7 @@ import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.locale.impl.BbsSpaceMark; import com.fr.design.login.DesignerLoginHelper; import com.fr.design.login.DesignerLoginSource; +import com.fr.design.login.service.DesignerPassportManager; import com.fr.design.login.utils.DesignerLoginUtils; import com.fr.design.mainframe.DesignerContext; import com.fr.design.os.impl.SupportOSImpl; @@ -29,6 +31,7 @@ import com.fr.general.locale.LocaleMark; import com.fr.log.FineLoggerFactory; import com.fr.stable.EncodeConstants; import com.fr.stable.StringUtils; +import javax.swing.JOptionPane; import javax.swing.SwingConstants; import java.awt.Cursor; import java.awt.Frame; @@ -120,8 +123,33 @@ public class UserInfoLabel extends UILabel { UserLoginContext.fireLoginContextListener(DesignerLoginSource.SWITCH_ACCOUNT); } }); + //退出登录 + UIMenuItem logout = new UIMenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_BBSLogin_Logout")); + logout.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + String[] options = new String[]{ + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_BBSLogin_Logout"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Cancel") + }; + int rv = FineJOptionPane.showConfirmDialog( + DesignerLoginHelper.getDialog(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_BBSLogin_Logout_Tip"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.WARNING_MESSAGE, + null, + options, + options[1] + ); + if (rv == JOptionPane.YES_OPTION) { + DesignerPassportManager.getInstance().logout(); + } + } + }); menu.add(priviteMessage); menu.add(closeOther); + menu.add(logout); GUICoreUtils.showPopupMenu(menu, UserInfoLabel.this, 0, MENU_HEIGHT); } else { UserLoginContext.fireLoginContextListener(DesignerLoginSource.NORMAL); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoPane.java index e6ae079aa4..b3d6e35e5e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoPane.java @@ -86,6 +86,12 @@ public class UserInfoPane extends BasicPane { markSignIn(text); } }); + EventDispatcher.listen(CertificateEvent.LOGOUT, new Listener() { + @Override + public void on(Event event, String text) { + markUnSignIn(); + } + }); } public UserInfoLabel getUserInfoLabel() {