KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > quikj > application > web > talk > feature > proactive > client > ProactiveOperatorList


1 /*
2  * ProactiveOperatorList.java
3  *
4  * Created on May 11, 2003, 4:49 AM
5  */

6
7 package com.quikj.application.web.talk.feature.proactive.client;
8 import java.awt.*;
9 import java.util.*;
10 import com.quikj.application.web.talk.client.*;
11
12 /**
13  *
14  * @author amit
15  */

16 public class ProactiveOperatorList extends java.awt.Frame JavaDoc
17 {
18     private Locale locale = null;
19     
20     /** Creates new form ProactiveOperatorList */
21     public ProactiveOperatorList()
22     {
23         locale = TalkFrame.Instance().getLocale();
24         initComponents();
25         visitorList.setFont(new Font("Courier", Font.PLAIN, 12));
26         captionLabel.setFont(new Font("Courier", Font.PLAIN, 12));
27         setBounds(new Rectangle(600, 400));
28         
29         // and center it
30
Rectangle pbounds = null;
31         if (TalkFrame.Instance().isShowing() == false)
32         {
33             Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
34             pbounds = new Rectangle(0, 0, dim.width, dim.height);
35         }
36         else
37         {
38             pbounds = TalkFrame.Instance().getBounds();
39         }
40         
41         Point mid = new Point(pbounds.x + (pbounds.width/2), pbounds.y + (pbounds.height/2));
42         Rectangle bounds = getBounds();
43         int x = mid.x - (bounds.width/2);
44         int y = mid.y - (bounds.height/2);
45         if (x < 0) x = pbounds.x;
46         if (y < 0) y = pbounds.y;
47         setBounds(x, y, bounds.width, bounds.height);
48         
49         TalkFrame.Instance().addToFrameList(this);
50     }
51     
52     /** This method is called from within the constructor to
53      * initialize the form.
54      * WARNING: Do NOT modify this code. The content of this method is
55      * always regenerated by the Form Editor.
56      */

57     private void initComponents()//GEN-BEGIN:initComponents
58
{
59         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
60
61         captionLabel = new java.awt.Label JavaDoc();
62         visitorList = new java.awt.List JavaDoc();
63         statusBar = new java.awt.TextField JavaDoc();
64         menuBar = new java.awt.MenuBar JavaDoc();
65         fileMenu = new java.awt.Menu JavaDoc();
66         closeMenuItem = new java.awt.MenuItem JavaDoc();
67         editMenu = new java.awt.Menu JavaDoc();
68         copyMenuItem = new java.awt.MenuItem JavaDoc();
69         pasteMenuItem = new java.awt.MenuItem JavaDoc();
70         operationsMenu = new java.awt.Menu JavaDoc();
71         informationMenuItem = new java.awt.MenuItem JavaDoc();
72         callMenuItem = new java.awt.MenuItem JavaDoc();
73
74         setLayout(new java.awt.GridBagLayout JavaDoc());
75
76         setBackground(java.awt.Color.white);
77         setTitle(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.feature.proactive.client.language", locale).getString("Visitor_List"));
78         addWindowListener(new java.awt.event.WindowAdapter JavaDoc()
79         {
80             public void windowClosing(java.awt.event.WindowEvent JavaDoc evt)
81             {
82                 exitForm(evt);
83             }
84         });
85
86         captionLabel.setFont(new java.awt.Font JavaDoc("Monospaced", 0, 12));
87         captionLabel.setText(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.feature.proactive.client.language", locale).getString("Session_Since_Page_Count_Current_URL"));
88         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
89         gridBagConstraints.gridx = 0;
90         gridBagConstraints.gridy = 0;
91         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
92         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
93         gridBagConstraints.weightx = 100.0;
94         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 5, 0, 5);
95         add(captionLabel, gridBagConstraints);
96
97         visitorList.setFont(new java.awt.Font JavaDoc("Monospaced", 0, 12));
98         visitorList.setBackground(new java.awt.Color JavaDoc(255, 255, 255));
99         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
100         gridBagConstraints.gridx = 0;
101         gridBagConstraints.gridy = 1;
102         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
103         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
104         gridBagConstraints.weightx = 100.0;
105         gridBagConstraints.weighty = 100.0;
106         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 5, 5, 5);
107         add(visitorList, gridBagConstraints);
108
109         statusBar.setEditable(false);
110         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
111         gridBagConstraints.gridx = 0;
112         gridBagConstraints.gridy = 2;
113         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
114         gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH;
115         gridBagConstraints.weightx = 100.0;
116         add(statusBar, gridBagConstraints);
117
118         fileMenu.setLabel(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.feature.proactive.client.language", locale).getString("File"));
119         closeMenuItem.setLabel(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.feature.proactive.client.language", locale).getString("Close"));
120         closeMenuItem.addActionListener(new java.awt.event.ActionListener JavaDoc()
121         {
122             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
123             {
124                 closeMenuItemActionPerformed(evt);
125             }
126         });
127
128         fileMenu.add(closeMenuItem);
129
130         menuBar.add(fileMenu);
131
132         editMenu.setLabel(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.feature.proactive.client.language", locale).getString("Edit"));
133         copyMenuItem.setLabel(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.feature.proactive.client.language", locale).getString("Copy"));
134         editMenu.add(copyMenuItem);
135
136         pasteMenuItem.setLabel(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.feature.proactive.client.language", locale).getString("Paste"));
137         editMenu.add(pasteMenuItem);
138
139         menuBar.add(editMenu);
140
141         operationsMenu.setLabel(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.feature.proactive.client.language", locale).getString("Operations"));
142         informationMenuItem.setLabel(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.feature.proactive.client.language", locale).getString("Information"));
143         informationMenuItem.addActionListener(new java.awt.event.ActionListener JavaDoc()
144         {
145             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
146             {
147                 informationMenuItemActionPerformed(evt);
148             }
149         });
150
151         operationsMenu.add(informationMenuItem);
152
153         callMenuItem.setLabel(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.feature.proactive.client.language", locale).getString("Call"));
154         callMenuItem.addActionListener(new java.awt.event.ActionListener JavaDoc()
155         {
156             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
157             {
158                 callMenuItemActionPerformed(evt);
159             }
160         });
161
162         operationsMenu.add(callMenuItem);
163
164         menuBar.add(operationsMenu);
165
166         setMenuBar(menuBar);
167
168         pack();
169     }//GEN-END:initComponents
170

171     private void informationMenuItemActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_informationMenuItemActionPerformed
172
{//GEN-HEADEREND:event_informationMenuItemActionPerformed
173
// Add your handling code here:
174
int selected = visitorList.getSelectedIndex();
175         if (selected >= 0)
176         {
177             ProactiveOperatorListHandler.getInstance().infoOperationSelected(selected);
178         }
179     }//GEN-LAST:event_informationMenuItemActionPerformed
180

181     private void callMenuItemActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_callMenuItemActionPerformed
182
{//GEN-HEADEREND:event_callMenuItemActionPerformed
183
// Add your handling code here:
184
int selected = visitorList.getSelectedIndex();
185         if (selected >= 0)
186         {
187             ProactiveOperatorListHandler.getInstance().callOperationSelected(selected);
188         }
189     }//GEN-LAST:event_callMenuItemActionPerformed
190

191     private void closeMenuItemActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_closeMenuItemActionPerformed
192
{//GEN-HEADEREND:event_closeMenuItemActionPerformed
193
// Add your handling code here:
194
ProactiveOperatorListHandler.getInstance().disposed();
195         TalkFrame.Instance().removeFromFrameList(this);
196         dispose();
197     }//GEN-LAST:event_closeMenuItemActionPerformed
198

199     /** Exit the Application */
200     private void exitForm(java.awt.event.WindowEvent JavaDoc evt)
201     {//GEN-FIRST:event_exitForm
202
ProactiveOperatorListHandler.getInstance().disposed();
203         dispose();
204     }//GEN-LAST:event_exitForm
205

206     /**
207      * @param args the command line arguments
208      */

209     public static void main(String JavaDoc args[])
210     {
211         new ProactiveOperatorList().show();
212     }
213     
214     public void addListElement(String JavaDoc text)
215     {
216         visitorList.add(text);
217     }
218     
219     public void replaceListElement(String JavaDoc text, int index)
220     {
221         visitorList.replaceItem(text, index);
222     }
223     
224     public void removeListElement(int index)
225     {
226         visitorList.remove(index);
227     }
228     
229     public void setStatusBarText(String JavaDoc text)
230     {
231         statusBar.setText(text);
232     }
233     
234     // Variables declaration - do not modify//GEN-BEGIN:variables
235
private java.awt.MenuItem JavaDoc closeMenuItem;
236     private java.awt.MenuItem JavaDoc pasteMenuItem;
237     private java.awt.TextField JavaDoc statusBar;
238     private java.awt.MenuItem JavaDoc informationMenuItem;
239     private java.awt.MenuBar JavaDoc menuBar;
240     private java.awt.MenuItem JavaDoc callMenuItem;
241     private java.awt.Menu JavaDoc editMenu;
242     private java.awt.Menu JavaDoc operationsMenu;
243     private java.awt.MenuItem JavaDoc copyMenuItem;
244     private java.awt.List JavaDoc visitorList;
245     private java.awt.Label JavaDoc captionLabel;
246     private java.awt.Menu JavaDoc fileMenu;
247     // End of variables declaration//GEN-END:variables
248

249 }
250
Popular Tags