1 26 27 package org.objectweb.ccm.demo2.cif; 28 29 import org.objectweb.ccm.demo2.*; 30 31 44 45 public class ConsumerImpl 46 extends org.objectweb.ccm.demo2.ConsumerSessionComposition.ComponentImpl 47 { 48 54 55 private String name_; 56 57 58 private javax.swing.JFrame frame_; 59 60 61 private javax.swing.JTextArea textArea_; 62 63 69 70 public 71 ConsumerImpl() 72 { 73 } 74 75 81 87 93 99 public void 100 configuration_complete () 101 throws org.omg.Components.InvalidConfiguration 102 { 103 if(name_ == null) 105 throw new org.omg.Components.InvalidConfiguration(); 106 107 109 frame_ = new javax.swing.JFrame (name_ + "'s Consumer GUI"); 111 frame_.setSize(400, 300); 113 114 textArea_ = new javax.swing.JTextArea (40, 20); 116 textArea_.setEditable(false); 117 118 javax.swing.JPanel panel = new javax.swing.JPanel ( 120 new java.awt.BorderLayout () 121 ); 122 frame_.getContentPane().add(panel); 123 panel.add(new javax.swing.JScrollPane (textArea_), 124 java.awt.BorderLayout.CENTER); 125 frame_.pack(); 126 frame_.show(); 127 } 128 129 135 140 public void 141 ccm_remove() 142 throws org.omg.Components.CCMException 143 { 144 frame_.dispose(); 146 frame_ = null; 147 } 148 149 155 160 public void 161 name(String n) 162 { 163 name_ = n; 164 165 if (frame_ != null) 166 frame_.setTitle(name_ + "'s Consumer GUI"); 167 } 168 169 174 public String 175 name() 176 { 177 return name_; 178 } 179 180 186 191 public void 192 push(Food event) 193 { 194 textArea_.append("Receive Food(" + event.type + ")\n"); 196 } 197 } 198 199 200 | Popular Tags |