1 26 27 package org.objectweb.ccm.demo2.monolithic; 28 29 import org.objectweb.ccm.demo2.*; 30 31 43 44 public class ConsumerImpl 45 extends org.omg.CORBA.LocalObject 46 implements CCM_Consumer, 47 CCM_FoodConsumer, 48 org.omg.Components.SessionComponent 49 { 50 56 57 private String name_; 58 59 60 private javax.swing.JFrame frame_; 61 62 63 private javax.swing.JTextArea textArea_; 64 65 66 private CCM_Consumer_Context the_context_; 67 68 74 75 public 76 ConsumerImpl() 77 { 78 } 79 80 86 92 98 104 public void 105 configuration_complete () 106 throws org.omg.Components.InvalidConfiguration 107 { 108 if(name_ == null) 110 throw new org.omg.Components.InvalidConfiguration(); 111 112 114 frame_ = new javax.swing.JFrame (name_ + "'s Consumer GUI"); 116 frame_.setSize(400, 300); 118 119 textArea_ = new javax.swing.JTextArea (40, 20); 121 textArea_.setEditable(false); 122 123 javax.swing.JPanel panel = new javax.swing.JPanel ( 125 new java.awt.BorderLayout () 126 ); 127 frame_.getContentPane().add(panel); 128 panel.add(new javax.swing.JScrollPane (textArea_), 129 java.awt.BorderLayout.CENTER); 130 frame_.pack(); 131 frame_.show(); 132 } 133 134 140 147 public void 148 set_session_context(org.omg.Components.SessionContext context) 149 throws org.omg.Components.CCMException 150 { 151 the_context_ = (CCM_Consumer_Context)context; 152 } 153 154 159 public void 160 ccm_activate() 161 throws org.omg.Components.CCMException 162 { 163 } 165 166 171 public void 172 ccm_passivate() 173 throws org.omg.Components.CCMException 174 { 175 } 177 178 183 public void 184 ccm_remove() 185 throws org.omg.Components.CCMException 186 { 187 frame_.dispose(); 189 frame_ = null; 190 } 191 192 198 203 public void 204 push_eat(Food event) 205 { 206 push(event); 207 } 208 209 214 public void 215 name(String n) 216 { 217 name_ = n; 218 219 if (frame_ != null) 220 frame_.setTitle(name_ + "'s Consumer GUI"); 221 } 222 223 228 public String 229 name() 230 { 231 return name_; 232 } 233 234 240 245 public void 246 push(Food event) 247 { 248 textArea_.append("Receive Food(" + event.type + ")\n"); 250 } 251 } 252 253 254 | Popular Tags |