| 1 package org.sape.carbon.services.console; 2 3 import javax.management.MBeanNotificationInfo ; 4 import javax.management.MBeanServer ; 5 import javax.management.ObjectName ; 6 import javax.swing.DefaultListModel ; 7 import javax.swing.border.CompoundBorder ; 8 import javax.swing.border.TitledBorder ; 9 10 17 public class NotificationPanel extends javax.swing.JPanel { 18 19 private ObjectName objectName; 20 private MBeanNotificationInfo notificationInfo; 21 private MBeanServer server; 22 23 public NotificationPanel(ObjectName objectName, MBeanNotificationInfo notificationInfo, MBeanServer server) { 25 this.objectName = objectName; 26 this.notificationInfo = notificationInfo; 27 this.server = server; 28 29 initComponents(); 30 31 ((TitledBorder )((CompoundBorder )this.getBorder()).getInsideBorder()).setTitle(this.notificationInfo.getName()); 32 33 34 String [] notifTypes = this.notificationInfo.getNotifTypes(); 35 36 DefaultListModel model = new DefaultListModel (); 37 for (int i = 0; i < notifTypes.length; i++) { 38 model.addElement(notifTypes[i]); 39 } 40 this.notificationTypeList.setModel(model); 41 42 this.repaint(); 44 } 45 46 47 48 53 private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; 55 56 jLabel1 = new javax.swing.JLabel (); 57 descriptionTextArea = new javax.swing.JTextArea (); 58 notificationTypeScrollPane = new javax.swing.JScrollPane (); 59 notificationTypeList = new javax.swing.JList (); 60 61 setLayout(new java.awt.GridBagLayout ()); 62 63 setBorder(new javax.swing.border.CompoundBorder (new javax.swing.border.EmptyBorder (new java.awt.Insets (3, 3, 3, 3)), new javax.swing.border.TitledBorder ("Notification Name"))); 64 jLabel1.setText("Description"); 65 gridBagConstraints = new java.awt.GridBagConstraints (); 66 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST; 67 gridBagConstraints.insets = new java.awt.Insets (1, 1, 1, 1); 68 add(jLabel1, gridBagConstraints); 69 70 descriptionTextArea.setBackground(new java.awt.Color (204, 204, 204)); 71 descriptionTextArea.setEditable(false); 72 descriptionTextArea.setLineWrap(true); 73 descriptionTextArea.setRows(5); 74 descriptionTextArea.setText(this.notificationInfo.getDescription()); 75 descriptionTextArea.setWrapStyleWord(true); 76 gridBagConstraints = new java.awt.GridBagConstraints (); 77 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 78 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 79 gridBagConstraints.weightx = 1.0; 80 add(descriptionTextArea, gridBagConstraints); 81 82 notificationTypeScrollPane.setMinimumSize(new java.awt.Dimension (120, 60)); 83 notificationTypeScrollPane.setPreferredSize(new java.awt.Dimension (150, 50)); 84 notificationTypeScrollPane.setViewportView(notificationTypeList); 85 86 add(notificationTypeScrollPane, new java.awt.GridBagConstraints ()); 87 88 } 90 91 private javax.swing.JLabel jLabel1; 93 private javax.swing.JTextArea descriptionTextArea; 94 private javax.swing.JScrollPane notificationTypeScrollPane; 95 private javax.swing.JList notificationTypeList; 96 98 } 99 | Popular Tags |