001: package org.jacorb.poa.gui.poa;
002:
003: /*
004: * JacORB - a free Java ORB
005: *
006: * Copyright (C) 1997-2004 Gerald Brose.
007: *
008: * This library is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU Library General Public
010: * License as published by the Free Software Foundation; either
011: * version 2 of the License, or (at your option) any later version.
012: *
013: * This library is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016: * Library General Public License for more details.
017: *
018: * You should have received a copy of the GNU Library General Public
019: * License along with this library; if not, write to the Free
020: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
021: */
022:
023: import org.jacorb.poa.gui.beans.DoubleListDialog;
024:
025: /**
026: * @author Reimo Tiedemann, FU Berlin
027: * @version 1.0, 05/10/99, RT
028: */
029: public class QueueListItem extends java.awt.Panel implements
030: org.jacorb.poa.gui.beans.DoubleListItem,
031: java.awt.event.ActionListener, java.awt.event.MouseListener {
032: private DoubleListDialog container;
033: private QueueListItemController controller;
034: private String ridStr;
035: private java.awt.Panel ivjInnerPanel = null;
036: private java.awt.Label ivjRequestLabel = null;
037: private java.awt.Label ivjObjectLabel = null;
038: private java.awt.MenuItem ivjInspectionMenuItem = null;
039: private org.jacorb.poa.gui.beans.PopupMenu ivjPopupMenu = null;
040: private java.awt.MenuItem ivjRemoveMenuItem = null;
041:
042: /**
043: * Comment
044: */
045: private void _actionInspectRequest() {
046: if (controller != null) {
047: controller._inspectRequest(ridStr);
048: }
049: }
050:
051: /**
052: * Comment
053: */
054: private void _actionMousePressed(java.awt.event.MouseEvent e) {
055: if (container != null) {
056: container._setSelectedItem(this );
057: }
058: }
059:
060: /**
061: * Comment
062: */
063: private void _actionMouseReleased(java.awt.event.MouseEvent e) {
064: int mods = e.getModifiers();
065: if ((mods & java.awt.event.MouseEvent.BUTTON3_MASK) != 0) {
066: /* Right Mouse Button pressed */
067: getPopupMenu()._show(e);
068: } else if ((mods & java.awt.event.MouseEvent.BUTTON2_MASK) != 0) {
069: /* Middle Mouse Button pressed */
070: } else {
071: /* Left Mouse Button pressed */
072: if (e.getClickCount() > 1) {
073: /* doubel click */
074: }
075: }
076: }
077:
078: /**
079: * Method to handle events for the ActionListener interface.
080: * @param e java.awt.event.ActionEvent
081: */
082: /* WARNING: THIS METHOD WILL BE REGENERATED. */
083: public void actionPerformed(java.awt.event.ActionEvent e) {
084: // user code begin {1}
085: // user code end
086: if ((e.getSource() == getRemoveMenuItem())) {
087: connEtoC7(e);
088: }
089: if ((e.getSource() == getInspectionMenuItem())) {
090: connEtoC8(e);
091: }
092: // user code begin {2}
093: // user code end
094: }
095:
096: /**
097: * Comment
098: */
099: private void _actionRemoveRequest() {
100: if (controller != null) {
101: controller._removeRequest(ridStr);
102: }
103: }
104:
105: /**
106: * connEtoC1: (InnerPanel.mouse.mousePressed(java.awt.event.MouseEvent) --> QueueListItem._actionMousePressed(Ljava.awt.event.MouseEvent;)V)
107: * @param arg1 java.awt.event.MouseEvent
108: */
109: /* WARNING: THIS METHOD WILL BE REGENERATED. */
110: private void connEtoC1(java.awt.event.MouseEvent arg1) {
111: try {
112: // user code begin {1}
113: // user code end
114: this ._actionMousePressed(arg1);
115: // user code begin {2}
116: // user code end
117: } catch (java.lang.Throwable ivjExc) {
118: // user code begin {3}
119: // user code end
120: handleException(ivjExc);
121: }
122: }
123:
124: /**
125: * connEtoC2: (RequestLabel.mouse.mousePressed(java.awt.event.MouseEvent) --> QueueListItem._actionMousePressed(Ljava.awt.event.MouseEvent;)V)
126: * @param arg1 java.awt.event.MouseEvent
127: */
128: /* WARNING: THIS METHOD WILL BE REGENERATED. */
129: private void connEtoC2(java.awt.event.MouseEvent arg1) {
130: try {
131: // user code begin {1}
132: // user code end
133: this ._actionMousePressed(arg1);
134: // user code begin {2}
135: // user code end
136: } catch (java.lang.Throwable ivjExc) {
137: // user code begin {3}
138: // user code end
139: handleException(ivjExc);
140: }
141: }
142:
143: /**
144: * connEtoC3: (ObjectLabel.mouse.mousePressed(java.awt.event.MouseEvent) --> QueueListItem._actionMousePressed(Ljava.awt.event.MouseEvent;)V)
145: * @param arg1 java.awt.event.MouseEvent
146: */
147: /* WARNING: THIS METHOD WILL BE REGENERATED. */
148: private void connEtoC3(java.awt.event.MouseEvent arg1) {
149: try {
150: // user code begin {1}
151: // user code end
152: this ._actionMousePressed(arg1);
153: // user code begin {2}
154: // user code end
155: } catch (java.lang.Throwable ivjExc) {
156: // user code begin {3}
157: // user code end
158: handleException(ivjExc);
159: }
160: }
161:
162: /**
163: * connEtoC4: (InnerPanel.mouse.mouseReleased(java.awt.event.MouseEvent) --> QueueListItem._actionMouseReleased(Ljava.awt.event.MouseEvent;)V)
164: * @param arg1 java.awt.event.MouseEvent
165: */
166: /* WARNING: THIS METHOD WILL BE REGENERATED. */
167: private void connEtoC4(java.awt.event.MouseEvent arg1) {
168: try {
169: // user code begin {1}
170: // user code end
171: this ._actionMouseReleased(arg1);
172: // user code begin {2}
173: // user code end
174: } catch (java.lang.Throwable ivjExc) {
175: // user code begin {3}
176: // user code end
177: handleException(ivjExc);
178: }
179: }
180:
181: /**
182: * connEtoC5: (RequestLabel.mouse.mouseReleased(java.awt.event.MouseEvent) --> QueueListItem._actionMouseReleased(Ljava.awt.event.MouseEvent;)V)
183: * @param arg1 java.awt.event.MouseEvent
184: */
185: /* WARNING: THIS METHOD WILL BE REGENERATED. */
186: private void connEtoC5(java.awt.event.MouseEvent arg1) {
187: try {
188: // user code begin {1}
189: // user code end
190: this ._actionMouseReleased(arg1);
191: // user code begin {2}
192: // user code end
193: } catch (java.lang.Throwable ivjExc) {
194: // user code begin {3}
195: // user code end
196: handleException(ivjExc);
197: }
198: }
199:
200: /**
201: * connEtoC6: (ObjectLabel.mouse.mouseReleased(java.awt.event.MouseEvent) --> QueueListItem._actionMouseReleased(Ljava.awt.event.MouseEvent;)V)
202: * @param arg1 java.awt.event.MouseEvent
203: */
204: /* WARNING: THIS METHOD WILL BE REGENERATED. */
205: private void connEtoC6(java.awt.event.MouseEvent arg1) {
206: try {
207: // user code begin {1}
208: // user code end
209: this ._actionMouseReleased(arg1);
210: // user code begin {2}
211: // user code end
212: } catch (java.lang.Throwable ivjExc) {
213: // user code begin {3}
214: // user code end
215: handleException(ivjExc);
216: }
217: }
218:
219: /**
220: * connEtoC7: (RemoveMenuItem.action.actionPerformed(java.awt.event.ActionEvent) --> QueueListItem._actionRemoveRequest()V)
221: * @param arg1 java.awt.event.ActionEvent
222: */
223: /* WARNING: THIS METHOD WILL BE REGENERATED. */
224: private void connEtoC7(java.awt.event.ActionEvent arg1) {
225: try {
226: // user code begin {1}
227: // user code end
228: this ._actionRemoveRequest();
229: // user code begin {2}
230: // user code end
231: } catch (java.lang.Throwable ivjExc) {
232: // user code begin {3}
233: // user code end
234: handleException(ivjExc);
235: }
236: }
237:
238: /**
239: * connEtoC8: (InspectionMenuItem.action.actionPerformed(java.awt.event.ActionEvent) --> QueueListItem._actionInspectRequest()V)
240: * @param arg1 java.awt.event.ActionEvent
241: */
242: /* WARNING: THIS METHOD WILL BE REGENERATED. */
243: private void connEtoC8(java.awt.event.ActionEvent arg1) {
244: try {
245: // user code begin {1}
246: // user code end
247: this ._actionInspectRequest();
248: // user code begin {2}
249: // user code end
250: } catch (java.lang.Throwable ivjExc) {
251: // user code begin {3}
252: // user code end
253: handleException(ivjExc);
254: }
255: }
256:
257: public void _correctWidth(int diff_width) {
258: }
259:
260: java.awt.Label _getFirstLabel() {
261: return getRequestLabel();
262: }
263:
264: /**
265: * Return the InnerPanel property value.
266: * @return java.awt.Panel
267: */
268: /* WARNING: THIS METHOD WILL BE REGENERATED. */
269: private java.awt.Panel getInnerPanel() {
270: if (ivjInnerPanel == null) {
271: try {
272: ivjInnerPanel = new java.awt.Panel();
273: ivjInnerPanel.setName("InnerPanel");
274: ivjInnerPanel.setLayout(null);
275: ivjInnerPanel.setBackground(java.awt.Color.lightGray);
276: ivjInnerPanel.setBounds(0, 1, 1200, 13);
277: getInnerPanel().add(getRequestLabel(),
278: getRequestLabel().getName());
279: getInnerPanel().add(getObjectLabel(),
280: getObjectLabel().getName());
281: // user code begin {1}
282: // user code end
283: } catch (java.lang.Throwable ivjExc) {
284: // user code begin {2}
285: // user code end
286: handleException(ivjExc);
287: }
288: }
289: ;
290: return ivjInnerPanel;
291: }
292:
293: /**
294: * Return the InspectionMenuItem property value.
295: * @return java.awt.MenuItem
296: */
297: /* WARNING: THIS METHOD WILL BE REGENERATED. */
298: private java.awt.MenuItem getInspectionMenuItem() {
299: if (ivjInspectionMenuItem == null) {
300: try {
301: ivjInspectionMenuItem = new java.awt.MenuItem();
302: ivjInspectionMenuItem.setEnabled(true);
303: ivjInspectionMenuItem
304: .setLabel("Inspect Request Object");
305: // user code begin {1}
306: // user code end
307: } catch (java.lang.Throwable ivjExc) {
308: // user code begin {2}
309: // user code end
310: handleException(ivjExc);
311: }
312: }
313: ;
314: return ivjInspectionMenuItem;
315: }
316:
317: /**
318: * Return the Label1 property value.
319: * @return java.awt.Label
320: */
321: /* WARNING: THIS METHOD WILL BE REGENERATED. */
322: private java.awt.Label getObjectLabel() {
323: if (ivjObjectLabel == null) {
324: try {
325: ivjObjectLabel = new java.awt.Label();
326: ivjObjectLabel.setName("ObjectLabel");
327: ivjObjectLabel.setFont(new java.awt.Font("dialog", 0,
328: 10));
329: ivjObjectLabel.setText("Label2");
330: ivjObjectLabel.setBounds(200, 0, 990, 13);
331: // user code begin {1}
332: // user code end
333: } catch (java.lang.Throwable ivjExc) {
334: // user code begin {2}
335: // user code end
336: handleException(ivjExc);
337: }
338: }
339: ;
340: return ivjObjectLabel;
341: }
342:
343: /**
344: * Return the PopupMenu property value.
345: * @return org.jacorb.poa.gui.beans.PopupMenu
346: */
347: /* WARNING: THIS METHOD WILL BE REGENERATED. */
348: private org.jacorb.poa.gui.beans.PopupMenu getPopupMenu() {
349: if (ivjPopupMenu == null) {
350: try {
351: ivjPopupMenu = new org.jacorb.poa.gui.beans.PopupMenu();
352: ivjPopupMenu.setLabel("Request Actions");
353: ivjPopupMenu.add(getRemoveMenuItem());
354: ivjPopupMenu.add(getInspectionMenuItem());
355: // user code begin {1}
356: // user code end
357: } catch (java.lang.Throwable ivjExc) {
358: // user code begin {2}
359: // user code end
360: handleException(ivjExc);
361: }
362: }
363: ;
364: return ivjPopupMenu;
365: }
366:
367: /**
368: * Return the RemoveMenuItem property value.
369: * @return java.awt.MenuItem
370: */
371: /* WARNING: THIS METHOD WILL BE REGENERATED. */
372: private java.awt.MenuItem getRemoveMenuItem() {
373: if (ivjRemoveMenuItem == null) {
374: try {
375: ivjRemoveMenuItem = new java.awt.MenuItem();
376: ivjRemoveMenuItem.setLabel("Remove Request from Queue");
377: // user code begin {1}
378: // user code end
379: } catch (java.lang.Throwable ivjExc) {
380: // user code begin {2}
381: // user code end
382: handleException(ivjExc);
383: }
384: }
385: ;
386: return ivjRemoveMenuItem;
387: }
388:
389: /**
390: * Return the RequestLabel property value.
391: * @return java.awt.Label
392: */
393: /* WARNING: THIS METHOD WILL BE REGENERATED. */
394: private java.awt.Label getRequestLabel() {
395: if (ivjRequestLabel == null) {
396: try {
397: ivjRequestLabel = new java.awt.Label();
398: ivjRequestLabel.setName("RequestLabel");
399: ivjRequestLabel.setFont(new java.awt.Font("dialog", 0,
400: 10));
401: ivjRequestLabel.setText("Label1");
402: ivjRequestLabel.setBounds(10, 0, 180, 13);
403: // user code begin {1}
404: // user code end
405: } catch (java.lang.Throwable ivjExc) {
406: // user code begin {2}
407: // user code end
408: handleException(ivjExc);
409: }
410: }
411: ;
412: return ivjRequestLabel;
413: }
414:
415: java.awt.Label _getSecondLabel() {
416: return getObjectLabel();
417: }
418:
419: /**
420: * Called whenever the part throws an exception.
421: * @param exception java.lang.Throwable
422: */
423: private void handleException(Throwable exception) {
424:
425: /* Uncomment the following lines to print uncaught exceptions to stdout */
426: // System.out.println("--------- UNCAUGHT EXCEPTION ---------");
427: // exception.printStackTrace(System.out);
428: }
429:
430: /**
431: * Initializes connections
432: */
433: /* WARNING: THIS METHOD WILL BE REGENERATED. */
434: private void initConnections() {
435: // user code begin {1}
436: // user code end
437: getInnerPanel().addMouseListener(this );
438: getRequestLabel().addMouseListener(this );
439: getObjectLabel().addMouseListener(this );
440: getRemoveMenuItem().addActionListener(this );
441: getInspectionMenuItem().addActionListener(this );
442: }
443:
444: /**
445: * Initialize the class.
446: */
447: /* WARNING: THIS METHOD WILL BE REGENERATED. */
448: private void initialize() {
449: // user code begin {1}
450: // user code end
451: setName("QueueListItem");
452: setLayout(null);
453: setBackground(java.awt.Color.black);
454: setSize(1200, 15);
455: add(getInnerPanel(), getInnerPanel().getName());
456: initConnections();
457: // user code begin {2}
458: // user code end
459: }
460:
461: void _init(QueueListItemController _controller, String _ridStr) {
462: controller = _controller;
463: ridStr = _ridStr;
464: }
465:
466: /**
467: * QueueListItem constructor comment.
468: * @param layout java.awt.LayoutManager
469: */
470: public QueueListItem(java.awt.LayoutManager layout) {
471: super (layout);
472: }
473:
474: /**
475: * main entrypoint - starts the part when it is run as an application
476: * @param args java.lang.String[]
477: */
478: public static void main(java.lang.String[] args) {
479: try {
480: java.awt.Frame frame;
481: try {
482: Class aFrameClass = Class
483: .forName("com.ibm.uvm.abt.edit.TestFrame");
484: frame = (java.awt.Frame) aFrameClass.newInstance();
485: } catch (java.lang.Throwable ivjExc) {
486: frame = new java.awt.Frame();
487: }
488: QueueListItem aQueueListItem;
489: aQueueListItem = new QueueListItem();
490: frame.add("Center", aQueueListItem);
491: frame.setSize(aQueueListItem.getSize());
492: frame.setVisible(true);
493: } catch (Throwable exception) {
494: System.err
495: .println("Exception occurred in main() of java.awt.Panel");
496: exception.printStackTrace(System.out);
497: }
498: }
499:
500: /**
501: * Method to handle events for the MouseListener interface.
502: * @param e java.awt.event.MouseEvent
503: */
504: /* WARNING: THIS METHOD WILL BE REGENERATED. */
505: public void mouseClicked(java.awt.event.MouseEvent e) {
506: // user code begin {1}
507: // user code end
508: // user code begin {2}
509: // user code end
510: }
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 mouseEntered(java.awt.event.MouseEvent e) {
518: // user code begin {1}
519: // user code end
520: // user code begin {2}
521: // user code end
522: }
523:
524: /**
525: * Method to handle events for the MouseListener interface.
526: * @param e java.awt.event.MouseEvent
527: */
528: /* WARNING: THIS METHOD WILL BE REGENERATED. */
529: public void mouseExited(java.awt.event.MouseEvent e) {
530: // user code begin {1}
531: // user code end
532: // user code begin {2}
533: // user code end
534: }
535:
536: /**
537: * Method to handle events for the MouseListener interface.
538: * @param e java.awt.event.MouseEvent
539: */
540: /* WARNING: THIS METHOD WILL BE REGENERATED. */
541: public void mousePressed(java.awt.event.MouseEvent e) {
542: // user code begin {1}
543: // user code end
544: if ((e.getSource() == getInnerPanel())) {
545: connEtoC1(e);
546: }
547: if ((e.getSource() == getRequestLabel())) {
548: connEtoC2(e);
549: }
550: if ((e.getSource() == getObjectLabel())) {
551: connEtoC3(e);
552: }
553: // user code begin {2}
554: // user code end
555: }
556:
557: /**
558: * Method to handle events for the MouseListener interface.
559: * @param e java.awt.event.MouseEvent
560: */
561: /* WARNING: THIS METHOD WILL BE REGENERATED. */
562: public void mouseReleased(java.awt.event.MouseEvent e) {
563: // user code begin {1}
564: // user code end
565: if ((e.getSource() == getInnerPanel())) {
566: connEtoC4(e);
567: }
568: if ((e.getSource() == getRequestLabel())) {
569: connEtoC5(e);
570: }
571: if ((e.getSource() == getObjectLabel())) {
572: connEtoC6(e);
573: }
574: // user code begin {2}
575: // user code end
576: }
577:
578: public void _setContainer(DoubleListDialog _container) {
579: container = _container;
580: }
581:
582: public void _setSelected(boolean selected) {
583: if (selected) {
584: getInnerPanel().setBackground(java.awt.Color.darkGray);
585: getRequestLabel().setBackground(java.awt.Color.darkGray);
586: getObjectLabel().setBackground(java.awt.Color.darkGray);
587: getRequestLabel().setForeground(java.awt.Color.white);
588: getObjectLabel().setForeground(java.awt.Color.white);
589:
590: } else {
591: getInnerPanel().setBackground(java.awt.Color.lightGray);
592: getRequestLabel().setBackground(java.awt.Color.lightGray);
593: getObjectLabel().setBackground(java.awt.Color.lightGray);
594: getRequestLabel().setForeground(java.awt.Color.black);
595: getObjectLabel().setForeground(java.awt.Color.black);
596: }
597: }
598:
599: void _setWidth(int w1, int w2) {
600: getRequestLabel().setSize(w1, 13);
601: getObjectLabel().setBounds(20 + w1, 0, 1200 - (w1 + 20), 13);
602: }
603:
604: /**
605: * Constructor
606: */
607: /* WARNING: THIS METHOD WILL BE REGENERATED. */
608: public QueueListItem() {
609: super();
610: initialize();
611: }
612: }
|