1 26 27 package org.objectweb.ccm.demo3.cif; 28 29 import org.objectweb.ccm.demo3.*; 30 31 41 42 public class ServerImpl 43 extends org.objectweb.ccm.demo3.ServerSessionComposition.ComponentImpl 44 { 45 51 52 private String name_; 53 54 55 private javax.swing.JFrame frame_; 56 57 58 private javax.swing.JTextArea textArea_; 59 60 66 67 public 68 ServerImpl() 69 { 70 } 71 72 78 84 90 96 public void 97 configuration_complete() 98 throws org.omg.Components.InvalidConfiguration 99 { 100 if(name_ == null) 102 throw new org.omg.Components.InvalidConfiguration(); 103 104 106 frame_ = new javax.swing.JFrame (name_ + "'s Server GUI"); 108 frame_.setSize(400, 300); 110 111 textArea_ = new javax.swing.JTextArea (40, 20); 113 textArea_.setEditable(false); 114 115 javax.swing.JPanel panel = new javax.swing.JPanel ( 117 new java.awt.BorderLayout () 118 ); 119 frame_.getContentPane().add(panel); 120 panel.add(new javax.swing.JScrollPane (textArea_), 121 java.awt.BorderLayout.CENTER); 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 void 158 name(String n) 159 { 160 name_ = n; 161 162 if (frame_ != null) 163 frame_.setTitle(name_ + "'s Server GUI"); 164 } 165 166 171 public String 172 name() 173 { 174 return name_; 175 } 176 177 183 188 public void 189 display(String text) 190 { 191 textArea_.append(text + "\n"); 193 194 get_context().push_to_consumers( new TextEventImpl(text) ); 196 } 197 } 198 199 200 201 202 203 204 205 | Popular Tags |