1 package org.jacorb.poa.gui.pm; 2 3 22 23 27 public class RegisterPanel extends java.awt.Panel implements java.awt.event.ActionListener , java.awt.event.MouseListener { 28 private RegisterPanelController controller; 29 private java.awt.List ivjPOAList = null; 30 private java.awt.Label ivjRegisterLabel = null; 31 private java.awt.BorderLayout ivjRegisterPanelBorderLayout = null; 32 private java.awt.MenuItem ivjCloseMenuItem = null; 33 private java.awt.MenuItem ivjDestroyMenuItem = null; 34 private java.awt.MenuItem ivjOpenMenuItem = null; 35 private org.jacorb.poa.gui.beans.PopupMenu ivjPopupMenu = null; 36 39 40 public RegisterPanel() { 41 super(); 42 initialize(); 43 } 44 48 public RegisterPanel(java.awt.LayoutManager layout) { 49 super(layout); 50 } 51 54 private void _actionClosePOAMonitor(String item) { 55 if (controller != null) { 56 controller._actionClosePOAMonitor(item); 57 } 58 } 59 62 private void _actionDestroyPOA(String item) { 63 if (controller != null) { 64 controller._actionDestroyPOA(item); 65 } 66 } 67 70 private void _actionMousePressed(java.awt.event.MouseEvent e) { 71 if (getPOAList().getSelectedItem() != null) { 72 int mods = e.getModifiers(); 73 if ((mods & java.awt.event.MouseEvent.BUTTON3_MASK) != 0) { 74 75 getPopupMenu()._show(this, getBounds().width, e.getY()+10); 76 } else if ((mods & java.awt.event.MouseEvent.BUTTON2_MASK) != 0) { 77 78 } else { 79 80 if (e.getClickCount() > 1) { 81 82 _actionOpenPOAMonitor(getPOAList().getSelectedItem()); 83 } 84 } 85 } 86 } 87 90 private void _actionOpenPOAMonitor(String item) { 91 if (controller != null) { 92 controller._actionOpenPOAMonitor(item); 93 } 94 } 95 java.awt.List _getPOAList() { 96 return getPOAList(); 97 } 98 void _init(RegisterPanelController _controller) { 99 controller = _controller; 100 } 101 105 106 public void actionPerformed(java.awt.event.ActionEvent e) { 107 if ((e.getSource() == getOpenMenuItem()) ) { 110 connEtoC2(e); 111 } 112 if ((e.getSource() == getCloseMenuItem()) ) { 113 connEtoC3(e); 114 } 115 if ((e.getSource() == getDestroyMenuItem()) ) { 116 connEtoC4(e); 117 } 118 } 121 125 126 private void connEtoC1(java.awt.event.MouseEvent arg1) { 127 try { 128 this._actionMousePressed(arg1); 131 } catch (java.lang.Throwable ivjExc) { 134 handleException(ivjExc); 137 } 138 } 139 143 144 private void connEtoC2(java.awt.event.ActionEvent arg1) { 145 try { 146 this._actionOpenPOAMonitor(getPOAList().getSelectedItem()); 149 } catch (java.lang.Throwable ivjExc) { 152 handleException(ivjExc); 155 } 156 } 157 161 162 private void connEtoC3(java.awt.event.ActionEvent arg1) { 163 try { 164 this._actionClosePOAMonitor(getPOAList().getSelectedItem()); 167 } catch (java.lang.Throwable ivjExc) { 170 handleException(ivjExc); 173 } 174 } 175 179 180 private void connEtoC4(java.awt.event.ActionEvent arg1) { 181 try { 182 this._actionDestroyPOA(getPOAList().getSelectedItem()); 185 } catch (java.lang.Throwable ivjExc) { 188 handleException(ivjExc); 191 } 192 } 193 197 198 private java.awt.MenuItem getCloseMenuItem() { 199 if (ivjCloseMenuItem == null) { 200 try { 201 ivjCloseMenuItem = new java.awt.MenuItem (); 202 ivjCloseMenuItem.setLabel("Close Monitor"); 203 } catch (java.lang.Throwable ivjExc) { 206 handleException(ivjExc); 209 } 210 }; 211 return ivjCloseMenuItem; 212 } 213 217 218 private java.awt.MenuItem getDestroyMenuItem() { 219 if (ivjDestroyMenuItem == null) { 220 try { 221 ivjDestroyMenuItem = new java.awt.MenuItem (); 222 ivjDestroyMenuItem.setLabel("Destroy POA"); 223 } catch (java.lang.Throwable ivjExc) { 226 handleException(ivjExc); 229 } 230 }; 231 return ivjDestroyMenuItem; 232 } 233 237 238 private java.awt.MenuItem getOpenMenuItem() { 239 if (ivjOpenMenuItem == null) { 240 try { 241 ivjOpenMenuItem = new java.awt.MenuItem (); 242 ivjOpenMenuItem.setLabel("Open Monitor"); 243 } catch (java.lang.Throwable ivjExc) { 246 handleException(ivjExc); 249 } 250 }; 251 return ivjOpenMenuItem; 252 } 253 257 258 private java.awt.List getPOAList() { 259 if (ivjPOAList == null) { 260 try { 261 ivjPOAList = new java.awt.List (); 262 ivjPOAList.setName("POAList"); 263 ivjPOAList.setFont(new java.awt.Font ("dialog", 0, 10)); 264 ivjPOAList.setBackground(java.awt.SystemColor.activeCaptionText); 265 } catch (java.lang.Throwable ivjExc) { 268 handleException(ivjExc); 271 } 272 }; 273 return ivjPOAList; 274 } 275 279 280 private org.jacorb.poa.gui.beans.PopupMenu getPopupMenu() { 281 if (ivjPopupMenu == null) { 282 try { 283 ivjPopupMenu = new org.jacorb.poa.gui.beans.PopupMenu(); 284 ivjPopupMenu.setLabel("POA Actions"); 285 ivjPopupMenu.add(getOpenMenuItem()); 286 ivjPopupMenu.add(getCloseMenuItem()); 287 ivjPopupMenu.add(getDestroyMenuItem()); 288 } catch (java.lang.Throwable ivjExc) { 291 handleException(ivjExc); 294 } 295 }; 296 return ivjPopupMenu; 297 } 298 302 303 private java.awt.Label getRegisterLabel() { 304 if (ivjRegisterLabel == null) { 305 try { 306 ivjRegisterLabel = new java.awt.Label (); 307 ivjRegisterLabel.setName("RegisterLabel"); 308 ivjRegisterLabel.setText("Registered POA's:"); 309 ivjRegisterLabel.setBackground(java.awt.SystemColor.control); 310 ivjRegisterLabel.setForeground(java.awt.Color.black); 311 } catch (java.lang.Throwable ivjExc) { 314 handleException(ivjExc); 317 } 318 }; 319 return ivjRegisterLabel; 320 } 321 325 326 private java.awt.BorderLayout getRegisterPanelBorderLayout() { 327 java.awt.BorderLayout ivjRegisterPanelBorderLayout = null; 328 try { 329 330 ivjRegisterPanelBorderLayout = new java.awt.BorderLayout (); 331 ivjRegisterPanelBorderLayout.setVgap(0); 332 ivjRegisterPanelBorderLayout.setHgap(0); 333 } catch (java.lang.Throwable ivjExc) { 334 handleException(ivjExc); 335 }; 336 return ivjRegisterPanelBorderLayout; 337 } 338 342 private void handleException(Throwable exception) { 343 344 345 } 348 351 352 private void initConnections() { 353 getPOAList().addMouseListener(this); 356 getOpenMenuItem().addActionListener(this); 357 getCloseMenuItem().addActionListener(this); 358 getDestroyMenuItem().addActionListener(this); 359 } 360 363 364 private void initialize() { 365 setName("RegisterPanel"); 368 setLayout(getRegisterPanelBorderLayout()); 369 setBackground(java.awt.SystemColor.control); 370 setSize(150, 90); 371 add(getRegisterLabel(), "North"); 372 add(getPOAList(), "Center"); 373 initConnections(); 374 } 377 381 public static void main(java.lang.String [] args) { 382 try { 383 java.awt.Frame frame; 384 try { 385 Class aFrameClass = Class.forName("com.ibm.uvm.abt.edit.TestFrame"); 386 frame = (java.awt.Frame )aFrameClass.newInstance(); 387 } catch (java.lang.Throwable ivjExc) { 388 frame = new java.awt.Frame (); 389 } 390 RegisterPanel aRegisterPanel; 391 aRegisterPanel = new RegisterPanel(); 392 frame.add("Center", aRegisterPanel); 393 frame.setSize(aRegisterPanel.getSize()); 394 frame.setVisible(true); 395 } catch (Throwable exception) { 396 System.err.println("Exception occurred in main() of java.awt.Panel"); 397 exception.printStackTrace(System.out); 398 } 399 } 400 404 405 public void mouseClicked(java.awt.event.MouseEvent e) { 406 } 411 415 416 public void mouseEntered(java.awt.event.MouseEvent e) { 417 } 422 426 427 public void mouseExited(java.awt.event.MouseEvent e) { 428 } 433 437 438 public void mousePressed(java.awt.event.MouseEvent e) { 439 } 444 448 449 public void mouseReleased(java.awt.event.MouseEvent e) { 450 if ((e.getSource() == getPOAList()) ) { 453 connEtoC1(e); 454 } 455 } 458 459 } 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | Popular Tags |