帆软报表设计器源代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

53 lines
1.5 KiB

package com.fr.design.notification;
import com.fr.design.notification.ui.NotificationCenterPane;
import com.fr.stable.StringUtils;
import java.util.ArrayList;
import java.util.List;
public class NotificationCenter {
private static NotificationCenter notificationCenter = new NotificationCenter();
private List<Notification> notifications;
private NotificationCenter(){
notifications = new ArrayList<>();
}
public static NotificationCenter getInstance(){
return notificationCenter;
}
public void addNotification(Notification message){
notifications.add(message);
NotificationCenterPane.getNotificationCenterPane().refreshButton();
}
public int getNotificationsCount(){
return notifications.size();
}
public void removeNotification(int index){
notifications.remove(index);
NotificationCenterPane.getNotificationCenterPane().refreshButton();
}
/**
* 通过messageId删除消息
* @param messageID
*/
public void removeNotificationByMessageID(String messageID) {
notifications.removeIf(notification -> StringUtils.equals(notification.getMessageId(), messageID));
NotificationCenterPane.getNotificationCenterPane().refreshButton();
}
public Notification getNotification(int index){
return notifications.get(index);
}
public void clearAllNotifications(){
notifications.clear();
NotificationCenterPane.getNotificationCenterPane().refreshButton();
}
}