Browse Source

REPORT-51958 远程环境检测及同步

feature/10.0
pengda 3 years ago
parent
commit
6be9984128
  1. 13
      designer-base/src/main/java/com/fr/design/notification/NotificationCenter.java
  2. 14
      designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java
  3. 4
      designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java

13
designer-base/src/main/java/com/fr/design/notification/NotificationCenter.java

@ -21,8 +21,17 @@ public class NotificationCenter {
NotificationCenterPane.getNotificationCenterPane().refreshButton(); NotificationCenterPane.getNotificationCenterPane().refreshButton();
} }
public List<Notification> getNotifications(){ public int getNotificationsCount(){
return notifications; 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(){ public void clearAllNotifications(){

14
designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java

@ -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();

4
designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java

@ -21,7 +21,7 @@ public class NotificationCenterPane extends BasicPane {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
notificationCenterButton = new UIButton(); notificationCenterButton = new UIButton();
notificationCenterButton.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/notificationcenter/notificationCenter.png")); 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.set4ToolbarButton();
notificationCenterButton.setRolloverEnabled(false); notificationCenterButton.setRolloverEnabled(false);
this.add(notificationCenterButton); this.add(notificationCenterButton);
@ -40,7 +40,7 @@ public class NotificationCenterPane extends BasicPane {
} }
public void refreshButton() { 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")); notificationCenterButton.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/notificationcenter/normal.png"));
} else { } else {
notificationCenterButton.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/notificationcenter/notificationCenter.png")); notificationCenterButton.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/notificationcenter/notificationCenter.png"));

Loading…
Cancel
Save