|
|
@ -42,7 +42,7 @@ public class NotificationCenterDialog extends JDialog { |
|
|
|
public void initComponents() { |
|
|
|
public void initComponents() { |
|
|
|
centerPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); |
|
|
|
centerPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); |
|
|
|
addNotification(); |
|
|
|
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.setForeground(Color.BLUE); |
|
|
|
|
|
|
|
|
|
|
|
deleteLabel.addMouseListener(new MouseAdapter() { |
|
|
|
deleteLabel.addMouseListener(new MouseAdapter() { |
|
|
@ -52,7 +52,7 @@ public class NotificationCenterDialog extends JDialog { |
|
|
|
centerPanel.removeAll(); |
|
|
|
centerPanel.removeAll(); |
|
|
|
addNotification(); |
|
|
|
addNotification(); |
|
|
|
pack(); |
|
|
|
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) { |
|
|
|
if (notificationNeedShow.size() == 0) { |
|
|
|
hideDialog(); |
|
|
|
hideDialog(); |
|
|
|
} |
|
|
|
} |
|
|
@ -73,12 +73,12 @@ public class NotificationCenterDialog extends JDialog { |
|
|
|
|
|
|
|
|
|
|
|
private void addNotification() { |
|
|
|
private void addNotification() { |
|
|
|
notificationNeedShow.clear(); |
|
|
|
notificationNeedShow.clear(); |
|
|
|
List<Notification> notifications = NotificationCenter.getInstance().getNotifications(); |
|
|
|
|
|
|
|
int size = notifications.size(); |
|
|
|
int size = NotificationCenter.getInstance().getNotificationsCount(); |
|
|
|
for (int i = NOTIFICATIONCOUNT; i > 0; i--) { |
|
|
|
for (int i = NOTIFICATIONCOUNT; i > 0; i--) { |
|
|
|
int j = size - i; |
|
|
|
int j = size - i; |
|
|
|
if (j >= 0) { |
|
|
|
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()); |
|
|
|
NotificationPane notificationPane = new NotificationPane(notification.getType(), notification.getMessage(), i, notification.getNotificationDialogAction()); |
|
|
|
notificationNeedShow.add(notificationPane); |
|
|
|
notificationNeedShow.add(notificationPane); |
|
|
|
} |
|
|
|
} |
|
|
@ -141,10 +141,10 @@ public class NotificationCenterDialog extends JDialog { |
|
|
|
deleteIconPane.addMouseListener(new MouseAdapter() { |
|
|
|
deleteIconPane.addMouseListener(new MouseAdapter() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
|
NotificationCenter.getInstance().getNotifications().remove(NotificationCenter.getInstance().getNotifications().size() - index); |
|
|
|
NotificationCenter.getInstance().removeNotification(NotificationCenter.getInstance().getNotificationsCount() - index); |
|
|
|
centerPanel.removeAll(); |
|
|
|
centerPanel.removeAll(); |
|
|
|
addNotification(); |
|
|
|
addNotification(); |
|
|
|
deleteLabel.setText("清除所有消息" + "(" + NotificationCenter.getInstance().getNotifications().size() + ")"); |
|
|
|
deleteLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Clear_Notifications") + "(" + NotificationCenter.getInstance().getNotificationsCount() + ")"); |
|
|
|
pack(); |
|
|
|
pack(); |
|
|
|
if (notificationNeedShow.size() == 0) { |
|
|
|
if (notificationNeedShow.size() == 0) { |
|
|
|
centerWindow(); |
|
|
|
centerWindow(); |
|
|
|