package tmcsim.client; import java.awt.Color; import java.awt.Dimension; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.Observable; import java.util.Observer; import java.util.TreeMap; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextPane; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import tmcsim.cadmodels.BlankScreenModel; import tmcsim.cadmodels.CADScreenModel; import tmcsim.cadmodels.IncidentBoardModel; import tmcsim.cadmodels.IncidentInquiryModel; import tmcsim.cadmodels.IncidentSummaryModel; import tmcsim.cadmodels.RoutedMessageModel; import tmcsim.client.cadscreens.IB_IncidentBoard; import tmcsim.client.cadscreens.II_IncidentInquiry; import tmcsim.client.cadscreens.SA_IncidentSummary; import tmcsim.client.cadscreens.TO_RoutedMessage; import tmcsim.client.cadscreens.view.CADCommandLineView; import tmcsim.client.cadscreens.view.CADFooterView; import tmcsim.client.cadscreens.view.CADMainView; import tmcsim.common.ObserverMessage; import tmcsim.common.CADEnums.ARROW; import tmcsim.common.CADEnums.CADScreenNum; import tmcsim.common.CADEnums.CAD_ERROR; import tmcsim.common.CADEnums.CAD_KEYS; import tmcsim.common.CADProtocol.CAD_CLIENT_CMD; /** * The CADClientView class is the view component to the CAD Client application. * * This view class observers the CADClientModel, listening for updates * from the CAD Simulator. Updates includes the current * CAD time */ @SuppressWarnings("serial") public class CADClockView extends JFrame implements KeyListener, Observer { /** Error Logger. */ private static Logger cadLogger = Logger.getLogger("tmcsim.client"); /** Reference to the CADClient model object. */ private CADClientModel theModel = null; /** Current CAD Screen number. */ private CADScreenNum currentScreenNum = null; /** * Constructor. Build panes, add key listeners, and set up observer * relationship between the footer and main panes. * * @param position * The CAD position for this client terminal. */ public CADClockView(CADClientModel mod) { super("CAD Client"); theModel = mod; } /** * Observable update method. The CADClientView class is an observer of the * CADClientModel. If the model sends a null object, it is signifying that * it has shut down. In this case, an error message should be shown to prompt * the user to restart the CAD Client. If the update object is an * ObserverMessage object, the following actions are to be taken: * *
| Message Type | *Message Data | *Action Taken | *
|---|---|---|
| TIME_UPDATE |
* Time String |
* Update the footer pane with the new time. | *