1 package org.jacorb.poa.gui.pm; 2 3 22 23 import org.jacorb.poa.gui.POAManagerMonitorController; 24 25 import java.awt.List ; 26 import java.awt.Checkbox ; 27 import java.awt.Choice ; 28 29 35 public class POAManagerFrame extends java.awt.Frame implements org.jacorb.poa.gui.beans.CloseButtonPanelController, RegisterPanelController, StatePanelController, org.jacorb.poa.gui.POAManagerMonitorView, java.awt.event.WindowListener { 36 private POAManagerMonitorController controller; 37 private String [] stateChoiceItems = { "Active", "Holding", "Discarding", "Inactive"}; 38 private String currentStateItem = stateChoiceItems[1]; 39 private List poaList = null; 40 private Choice stateChoice = null; 41 private Checkbox waitCheckbox = null; 42 private Checkbox etherializeCheckbox = null; 43 private java.awt.Panel ivjContentsPane = null; 44 private org.jacorb.poa.gui.beans.CloseButtonPanel ivjButtonPanel = null; 45 private POAManagerStatePanel ivjPOAManagerStatePanel = null; 46 private java.awt.BorderLayout ivjContentsPaneBorderLayout = null; 47 private org.jacorb.poa.gui.beans.ConsolePanel ivjConsolePanel = null; 48 private java.awt.BorderLayout ivjPOAManagerFrameBorderLayout = null; 49 52 53 public POAManagerFrame() { 54 super(); 55 initialize(); 56 } 57 61 public POAManagerFrame(POAManagerMonitorController _controller) { 62 super(); 63 controller = _controller; 64 initialize(); 65 } 66 70 public POAManagerFrame(String title) { 71 super(title); 72 } 73 public void _actionCloseButtonPressed() { 74 if (controller != null) { 75 controller.actionCloseView(); 76 } 77 } 78 public void _actionClosePOAMonitor(String name) { 79 if (controller != null) { 80 controller.actionClosePOAMonitor(name); 81 } 82 } 83 public void _actionDestroyPOA(String name) { 84 if (controller != null) { 85 controller.actionDestroyPOA(name); 86 } 87 } 88 public void _actionOpenPOAMonitor(String name) { 89 if (controller != null) { 90 controller.actionOpenPOAMonitor(name); 91 } 92 } 93 public void _addPOA(String name) { 94 _getPOAList().add(name); 95 } 96 public void _destroy() { 97 dispose(); 98 } 99 private Checkbox _getEtherializeCheckbox() { 100 if (etherializeCheckbox == null) { 101 etherializeCheckbox = getPOAManagerStatePanel()._getStatePanel()._getEtherializeCheckbox(); 102 } 103 return etherializeCheckbox; 104 } 105 private List _getPOAList() { 106 if (poaList == null) { 107 poaList = getPOAManagerStatePanel()._getRegisterPanel()._getPOAList(); 108 } 109 return poaList; 110 } 111 private Choice _getStateChoice() { 112 if (stateChoice == null) { 113 stateChoice = getPOAManagerStatePanel()._getStatePanel()._getStateChoice(); 114 } 115 return stateChoice; 116 } 117 private Checkbox _getWaitCheckbox() { 118 if (waitCheckbox == null) { 119 waitCheckbox = getPOAManagerStatePanel()._getStatePanel()._getWaitCheckbox(); 120 } 121 return waitCheckbox; 122 } 123 public void _printMessage(String str) { 124 getConsolePanel()._printMessage(str); 125 } 126 public void _removePOA(String name) { 127 _getPOAList().remove(name); 128 } 129 public void _resetState() { 130 _getStateChoice().select(currentStateItem); 131 } 132 public void _setToActive() { 133 currentStateItem = stateChoiceItems[0]; 134 _getStateChoice().select(currentStateItem); 135 _getWaitCheckbox().setState(false); 136 _getEtherializeCheckbox().setState(false); 137 } 138 public void _setToDiscarding(boolean wait) { 139 currentStateItem = stateChoiceItems[2]; 140 _getStateChoice().select(currentStateItem); 141 _getWaitCheckbox().setState(wait); 142 _getEtherializeCheckbox().setState(false); 143 } 144 public void _setToHolding(boolean wait) { 145 currentStateItem = stateChoiceItems[1]; 146 _getStateChoice().select(currentStateItem); 147 _getWaitCheckbox().setState(wait); 148 _getEtherializeCheckbox().setState(false); 149 } 150 public void _setToInactive(boolean wait, boolean etherialize) { 151 currentStateItem = stateChoiceItems[3]; 152 _getStateChoice().select(currentStateItem); 153 _getWaitCheckbox().setState(wait); 154 _getEtherializeCheckbox().setState(etherialize); 155 } 156 public void _setVisible(boolean visible) { 157 setVisible(visible); 158 } 159 public void _stateItemChanged(String item, boolean wait, boolean etherialize) { 160 161 if (item.equals(currentStateItem)) return; 162 163 if (controller != null) { 164 165 if (item.equals(stateChoiceItems[0])) { 166 controller.actionSetToActive(); 167 168 } else if (item.equals(stateChoiceItems[1])) { 169 controller.actionSetToHolding(wait); 170 171 } else if (item.equals(stateChoiceItems[2])) { 172 controller.actionSetToDiscarding(wait); 173 174 } else if (item.equals(stateChoiceItems[3])) { 175 controller.actionSetToInactive(wait, etherialize); 176 177 } 178 } 179 } 180 184 185 private void connEtoC1(java.awt.event.WindowEvent arg1) { 186 try { 187 this.dispose(); 190 } catch (java.lang.Throwable ivjExc) { 193 handleException(ivjExc); 196 } 197 } 198 202 203 private org.jacorb.poa.gui.beans.CloseButtonPanel getButtonPanel() { 204 if (ivjButtonPanel == null) { 205 try { 206 ivjButtonPanel = new org.jacorb.poa.gui.beans.CloseButtonPanel(); 207 ivjButtonPanel.setName("ButtonPanel"); 208 ivjButtonPanel.setBackground(java.awt.SystemColor.control); 209 ivjButtonPanel.setSize(427, 34); 210 } catch (java.lang.Throwable ivjExc) { 213 handleException(ivjExc); 216 } 217 }; 218 return ivjButtonPanel; 219 } 220 224 225 private org.jacorb.poa.gui.beans.ConsolePanel getConsolePanel() { 226 if (ivjConsolePanel == null) { 227 try { 228 ivjConsolePanel = new org.jacorb.poa.gui.beans.ConsolePanel(); 229 ivjConsolePanel.setName("ConsolePanel"); 230 ivjConsolePanel.setBackground(java.awt.SystemColor.control); 231 ivjConsolePanel.setSize(426, 240); 232 } catch (java.lang.Throwable ivjExc) { 235 handleException(ivjExc); 238 } 239 }; 240 return ivjConsolePanel; 241 } 242 246 247 private java.awt.Panel getContentsPane() { 248 if (ivjContentsPane == null) { 249 try { 250 ivjContentsPane = new java.awt.Panel (); 251 ivjContentsPane.setName("ContentsPane"); 252 ivjContentsPane.setLayout(getContentsPaneBorderLayout()); 253 ivjContentsPane.setBackground(java.awt.SystemColor.control); 254 getContentsPane().add(getButtonPanel(), "South"); 255 getContentsPane().add(getConsolePanel(), "Center"); 256 getContentsPane().add(getPOAManagerStatePanel(), "North"); 257 } catch (java.lang.Throwable ivjExc) { 260 handleException(ivjExc); 263 } 264 }; 265 return ivjContentsPane; 266 } 267 271 272 private java.awt.BorderLayout getContentsPaneBorderLayout() { 273 java.awt.BorderLayout ivjContentsPaneBorderLayout = null; 274 try { 275 276 ivjContentsPaneBorderLayout = new java.awt.BorderLayout (); 277 ivjContentsPaneBorderLayout.setVgap(0); 278 ivjContentsPaneBorderLayout.setHgap(0); 279 } catch (java.lang.Throwable ivjExc) { 280 handleException(ivjExc); 281 }; 282 return ivjContentsPaneBorderLayout; 283 } 284 288 289 private java.awt.BorderLayout getPOAManagerFrameBorderLayout() { 290 java.awt.BorderLayout ivjPOAManagerFrameBorderLayout = null; 291 try { 292 293 ivjPOAManagerFrameBorderLayout = new java.awt.BorderLayout (); 294 ivjPOAManagerFrameBorderLayout.setVgap(0); 295 ivjPOAManagerFrameBorderLayout.setHgap(0); 296 } catch (java.lang.Throwable ivjExc) { 297 handleException(ivjExc); 298 }; 299 return ivjPOAManagerFrameBorderLayout; 300 } 301 305 306 private POAManagerStatePanel getPOAManagerStatePanel() { 307 if (ivjPOAManagerStatePanel == null) { 308 try { 309 ivjPOAManagerStatePanel = new org.jacorb.poa.gui.pm.POAManagerStatePanel(); 310 ivjPOAManagerStatePanel.setName("POAManagerStatePanel"); 311 ivjPOAManagerStatePanel.setBackground(java.awt.SystemColor.control); 312 ivjPOAManagerStatePanel.setSize(310, 100); 313 } catch (java.lang.Throwable ivjExc) { 316 handleException(ivjExc); 319 } 320 }; 321 return ivjPOAManagerStatePanel; 322 } 323 327 private void handleException(Throwable exception) { 328 329 330 } 333 336 337 private void initConnections() { 338 this.addWindowListener(this); 341 } 342 345 346 private void initialize() { 347 setName("POAManagerFrame"); 350 setLayout(getPOAManagerFrameBorderLayout()); 351 setBackground(java.awt.SystemColor.control); 352 setSize(318, 210); 353 setTitle("POAManager Monitor"); 354 add(getContentsPane(), "Center"); 355 initConnections(); 356 for (int i=0; i<stateChoiceItems.length; i++) { 358 _getStateChoice().addItem(stateChoiceItems[i]); 359 } 360 _getStateChoice().select(stateChoiceItems[1]); 361 getPOAManagerStatePanel()._getStatePanel()._init(this); 362 getPOAManagerStatePanel()._getRegisterPanel()._init(this); 363 getButtonPanel()._init(this, "Close"); 364 } 366 370 public static void main(java.lang.String [] args) { 371 try { 372 POAManagerFrame aPOAManagerFrame; 373 aPOAManagerFrame = new POAManagerFrame(); 374 try { 375 Class aCloserClass = Class.forName("com.ibm.uvm.abt.edit.WindowCloser"); 376 Class parmTypes[] = { java.awt.Window .class }; 377 Object parms[] = { aPOAManagerFrame }; 378 java.lang.reflect.Constructor aCtor = aCloserClass.getConstructor(parmTypes); 379 aCtor.newInstance(parms); 380 } catch (java.lang.Throwable exc) {}; 381 aPOAManagerFrame.setVisible(true); 382 } catch (Throwable exception) { 383 System.err.println("Exception occurred in main() of java.awt.Frame"); 384 exception.printStackTrace(System.out); 385 } 386 } 387 391 392 public void windowActivated(java.awt.event.WindowEvent e) { 393 } 398 402 403 public void windowClosed(java.awt.event.WindowEvent e) { 404 } 409 413 414 public void windowClosing(java.awt.event.WindowEvent e) { 415 if ((e.getSource() == this) ) { 418 connEtoC1(e); 419 } 420 } 423 427 428 public void windowDeactivated(java.awt.event.WindowEvent e) { 429 } 434 438 439 public void windowDeiconified(java.awt.event.WindowEvent e) { 440 } 445 449 450 public void windowIconified(java.awt.event.WindowEvent e) { 451 } 456 460 461 public void windowOpened(java.awt.event.WindowEvent e) { 462 } 467 468 } 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | Popular Tags |