001: package org.sape.carbon.services.console;
002:
003: import javax.management.MBeanNotificationInfo;
004: import javax.management.MBeanServer;
005: import javax.management.ObjectName;
006: import javax.swing.DefaultListModel;
007: import javax.swing.border.CompoundBorder;
008: import javax.swing.border.TitledBorder;
009:
010: /**
011: *
012: * Copyright 2002 Sapient
013: * @since carbon 1.0
014: * @author Greg Hinkle, May 2002
015: * @version $Revision: 1.3 $($Author: ghinkl $ / $Date: 2003/04/04 01:11:49 $)
016: */
017: public class NotificationPanel extends javax.swing.JPanel {
018:
019: private ObjectName objectName;
020: private MBeanNotificationInfo notificationInfo;
021: private MBeanServer server;
022:
023: // TODO GH: There should be an abstract InfoPanel used by notification, operation and attribute
024: public NotificationPanel(ObjectName objectName,
025: MBeanNotificationInfo notificationInfo, MBeanServer server) {
026: this .objectName = objectName;
027: this .notificationInfo = notificationInfo;
028: this .server = server;
029:
030: initComponents();
031:
032: ((TitledBorder) ((CompoundBorder) this .getBorder())
033: .getInsideBorder()).setTitle(this .notificationInfo
034: .getName());
035:
036: String[] notifTypes = this .notificationInfo.getNotifTypes();
037:
038: DefaultListModel model = new DefaultListModel();
039: for (int i = 0; i < notifTypes.length; i++) {
040: model.addElement(notifTypes[i]);
041: }
042: this .notificationTypeList.setModel(model);
043:
044: //loadParameters(this.operation.getSignature());
045: this .repaint();
046: }
047:
048: /** This method is called from within the constructor to
049: * initialize the form.
050: * WARNING: Do NOT modify this code. The content of this method is
051: * always regenerated by the Form Editor.
052: */
053: private void initComponents() {//GEN-BEGIN:initComponents
054: java.awt.GridBagConstraints gridBagConstraints;
055:
056: jLabel1 = new javax.swing.JLabel();
057: descriptionTextArea = new javax.swing.JTextArea();
058: notificationTypeScrollPane = new javax.swing.JScrollPane();
059: notificationTypeList = new javax.swing.JList();
060:
061: setLayout(new java.awt.GridBagLayout());
062:
063: setBorder(new javax.swing.border.CompoundBorder(
064: new javax.swing.border.EmptyBorder(new java.awt.Insets(
065: 3, 3, 3, 3)),
066: new javax.swing.border.TitledBorder("Notification Name")));
067: jLabel1.setText("Description");
068: gridBagConstraints = new java.awt.GridBagConstraints();
069: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
070: gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1);
071: add(jLabel1, gridBagConstraints);
072:
073: descriptionTextArea.setBackground(new java.awt.Color(204, 204,
074: 204));
075: descriptionTextArea.setEditable(false);
076: descriptionTextArea.setLineWrap(true);
077: descriptionTextArea.setRows(5);
078: descriptionTextArea.setText(this .notificationInfo
079: .getDescription());
080: descriptionTextArea.setWrapStyleWord(true);
081: gridBagConstraints = new java.awt.GridBagConstraints();
082: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
083: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
084: gridBagConstraints.weightx = 1.0;
085: add(descriptionTextArea, gridBagConstraints);
086:
087: notificationTypeScrollPane
088: .setMinimumSize(new java.awt.Dimension(120, 60));
089: notificationTypeScrollPane
090: .setPreferredSize(new java.awt.Dimension(150, 50));
091: notificationTypeScrollPane
092: .setViewportView(notificationTypeList);
093:
094: add(notificationTypeScrollPane,
095: new java.awt.GridBagConstraints());
096:
097: }//GEN-END:initComponents
098:
099: // Variables declaration - do not modify//GEN-BEGIN:variables
100: private javax.swing.JLabel jLabel1;
101: private javax.swing.JTextArea descriptionTextArea;
102: private javax.swing.JScrollPane notificationTypeScrollPane;
103: private javax.swing.JList notificationTypeList;
104: // End of variables declaration//GEN-END:variables
105:
106: }
|