| 1 | package tmcsim.client.cadscreens; |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | import javax.swing.text.Document; |
|---|
| 5 | |
|---|
| 6 | import tmcsim.cadmodels.IncidentSummaryModel; |
|---|
| 7 | import tmcsim.cadmodels.IncidentSummaryModel_obj; |
|---|
| 8 | import tmcsim.client.cadscreens.view.CADMainView; |
|---|
| 9 | import tmcsim.common.CADEnums.TEXT_STYLES; |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | /** |
|---|
| 13 | * SA_IncidentSummary is the view component to the IncidentSummaryModel |
|---|
| 14 | * model object. The screen is shown when the user requests a "Summary |
|---|
| 15 | * of Incidents by Area." When the class is instantiated with reference |
|---|
| 16 | * to the model data and document, string and style pairs are added to the |
|---|
| 17 | * view document. This class extends from the CADMainView object, which |
|---|
| 18 | * contains the common methods and data needed for display and user |
|---|
| 19 | * interaction. |
|---|
| 20 | * |
|---|
| 21 | * @see IncidentSummaryModel |
|---|
| 22 | * @author Matthew Cechini |
|---|
| 23 | * @version $Revision: 1.4 $ $Date: 2009/04/17 16:27:45 $ |
|---|
| 24 | */ |
|---|
| 25 | public class SA_IncidentSummary extends CADMainView { |
|---|
| 26 | |
|---|
| 27 | /** |
|---|
| 28 | * Reference to the Model class for the Incident Summary data. |
|---|
| 29 | */ |
|---|
| 30 | private IncidentSummaryModel theModel; |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | /** |
|---|
| 34 | * Constructor. Initializes the screen with the appropriate formatted text. |
|---|
| 35 | * |
|---|
| 36 | * @param newModel The model data object. |
|---|
| 37 | * @param viewdoc The Document object used for displaying the model data. |
|---|
| 38 | */ |
|---|
| 39 | public SA_IncidentSummary(IncidentSummaryModel newModel, Document viewDoc) { |
|---|
| 40 | super(viewDoc); |
|---|
| 41 | |
|---|
| 42 | theModel = newModel; |
|---|
| 43 | |
|---|
| 44 | initialize(); |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | /** |
|---|
| 49 | * This method initializes the screen's Document object with |
|---|
| 50 | * text and style pairs to create the correct screen format. |
|---|
| 51 | */ |
|---|
| 52 | private void initialize() { |
|---|
| 53 | |
|---|
| 54 | addDocElement("AREA(S) ", TEXT_STYLES.CYAN); |
|---|
| 55 | |
|---|
| 56 | addDocElement(IncidentSummaryModel.areas, TEXT_STYLES.RED); |
|---|
| 57 | |
|---|
| 58 | addDocElement("- INCIDENT SUMMARY ------------ STATE: ", TEXT_STYLES.CYAN); |
|---|
| 59 | |
|---|
| 60 | addDocElement("I P A ", TEXT_STYLES.RED); |
|---|
| 61 | |
|---|
| 62 | addDocElement("F\n", TEXT_STYLES.CYAN); |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | for(IncidentSummaryModel_obj ismo : theModel.getModelObjects()) { |
|---|
| 66 | |
|---|
| 67 | addDocElement(lPad(rPad(ismo.logNumber.toString(), 4), 6) |
|---|
| 68 | + rPad(ismo.date, 4) + "-" |
|---|
| 69 | + rPad(ismo.time, 4) |
|---|
| 70 | + rPad(ismo.priority, 3) |
|---|
| 71 | + rPad(ismo.callType, 5) |
|---|
| 72 | + rPad(ismo.beatArea, 6) |
|---|
| 73 | + rPad(ismo.location, 35) |
|---|
| 74 | + rPad(ismo.beatAssigned, 5) + "\n", |
|---|
| 75 | TEXT_STYLES.YELLOW); |
|---|
| 76 | } |
|---|
| 77 | |
|---|
| 78 | } |
|---|
| 79 | } |
|---|