1 28 29 30 package org.objectweb.ccm.logdemo; 31 32 36 public class AsyncServerImpl 37 extends AsyncServer_MainSegBase 38 { 39 private String _name; 41 private javax.swing.JFrame _frame; 42 private javax.swing.JTextArea _text; 43 44 public 45 AsyncServerImpl() 46 { 47 _name = null; 49 _frame = null; 50 _text = null; 51 } 52 53 57 final public void 58 configuration_complete() 59 throws org.omg.Components.InvalidConfiguration 60 { 61 _text = new javax.swing.JTextArea (40, 20); 64 _text.setEditable(false); 65 66 javax.swing.JPanel panel = new javax.swing.JPanel (new java.awt.BorderLayout ()); 68 panel.add(new javax.swing.JScrollPane (_text), java.awt.BorderLayout.CENTER); 69 _frame = new javax.swing.JFrame (_name + " GUI"); 70 _frame.setSize(400, 300); 71 _frame.getContentPane().add(panel); 72 _frame.pack(); 73 _frame.show(); 74 } 75 76 80 final public void 81 ccm_activate() 82 throws org.omg.Components.CCMException 83 { 84 getCCM2Context().register_valuefactory(AsyncMessageHelper.id(), new AsyncMessageFactoryImpl()); 87 88 if ((_frame!=null) && (!_frame.isShowing())){ 90 _frame.show(); 91 } 92 } 93 94 final public void 95 ccm_passivate() 96 throws org.omg.Components.CCMException 97 { 98 _text.setText(null); 100 _frame.hide(); 101 } 102 103 final public void 104 ccm_remove() 105 throws org.omg.Components.CCMException 106 { 107 _frame.dispose(); 109 _frame = null; 110 } 111 112 116 final public void 117 push_event(org.omg.Components.EventBase evt) 118 throws org.omg.Components.BadEventType 119 { 120 if (evt instanceof AsyncMessage) { 121 push_AsyncMessage((AsyncMessage)evt); 122 return ; 123 } 124 125 throw new org.omg.Components.BadEventType(); 126 } 127 128 132 final public void 133 push_AsyncMessage(AsyncMessage amsg) 134 { 135 _text.append("["+amsg.msg.header+"] "+amsg.msg.content + "\n"); 137 } 138 139 143 final public void 144 name(String n) 145 { 146 _name = n; 147 148 if (_frame!=null) { 149 _frame.setTitle(_name+" GUI"); 150 } 151 } 152 153 final public String 154 name() 155 { 156 return _name; 157 } 158 } 159 | Popular Tags |