KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > poa > gui > poa > QueueListItem


1 package org.jacorb.poa.gui.poa;
2
3 /*
4  * JacORB - a free Java ORB
5  *
6  * Copyright (C) 1997-2004 Gerald Brose.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */

22  
23 import org.jacorb.poa.gui.beans.DoubleListDialog;
24
25 /**
26  * @author Reimo Tiedemann, FU Berlin
27  * @version 1.0, 05/10/99, RT
28  */

29 public class QueueListItem
30     extends java.awt.Panel JavaDoc
31     implements org.jacorb.poa.gui.beans.DoubleListItem, java.awt.event.ActionListener JavaDoc, java.awt.event.MouseListener JavaDoc
32 {
33     private DoubleListDialog container;
34     private QueueListItemController controller;
35     private String JavaDoc ridStr;
36     private java.awt.Panel JavaDoc ivjInnerPanel = null;
37     private java.awt.Label JavaDoc ivjRequestLabel = null;
38     private java.awt.Label JavaDoc ivjObjectLabel = null;
39     private java.awt.MenuItem JavaDoc ivjInspectionMenuItem = null;
40     private org.jacorb.poa.gui.beans.PopupMenu ivjPopupMenu = null;
41     private java.awt.MenuItem JavaDoc ivjRemoveMenuItem = null;
42     /**
43      * Comment
44      */

45     private void _actionInspectRequest() {
46     if (controller != null) {
47             controller._inspectRequest(ridStr);
48     }
49     }
50     /**
51      * Comment
52      */

53     private void _actionMousePressed(java.awt.event.MouseEvent JavaDoc e) {
54     if (container != null) {
55             container._setSelectedItem(this);
56     }
57     }
58     /**
59      * Comment
60      */

61     private void _actionMouseReleased(java.awt.event.MouseEvent JavaDoc e) {
62     int mods = e.getModifiers();
63     if ((mods & java.awt.event.MouseEvent.BUTTON3_MASK) != 0) {
64             /* Right Mouse Button pressed */
65             getPopupMenu()._show(e);
66     } else if ((mods & java.awt.event.MouseEvent.BUTTON2_MASK) != 0) {
67             /* Middle Mouse Button pressed */
68     } else {
69             /* Left Mouse Button pressed */
70             if (e.getClickCount() > 1) {
71                 /* doubel click */
72             }
73     }
74     }
75     /**
76      * Method to handle events for the ActionListener interface.
77      * @param e java.awt.event.ActionEvent
78      */

79     /* WARNING: THIS METHOD WILL BE REGENERATED. */
80     public void actionPerformed(java.awt.event.ActionEvent JavaDoc e) {
81     // user code begin {1}
82
// user code end
83
if ((e.getSource() == getRemoveMenuItem()) ) {
84             connEtoC7(e);
85     }
86     if ((e.getSource() == getInspectionMenuItem()) ) {
87             connEtoC8(e);
88     }
89     // user code begin {2}
90
// user code end
91
}
92     /**
93      * Comment
94      */

95     private void _actionRemoveRequest() {
96     if (controller != null) {
97             controller._removeRequest(ridStr);
98     }
99     }
100     /**
101      * connEtoC1: (InnerPanel.mouse.mousePressed(java.awt.event.MouseEvent) --> QueueListItem._actionMousePressed(Ljava.awt.event.MouseEvent;)V)
102      * @param arg1 java.awt.event.MouseEvent
103      */

104     /* WARNING: THIS METHOD WILL BE REGENERATED. */
105     private void connEtoC1(java.awt.event.MouseEvent JavaDoc arg1) {
106     try {
107             // user code begin {1}
108
// user code end
109
this._actionMousePressed(arg1);
110             // user code begin {2}
111
// user code end
112
} catch (java.lang.Throwable JavaDoc ivjExc) {
113             // user code begin {3}
114
// user code end
115
handleException(ivjExc);
116     }
117     }
118     /**
119      * connEtoC2: (RequestLabel.mouse.mousePressed(java.awt.event.MouseEvent) --> QueueListItem._actionMousePressed(Ljava.awt.event.MouseEvent;)V)
120      * @param arg1 java.awt.event.MouseEvent
121      */

122     /* WARNING: THIS METHOD WILL BE REGENERATED. */
123     private void connEtoC2(java.awt.event.MouseEvent JavaDoc arg1) {
124     try {
125             // user code begin {1}
126
// user code end
127
this._actionMousePressed(arg1);
128             // user code begin {2}
129
// user code end
130
} catch (java.lang.Throwable JavaDoc ivjExc) {
131             // user code begin {3}
132
// user code end
133
handleException(ivjExc);
134     }
135     }
136     /**
137      * connEtoC3: (ObjectLabel.mouse.mousePressed(java.awt.event.MouseEvent) --> QueueListItem._actionMousePressed(Ljava.awt.event.MouseEvent;)V)
138      * @param arg1 java.awt.event.MouseEvent
139      */

140     /* WARNING: THIS METHOD WILL BE REGENERATED. */
141     private void connEtoC3(java.awt.event.MouseEvent JavaDoc arg1) {
142     try {
143             // user code begin {1}
144
// user code end
145
this._actionMousePressed(arg1);
146             // user code begin {2}
147
// user code end
148
} catch (java.lang.Throwable JavaDoc ivjExc) {
149             // user code begin {3}
150
// user code end
151
handleException(ivjExc);
152     }
153     }
154     /**
155      * connEtoC4: (InnerPanel.mouse.mouseReleased(java.awt.event.MouseEvent) --> QueueListItem._actionMouseReleased(Ljava.awt.event.MouseEvent;)V)
156      * @param arg1 java.awt.event.MouseEvent
157      */

158     /* WARNING: THIS METHOD WILL BE REGENERATED. */
159     private void connEtoC4(java.awt.event.MouseEvent JavaDoc arg1) {
160     try {
161             // user code begin {1}
162
// user code end
163
this._actionMouseReleased(arg1);
164             // user code begin {2}
165
// user code end
166
} catch (java.lang.Throwable JavaDoc ivjExc) {
167             // user code begin {3}
168
// user code end
169
handleException(ivjExc);
170     }
171     }
172     /**
173      * connEtoC5: (RequestLabel.mouse.mouseReleased(java.awt.event.MouseEvent) --> QueueListItem._actionMouseReleased(Ljava.awt.event.MouseEvent;)V)
174      * @param arg1 java.awt.event.MouseEvent
175      */

176     /* WARNING: THIS METHOD WILL BE REGENERATED. */
177     private void connEtoC5(java.awt.event.MouseEvent JavaDoc arg1) {
178     try {
179             // user code begin {1}
180
// user code end
181
this._actionMouseReleased(arg1);
182             // user code begin {2}
183
// user code end
184
} catch (java.lang.Throwable JavaDoc ivjExc) {
185             // user code begin {3}
186
// user code end
187
handleException(ivjExc);
188     }
189     }
190     /**
191      * connEtoC6: (ObjectLabel.mouse.mouseReleased(java.awt.event.MouseEvent) --> QueueListItem._actionMouseReleased(Ljava.awt.event.MouseEvent;)V)
192      * @param arg1 java.awt.event.MouseEvent
193      */

194     /* WARNING: THIS METHOD WILL BE REGENERATED. */
195     private void connEtoC6(java.awt.event.MouseEvent JavaDoc arg1) {
196     try {
197             // user code begin {1}
198
// user code end
199
this._actionMouseReleased(arg1);
200             // user code begin {2}
201
// user code end
202
} catch (java.lang.Throwable JavaDoc ivjExc) {
203             // user code begin {3}
204
// user code end
205
handleException(ivjExc);
206     }
207     }
208     /**
209      * connEtoC7: (RemoveMenuItem.action.actionPerformed(java.awt.event.ActionEvent) --> QueueListItem._actionRemoveRequest()V)
210      * @param arg1 java.awt.event.ActionEvent
211      */

212     /* WARNING: THIS METHOD WILL BE REGENERATED. */
213     private void connEtoC7(java.awt.event.ActionEvent JavaDoc arg1) {
214     try {
215             // user code begin {1}
216
// user code end
217
this._actionRemoveRequest();
218             // user code begin {2}
219
// user code end
220
} catch (java.lang.Throwable JavaDoc ivjExc) {
221             // user code begin {3}
222
// user code end
223
handleException(ivjExc);
224     }
225     }
226     /**
227      * connEtoC8: (InspectionMenuItem.action.actionPerformed(java.awt.event.ActionEvent) --> QueueListItem._actionInspectRequest()V)
228      * @param arg1 java.awt.event.ActionEvent
229      */

230     /* WARNING: THIS METHOD WILL BE REGENERATED. */
231     private void connEtoC8(java.awt.event.ActionEvent JavaDoc arg1) {
232     try {
233             // user code begin {1}
234
// user code end
235
this._actionInspectRequest();
236             // user code begin {2}
237
// user code end
238
} catch (java.lang.Throwable JavaDoc ivjExc) {
239             // user code begin {3}
240
// user code end
241
handleException(ivjExc);
242     }
243     }
244     public void _correctWidth(int diff_width) {
245     }
246     java.awt.Label JavaDoc _getFirstLabel() {
247     return getRequestLabel();
248     }
249     /**
250      * Return the InnerPanel property value.
251      * @return java.awt.Panel
252      */

253     /* WARNING: THIS METHOD WILL BE REGENERATED. */
254     private java.awt.Panel JavaDoc getInnerPanel() {
255     if (ivjInnerPanel == null) {
256             try {
257                 ivjInnerPanel = new java.awt.Panel JavaDoc();
258                 ivjInnerPanel.setName("InnerPanel");
259                 ivjInnerPanel.setLayout(null);
260                 ivjInnerPanel.setBackground(java.awt.Color.lightGray);
261                 ivjInnerPanel.setBounds(0, 1, 1200, 13);
262                 getInnerPanel().add(getRequestLabel(), getRequestLabel().getName());
263                 getInnerPanel().add(getObjectLabel(), getObjectLabel().getName());
264                 // user code begin {1}
265
// user code end
266
} catch (java.lang.Throwable JavaDoc ivjExc) {
267                 // user code begin {2}
268
// user code end
269
handleException(ivjExc);
270             }
271     };
272     return ivjInnerPanel;
273     }
274     /**
275      * Return the InspectionMenuItem property value.
276      * @return java.awt.MenuItem
277      */

278     /* WARNING: THIS METHOD WILL BE REGENERATED. */
279     private java.awt.MenuItem JavaDoc getInspectionMenuItem() {
280     if (ivjInspectionMenuItem == null) {
281             try {
282                 ivjInspectionMenuItem = new java.awt.MenuItem JavaDoc();
283                 ivjInspectionMenuItem.setEnabled(true);
284                 ivjInspectionMenuItem.setLabel("Inspect Request Object");
285                 // user code begin {1}
286
// user code end
287
} catch (java.lang.Throwable JavaDoc ivjExc) {
288                 // user code begin {2}
289
// user code end
290
handleException(ivjExc);
291             }
292     };
293     return ivjInspectionMenuItem;
294     }
295     /**
296      * Return the Label1 property value.
297      * @return java.awt.Label
298      */

299     /* WARNING: THIS METHOD WILL BE REGENERATED. */
300     private java.awt.Label JavaDoc getObjectLabel() {
301     if (ivjObjectLabel == null) {
302             try {
303                 ivjObjectLabel = new java.awt.Label JavaDoc();
304                 ivjObjectLabel.setName("ObjectLabel");
305                 ivjObjectLabel.setFont(new java.awt.Font JavaDoc("dialog", 0, 10));
306                 ivjObjectLabel.setText("Label2");
307                 ivjObjectLabel.setBounds(200, 0, 990, 13);
308                 // user code begin {1}
309
// user code end
310
} catch (java.lang.Throwable JavaDoc ivjExc) {
311                 // user code begin {2}
312
// user code end
313
handleException(ivjExc);
314             }
315     };
316     return ivjObjectLabel;
317     }
318     /**
319      * Return the PopupMenu property value.
320      * @return org.jacorb.poa.gui.beans.PopupMenu
321      */

322     /* WARNING: THIS METHOD WILL BE REGENERATED. */
323     private org.jacorb.poa.gui.beans.PopupMenu getPopupMenu() {
324     if (ivjPopupMenu == null) {
325             try {
326                 ivjPopupMenu = new org.jacorb.poa.gui.beans.PopupMenu();
327                 ivjPopupMenu.setLabel("Request Actions");
328                 ivjPopupMenu.add(getRemoveMenuItem());
329                 ivjPopupMenu.add(getInspectionMenuItem());
330                 // user code begin {1}
331
// user code end
332
} catch (java.lang.Throwable JavaDoc ivjExc) {
333                 // user code begin {2}
334
// user code end
335
handleException(ivjExc);
336             }
337     };
338     return ivjPopupMenu;
339     }
340     /**
341      * Return the RemoveMenuItem property value.
342      * @return java.awt.MenuItem
343      */

344     /* WARNING: THIS METHOD WILL BE REGENERATED. */
345     private java.awt.MenuItem JavaDoc getRemoveMenuItem() {
346     if (ivjRemoveMenuItem == null) {
347             try {
348                 ivjRemoveMenuItem = new java.awt.MenuItem JavaDoc();
349                 ivjRemoveMenuItem.setLabel("Remove Request from Queue");
350                 // user code begin {1}
351
// user code end
352
} catch (java.lang.Throwable JavaDoc ivjExc) {
353                 // user code begin {2}
354
// user code end
355
handleException(ivjExc);
356             }
357     };
358     return ivjRemoveMenuItem;
359     }
360     /**
361      * Return the RequestLabel property value.
362      * @return java.awt.Label
363      */

364     /* WARNING: THIS METHOD WILL BE REGENERATED. */
365     private java.awt.Label JavaDoc getRequestLabel() {
366     if (ivjRequestLabel == null) {
367             try {
368                 ivjRequestLabel = new java.awt.Label JavaDoc();
369                 ivjRequestLabel.setName("RequestLabel");
370                 ivjRequestLabel.setFont(new java.awt.Font JavaDoc("dialog", 0, 10));
371                 ivjRequestLabel.setText("Label1");
372                 ivjRequestLabel.setBounds(10, 0, 180, 13);
373                 // user code begin {1}
374
// user code end
375
} catch (java.lang.Throwable JavaDoc ivjExc) {
376                 // user code begin {2}
377
// user code end
378
handleException(ivjExc);
379             }
380     };
381     return ivjRequestLabel;
382     }
383     java.awt.Label JavaDoc _getSecondLabel() {
384     return getObjectLabel();
385     }
386     /**
387      * Called whenever the part throws an exception.
388      * @param exception java.lang.Throwable
389      */

390     private void handleException(Throwable JavaDoc exception) {
391
392     /* Uncomment the following lines to print uncaught exceptions to stdout */
393     // System.out.println("--------- UNCAUGHT EXCEPTION ---------");
394
// exception.printStackTrace(System.out);
395
}
396     /**
397      * Initializes connections
398      */

399     /* WARNING: THIS METHOD WILL BE REGENERATED. */
400     private void initConnections() {
401     // user code begin {1}
402
// user code end
403
getInnerPanel().addMouseListener(this);
404     getRequestLabel().addMouseListener(this);
405     getObjectLabel().addMouseListener(this);
406     getRemoveMenuItem().addActionListener(this);
407     getInspectionMenuItem().addActionListener(this);
408     }
409     /**
410      * Initialize the class.
411      */

412     /* WARNING: THIS METHOD WILL BE REGENERATED. */
413     private void initialize() {
414     // user code begin {1}
415
// user code end
416
setName("QueueListItem");
417     setLayout(null);
418     setBackground(java.awt.Color.black);
419     setSize(1200, 15);
420     add(getInnerPanel(), getInnerPanel().getName());
421     initConnections();
422     // user code begin {2}
423
// user code end
424
}
425     void _init(QueueListItemController _controller, String JavaDoc _ridStr) {
426     controller = _controller;
427     ridStr = _ridStr;
428     }
429     /**
430      * QueueListItem constructor comment.
431      * @param layout java.awt.LayoutManager
432      */

433     public QueueListItem(java.awt.LayoutManager JavaDoc layout) {
434     super(layout);
435     }
436     /**
437      * main entrypoint - starts the part when it is run as an application
438      * @param args java.lang.String[]
439      */

440     public static void main(java.lang.String JavaDoc[] args) {
441     try {
442             java.awt.Frame JavaDoc frame;
443             try {
444                 Class JavaDoc aFrameClass = Class.forName("com.ibm.uvm.abt.edit.TestFrame");
445                 frame = (java.awt.Frame JavaDoc)aFrameClass.newInstance();
446             } catch (java.lang.Throwable JavaDoc ivjExc) {
447                 frame = new java.awt.Frame JavaDoc();
448             }
449             QueueListItem aQueueListItem;
450             aQueueListItem = new QueueListItem();
451             frame.add("Center", aQueueListItem);
452             frame.setSize(aQueueListItem.getSize());
453             frame.setVisible(true);
454     } catch (Throwable JavaDoc exception) {
455             System.err.println("Exception occurred in main() of java.awt.Panel");
456             exception.printStackTrace(System.out);
457     }
458     }
459     /**
460      * Method to handle events for the MouseListener interface.
461      * @param e java.awt.event.MouseEvent
462      */

463     /* WARNING: THIS METHOD WILL BE REGENERATED. */
464     public void mouseClicked(java.awt.event.MouseEvent JavaDoc e) {
465     // user code begin {1}
466
// user code end
467
// user code begin {2}
468
// user code end
469
}
470     /**
471      * Method to handle events for the MouseListener interface.
472      * @param e java.awt.event.MouseEvent
473      */

474     /* WARNING: THIS METHOD WILL BE REGENERATED. */
475     public void mouseEntered(java.awt.event.MouseEvent JavaDoc e) {
476     // user code begin {1}
477
// user code end
478
// user code begin {2}
479
// user code end
480
}
481     /**
482      * Method to handle events for the MouseListener interface.
483      * @param e java.awt.event.MouseEvent
484      */

485     /* WARNING: THIS METHOD WILL BE REGENERATED. */
486     public void mouseExited(java.awt.event.MouseEvent JavaDoc e) {
487     // user code begin {1}
488
// user code end
489
// user code begin {2}
490
// user code end
491
}
492     /**
493      * Method to handle events for the MouseListener interface.
494      * @param e java.awt.event.MouseEvent
495      */

496     /* WARNING: THIS METHOD WILL BE REGENERATED. */
497     public void mousePressed(java.awt.event.MouseEvent JavaDoc e) {
498     // user code begin {1}
499
// user code end
500
if ((e.getSource() == getInnerPanel()) ) {
501             connEtoC1(e);
502     }
503     if ((e.getSource() == getRequestLabel()) ) {
504             connEtoC2(e);
505     }
506     if ((e.getSource() == getObjectLabel()) ) {
507             connEtoC3(e);
508     }
509     // user code begin {2}
510
// user code end
511
}
512     /**
513      * Method to handle events for the MouseListener interface.
514      * @param e java.awt.event.MouseEvent
515      */

516     /* WARNING: THIS METHOD WILL BE REGENERATED. */
517     public void mouseReleased(java.awt.event.MouseEvent JavaDoc e) {
518     // user code begin {1}
519
// user code end
520
if ((e.getSource() == getInnerPanel()) ) {
521             connEtoC4(e);
522     }
523     if ((e.getSource() == getRequestLabel()) ) {
524             connEtoC5(e);
525     }
526     if ((e.getSource() == getObjectLabel()) ) {
527             connEtoC6(e);
528     }
529     // user code begin {2}
530
// user code end
531
}
532     public void _setContainer(DoubleListDialog _container) {
533     container = _container;
534     }
535     public void _setSelected(boolean selected) {
536     if (selected) {
537             getInnerPanel().setBackground(java.awt.Color.darkGray);
538             getRequestLabel().setBackground(java.awt.Color.darkGray);
539             getObjectLabel().setBackground(java.awt.Color.darkGray);
540             getRequestLabel().setForeground(java.awt.Color.white);
541             getObjectLabel().setForeground(java.awt.Color.white);
542
543     } else {
544             getInnerPanel().setBackground(java.awt.Color.lightGray);
545             getRequestLabel().setBackground(java.awt.Color.lightGray);
546             getObjectLabel().setBackground(java.awt.Color.lightGray);
547             getRequestLabel().setForeground(java.awt.Color.black);
548             getObjectLabel().setForeground(java.awt.Color.black);
549     }
550     }
551     void _setWidth(int w1, int w2) {
552     getRequestLabel().setSize(w1, 13);
553     getObjectLabel().setBounds(20+w1, 0, 1200-(w1+20), 13);
554     }
555     /**
556      * Constructor
557      */

558     /* WARNING: THIS METHOD WILL BE REGENERATED. */
559     public QueueListItem() {
560     super();
561     initialize();
562     }
563 }
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
Popular Tags