1 package Jt.examples.patterns; 2 import java.util.*; 3 import java.lang.reflect.*; 4 import java.beans.*; 5 import java.io.*; 6 import Jt.*; 7 8 9 10 13 14 15 16 public class OnSwitch extends JtState { 17 18 19 20 public OnSwitch () { 21 } 22 23 24 25 26 32 33 public Object processMessage (Object event) { 34 35 String msgid = null; 36 JtMessage e = (JtMessage) event; 37 Object content; 38 Object data; 39 JtMessage aux; 40 41 42 if (e == null) 43 return null; 44 45 msgid = (String ) e.getMsgId (); 46 47 if (msgid == null) 48 return null; 49 50 content = e.getMsgContent(); 51 52 if (msgid.equals ("JtREMOVE")) { 53 return (this); 54 } 55 56 if (msgid.equals ("JtSWITCH_VALUE")) { 57 return ("On"); 58 } 59 handleError ("processMessage: invalid message id:" + msgid); 60 return (null); 61 62 } 63 64 65 } 66 | Popular Tags |