source: tmcsimulator/trunk/src/tmcsim/client/cadscreens/IB_IncidentBoard.java @ 2

Revision 2, 2.1 KB checked in by jdalbey, 10 years ago (diff)

Initial Import of project files

Line 
1package tmcsim.client.cadscreens;
2
3
4import javax.swing.text.Document;
5
6import tmcsim.cadmodels.IncidentBoardModel;
7import tmcsim.cadmodels.IncidentBoardModel_obj;
8import tmcsim.client.cadscreens.view.CADMainView;
9import tmcsim.common.CADEnums.TEXT_STYLES;
10
11/**
12 * IB_IncidentBoard is the view component to the IncidentBoardModel
13 * model object.  The screen is shown when the user requests to view the
14 * Incident Board. When the class is instantiated with reference
15 * to the model data and document, string and style pairs are added to the
16 * view document.  This class extends from the CADMainView object, which
17 * contains the common methods and data needed for display and user
18 *
19 * @see IncidentBoardModel
20 * @author Matthew Cechini
21 * @version $Revision: 1.4 $ $Date: 2009/04/17 16:27:45 $
22 */
23public class IB_IncidentBoard extends CADMainView {
24
25    /**
26     * Reference to the Model class for the Incident Board data.
27     */
28    private IncidentBoardModel theModel;
29   
30    /**
31     * Constructor.  Initializes the screen with the appropriate formatted text.
32     *
33     * @param newModel The model data object.
34     * @param viewdoc  The Document object used for displaying the model data.
35     */
36    public IB_IncidentBoard(IncidentBoardModel newModel, Document viewDoc) {
37        super(viewDoc);
38       
39        theModel         = newModel;
40           
41        initialize();
42    }   
43   
44   
45    /**
46     * This method initializes the screen's Document object with
47     * text and style pairs to create the correct screen format.
48     */
49    private void initialize() {
50                       
51        for(IncidentBoardModel_obj ibmo : theModel.getModelObjects()) {
52
53            addDocElement("------------------ BULLETIN " 
54                    + String.valueOf(ibmo.bulletinNum) 
55                    + " "  + ibmo.date 
56                    + "  " + ibmo.time
57                    + "           ---------------------\n", 
58                    TEXT_STYLES.CYAN);
59               
60            addDocElement(ibmo.message + "\n", 
61                    TEXT_STYLES.CYAN);
62        }
63
64    }   
65}
Note: See TracBrowser for help on using the repository browser.