1 package org.jacorb.poa.gui.poa; 2 3 22 23 import org.jacorb.poa.gui.beans.DoubleListDialog; 24 25 29 public class ObjectListItem 30 extends java.awt.Panel 31 implements org.jacorb.poa.gui.beans.DoubleListItem, java.awt.event.ActionListener , java.awt.event.MouseListener 32 { 33 public DoubleListDialog container; 34 private ObjectListItemController controller; 35 private String oidStr; 36 private java.awt.MenuItem ivjDeactivateMenuItem = null; 37 private java.awt.MenuItem ivjInspectionMenuItem = null; 38 private org.jacorb.poa.gui.beans.PopupMenu ivjPopupMenu = null; 39 private java.awt.Panel ivjInnerPanel = null; 40 private java.awt.Label ivjObjectLabel = null; 41 private java.awt.Label ivjServantLabel = null; 42 45 private void _actionDeactivateObject() { 46 if (controller != null) { 47 controller._actionDeactivateObject(oidStr); 48 } 49 } 50 53 private void _actionInspectServantClass() { 54 if (controller != null) { 55 controller._inspectServantClass(oidStr); 56 } 57 } 58 61 private void _actionMousePressed(java.awt.event.MouseEvent e) { 62 if (container != null) { 63 container._setSelectedItem(this); 64 } 65 } 66 69 private void _actionMouseReleased(java.awt.event.MouseEvent e) { 70 int mods = e.getModifiers(); 71 if ((mods & java.awt.event.MouseEvent.BUTTON3_MASK) != 0) { 72 73 getPopupMenu()._show(e); 74 } else if ((mods & java.awt.event.MouseEvent.BUTTON2_MASK) != 0) { 75 76 } else { 77 78 if (e.getClickCount() > 1) { 79 80 } 81 } 82 } 83 87 88 public void actionPerformed(java.awt.event.ActionEvent e) { 89 if ((e.getSource() == getDeactivateMenuItem()) ) { 92 connEtoC4(e); 93 } 94 if ((e.getSource() == getInspectionMenuItem()) ) { 95 connEtoC5(e); 96 } 97 } 100 104 105 private void connEtoC1(java.awt.event.MouseEvent arg1) { 106 try { 107 this._actionMousePressed(arg1); 110 } catch (java.lang.Throwable ivjExc) { 113 handleException(ivjExc); 116 } 117 } 118 122 123 private void connEtoC2(java.awt.event.MouseEvent arg1) { 124 try { 125 this._actionMousePressed(arg1); 128 } catch (java.lang.Throwable ivjExc) { 131 handleException(ivjExc); 134 } 135 } 136 140 141 private void connEtoC3(java.awt.event.MouseEvent arg1) { 142 try { 143 this._actionMousePressed(arg1); 146 } catch (java.lang.Throwable ivjExc) { 149 handleException(ivjExc); 152 } 153 } 154 158 159 private void connEtoC4(java.awt.event.ActionEvent arg1) { 160 try { 161 this._actionDeactivateObject(); 164 } catch (java.lang.Throwable ivjExc) { 167 handleException(ivjExc); 170 } 171 } 172 176 177 private void connEtoC5(java.awt.event.ActionEvent arg1) { 178 try { 179 this._actionInspectServantClass(); 182 } catch (java.lang.Throwable ivjExc) { 185 handleException(ivjExc); 188 } 189 } 190 194 195 private void connEtoC6(java.awt.event.MouseEvent arg1) { 196 try { 197 this._actionMouseReleased(arg1); 200 } catch (java.lang.Throwable ivjExc) { 203 handleException(ivjExc); 206 } 207 } 208 212 213 private void connEtoC7(java.awt.event.MouseEvent arg1) { 214 try { 215 this._actionMouseReleased(arg1); 218 } catch (java.lang.Throwable ivjExc) { 221 handleException(ivjExc); 224 } 225 } 226 230 231 private void connEtoC8(java.awt.event.MouseEvent arg1) { 232 try { 233 this._actionMouseReleased(arg1); 236 } catch (java.lang.Throwable ivjExc) { 239 handleException(ivjExc); 242 } 243 } 244 public void _correctWidth(int diff_width) { 245 257 } 258 262 263 private java.awt.MenuItem getDeactivateMenuItem() { 264 if (ivjDeactivateMenuItem == null) { 265 try { 266 ivjDeactivateMenuItem = new java.awt.MenuItem (); 267 ivjDeactivateMenuItem.setLabel("Deactivate Object"); 268 } catch (java.lang.Throwable ivjExc) { 271 handleException(ivjExc); 274 } 275 }; 276 return ivjDeactivateMenuItem; 277 } 278 java.awt.Label _getFirstLabel() { 279 return getObjectLabel(); 280 } 281 285 286 private java.awt.Panel getInnerPanel() { 287 if (ivjInnerPanel == null) { 288 try { 289 ivjInnerPanel = new java.awt.Panel (); 290 ivjInnerPanel.setName("InnerPanel"); 291 ivjInnerPanel.setLayout(null); 292 ivjInnerPanel.setBackground(java.awt.Color.lightGray); 293 ivjInnerPanel.setBounds(0, 1, 1200, 13); 294 getInnerPanel().add(getObjectLabel(), getObjectLabel().getName()); 295 getInnerPanel().add(getServantLabel(), getServantLabel().getName()); 296 } catch (java.lang.Throwable ivjExc) { 299 handleException(ivjExc); 302 } 303 }; 304 return ivjInnerPanel; 305 } 306 310 311 private java.awt.MenuItem getInspectionMenuItem() { 312 if (ivjInspectionMenuItem == null) { 313 try { 314 ivjInspectionMenuItem = new java.awt.MenuItem (); 315 ivjInspectionMenuItem.setEnabled(true); 316 ivjInspectionMenuItem.setLabel("Inspect Servant Class"); 317 } catch (java.lang.Throwable ivjExc) { 320 handleException(ivjExc); 323 } 324 }; 325 return ivjInspectionMenuItem; 326 } 327 331 332 private java.awt.Label getObjectLabel() { 333 if (ivjObjectLabel == null) { 334 try { 335 ivjObjectLabel = new java.awt.Label (); 336 ivjObjectLabel.setName("ObjectLabel"); 337 ivjObjectLabel.setFont(new java.awt.Font ("dialog", 0, 10)); 338 ivjObjectLabel.setText("Label1"); 339 ivjObjectLabel.setBounds(10, 0, 180, 13); 340 } catch (java.lang.Throwable ivjExc) { 343 handleException(ivjExc); 346 } 347 }; 348 return ivjObjectLabel; 349 } 350 354 355 private org.jacorb.poa.gui.beans.PopupMenu getPopupMenu() { 356 if (ivjPopupMenu == null) { 357 try { 358 ivjPopupMenu = new org.jacorb.poa.gui.beans.PopupMenu(); 359 ivjPopupMenu.setLabel("Object Actions"); 360 ivjPopupMenu.add(getDeactivateMenuItem()); 361 ivjPopupMenu.add(getInspectionMenuItem()); 362 } catch (java.lang.Throwable ivjExc) { 365 handleException(ivjExc); 368 } 369 }; 370 return ivjPopupMenu; 371 } 372 java.awt.Label _getSecondLabel() { 373 return getServantLabel(); 374 } 375 379 380 private java.awt.Label getServantLabel() { 381 if (ivjServantLabel == null) { 382 try { 383 ivjServantLabel = new java.awt.Label (); 384 ivjServantLabel.setName("ServantLabel"); 385 ivjServantLabel.setFont(new java.awt.Font ("dialog", 0, 10)); 386 ivjServantLabel.setText("Label2"); 387 ivjServantLabel.setBounds(200, 0, 990, 13); 388 } catch (java.lang.Throwable ivjExc) { 391 handleException(ivjExc); 394 } 395 }; 396 return ivjServantLabel; 397 } 398 402 private void handleException(Throwable exception) { 403 404 405 } 408 411 412 private void initConnections() { 413 getServantLabel().addMouseListener(this); 416 getObjectLabel().addMouseListener(this); 417 getInnerPanel().addMouseListener(this); 418 getDeactivateMenuItem().addActionListener(this); 419 getInspectionMenuItem().addActionListener(this); 420 } 421 424 425 private void initialize() { 426 setName("ObjectListItem"); 429 setLayout(null); 430 setBackground(java.awt.Color.black); 431 setSize(1200, 15); 432 add(getInnerPanel(), getInnerPanel().getName()); 433 initConnections(); 434 } 437 void _init(ObjectListItemController _controller, String _oidStr) { 438 controller = _controller; 439 oidStr = _oidStr; 440 } 441 445 public ObjectListItem(java.awt.LayoutManager layout) { 446 super(layout); 447 } 448 452 public static void main(java.lang.String [] args) { 453 try { 454 java.awt.Frame frame; 455 try { 456 Class aFrameClass = Class.forName("com.ibm.uvm.abt.edit.TestFrame"); 457 frame = (java.awt.Frame )aFrameClass.newInstance(); 458 } catch (java.lang.Throwable ivjExc) { 459 frame = new java.awt.Frame (); 460 } 461 ObjectListItem aObjectListItem; 462 aObjectListItem = new ObjectListItem(); 463 frame.add("Center", aObjectListItem); 464 frame.setSize(aObjectListItem.getSize()); 465 frame.setVisible(true); 466 } catch (Throwable exception) { 467 System.err.println("Exception occurred in main() of java.awt.Panel"); 468 exception.printStackTrace(System.out); 469 } 470 } 471 475 476 public void mouseClicked(java.awt.event.MouseEvent e) { 477 } 482 486 487 public void mouseEntered(java.awt.event.MouseEvent e) { 488 } 493 497 498 public void mouseExited(java.awt.event.MouseEvent e) { 499 } 504 508 509 public void mousePressed(java.awt.event.MouseEvent e) { 510 if ((e.getSource() == getServantLabel()) ) { 513 connEtoC1(e); 514 } 515 if ((e.getSource() == getObjectLabel()) ) { 516 connEtoC2(e); 517 } 518 if ((e.getSource() == getInnerPanel()) ) { 519 connEtoC3(e); 520 } 521 } 524 528 529 public void mouseReleased(java.awt.event.MouseEvent e) { 530 if ((e.getSource() == getObjectLabel()) ) { 533 connEtoC6(e); 534 } 535 if ((e.getSource() == getInnerPanel()) ) { 536 connEtoC7(e); 537 } 538 if ((e.getSource() == getServantLabel()) ) { 539 connEtoC8(e); 540 } 541 } 544 public void _setContainer(DoubleListDialog _container) { 545 container = _container; 546 } 547 public void _setSelected(boolean selected) { 548 if (selected) { 549 getInnerPanel().setBackground(java.awt.Color.darkGray); 550 getObjectLabel().setBackground(java.awt.Color.darkGray); 551 getServantLabel().setBackground(java.awt.Color.darkGray); 552 getObjectLabel().setForeground(java.awt.Color.white); 553 getServantLabel().setForeground(java.awt.Color.white); 554 555 } else { 556 getInnerPanel().setBackground(java.awt.Color.lightGray); 557 getObjectLabel().setBackground(java.awt.Color.lightGray); 558 getServantLabel().setBackground(java.awt.Color.lightGray); 559 getObjectLabel().setForeground(java.awt.Color.black); 560 getServantLabel().setForeground(java.awt.Color.black); 561 } 562 } 563 void _setWidth(int w1, int w2) { 564 getObjectLabel().setSize(w1, 13); 565 getServantLabel().setBounds(20+w1, 0, 1200-(w1+20), 13); 566 574 } 575 578 579 public ObjectListItem() { 580 super(); 581 initialize(); 582 } 583 } 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | Popular Tags |