| 1 | package tmcsim.common; |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | /** |
|---|
| 5 | * The ObserverMessage acts as a message object to pass information between |
|---|
| 6 | * components within the CADClient and CAD Simulator. The ObserverMessage |
|---|
| 7 | * contains a enumerated message type and data object that may be used |
|---|
| 8 | * by observers. |
|---|
| 9 | * |
|---|
| 10 | * @author Matthew Cechini |
|---|
| 11 | * @version |
|---|
| 12 | */ |
|---|
| 13 | public class ObserverMessage { |
|---|
| 14 | |
|---|
| 15 | /** |
|---|
| 16 | * Enumeration of all possible message types. |
|---|
| 17 | * |
|---|
| 18 | * INCIDENT_INQUIRY - Notify observers with a new IncidentInquiry model object. |
|---|
| 19 | * INCIDENT_SUMMARY - Notify observers with a new IncidentSummry model object. |
|---|
| 20 | * INCIDENT_BOARD - Notify observers with a new IncidentBoard model object. |
|---|
| 21 | * ROUTED_MESSAGE - Notify observers with a new RouteMessage model object. |
|---|
| 22 | * BLANK_SCREEN - Notify observers with a new BlankScreen model object. |
|---|
| 23 | * SCREEN_UPDATE - Notify observers with a new ScreenUpdate string. |
|---|
| 24 | * TIME_UPDATE - Notify observers with a new CAD Time value. |
|---|
| 25 | * ROUTED_MESSAGE_COUNT_UPDATE - Notify observers with a new count of routed messages. |
|---|
| 26 | * ROUTED_MESSAGE_UNREAD_UPDATE - Notify observers with the unread message status boolean. |
|---|
| 27 | * CAD_INFO_MESSAGE - Notify observers with a new CAD info message. |
|---|
| 28 | * REFRESH_VIEW - Notify observers with to refresh the current view. |
|---|
| 29 | * RESET_SIMULATION - Notify observers that the simulation is being reset. |
|---|
| 30 | */ |
|---|
| 31 | public static enum messageType { INCIDENT_INQUIRY, INCIDENT_SUMMARY, INCIDENT_BOARD, |
|---|
| 32 | ROUTED_MESSAGE, BLANK_SCREEN, SCREEN_UPDATE, |
|---|
| 33 | TIME_UPDATE, ROUTED_MESSAGE_COUNT_UPDATE, |
|---|
| 34 | ROUTED_MESSAGE_UNREAD_UPDATE, CAD_INFO_MESSAGE, |
|---|
| 35 | REFRESH_VIEW, RESET_SIMULATION }; |
|---|
| 36 | |
|---|
| 37 | /** Type of message. */ |
|---|
| 38 | public messageType type = null; |
|---|
| 39 | |
|---|
| 40 | /** Data being sent to observers. */ |
|---|
| 41 | public Object value = null; |
|---|
| 42 | |
|---|
| 43 | /** |
|---|
| 44 | * |
|---|
| 45 | * @param newType Type of message. |
|---|
| 46 | * @param o Data object. |
|---|
| 47 | */ |
|---|
| 48 | public ObserverMessage(messageType newType, Object o) { |
|---|
| 49 | type = newType; |
|---|
| 50 | value = o; |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | } |
|---|