1 package org.jacorb.poa.gui.beans; 2 3 22 23 30 public class DoubleListDialog extends java.awt.Dialog implements CloseButtonPanelController, java.awt.event.ComponentListener , java.awt.event.MouseListener , java.awt.event.WindowListener { 31 private DoubleListItem selectedItem = null; 32 private int curr_width = 0; 33 private int init_width = 0; 34 private int curr_width_wp = 0; 35 private int init_width_wp = 0; 36 private int itemCount = 0; 37 private CloseButtonPanel ivjButtonPanel = null; 38 private java.awt.Panel ivjContentsPane = null; 39 private java.awt.Panel ivjInnerPanel = null; 40 private java.awt.ScrollPane ivjScrollPane = null; 41 private java.awt.Panel ivjWorkPanel = null; 42 private DoubleListHeaderPanel ivjHeaderPanel = null; 43 47 48 public DoubleListDialog(java.awt.Frame parent) { 49 super(parent); 50 initialize(); 51 } 52 57 public DoubleListDialog(java.awt.Frame parent, String title) { 58 super(parent, title); 59 initialize(); 60 } 61 67 public DoubleListDialog(java.awt.Frame parent, String title, boolean modal) { 68 super(parent, title, modal); 69 initialize(); 70 } 71 76 public DoubleListDialog(java.awt.Frame parent, boolean modal) { 77 super(parent, modal); 78 initialize(); 79 } 80 public void _actionCloseButtonPressed() { 81 dispose(); 82 } 83 86 public void _actionMousePressed(java.awt.event.MouseEvent mouseEvent) { 87 _setSelectedItem(null); 88 } 89 92 private void _actionWindowResized(java.awt.event.ComponentEvent componentEvent) { 93 int width = getBounds().width; 94 95 int diff = (width-12) - curr_width_wp; 96 97 if (width > init_width) { 98 curr_width_wp = curr_width_wp + diff; 99 } else { 100 curr_width_wp = init_width_wp; 101 } 102 103 getWorkPanel().setSize(curr_width_wp, getWorkPanel().getComponentCount()*14); 104 105 115 getScrollPane().validate(); 116 } 117 public void _addItem(DoubleListItem item) { 118 java.awt.Component c = (java.awt.Component ) item; 119 c.setLocation(0, itemCount*14); 120 getWorkPanel().add(c); 121 item._setContainer(this); 122 itemCount++; 123 } 124 public void _setHeaderLabel1(String str) { 125 getHeaderPanel()._getHeaderLabel1().setText(str); 126 } 127 public void _setHeaderLabel2(String str) { 128 getHeaderPanel()._getHeaderLabel2().setText(str); 129 } 130 public void _setSelectedItem(DoubleListItem item) { 131 if (selectedItem != null) selectedItem._setSelected(false); 132 selectedItem = item; 133 if (selectedItem != null) selectedItem._setSelected(true); 134 } 135 public void _setSize(int w1, int w2) { 136 int width1 = w1 < 100 ? 100 : w1; 137 int width2 = w2 < 100 ? 100 : w2; 138 139 init_width_wp = curr_width_wp = 10+width1+10+width2+10; 140 init_width = curr_width = init_width_wp +12; 141 142 setSize(init_width, 400); 143 getWorkPanel().setSize(init_width - 12, 0); 144 getHeaderPanel()._getHeaderLabel1().setSize(width1, 20); 145 getHeaderPanel()._getHeaderLabel2().setBounds(20+width1, 0, width2, 20); 146 } 147 151 152 public void componentHidden(java.awt.event.ComponentEvent e) { 153 } 158 162 163 public void componentMoved(java.awt.event.ComponentEvent e) { 164 } 169 173 174 public void componentResized(java.awt.event.ComponentEvent e) { 175 if ((e.getSource() == this) ) { 178 connEtoC2(e); 179 } 180 } 183 187 188 public void componentShown(java.awt.event.ComponentEvent e) { 189 } 194 198 199 private void connEtoC1(java.awt.event.WindowEvent arg1) { 200 try { 201 this.dispose(); 204 } catch (java.lang.Throwable ivjExc) { 207 handleException(ivjExc); 210 } 211 } 212 216 217 private void connEtoC2(java.awt.event.ComponentEvent arg1) { 218 try { 219 this._actionWindowResized(arg1); 222 } catch (java.lang.Throwable ivjExc) { 225 handleException(ivjExc); 228 } 229 } 230 234 235 private void connEtoC3(java.awt.event.MouseEvent arg1) { 236 try { 237 this._actionMousePressed(arg1); 240 } catch (java.lang.Throwable ivjExc) { 243 handleException(ivjExc); 246 } 247 } 248 252 253 private CloseButtonPanel getButtonPanel() { 254 if (ivjButtonPanel == null) { 255 try { 256 ivjButtonPanel = new org.jacorb.poa.gui.beans.CloseButtonPanel(); 257 ivjButtonPanel.setName("ButtonPanel"); 258 } catch (java.lang.Throwable ivjExc) { 261 handleException(ivjExc); 264 } 265 }; 266 return ivjButtonPanel; 267 } 268 272 273 private java.awt.Panel getContentsPane() { 274 if (ivjContentsPane == null) { 275 try { 276 ivjContentsPane = new java.awt.Panel (); 277 ivjContentsPane.setName("ContentsPane"); 278 ivjContentsPane.setLayout(new java.awt.BorderLayout ()); 279 ivjContentsPane.setBackground(java.awt.SystemColor.control); 280 getContentsPane().add(getButtonPanel(), "South"); 281 getContentsPane().add(getInnerPanel(), "Center"); 282 } catch (java.lang.Throwable ivjExc) { 285 handleException(ivjExc); 288 } 289 }; 290 return ivjContentsPane; 291 } 292 296 297 private DoubleListHeaderPanel getHeaderPanel() { 298 if (ivjHeaderPanel == null) { 299 try { 300 ivjHeaderPanel = new org.jacorb.poa.gui.beans.DoubleListHeaderPanel(); 301 ivjHeaderPanel.setName("HeaderPanel"); 302 } catch (java.lang.Throwable ivjExc) { 305 handleException(ivjExc); 308 } 309 }; 310 return ivjHeaderPanel; 311 } 312 316 317 private java.awt.Panel getInnerPanel() { 318 if (ivjInnerPanel == null) { 319 try { 320 ivjInnerPanel = new java.awt.Panel (); 321 ivjInnerPanel.setName("InnerPanel"); 322 ivjInnerPanel.setLayout(new java.awt.BorderLayout ()); 323 ivjInnerPanel.setBackground(java.awt.SystemColor.control); 324 getInnerPanel().add(getHeaderPanel(), "North"); 325 getInnerPanel().add(getScrollPane(), "Center"); 326 } catch (java.lang.Throwable ivjExc) { 329 handleException(ivjExc); 332 } 333 }; 334 return ivjInnerPanel; 335 } 336 340 341 private java.awt.ScrollPane getScrollPane() { 342 if (ivjScrollPane == null) { 343 try { 344 ivjScrollPane = new java.awt.ScrollPane (); 345 ivjScrollPane.setName("ScrollPane"); 346 getScrollPane().add(getWorkPanel(), getWorkPanel().getName()); 347 } catch (java.lang.Throwable ivjExc) { 350 handleException(ivjExc); 353 } 354 }; 355 return ivjScrollPane; 356 } 357 361 362 private java.awt.Panel getWorkPanel() { 363 if (ivjWorkPanel == null) { 364 try { 365 ivjWorkPanel = new java.awt.Panel (); 366 ivjWorkPanel.setName("WorkPanel"); 367 ivjWorkPanel.setLayout(null); 368 ivjWorkPanel.setBackground(java.awt.Color.lightGray); 369 ivjWorkPanel.setLocation(0, 0); 370 } catch (java.lang.Throwable ivjExc) { 373 handleException(ivjExc); 376 } 377 }; 378 return ivjWorkPanel; 379 } 380 384 private void handleException(Throwable exception) { 385 386 387 } 390 393 394 private void initConnections() { 395 this.addWindowListener(this); 398 this.addComponentListener(this); 399 getWorkPanel().addMouseListener(this); 400 } 401 404 405 private void initialize() { 406 setName("DoubleListDialog"); 409 setLayout(new java.awt.BorderLayout ()); 410 setSize(400, 400); 411 setResizable(true); 412 add(getContentsPane(), "Center"); 413 initConnections(); 414 getButtonPanel()._init(this, "Cancel"); 416 } 418 422 public static void main(java.lang.String [] args) { 423 try { 424 DoubleListDialog aDoubleListDialog = new org.jacorb.poa.gui.beans.DoubleListDialog(new java.awt.Frame ()); 425 aDoubleListDialog.setModal(true); 426 try { 427 Class aCloserClass = Class.forName("com.ibm.uvm.abt.edit.WindowCloser"); 428 Class parmTypes[] = { java.awt.Window .class }; 429 Object parms[] = { aDoubleListDialog }; 430 java.lang.reflect.Constructor aCtor = aCloserClass.getConstructor(parmTypes); 431 aCtor.newInstance(parms); 432 } catch (java.lang.Throwable exc) {}; 433 aDoubleListDialog.setVisible(true); 434 } catch (Throwable exception) { 435 System.err.println("Exception occurred in main() of java.awt.Dialog"); 436 exception.printStackTrace(System.out); 437 } 438 } 439 443 444 public void mouseClicked(java.awt.event.MouseEvent e) { 445 } 450 454 455 public void mouseEntered(java.awt.event.MouseEvent e) { 456 } 461 465 466 public void mouseExited(java.awt.event.MouseEvent e) { 467 } 472 476 477 public void mousePressed(java.awt.event.MouseEvent e) { 478 if ((e.getSource() == getWorkPanel()) ) { 481 connEtoC3(e); 482 } 483 } 486 490 491 public void mouseReleased(java.awt.event.MouseEvent e) { 492 } 497 501 502 public void windowActivated(java.awt.event.WindowEvent e) { 503 } 508 512 513 public void windowClosed(java.awt.event.WindowEvent e) { 514 } 519 523 524 public void windowClosing(java.awt.event.WindowEvent e) { 525 if ((e.getSource() == this) ) { 528 connEtoC1(e); 529 } 530 } 533 537 538 public void windowDeactivated(java.awt.event.WindowEvent e) { 539 } 544 548 549 public void windowDeiconified(java.awt.event.WindowEvent e) { 550 } 555 559 560 public void windowIconified(java.awt.event.WindowEvent e) { 561 } 566 570 571 public void windowOpened(java.awt.event.WindowEvent e) { 572 } 577 578 579 } 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | Popular Tags |