1 28 29 package ist.coach.coachEmfClientComponents.ManagedObjectClientComposition; 30 31 import intt.itu.itut_x780.*; 32 import java.text.DateFormat ; 33 import ist.coach.coachEmfCommon.Utils; 34 35 41 public class stateChangeSegImpl 42 extends ist.coach.coachEmfClientComponents.ManagedObjectClientComposition.stateChangeSeg 43 { 44 50 56 public stateChangeSegImpl() 57 { 58 59 } 60 61 67 70 public void 71 push(ist.coach.itut_q816Components.StateChangedEvent event) 72 { 73 System.err.println("---->StateChangedEvent received: "); 77 System.err.println("Source Object Name = " + Utils.name2string(event.source)); 78 System.err.println("Source Object Type = " + event.sourceClass); 79 System.err.println("Notification Id = " + event.notificationIdentifier); 80 String details = new String (); 81 for(int i = 0; i < event.attributeList.length; i++) { 82 details += event.attributeList[i].attributeName + " changed "; 83 if (event.attributeList[i].oldValue != null) { 84 OperationalStateType oldState = OperationalStateTypeHelper.extract( 85 event.attributeList[i].oldValue); 86 details += " from "; 87 switch(oldState.value()) { 88 case OperationalStateType._disabled : 89 details += "Disabled"; 90 break; 91 case OperationalStateType._enabled : 92 details += "Enabled"; 93 break; 94 default: 95 details += "Unknown"; 96 } 97 } 98 if (event.attributeList[i].newValue != null) { 99 OperationalStateType newState = OperationalStateTypeHelper.extract( 100 event.attributeList[i].newValue); 101 details += " to "; 102 switch(newState.value()) { 103 case OperationalStateType._disabled : 104 details += "Disabled"; 105 break; 106 case OperationalStateType._enabled : 107 details += "Enabled"; 108 break; 109 default: 110 details += "Unknown"; 111 } 112 } 113 } 114 115 System.err.println("Details = " + details); 116 java.util.Date event_date = new java.util.Date (event.eventTime.time); 117 DateFormat df = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT); 118 String time_str = df.format(event_date); 119 System.err.println("Date = " + time_str); 120 121 ManagedObjectClientImpl main_segment = (ManagedObjectClientImpl) get_main_segment(); 122 main_segment.ui_client.print_alarm(time_str, 124 ist.coach.coachEmfClientComponents.gui.GuiMessages.state_changed_alarm, 125 Utils.name2string(event.source), event.sourceClass, 126 String.valueOf(event.notificationIdentifier), details); 127 } 128 129 } 130 | Popular Tags |