From 6be9984128b0a373c6c4331c4a098d5d9ddf3e9d Mon Sep 17 00:00:00 2001 From: pengda Date: Fri, 11 Jun 2021 17:09:26 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-51958=20=E8=BF=9C=E7=A8=8B=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E6=A3=80=E6=B5=8B=E5=8F=8A=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/notification/NotificationCenter.java | 13 +++++++++++-- .../notification/ui/NotificationCenterDialog.java | 14 +++++++------- .../notification/ui/NotificationCenterPane.java | 4 ++-- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/notification/NotificationCenter.java b/designer-base/src/main/java/com/fr/design/notification/NotificationCenter.java index 65f28966e..7ca868db5 100644 --- a/designer-base/src/main/java/com/fr/design/notification/NotificationCenter.java +++ b/designer-base/src/main/java/com/fr/design/notification/NotificationCenter.java @@ -21,8 +21,17 @@ public class NotificationCenter { NotificationCenterPane.getNotificationCenterPane().refreshButton(); } - public List getNotifications(){ - return notifications; + public int getNotificationsCount(){ + return notifications.size(); + } + + public void removeNotification(int index){ + notifications.remove(index); + NotificationCenterPane.getNotificationCenterPane().refreshButton(); + } + + public Notification getNotification(int index){ + return notifications.get(index); } public void clearAllNotifications(){ 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 162286a9d..789a02fa9 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 @@ -42,7 +42,7 @@ public class NotificationCenterDialog extends JDialog { public 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().getNotifications().size() + ")"); + deleteLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Clear_Notifications") + "(" + NotificationCenter.getInstance().getNotificationsCount() + ")"); deleteLabel.setForeground(Color.BLUE); deleteLabel.addMouseListener(new MouseAdapter() { @@ -52,7 +52,7 @@ public class NotificationCenterDialog extends JDialog { centerPanel.removeAll(); addNotification(); pack(); - deleteLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Clear_Notifications") + "(" + NotificationCenter.getInstance().getNotifications().size() + ")"); + deleteLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Clear_Notifications") + "(" + NotificationCenter.getInstance().getNotificationsCount() + ")"); if (notificationNeedShow.size() == 0) { hideDialog(); } @@ -73,12 +73,12 @@ public class NotificationCenterDialog extends JDialog { private void addNotification() { notificationNeedShow.clear(); - List notifications = NotificationCenter.getInstance().getNotifications(); - int size = notifications.size(); + + int size = NotificationCenter.getInstance().getNotificationsCount(); for (int i = NOTIFICATIONCOUNT; i > 0; i--) { int j = size - i; if (j >= 0) { - Notification notification = notifications.get(j); + Notification notification = NotificationCenter.getInstance().getNotification(j); NotificationPane notificationPane = new NotificationPane(notification.getType(), notification.getMessage(), i, notification.getNotificationDialogAction()); notificationNeedShow.add(notificationPane); } @@ -141,10 +141,10 @@ public class NotificationCenterDialog extends JDialog { deleteIconPane.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { - NotificationCenter.getInstance().getNotifications().remove(NotificationCenter.getInstance().getNotifications().size() - index); + NotificationCenter.getInstance().removeNotification(NotificationCenter.getInstance().getNotificationsCount() - index); centerPanel.removeAll(); addNotification(); - deleteLabel.setText("清除所有消息" + "(" + NotificationCenter.getInstance().getNotifications().size() + ")"); + deleteLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Clear_Notifications") + "(" + NotificationCenter.getInstance().getNotificationsCount() + ")"); pack(); if (notificationNeedShow.size() == 0) { centerWindow(); 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 55238a5ee..6ed74782b 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 @@ -21,7 +21,7 @@ public class NotificationCenterPane extends BasicPane { setLayout(new BorderLayout()); notificationCenterButton = new UIButton(); notificationCenterButton.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/notificationcenter/notificationCenter.png")); - notificationCenterButton.setToolTipText(Toolkit.i18nText("显示当前通知")); + notificationCenterButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Show_Notification")); notificationCenterButton.set4ToolbarButton(); notificationCenterButton.setRolloverEnabled(false); this.add(notificationCenterButton); @@ -40,7 +40,7 @@ public class NotificationCenterPane extends BasicPane { } public void refreshButton() { - if (NotificationCenter.getInstance().getNotifications().size() > 0) { + if (NotificationCenter.getInstance().getNotificationsCount() > 0) { notificationCenterButton.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/notificationcenter/normal.png")); } else { notificationCenterButton.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/notificationcenter/notificationCenter.png"));