1 6 7 package SOFA.SOFAnet.Browser; 8 9 import javax.swing.*; 10 import SOFA.SOFAnet.Repository.BundleOffer; 11 import SOFA.SOFAnode.TR.ComponentInfo; 12 import java.util.Iterator ; 13 import java.awt.Component ; 14 import java.awt.Frame ; 15 16 20 public class BundleOfferDialog extends javax.swing.JDialog 21 { 22 private BundleOffer bundleOffer; 23 private DefaultListModel content; 24 25 public static void showDialog(Component frameComp, BundleOffer bundleOffer) 26 { 27 Frame frame = JOptionPane.getFrameForComponent(frameComp); 28 BundleOfferDialog dialog = new BundleOfferDialog(frame, true, bundleOffer); 29 dialog.setLocationRelativeTo(frameComp); 30 dialog.setVisible(true); 31 } 32 33 34 public BundleOfferDialog(java.awt.Frame parent, boolean modal, BundleOffer bundleOffer) 35 { 36 super(parent, modal); 37 this.bundleOffer = bundleOffer; 38 content = new DefaultListModel(); 39 initComponents(); 40 41 nodeTextField.setText(bundleOffer.getNodeName()); 42 43 Iterator it = bundleOffer.getComponents().iterator(); 44 while (it.hasNext()) 45 { 46 ComponentInfo componentInfo = (ComponentInfo)it.next(); 47 content.addElement(componentInfo.getName() + "[" + componentInfo.getImplementationVersion() + "]"); 48 } 49 50 setTitle("Bundle Offer for '" + bundleOffer.getName() + "'"); 51 } 52 53 58 private void initComponents() { 60 jPanel3 = new javax.swing.JPanel (); 61 jPanel1 = new javax.swing.JPanel (); 62 nodeLabel = new javax.swing.JLabel (); 63 nodeTextField = new javax.swing.JTextField (); 64 componentsLabel = new javax.swing.JLabel (); 65 jScrollPane1 = new javax.swing.JScrollPane (); 66 componentsList = new javax.swing.JList (); 67 jPanel2 = new javax.swing.JPanel (); 68 closeButton = new javax.swing.JButton (); 69 70 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); 71 jPanel3.setLayout(new java.awt.BorderLayout ()); 72 73 jPanel3.setMinimumSize(new java.awt.Dimension (400, 122)); 74 jPanel3.setPreferredSize(new java.awt.Dimension (400, 300)); 75 jPanel1.setLayout(new java.awt.GridLayout (3, 0)); 76 77 jPanel1.setMinimumSize(new java.awt.Dimension (200, 63)); 78 jPanel1.setPreferredSize(new java.awt.Dimension (200, 63)); 79 nodeLabel.setText("Source Node:"); 80 nodeLabel.setMinimumSize(new java.awt.Dimension (66, 15)); 81 nodeLabel.setPreferredSize(new java.awt.Dimension (66, 15)); 82 jPanel1.add(nodeLabel); 83 84 nodeTextField.setEditable(false); 85 jPanel1.add(nodeTextField); 86 87 componentsLabel.setText("Components in the Bundle:"); 88 jPanel1.add(componentsLabel); 89 90 jPanel3.add(jPanel1, java.awt.BorderLayout.NORTH); 91 92 jScrollPane1.setMinimumSize(new java.awt.Dimension (260, 24)); 93 componentsList.setModel(content); 94 componentsList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); 95 jScrollPane1.setViewportView(componentsList); 96 97 jPanel3.add(jScrollPane1, java.awt.BorderLayout.CENTER); 98 99 jPanel2.setMinimumSize(new java.awt.Dimension (200, 35)); 100 jPanel2.setPreferredSize(new java.awt.Dimension (200, 35)); 101 closeButton.setText("Close"); 102 closeButton.addActionListener(new java.awt.event.ActionListener () 103 { 104 public void actionPerformed(java.awt.event.ActionEvent evt) 105 { 106 closeButtonActionPerformed(evt); 107 } 108 }); 109 110 jPanel2.add(closeButton); 111 112 jPanel3.add(jPanel2, java.awt.BorderLayout.SOUTH); 113 114 getContentPane().add(jPanel3, java.awt.BorderLayout.CENTER); 115 116 pack(); 117 } 119 private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) { dispose(); 122 } 124 private javax.swing.JButton closeButton; 126 private javax.swing.JLabel componentsLabel; 127 private javax.swing.JList componentsList; 128 private javax.swing.JPanel jPanel1; 129 private javax.swing.JPanel jPanel2; 130 private javax.swing.JPanel jPanel3; 131 private javax.swing.JScrollPane jScrollPane1; 132 private javax.swing.JLabel nodeLabel; 133 private javax.swing.JTextField nodeTextField; 134 136 } 137 | Popular Tags |