1 26 27 package org.objectweb.ccm.demo3.monolithic; 28 29 import org.objectweb.ccm.demo3.*; 30 31 44 45 public class ServerImpl 46 extends org.omg.CORBA.LocalObject 47 implements CCM_Server, 48 CCM_Service, 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_Server_Context the_context_; 68 69 75 76 public 77 ServerImpl() 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 Server 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 ); 128 frame_.getContentPane().add(panel); 129 panel.add(new javax.swing.JScrollPane (textArea_), 130 java.awt.BorderLayout.CENTER); 131 frame_.pack(); 132 frame_.show(); 133 } 134 135 141 148 public void 149 set_session_context(org.omg.Components.SessionContext context) 150 throws org.omg.Components.CCMException 151 { 152 the_context_ = (CCM_Server_Context)context; 153 } 154 155 160 public void 161 ccm_activate() 162 throws org.omg.Components.CCMException 163 { 164 } 166 167 172 public void 173 ccm_passivate() 174 throws org.omg.Components.CCMException 175 { 176 } 178 179 184 public void 185 ccm_remove() 186 throws org.omg.Components.CCMException 187 { 188 frame_.dispose(); 190 frame_ = null; 191 } 192 193 199 204 public void 205 name(String n) 206 { 207 name_ = n; 208 209 if (frame_ != null) 210 frame_.setTitle(name_ + "'s Server GUI"); 211 } 212 213 218 public String 219 name() 220 { 221 return name_; 222 } 223 224 230 236 public CCM_Service 237 get_the_service() 238 { 239 return this; 241 } 242 243 249 254 public void 255 display(String text) 256 { 257 textArea_.append(text + "\n"); 259 260 the_context_.push_to_consumers( new TextEventImpl(text) ); 262 } 263 } 264 265 | Popular Tags |