Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 26 27 package DiningPhilosophers.cif; 28 29 import DiningPhilosophers.*; 30 31 47 48 public class ObserverImpl 49 extends DiningPhilosophers.ObserverServiceComposition.ObserverService_impl 50 { 51 57 58 private java.util.Hashtable philosopherStates_; 59 60 61 private javax.swing.JFrame frame_; 62 63 64 private java.util.Hashtable philosopherPanels_; 65 66 67 private javax.swing.Box box_; 68 69 75 76 public 77 ObserverImpl() 78 { 79 philosopherStates_ = new java.util.Hashtable (); 80 philosopherPanels_ = new java.util.Hashtable (); 81 } 82 83 89 95 101 108 public void 109 configuration_complete() 110 throws org.omg.Components.InvalidConfiguration 111 { 112 114 frame_ = new javax.swing.JFrame ("The Observer's GUI"); 116 frame_.setSize(400, 300); 118 119 box_ = javax.swing.Box.createVerticalBox(); 121 frame_.getContentPane().add(box_); 122 frame_.pack(); 123 frame_.show(); 124 } 125 126 132 137 public void 138 ccm_remove() 139 throws org.omg.Components.CCMException 140 { 141 frame_.dispose(); 143 frame_ = null; 144 } 145 146 152 157 public synchronized void 158 push(StatusInfo event) 159 { 160 if (! philosopherPanels_.containsKey(event.name)) { 161 PhilosopherPanel panel = new PhilosopherPanel(event); 162 box_.add(panel); 163 philosopherPanels_.put(event.name, panel); 164 frame_.pack(); 165 frame_.show(); 166 } else { 167 PhilosopherPanel panel; 168 panel = (PhilosopherPanel)philosopherPanels_.get(event.name); 169 panel.updatePanel(event); 170 } 171 } 172 } 173
| Popular Tags
|