KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnet > Browser > BundleOfferDialog


1 /*
2  * BundleOfferDialog.java
3  *
4  * Created on 17. květen 2004, 13:12
5  */

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 JavaDoc;
13 import java.awt.Component JavaDoc;
14 import java.awt.Frame JavaDoc;
15
16 /**
17  *
18  * @author Ladislav Sobr
19  */

20 public class BundleOfferDialog extends javax.swing.JDialog JavaDoc
21 {
22   private BundleOffer bundleOffer;
23   private DefaultListModel content;
24   
25   public static void showDialog(Component JavaDoc frameComp, BundleOffer bundleOffer)
26   {
27     Frame JavaDoc frame = JOptionPane.getFrameForComponent(frameComp);
28     BundleOfferDialog dialog = new BundleOfferDialog(frame, true, bundleOffer);
29     dialog.setLocationRelativeTo(frameComp);
30     dialog.setVisible(true);
31   }
32   
33   /** Creates new form BundleOfferDialog */
34   public BundleOfferDialog(java.awt.Frame JavaDoc 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 JavaDoc 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   /** This method is called from within the constructor to
54    * initialize the form.
55    * WARNING: Do NOT modify this code. The content of this method is
56    * always regenerated by the Form Editor.
57    */

58   private void initComponents()//GEN-BEGIN:initComponents
59
{
60     jPanel3 = new javax.swing.JPanel JavaDoc();
61     jPanel1 = new javax.swing.JPanel JavaDoc();
62     nodeLabel = new javax.swing.JLabel JavaDoc();
63     nodeTextField = new javax.swing.JTextField JavaDoc();
64     componentsLabel = new javax.swing.JLabel JavaDoc();
65     jScrollPane1 = new javax.swing.JScrollPane JavaDoc();
66     componentsList = new javax.swing.JList JavaDoc();
67     jPanel2 = new javax.swing.JPanel JavaDoc();
68     closeButton = new javax.swing.JButton JavaDoc();
69
70     setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
71     jPanel3.setLayout(new java.awt.BorderLayout JavaDoc());
72
73     jPanel3.setMinimumSize(new java.awt.Dimension JavaDoc(400, 122));
74     jPanel3.setPreferredSize(new java.awt.Dimension JavaDoc(400, 300));
75     jPanel1.setLayout(new java.awt.GridLayout JavaDoc(3, 0));
76
77     jPanel1.setMinimumSize(new java.awt.Dimension JavaDoc(200, 63));
78     jPanel1.setPreferredSize(new java.awt.Dimension JavaDoc(200, 63));
79     nodeLabel.setText("Source Node:");
80     nodeLabel.setMinimumSize(new java.awt.Dimension JavaDoc(66, 15));
81     nodeLabel.setPreferredSize(new java.awt.Dimension JavaDoc(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 JavaDoc(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 JavaDoc(200, 35));
100     jPanel2.setPreferredSize(new java.awt.Dimension JavaDoc(200, 35));
101     closeButton.setText("Close");
102     closeButton.addActionListener(new java.awt.event.ActionListener JavaDoc()
103     {
104       public void actionPerformed(java.awt.event.ActionEvent JavaDoc 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   }//GEN-END:initComponents
118

119   private void closeButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_closeButtonActionPerformed
120
{//GEN-HEADEREND:event_closeButtonActionPerformed
121
dispose();
122   }//GEN-LAST:event_closeButtonActionPerformed
123

124   // Variables declaration - do not modify//GEN-BEGIN:variables
125
private javax.swing.JButton JavaDoc closeButton;
126   private javax.swing.JLabel JavaDoc componentsLabel;
127   private javax.swing.JList JavaDoc componentsList;
128   private javax.swing.JPanel JavaDoc jPanel1;
129   private javax.swing.JPanel JavaDoc jPanel2;
130   private javax.swing.JPanel JavaDoc jPanel3;
131   private javax.swing.JScrollPane JavaDoc jScrollPane1;
132   private javax.swing.JLabel JavaDoc nodeLabel;
133   private javax.swing.JTextField JavaDoc nodeTextField;
134   // End of variables declaration//GEN-END:variables
135

136 }
137
Popular Tags