1 26 27 package org.objectweb.ccm.demo3.monolithic; 28 29 import org.objectweb.ccm.demo3.*; 30 31 44 45 public class ConsumerImpl 46 extends org.omg.CORBA.LocalObject 47 implements CCM_Consumer, 48 CCM_TextEventConsumer, 49 org.omg.Components.SessionComponent 50 { 51 57 58 private String name_; 59 60 61 private javax.swing.JFrame frame_; 62 63 64 private javax.swing.JTextArea textArea_; 65 66 67 private CCM_Consumer_Context the_context_; 68 69 75 76 public 77 ConsumerImpl() 78 { 79 } 80 81 87 93 99 105 public void 106 configuration_complete() 107 throws org.omg.Components.InvalidConfiguration 108 { 109 if(name_ == null) 111 throw new org.omg.Components.InvalidConfiguration(); 112 113 115 frame_ = new javax.swing.JFrame (name_ + "'s Consumer GUI"); 117 frame_.setSize(400, 300); 119 120 textArea_ = new javax.swing.JTextArea (40, 20); 122 textArea_.setEditable(false); 123 124 javax.swing.JPanel panel = new javax.swing.JPanel ( 126 new java.awt.BorderLayout ()); 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 name(String n) 205 { 206 name_ = n; 207 208 if (frame_ != null) 209 frame_.setTitle(name_ + "'s Consumer GUI"); 210 } 211 212 217 public String 218 name() 219 { 220 return name_; 221 } 222 223 229 234 public void 235 push_from_servers(TextEvent event) 236 { 237 push(event); 238 } 239 240 241 247 252 public void 253 push(TextEvent event) 254 { 255 textArea_.append(event.text + "\n"); 257 } 258 } 259 260 | Popular Tags |