KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sape > carbon > services > console > NotificationPanel


1 package org.sape.carbon.services.console;
2
3 import javax.management.MBeanNotificationInfo JavaDoc;
4 import javax.management.MBeanServer JavaDoc;
5 import javax.management.ObjectName JavaDoc;
6 import javax.swing.DefaultListModel JavaDoc;
7 import javax.swing.border.CompoundBorder JavaDoc;
8 import javax.swing.border.TitledBorder JavaDoc;
9
10 /**
11  *
12  * Copyright 2002 Sapient
13  * @since carbon 1.0
14  * @author Greg Hinkle, May 2002
15  * @version $Revision: 1.3 $($Author: ghinkl $ / $Date: 2003/04/04 01:11:49 $)
16  */

17 public class NotificationPanel extends javax.swing.JPanel JavaDoc {
18     
19     private ObjectName JavaDoc objectName;
20     private MBeanNotificationInfo JavaDoc notificationInfo;
21     private MBeanServer JavaDoc server;
22     
23     // TODO GH: There should be an abstract InfoPanel used by notification, operation and attribute
24
public NotificationPanel(ObjectName JavaDoc objectName, MBeanNotificationInfo JavaDoc notificationInfo, MBeanServer JavaDoc server) {
25         this.objectName = objectName;
26         this.notificationInfo = notificationInfo;
27         this.server = server;
28         
29         initComponents();
30         
31         ((TitledBorder JavaDoc)((CompoundBorder JavaDoc)this.getBorder()).getInsideBorder()).setTitle(this.notificationInfo.getName());
32         
33         
34         String JavaDoc[] notifTypes = this.notificationInfo.getNotifTypes();
35         
36         DefaultListModel JavaDoc model = new DefaultListModel JavaDoc();
37         for (int i = 0; i < notifTypes.length; i++) {
38             model.addElement(notifTypes[i]);
39         }
40         this.notificationTypeList.setModel(model);
41         
42         //loadParameters(this.operation.getSignature());
43
this.repaint();
44     }
45     
46     
47     
48     /** This method is called from within the constructor to
49      * initialize the form.
50      * WARNING: Do NOT modify this code. The content of this method is
51      * always regenerated by the Form Editor.
52      */

53     private void initComponents() {//GEN-BEGIN:initComponents
54
java.awt.GridBagConstraints JavaDoc gridBagConstraints;
55
56         jLabel1 = new javax.swing.JLabel JavaDoc();
57         descriptionTextArea = new javax.swing.JTextArea JavaDoc();
58         notificationTypeScrollPane = new javax.swing.JScrollPane JavaDoc();
59         notificationTypeList = new javax.swing.JList JavaDoc();
60
61         setLayout(new java.awt.GridBagLayout JavaDoc());
62
63         setBorder(new javax.swing.border.CompoundBorder JavaDoc(new javax.swing.border.EmptyBorder JavaDoc(new java.awt.Insets JavaDoc(3, 3, 3, 3)), new javax.swing.border.TitledBorder JavaDoc("Notification Name")));
64         jLabel1.setText("Description");
65         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
66         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
67         gridBagConstraints.insets = new java.awt.Insets JavaDoc(1, 1, 1, 1);
68         add(jLabel1, gridBagConstraints);
69
70         descriptionTextArea.setBackground(new java.awt.Color JavaDoc(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 JavaDoc();
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 JavaDoc(120, 60));
83         notificationTypeScrollPane.setPreferredSize(new java.awt.Dimension JavaDoc(150, 50));
84         notificationTypeScrollPane.setViewportView(notificationTypeList);
85
86         add(notificationTypeScrollPane, new java.awt.GridBagConstraints JavaDoc());
87
88     }//GEN-END:initComponents
89

90     
91     // Variables declaration - do not modify//GEN-BEGIN:variables
92
private javax.swing.JLabel JavaDoc jLabel1;
93     private javax.swing.JTextArea JavaDoc descriptionTextArea;
94     private javax.swing.JScrollPane JavaDoc notificationTypeScrollPane;
95     private javax.swing.JList JavaDoc notificationTypeList;
96     // End of variables declaration//GEN-END:variables
97

98 }
99
Popular Tags