From 5fb9e0be58260d4aa58aeb2df2ee34dd4ff6f044 Mon Sep 17 00:00:00 2001 From: Lanlan Date: Mon, 21 Jun 2021 19:55:13 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-51958=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E4=B8=AD=E5=BF=83=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/dialog/NotificationDialog.java | 28 +++- .../dialog/NotificationDialogAction.java | 3 + .../login/message/DesignerMessageHelper.java | 68 ++++---- ...kType.java => NotificationActionType.java} | 19 ++- .../fr/design/notification/Notification.java | 21 ++- .../ui/NotificationCenterDialog.java | 158 ++++-------------- .../ui/NotificationCenterPane.java | 4 +- .../notification/ui/NotificationPane.java | 148 ++++++++++++++++ .../versioncheck/VersionCheckUtils.java | 6 +- 9 files changed, 276 insertions(+), 179 deletions(-) rename designer-base/src/main/java/com/fr/design/login/message/{DesignerModuleClickType.java => NotificationActionType.java} (87%) create mode 100644 designer-base/src/main/java/com/fr/design/notification/ui/NotificationPane.java diff --git a/designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java b/designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java index b3398c53db..b136f50c89 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java +++ b/designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java @@ -9,6 +9,7 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.notification.Notification; import com.fr.design.notification.NotificationCenter; import com.fr.module.ModuleContext; +import com.fr.stable.StringUtils; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; @@ -43,17 +44,17 @@ public class NotificationDialog extends JDialog { public NotificationDialog(Frame owner, String title, boolean isModal, int messageType, String message, NotificationDialogAction action) { super(owner); setTitle(title); - initComponents(messageType, message, isModal, action); + initComponents(StringUtils.EMPTY, messageType, message, isModal, action); } public NotificationDialog(Builder builder) { super(builder.owner); setTitle(builder.title); - initComponents(builder.messageType, builder.message, builder.modal, builder.action); + initComponents(builder.messageId, builder.messageType, builder.message, builder.modal, builder.action); } - public void initComponents(int messageType, String message, boolean isModal, NotificationDialogAction action) { - NotificationCenter.getInstance().addNotification(new Notification(messageType, message, action)); + public void initComponents(String messageId, int messageType, String message, boolean isModal, NotificationDialogAction action) { + NotificationCenter.getInstance().addNotification(new Notification(messageId, messageType, message, action)); notificationDialogAction = action; setModal(isModal); setFocusable(false); @@ -173,6 +174,7 @@ public class NotificationDialog extends JDialog { public static final class Builder { public int messageType = WARNING_MESSAGE; + public String messageId; public String message; public boolean modal = true; public Frame owner = null; @@ -187,6 +189,11 @@ public class NotificationDialog extends JDialog { return new NotificationDialog(this); } + public Builder messageId(String messageId) { + this.messageId = messageId; + return this; + } + public Builder owner(Frame owner) { this.owner = owner; return this; @@ -217,4 +224,17 @@ public class NotificationDialog extends JDialog { return this; } } + + public static void defaultPopup(String messageId, String title, String body, NotificationDialogAction action) { + NotificationDialog.Builder() + .messageId(messageId) + .owner(DesignerContext.getDesignerFrame()) + .title(title) + .modal(false) + .messageType(NotificationDialog.NEW_MESSAGE) + .message(body) + .notificationDialogAction(action) + .build() + .setVisible(true); + } } diff --git a/designer-base/src/main/java/com/fr/design/dialog/NotificationDialogAction.java b/designer-base/src/main/java/com/fr/design/dialog/NotificationDialogAction.java index 3cd4e85e89..350354cf4a 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/NotificationDialogAction.java +++ b/designer-base/src/main/java/com/fr/design/dialog/NotificationDialogAction.java @@ -1,5 +1,8 @@ package com.fr.design.dialog; public interface NotificationDialogAction { + + String name(); + void doClick(); } diff --git a/designer-base/src/main/java/com/fr/design/login/message/DesignerMessageHelper.java b/designer-base/src/main/java/com/fr/design/login/message/DesignerMessageHelper.java index 68072b9402..c053fc0e50 100644 --- a/designer-base/src/main/java/com/fr/design/login/message/DesignerMessageHelper.java +++ b/designer-base/src/main/java/com/fr/design/login/message/DesignerMessageHelper.java @@ -59,7 +59,7 @@ public class DesignerMessageHelper { @Override public void run() { try { - pullLatestMessageAndShow(); + pullLatestMessage(); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -70,7 +70,7 @@ public class DesignerMessageHelper { }); } - private void pullLatestMessageAndShow() throws Exception { + private void pullLatestMessage() throws Exception { String url = CloudCenter.getInstance().acquireUrlByKind("designer.message.push", "https://market.fanruan.com/api/v1/message/designer"); Map params = new HashMap<>(); params.put("designerId", DesignerEnvManager.getEnvManager().getUUID()); @@ -78,42 +78,34 @@ public class DesignerMessageHelper { JSONObject response = JSONFactory.createJSON(JSON.OBJECT, result); String status = response.optString(STATUS); if (SUCCESS.equals(status)) { - JSONObject data = response.optJSONObject(DATA); - String messageId = data.optString(MESSAGE_ID); - String title = data.optString(TITLE); - String body = data.optString(BODY); - int jumpType = data.optInt(JUMP_TYPE); - String jumpTo = data.optString(JUMP_TO); - if (StringUtils.isNotEmpty(messageId) && StringUtils.isNotEmpty(title) && StringUtils.isNotEmpty(body) && jumpType > 0 && StringUtils.isNotEmpty(jumpTo)) { - NotificationJumpType notificationJumpType = NotificationJumpType.valueOf(jumpType); - if (notificationJumpType == NotificationJumpType.WEB_URL) { - NotificationDialog.Builder() - .owner(DesignerContext.getDesignerFrame()) - .title(title) - .modal(false) - .messageType(NotificationDialog.NEW_MESSAGE) - .message(body) - .notificationDialogAction(new NotificationDialogAction() { - @Override - public void doClick() { - String ssoUrl = DesignerLoginUtils.generateDesignerSSOUrl(jumpTo); - BrowseUtils.browser(ssoUrl); - } - }) - .build() - .setVisible(true); - } else if (notificationJumpType == NotificationJumpType.DESIGNER_MODULE) { - DesignerModuleClickType designerModuleClickType = DesignerModuleClickType.valueOf(jumpTo); - NotificationDialog.Builder() - .owner(DesignerContext.getDesignerFrame()) - .title(title) - .modal(false) - .messageType(NotificationDialog.NEW_MESSAGE) - .message(body) - .notificationDialogAction(designerModuleClickType.getAction()) - .build() - .setVisible(true); - } + parseLatestMessage(response.optJSONObject(DATA)); + } + } + + private void parseLatestMessage(JSONObject data) { + String messageId = data.optString(MESSAGE_ID); + String title = data.optString(TITLE); + String body = data.optString(BODY); + int jumpType = data.optInt(JUMP_TYPE); + String jumpTo = data.optString(JUMP_TO); + if (StringUtils.isNotEmpty(messageId) && StringUtils.isNotEmpty(title) && StringUtils.isNotEmpty(body) && jumpType > 0 && StringUtils.isNotEmpty(jumpTo)) { + NotificationJumpType notificationJumpType = NotificationJumpType.valueOf(jumpType); + if (notificationJumpType == NotificationJumpType.WEB_URL) { + NotificationDialog.defaultPopup(messageId, title, body, new NotificationDialogAction() { + @Override + public String name() { + return jumpTo; + } + + @Override + public void doClick() { + String ssoUrl = DesignerLoginUtils.generateDesignerSSOUrl(jumpTo); + BrowseUtils.browser(ssoUrl); + } + }); + } else if (notificationJumpType == NotificationJumpType.DESIGNER_MODULE) { + NotificationActionType notificationActionType = NotificationActionType.valueOf(jumpTo); + NotificationDialog.defaultPopup(messageId, title, body, notificationActionType.getAction()); } } } diff --git a/designer-base/src/main/java/com/fr/design/login/message/DesignerModuleClickType.java b/designer-base/src/main/java/com/fr/design/login/message/NotificationActionType.java similarity index 87% rename from designer-base/src/main/java/com/fr/design/login/message/DesignerModuleClickType.java rename to designer-base/src/main/java/com/fr/design/login/message/NotificationActionType.java index fb7ff4d0c3..e34caa7456 100644 --- a/designer-base/src/main/java/com/fr/design/login/message/DesignerModuleClickType.java +++ b/designer-base/src/main/java/com/fr/design/login/message/NotificationActionType.java @@ -21,8 +21,13 @@ import com.fr.stable.os.OperatingSystem; * @version 10.0 * Created by Lanlan on 2021/6/11 */ -public enum DesignerModuleClickType { +public enum NotificationActionType { PLUGIN("PLUGIN", new NotificationDialogAction() { + @Override + public String name() { + return "PLUGIN"; + } + @Override public void doClick() { try { @@ -41,6 +46,11 @@ public enum DesignerModuleClickType { } }), REUSE("REUSE", new NotificationDialogAction() { + @Override + public String name() { + return "REUSE"; + } + @Override public void doClick() { try { @@ -54,6 +64,11 @@ public enum DesignerModuleClickType { } }), UNKNOWN(StringUtils.EMPTY, new NotificationDialogAction() { + @Override + public String name() { + return "UNKNOWN"; + } + @Override public void doClick() { } @@ -62,7 +77,7 @@ public enum DesignerModuleClickType { private String jumpTo; private NotificationDialogAction action; - DesignerModuleClickType(String jumpTo, NotificationDialogAction action) { + NotificationActionType(String jumpTo, NotificationDialogAction action) { this.jumpTo = jumpTo; this.action = action; } diff --git a/designer-base/src/main/java/com/fr/design/notification/Notification.java b/designer-base/src/main/java/com/fr/design/notification/Notification.java index bc0fcf670f..e45dd17fa5 100644 --- a/designer-base/src/main/java/com/fr/design/notification/Notification.java +++ b/designer-base/src/main/java/com/fr/design/notification/Notification.java @@ -1,24 +1,33 @@ package com.fr.design.notification; import com.fr.design.dialog.NotificationDialogAction; +import com.fr.stable.StringUtils; public class Notification { + private String messageId; private int type; private String message; private NotificationDialogAction notificationDialogAction; public static final int ERROR_MESSAGE = 0; public static final int NEW_MESSAGE = 1; public static final int WARNING_MESSAGE = 2; - public Notification(int type,String message,NotificationDialogAction notificationDialogAction){ + + public Notification(String messageId, int type, String message, NotificationDialogAction notificationDialogAction) { + this.messageId = messageId; this.type = type; this.message = message; this.notificationDialogAction = notificationDialogAction; } - public Notification(String message){ + public Notification(String message) { this.type = WARNING_MESSAGE; this.message = message; this.notificationDialogAction = new NotificationDialogAction() { + @Override + public String name() { + return StringUtils.EMPTY; + } + @Override public void doClick() { //do nothing @@ -30,11 +39,15 @@ public class Notification { return notificationDialogAction; } - public int getType(){ + public int getType() { return type; } - public String getMessage(){ + public String getMessage() { return message; } + + public String getMessageId() { + return messageId; + } } diff --git a/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java b/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java index de6374a801..62b2f9d69b 100644 --- a/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java +++ b/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java @@ -1,30 +1,24 @@ package com.fr.design.notification.ui; -import com.fr.design.dialog.NotificationDialogAction; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.notification.Notification; import com.fr.design.notification.NotificationCenter; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Cursor; import java.awt.Dimension; import java.awt.Frame; import java.awt.Toolkit; import java.awt.Window; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.ArrayList; -import javax.swing.BorderFactory; -import javax.swing.Icon; import javax.swing.JDialog; import javax.swing.JPanel; -import javax.swing.UIManager; - public class NotificationCenterDialog extends JDialog { private ArrayList notificationNeedShow; @@ -32,7 +26,9 @@ public class NotificationCenterDialog extends JDialog { private UILabel deleteLabel; private static final int NOTIFICATIONCOUNT = 5; - public NotificationCenterDialog(Frame parent) { + private static NotificationCenterDialog instance; + + private NotificationCenterDialog(Frame parent) { super(parent); setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Notification")); setResizable(false); @@ -46,7 +42,14 @@ public class NotificationCenterDialog extends JDialog { initComponents(); } - public void initComponents() { + public static NotificationCenterDialog getInstance() { + if (instance == null) { + instance = new NotificationCenterDialog(DesignerContext.getDesignerFrame()); + } + return instance; + } + + private void initComponents() { centerPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); addNotification(); deleteLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Clear_Notifications") + "(" + NotificationCenter.getInstance().getNotificationsCount() + ")"); @@ -74,11 +77,27 @@ public class NotificationCenterDialog extends JDialog { centerWindow(); } - private void hideDialog() { + public ArrayList getNotificationNeedShow() { + return notificationNeedShow; + } + + public JPanel getCenterPanel() { + return centerPanel; + } + + public UILabel getDeleteLabel() { + return deleteLabel; + } + + public void showDialog() { + this.setVisible(true); + } + + public void hideDialog() { this.dispose(); } - private void addNotification() { + public void addNotification() { notificationNeedShow.clear(); int size = NotificationCenter.getInstance().getNotificationsCount(); @@ -86,7 +105,7 @@ public class NotificationCenterDialog extends JDialog { int j = size - i; if (j >= 0) { Notification notification = NotificationCenter.getInstance().getNotification(j); - NotificationPane notificationPane = new NotificationPane(notification.getType(), notification.getMessage(), i, notification.getNotificationDialogAction()); + NotificationPane notificationPane = new NotificationPane(this, notification.getMessageId(), notification.getType(), notification.getMessage(), i, notification.getNotificationDialogAction()); notificationNeedShow.add(notificationPane); } } @@ -111,119 +130,4 @@ public class NotificationCenterDialog extends JDialog { //这里设置位置:水平居中,竖直偏上 win.setLocation(screenSize.width - winSize.width - 90, 50); } - - /** - * 一条消息面板 - */ - - class NotificationPane extends JPanel { - private int index; - private UILabel messageLabel; - private UILabel messageIcon; - private NotificationDialogAction notificationDialogAction; - - public NotificationPane(int type, String message, int index, NotificationDialogAction notificationDialogAction) { - this.index = index; - this.notificationDialogAction = notificationDialogAction; - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - setTypeIcon(getIconForType(type)); - setNotification(message); - setDeleteIcon(); - } - - public void setTypeIcon(Icon icon) { - messageIcon = new UILabel(icon); - messageIcon.addMouseListener(messageAndIconListener); - JPanel messageIconPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - messageIconPanel.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); - messageIconPanel.add(messageIcon); - add(messageIconPanel, BorderLayout.WEST); - } - - public void setDeleteIcon() { - UILabel deleteIcon = new UILabel(UIManager.getIcon("OptionPane.deleteIcon")); - JPanel deleteIconPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - deleteIconPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 7)); - deleteIconPane.add(deleteIcon); - deleteIconPane.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - NotificationCenter.getInstance().removeNotification(NotificationCenter.getInstance().getNotificationsCount() - index); - centerPanel.removeAll(); - addNotification(); - deleteLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Clear_Notifications") + "(" + NotificationCenter.getInstance().getNotificationsCount() + ")"); - pack(); - if (notificationNeedShow.size() == 0) { - hideDialog(); - } - NotificationCenterPane.getNotificationCenterPane().refreshButton(); - } - - @Override - public void mouseEntered(MouseEvent e) { - deleteIcon.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - - } - - @Override - public void mouseExited(MouseEvent e) { - deleteIcon.setCursor(Cursor.getDefaultCursor()); - } - }); - add(deleteIconPane, BorderLayout.EAST); - } - - public int getIndex() { - return index; - } - - public void setNotification(String message) { - messageLabel = new UILabel("" + message + ""); - messageLabel.addMouseListener(messageAndIconListener); - JPanel labelPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - labelPanel.add(messageLabel); - this.add(labelPanel, BorderLayout.CENTER); - } - - protected Icon getIconForType(int messageType) { - String propertyName; - switch (messageType) { - case 0: - propertyName = "OptionPane.circularErrorIcon"; - break; - case 1: - propertyName = "OptionPane.newMessageIcon"; - break; - case 2: - propertyName = "OptionPane.circularWarningIcon"; - break; - default: - return null; - } - return UIManager.getIcon(propertyName); - } - - private MouseListener messageAndIconListener = new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - hideDialog(); - notificationDialogAction.doClick(); - } - - @Override - public void mouseEntered(MouseEvent e) { - messageLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - messageIcon.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - messageLabel.setForeground(new Color(250, 170, 57)); - - } - - @Override - public void mouseExited(MouseEvent e) { - messageLabel.setCursor(Cursor.getDefaultCursor()); - messageIcon.setCursor(Cursor.getDefaultCursor()); - messageLabel.setForeground(Color.BLACK); - } - }; - } } diff --git a/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java b/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java index f5af0bfc06..dfc89cce29 100644 --- a/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java +++ b/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java @@ -4,7 +4,6 @@ import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.i18n.Toolkit; -import com.fr.design.mainframe.DesignerContext; import com.fr.design.notification.NotificationCenter; import com.fr.general.IOUtils; import java.awt.BorderLayout; @@ -28,8 +27,7 @@ public class NotificationCenterPane extends BasicPane { notificationCenterButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { - NotificationCenterDialog notificationCenterDialog = new NotificationCenterDialog(DesignerContext.getDesignerFrame()); - notificationCenterDialog.setVisible(true); + NotificationCenterDialog.getInstance().showDialog(); } }); this.setBackground(UIConstants.TEMPLATE_TAB_PANE_BACKGROUND); diff --git a/designer-base/src/main/java/com/fr/design/notification/ui/NotificationPane.java b/designer-base/src/main/java/com/fr/design/notification/ui/NotificationPane.java new file mode 100644 index 0000000000..23de246cdb --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/notification/ui/NotificationPane.java @@ -0,0 +1,148 @@ +package com.fr.design.notification.ui; + +import com.fr.design.dialog.NotificationDialogAction; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.notification.NotificationCenter; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JPanel; +import javax.swing.UIManager; + +/** + * @author Lanlan + * @version 10.0 + * Created by Lanlan on 2021/6/21 + */ +public class NotificationPane extends JPanel { + private NotificationCenterDialog parent; + private String messageId; + private int index; + private UILabel messageLabel; + private UILabel messageIcon; + private NotificationDialogAction notificationDialogAction; + + public NotificationPane(NotificationCenterDialog parent, String messageId, int type, String message, int index, NotificationDialogAction notificationDialogAction) { + this.parent = parent; + this.index = index; + this.messageId = messageId; + this.notificationDialogAction = notificationDialogAction; + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + setTypeIcon(getIconForType(type)); + setNotification(message); + setDeleteIcon(); + } + + public void setTypeIcon(Icon icon) { + messageIcon = new UILabel(icon); + messageIcon.addMouseListener(messageAndIconListener); + JPanel messageIconPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + messageIconPanel.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); + messageIconPanel.add(messageIcon); + add(messageIconPanel, BorderLayout.WEST); + } + + public void setDeleteIcon() { + UILabel deleteIcon = new UILabel(UIManager.getIcon("OptionPane.deleteIcon")); + JPanel deleteIconPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + deleteIconPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 7)); + deleteIconPane.add(deleteIcon); + deleteIconPane.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + NotificationCenter.getInstance().removeNotification(NotificationCenter.getInstance().getNotificationsCount() - index); + parent.getCenterPanel().removeAll(); + parent.addNotification(); + parent.getDeleteLabel().setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Clear_Notifications") + "(" + NotificationCenter.getInstance().getNotificationsCount() + ")"); + parent.pack(); + if (parent.getNotificationNeedShow().size() == 0) { + parent.hideDialog(); + } + NotificationCenterPane.getNotificationCenterPane().refreshButton(); + } + + @Override + public void mouseEntered(MouseEvent e) { + deleteIcon.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + + } + + @Override + public void mouseExited(MouseEvent e) { + deleteIcon.setCursor(Cursor.getDefaultCursor()); + } + }); + add(deleteIconPane, BorderLayout.EAST); + } + + public int getIndex() { + return index; + } + + public String getMessageId() { + return messageId; + } + + public NotificationDialogAction getNotificationDialogAction() { + return notificationDialogAction; + } + + public void setNotification(String message) { + messageLabel = new UILabel("" + message + ""); + messageLabel.addMouseListener(messageAndIconListener); + JPanel labelPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + labelPanel.add(messageLabel); + this.add(labelPanel, BorderLayout.CENTER); + } + + protected Icon getIconForType(int messageType) { + String propertyName; + switch (messageType) { + case 0: + propertyName = "OptionPane.circularErrorIcon"; + break; + case 1: + propertyName = "OptionPane.newMessageIcon"; + break; + case 2: + propertyName = "OptionPane.circularWarningIcon"; + break; + default: + return null; + } + return UIManager.getIcon(propertyName); + } + + private void performTargetAction() { + parent.hideDialog(); + notificationDialogAction.doClick(); + } + + private MouseListener messageAndIconListener = new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + performTargetAction(); + } + + @Override + public void mouseEntered(MouseEvent e) { + messageLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + messageIcon.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + messageLabel.setForeground(new Color(250, 170, 57)); + + } + + @Override + public void mouseExited(MouseEvent e) { + messageLabel.setCursor(Cursor.getDefaultCursor()); + messageIcon.setCursor(Cursor.getDefaultCursor()); + messageLabel.setForeground(Color.BLACK); + } + }; +} diff --git a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java index 26406b3854..e63395ff65 100644 --- a/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java +++ b/designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java @@ -10,7 +10,6 @@ import com.fr.design.env.RemoteWorkspace; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.env.CheckServiceDialog; -import com.fr.env.VersionCheckMessageDialog; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralUtils; import com.fr.invoke.Reflect; @@ -74,6 +73,11 @@ public class VersionCheckUtils { if (!VersionCheckUtils.versionCheck(envName)) { NotificationDialog notificationDialog = new NotificationDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Sync_Prompt"), false, NotificationDialog.WARNING_MESSAGE, Toolkit.i18nText("Fine-Design_Basic_Sync_Check_Brief_Info"), new NotificationDialogAction() { + @Override + public String name() { + return "VERSION_CHECK"; + } + @Override public void doClick() { CheckServiceDialog checkServiceDialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), GeneralUtils.readFullBuildNO(), getRemoteBranch(envName),getNoExistServiceDescription(envName)); From 5b5e99405396e48645d7f1238b8acabe240a64fa Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 22 Jun 2021 13:41:32 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-53647=20=20=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/share/util/DownloadUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java index 2b4dc70c38..96c2cc28c6 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java @@ -35,7 +35,7 @@ import java.security.spec.X509EncodedKeySpec; * created by Harrison on 2020/05/27 **/ public class DownloadUtils { - private static final String REUSES_URL = CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo") + "file/"; + private static final String REUSES_URL = CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo") + "file/download"; private static final String PACKAGE_REUSES_URL = CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo") + "package/download/"; private static final String CERTIFICATE_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCtsz62CPSWXZE/IYZRiAuTSZkw\n" + "1WOwer8+JFktK0uKLAUuQoBr+UjAMFtRA8W7JgKMDwZy/2liEAiXEOSPU/hrdV8D\n" +