| 1 | package tmcsim.client.cadclientgui.data; |
|---|
| 2 | |
|---|
| 3 | import java.util.LinkedList; |
|---|
| 4 | import java.util.TreeMap; |
|---|
| 5 | import java.util.Vector; |
|---|
| 6 | |
|---|
| 7 | import java.io.Serializable; |
|---|
| 8 | |
|---|
| 9 | import javax.swing.ImageIcon; |
|---|
| 10 | import javax.swing.table.DefaultTableModel; |
|---|
| 11 | |
|---|
| 12 | import tmcsim.cadmodels.IncidentEditLog; |
|---|
| 13 | import tmcsim.cadmodels.IncidentInquiryHeader; |
|---|
| 14 | import tmcsim.client.cadclientgui.data.IncidentEvent.EVENT_STATUS; |
|---|
| 15 | import tmcsim.client.cadclientgui.enums.CADScriptTags.CAD_DATA_TAGS; |
|---|
| 16 | import tmcsim.client.cadclientgui.enums.IncidentEnums; |
|---|
| 17 | import tmcsim.common.ParamicsLocation; |
|---|
| 18 | |
|---|
| 19 | /** |
|---|
| 20 | * This class holds for the data for an incident. |
|---|
| 21 | * |
|---|
| 22 | * @author Vincent |
|---|
| 23 | * |
|---|
| 24 | */ |
|---|
| 25 | public class Incident implements Serializable { |
|---|
| 26 | |
|---|
| 27 | public Integer logNum; |
|---|
| 28 | private String masterInc; |
|---|
| 29 | |
|---|
| 30 | /* The init variables are set only from the XML script (readXMLNode method) |
|---|
| 31 | * and are only used for resetCADDataSimulation purposes |
|---|
| 32 | */ |
|---|
| 33 | private String init_oau = ""; |
|---|
| 34 | private String init_logTime = ""; |
|---|
| 35 | private String init_p = ""; |
|---|
| 36 | private String init_userData = ""; |
|---|
| 37 | private String init_attachments = ""; |
|---|
| 38 | private String init_rp = ""; |
|---|
| 39 | private String init_ali = ""; |
|---|
| 40 | private String init_rpType = ""; |
|---|
| 41 | private String init_media = ""; |
|---|
| 42 | |
|---|
| 43 | private ImageIcon alert; |
|---|
| 44 | private String oau; |
|---|
| 45 | private String logTime; |
|---|
| 46 | private String p; |
|---|
| 47 | private LinkedList<String> assignedUnitNums; |
|---|
| 48 | private String userData; |
|---|
| 49 | private String attachments; |
|---|
| 50 | private String rp; |
|---|
| 51 | private String ali; |
|---|
| 52 | private String rpType; |
|---|
| 53 | private String media; |
|---|
| 54 | private DefaultTableModel commentsNotesTable; |
|---|
| 55 | |
|---|
| 56 | private long startTime; |
|---|
| 57 | private long secondsIncidentStarted = 0; |
|---|
| 58 | private boolean incidentOccured = false; |
|---|
| 59 | public TreeMap<String, ParamicsLocation> locationMap; |
|---|
| 60 | private Vector<IncidentEvent> eventList = null; |
|---|
| 61 | public String description; |
|---|
| 62 | |
|---|
| 63 | private IncidentLocation incidentLocation; |
|---|
| 64 | private IncidentCaller incidentCaller; |
|---|
| 65 | private IncidentProblem problem; |
|---|
| 66 | private IncidentGeneralInfo genInfo; |
|---|
| 67 | private IncidentResponse response; |
|---|
| 68 | private IncidentAdditionalInfo additionalInfo; |
|---|
| 69 | private IncidentActivities activities; |
|---|
| 70 | private IncidentCallBacks callBacks; |
|---|
| 71 | private IncidentEditLog editLog; |
|---|
| 72 | private IncidentInfo info; |
|---|
| 73 | private IncidentTimes times; |
|---|
| 74 | private IncidentTransportInfo transpInfo; |
|---|
| 75 | private IncidentVehicle incidentVehicle; |
|---|
| 76 | private IncidentEnums status; |
|---|
| 77 | |
|---|
| 78 | private Vector<Object> toTableVector; |
|---|
| 79 | |
|---|
| 80 | public IncidentInquiryHeader header = new IncidentInquiryHeader(); |
|---|
| 81 | |
|---|
| 82 | |
|---|
| 83 | /* |
|---|
| 84 | * Constructor. Initializes all objects to avoid null pointers. |
|---|
| 85 | */ |
|---|
| 86 | /*public Incident(int logNum) { |
|---|
| 87 | masterInc = ""; |
|---|
| 88 | alert = new ImageIcon("images/IncidentPanelsImages/blank.png"); |
|---|
| 89 | oau = ""; |
|---|
| 90 | p = ""; |
|---|
| 91 | description = ""; |
|---|
| 92 | incidentLocation = new IncidentLocation(); |
|---|
| 93 | incidentCaller = new IncidentCaller(); |
|---|
| 94 | problem = new IncidentProblem(); |
|---|
| 95 | genInfo = new IncidentGeneralInfo(); |
|---|
| 96 | assignedUnitNums = new LinkedList<String>(); |
|---|
| 97 | response = new IncidentResponse(); |
|---|
| 98 | additionalInfo = new IncidentAdditionalInfo(); |
|---|
| 99 | activities = new IncidentActivities(); |
|---|
| 100 | callBacks = new IncidentCallBacks(); |
|---|
| 101 | editLog = new IncidentEditLog(); |
|---|
| 102 | info = new IncidentInfo(); |
|---|
| 103 | times = new IncidentTimes(); |
|---|
| 104 | transpInfo = new IncidentTransportInfo(); |
|---|
| 105 | incidentVehicle = new IncidentVehicle(); |
|---|
| 106 | userData = ""; |
|---|
| 107 | attachments = ""; |
|---|
| 108 | status = IncidentEnums.Pending; |
|---|
| 109 | assignedUnitNums = new LinkedList<String>(); |
|---|
| 110 | rp = ""; |
|---|
| 111 | ali = ""; |
|---|
| 112 | rpType = ""; |
|---|
| 113 | media = ""; |
|---|
| 114 | eventList = new Vector<IncidentEvent>(); |
|---|
| 115 | |
|---|
| 116 | toTableVector = new Vector<Object>(); |
|---|
| 117 | |
|---|
| 118 | commentsNotesTable = new DefaultTableModel() { |
|---|
| 119 | public boolean isCellEditable(int row, int column) { |
|---|
| 120 | return false;// This causes all cells to be not editable |
|---|
| 121 | } |
|---|
| 122 | }; |
|---|
| 123 | commentsNotesTable.setColumnIdentifiers(new String[] { "Date", "Time", |
|---|
| 124 | "Initial", "Block", "Comment" }); |
|---|
| 125 | |
|---|
| 126 | setLogNum(logNum); |
|---|
| 127 | }*/ |
|---|
| 128 | |
|---|
| 129 | public Incident(Integer log, String desc, long start) { |
|---|
| 130 | logNum = log; |
|---|
| 131 | description = desc; |
|---|
| 132 | startTime = start; |
|---|
| 133 | header = new IncidentInquiryHeader(); |
|---|
| 134 | locationMap = new TreeMap<String, ParamicsLocation>(); |
|---|
| 135 | eventList = new Vector<IncidentEvent>(); |
|---|
| 136 | |
|---|
| 137 | masterInc = ""; |
|---|
| 138 | alert = new ImageIcon("images/IncidentPanelsImages/blank.png"); |
|---|
| 139 | oau = ""; |
|---|
| 140 | p = ""; |
|---|
| 141 | incidentLocation = new IncidentLocation(); |
|---|
| 142 | incidentCaller = new IncidentCaller(); |
|---|
| 143 | problem = new IncidentProblem(); |
|---|
| 144 | genInfo = new IncidentGeneralInfo(); |
|---|
| 145 | assignedUnitNums = new LinkedList<String>(); |
|---|
| 146 | response = new IncidentResponse(); |
|---|
| 147 | additionalInfo = new IncidentAdditionalInfo(); |
|---|
| 148 | activities = new IncidentActivities(); |
|---|
| 149 | callBacks = new IncidentCallBacks(); |
|---|
| 150 | editLog = new IncidentEditLog(); |
|---|
| 151 | info = new IncidentInfo(); |
|---|
| 152 | times = new IncidentTimes(); |
|---|
| 153 | transpInfo = new IncidentTransportInfo(); |
|---|
| 154 | userData = ""; |
|---|
| 155 | attachments = ""; |
|---|
| 156 | status = IncidentEnums.Pending; |
|---|
| 157 | assignedUnitNums = new LinkedList(); |
|---|
| 158 | rp = ""; |
|---|
| 159 | ali = ""; |
|---|
| 160 | rpType = ""; |
|---|
| 161 | media = ""; |
|---|
| 162 | eventList = new Vector<IncidentEvent>(); |
|---|
| 163 | |
|---|
| 164 | toTableVector = new Vector<Object>(); |
|---|
| 165 | |
|---|
| 166 | commentsNotesTable = new DefaultTableModel() { |
|---|
| 167 | public boolean isCellEditable(int row, int column) { |
|---|
| 168 | return false;// This causes all cells to be not editable |
|---|
| 169 | } |
|---|
| 170 | }; |
|---|
| 171 | commentsNotesTable.setColumnIdentifiers(new String[] { "Date", "Time", |
|---|
| 172 | "Initial", "Block", "Comment" }); |
|---|
| 173 | } |
|---|
| 174 | |
|---|
| 175 | /*This method is to be called alongside resetSimulation for true reset. |
|---|
| 176 | * resetSimulation handles the variables from prior version, while this method resets all the variables |
|---|
| 177 | * specific to the CADData version. This method is called in the Coordinator following resetSimulation. |
|---|
| 178 | */ |
|---|
| 179 | public void resetCADDataSimulation(){ |
|---|
| 180 | oau = init_oau; |
|---|
| 181 | logTime = init_logTime; |
|---|
| 182 | p = init_p; |
|---|
| 183 | userData = init_userData; |
|---|
| 184 | attachments = init_attachments; |
|---|
| 185 | rp = init_rp; |
|---|
| 186 | ali = init_ali; |
|---|
| 187 | rpType = init_rpType; |
|---|
| 188 | media = init_media; |
|---|
| 189 | assignedUnitNums.clear(); |
|---|
| 190 | while(commentsNotesTable.getRowCount() > 0){ |
|---|
| 191 | commentsNotesTable.removeRow(0); |
|---|
| 192 | } |
|---|
| 193 | |
|---|
| 194 | incidentLocation.resetCADDataSimulation(); |
|---|
| 195 | incidentCaller.resetCADDataSimulation(); |
|---|
| 196 | problem.resetCADDataSimulation(); |
|---|
| 197 | genInfo.resetCADDataSimulation(); |
|---|
| 198 | response.resetCADDataSimulation(); |
|---|
| 199 | additionalInfo.resetCADDataSimulation(); |
|---|
| 200 | activities.resetCADDataSimulation(); |
|---|
| 201 | callBacks.resetCADDataSimulation(); |
|---|
| 202 | //editLog.resetCADDataSimulation(); |
|---|
| 203 | info.resetCADDataSimulation(); |
|---|
| 204 | //times.resetCADDataSimulation(); |
|---|
| 205 | //transpInfo.resetCADDataSimulation(); |
|---|
| 206 | } |
|---|
| 207 | |
|---|
| 208 | public boolean tick(long scriptSeconds) { |
|---|
| 209 | |
|---|
| 210 | if (scriptSeconds >= startTime && !incidentOccured) { |
|---|
| 211 | incidentOccured = true; |
|---|
| 212 | secondsIncidentStarted = scriptSeconds; |
|---|
| 213 | |
|---|
| 214 | return true; |
|---|
| 215 | } else |
|---|
| 216 | return false; |
|---|
| 217 | } |
|---|
| 218 | |
|---|
| 219 | public Vector<IncidentEvent> getTriggeredEvents(long simTime) { |
|---|
| 220 | |
|---|
| 221 | Vector<IncidentEvent> triggered = new Vector<IncidentEvent>(); |
|---|
| 222 | |
|---|
| 223 | if (incidentOccured) { |
|---|
| 224 | for (IncidentEvent evt : eventList) { |
|---|
| 225 | if (evt.triggerEvent(secondsIncidentStarted, simTime)) { |
|---|
| 226 | triggered.add(evt); |
|---|
| 227 | } |
|---|
| 228 | } |
|---|
| 229 | } |
|---|
| 230 | |
|---|
| 231 | return triggered; |
|---|
| 232 | } |
|---|
| 233 | |
|---|
| 234 | public Vector<IncidentEvent> getCompletedEvents() { |
|---|
| 235 | |
|---|
| 236 | Vector<IncidentEvent> completed = new Vector<IncidentEvent>(); |
|---|
| 237 | |
|---|
| 238 | for (IncidentEvent evt : eventList) { |
|---|
| 239 | if (evt.eventStatus == EVENT_STATUS.COMPLETED) { |
|---|
| 240 | completed.add(evt); |
|---|
| 241 | } |
|---|
| 242 | } |
|---|
| 243 | |
|---|
| 244 | return completed; |
|---|
| 245 | } |
|---|
| 246 | |
|---|
| 247 | public Integer getLogNumber() { |
|---|
| 248 | return logNum; |
|---|
| 249 | } |
|---|
| 250 | |
|---|
| 251 | public void manualTrigger(long newtime) { |
|---|
| 252 | secondsIncidentStarted = newtime; |
|---|
| 253 | incidentOccured = true; |
|---|
| 254 | } |
|---|
| 255 | |
|---|
| 256 | public long getSecondsToStart() { |
|---|
| 257 | return startTime; |
|---|
| 258 | } |
|---|
| 259 | |
|---|
| 260 | public void setSecondsToStart(long newStartTime) { |
|---|
| 261 | startTime = newStartTime; |
|---|
| 262 | } |
|---|
| 263 | |
|---|
| 264 | public Long getIncidentLength() { |
|---|
| 265 | return eventList.lastElement().secondsToOccurInIncident |
|---|
| 266 | - eventList.firstElement().secondsToOccurInIncident; |
|---|
| 267 | } |
|---|
| 268 | |
|---|
| 269 | public boolean hasOccured() { |
|---|
| 270 | return incidentOccured; |
|---|
| 271 | } |
|---|
| 272 | |
|---|
| 273 | public void resetSimulation() { |
|---|
| 274 | secondsIncidentStarted = 0; |
|---|
| 275 | incidentOccured = false; |
|---|
| 276 | |
|---|
| 277 | for (IncidentEvent ie : eventList) |
|---|
| 278 | ie.resetSimulation(); |
|---|
| 279 | |
|---|
| 280 | } |
|---|
| 281 | |
|---|
| 282 | public void addEvent(IncidentEvent newEvent) { |
|---|
| 283 | newEvent.eventInfo.setHeader(header); |
|---|
| 284 | eventList.add(newEvent); |
|---|
| 285 | } |
|---|
| 286 | |
|---|
| 287 | public String getMasterInc() { |
|---|
| 288 | return masterInc; |
|---|
| 289 | } |
|---|
| 290 | |
|---|
| 291 | public void setMasterInc(String masterInc) { |
|---|
| 292 | this.masterInc = masterInc; |
|---|
| 293 | } |
|---|
| 294 | |
|---|
| 295 | public int getLogNum() { |
|---|
| 296 | return logNum; |
|---|
| 297 | } |
|---|
| 298 | |
|---|
| 299 | public void setLogNum(int logNum) { |
|---|
| 300 | this.logNum = logNum; |
|---|
| 301 | } |
|---|
| 302 | |
|---|
| 303 | public String getOau() { |
|---|
| 304 | return oau; |
|---|
| 305 | } |
|---|
| 306 | |
|---|
| 307 | public void setOau(String oau) { |
|---|
| 308 | this.oau = oau; |
|---|
| 309 | } |
|---|
| 310 | |
|---|
| 311 | public long getTime() { |
|---|
| 312 | return startTime; |
|---|
| 313 | } |
|---|
| 314 | |
|---|
| 315 | public void setTime(long time) { |
|---|
| 316 | this.startTime = time; |
|---|
| 317 | } |
|---|
| 318 | |
|---|
| 319 | public String getLogTime() { |
|---|
| 320 | return logTime; |
|---|
| 321 | } |
|---|
| 322 | |
|---|
| 323 | public void setLogTime(String logTime) { |
|---|
| 324 | this.logTime = logTime; |
|---|
| 325 | } |
|---|
| 326 | |
|---|
| 327 | public String getP() { |
|---|
| 328 | return p; |
|---|
| 329 | } |
|---|
| 330 | |
|---|
| 331 | public void setP(String p) { |
|---|
| 332 | this.p = p; |
|---|
| 333 | } |
|---|
| 334 | |
|---|
| 335 | public String getDescription() { |
|---|
| 336 | return description; |
|---|
| 337 | } |
|---|
| 338 | |
|---|
| 339 | public void setDescription(String description) { |
|---|
| 340 | this.description = description; |
|---|
| 341 | } |
|---|
| 342 | |
|---|
| 343 | public IncidentCaller getIncidentCaller() { |
|---|
| 344 | return incidentCaller; |
|---|
| 345 | } |
|---|
| 346 | |
|---|
| 347 | public void setIncidentCaller(IncidentCaller incidentCaller) { |
|---|
| 348 | this.incidentCaller = incidentCaller; |
|---|
| 349 | } |
|---|
| 350 | |
|---|
| 351 | public IncidentLocation getIncidentLocation() { |
|---|
| 352 | return incidentLocation; |
|---|
| 353 | } |
|---|
| 354 | |
|---|
| 355 | public void setIncidentLocation(IncidentLocation incidentLocation) { |
|---|
| 356 | this.incidentLocation = incidentLocation; |
|---|
| 357 | } |
|---|
| 358 | |
|---|
| 359 | public IncidentProblem getProblem() { |
|---|
| 360 | return problem; |
|---|
| 361 | } |
|---|
| 362 | |
|---|
| 363 | public void setProblem(IncidentProblem problem) { |
|---|
| 364 | this.problem = problem; |
|---|
| 365 | } |
|---|
| 366 | |
|---|
| 367 | public IncidentGeneralInfo getGenInfo() { |
|---|
| 368 | return genInfo; |
|---|
| 369 | } |
|---|
| 370 | |
|---|
| 371 | public void setGenInfo(IncidentGeneralInfo genInfo) { |
|---|
| 372 | this.genInfo = genInfo; |
|---|
| 373 | } |
|---|
| 374 | |
|---|
| 375 | public LinkedList<String> getAssignedUnitNums() { |
|---|
| 376 | return assignedUnitNums; |
|---|
| 377 | } |
|---|
| 378 | |
|---|
| 379 | public void setPrimaryAssignedUnitNum(String assignedUnitNum) { |
|---|
| 380 | assignedUnitNums.remove(assignedUnitNum); |
|---|
| 381 | assignedUnitNums.addFirst(assignedUnitNum); |
|---|
| 382 | } |
|---|
| 383 | |
|---|
| 384 | public void addAssignedUnitNum(String assignedUnitNum) { |
|---|
| 385 | assignedUnitNums.addLast(assignedUnitNum); |
|---|
| 386 | } |
|---|
| 387 | |
|---|
| 388 | public void removeAssignedUnitNum(String assignedUnitNum){ |
|---|
| 389 | assignedUnitNums.remove(assignedUnitNum); |
|---|
| 390 | if(assignedUnitNums.size() == 0){ |
|---|
| 391 | status = IncidentEnums.Closed; |
|---|
| 392 | } |
|---|
| 393 | } |
|---|
| 394 | |
|---|
| 395 | public IncidentResponse getResponse() { |
|---|
| 396 | return response; |
|---|
| 397 | } |
|---|
| 398 | |
|---|
| 399 | public void setResponse(IncidentResponse response) { |
|---|
| 400 | this.response = response; |
|---|
| 401 | } |
|---|
| 402 | |
|---|
| 403 | public IncidentAdditionalInfo getAdditionalInfo() { |
|---|
| 404 | return additionalInfo; |
|---|
| 405 | } |
|---|
| 406 | |
|---|
| 407 | public void setAdditionalInfo(IncidentAdditionalInfo additionalInfo) { |
|---|
| 408 | this.additionalInfo = additionalInfo; |
|---|
| 409 | } |
|---|
| 410 | |
|---|
| 411 | public IncidentActivities getActivities() { |
|---|
| 412 | return activities; |
|---|
| 413 | } |
|---|
| 414 | |
|---|
| 415 | public void setActivities(IncidentActivities activities) { |
|---|
| 416 | this.activities = activities; |
|---|
| 417 | } |
|---|
| 418 | |
|---|
| 419 | public IncidentCallBacks getCallBacks() { |
|---|
| 420 | return callBacks; |
|---|
| 421 | } |
|---|
| 422 | |
|---|
| 423 | public void setCallBacks(IncidentCallBacks callBacks) { |
|---|
| 424 | this.callBacks = callBacks; |
|---|
| 425 | } |
|---|
| 426 | |
|---|
| 427 | public IncidentEditLog getEditLog() { |
|---|
| 428 | return editLog; |
|---|
| 429 | } |
|---|
| 430 | |
|---|
| 431 | public void setEditLog(IncidentEditLog editLog) { |
|---|
| 432 | this.editLog = editLog; |
|---|
| 433 | } |
|---|
| 434 | |
|---|
| 435 | public IncidentInfo getInfo() { |
|---|
| 436 | return info; |
|---|
| 437 | } |
|---|
| 438 | |
|---|
| 439 | public void setInfo(IncidentInfo info) { |
|---|
| 440 | this.info = info; |
|---|
| 441 | } |
|---|
| 442 | |
|---|
| 443 | public IncidentTimes getTimes() { |
|---|
| 444 | return times; |
|---|
| 445 | } |
|---|
| 446 | |
|---|
| 447 | public void setTimes(IncidentTimes times) { |
|---|
| 448 | this.times = times; |
|---|
| 449 | } |
|---|
| 450 | |
|---|
| 451 | public IncidentTransportInfo getTranspInfo() { |
|---|
| 452 | return transpInfo; |
|---|
| 453 | } |
|---|
| 454 | |
|---|
| 455 | public void setTranspInfo(IncidentTransportInfo transpInfo) { |
|---|
| 456 | this.transpInfo = transpInfo; |
|---|
| 457 | } |
|---|
| 458 | |
|---|
| 459 | public IncidentVehicle getIncidentVehicle() { |
|---|
| 460 | return incidentVehicle; |
|---|
| 461 | } |
|---|
| 462 | |
|---|
| 463 | public void setIncidentVehicle(IncidentVehicle incidentVehicle) { |
|---|
| 464 | this.incidentVehicle = incidentVehicle; |
|---|
| 465 | } |
|---|
| 466 | |
|---|
| 467 | public String getUserData() { |
|---|
| 468 | return userData; |
|---|
| 469 | } |
|---|
| 470 | |
|---|
| 471 | public void setUserData(String userData) { |
|---|
| 472 | this.userData = userData; |
|---|
| 473 | } |
|---|
| 474 | |
|---|
| 475 | public String getAttachments() { |
|---|
| 476 | return attachments; |
|---|
| 477 | } |
|---|
| 478 | |
|---|
| 479 | public void setAttachments(String attachments) { |
|---|
| 480 | this.attachments = attachments; |
|---|
| 481 | } |
|---|
| 482 | |
|---|
| 483 | public IncidentEnums getIncidentStatus() { |
|---|
| 484 | return status; |
|---|
| 485 | } |
|---|
| 486 | |
|---|
| 487 | public void setIncidentStatus(IncidentEnums status) { |
|---|
| 488 | this.status = status; |
|---|
| 489 | } |
|---|
| 490 | |
|---|
| 491 | public String getRp() { |
|---|
| 492 | return rp; |
|---|
| 493 | } |
|---|
| 494 | |
|---|
| 495 | public void setRp(String rp) { |
|---|
| 496 | this.rp = rp; |
|---|
| 497 | } |
|---|
| 498 | |
|---|
| 499 | public String getAli() { |
|---|
| 500 | return ali; |
|---|
| 501 | } |
|---|
| 502 | |
|---|
| 503 | public void setAli(String ali) { |
|---|
| 504 | this.ali = ali; |
|---|
| 505 | } |
|---|
| 506 | |
|---|
| 507 | public String getRpType() { |
|---|
| 508 | return rpType; |
|---|
| 509 | } |
|---|
| 510 | |
|---|
| 511 | public void setRpType(String rpType) { |
|---|
| 512 | this.rpType = rpType; |
|---|
| 513 | } |
|---|
| 514 | |
|---|
| 515 | public String getMedia() { |
|---|
| 516 | return media; |
|---|
| 517 | } |
|---|
| 518 | |
|---|
| 519 | public void setMedia(String media) { |
|---|
| 520 | this.media = media; |
|---|
| 521 | } |
|---|
| 522 | |
|---|
| 523 | public DefaultTableModel getCommentsNotesTable() { |
|---|
| 524 | return commentsNotesTable; |
|---|
| 525 | } |
|---|
| 526 | |
|---|
| 527 | public void addToCommentsNotesTable(String[] fields) { |
|---|
| 528 | this.commentsNotesTable.insertRow(0, fields); // new notes go 1st |
|---|
| 529 | } |
|---|
| 530 | |
|---|
| 531 | /* |
|---|
| 532 | * Stores the data needed to be displayed in the AssignedIncidents panel and |
|---|
| 533 | * sends it out as a toTableVector. |
|---|
| 534 | */ |
|---|
| 535 | public Vector<Object> toVectorForAssignedIncidents() { |
|---|
| 536 | Vector<Object> vector = new Vector<Object>(); |
|---|
| 537 | |
|---|
| 538 | toTableVector.clear(); |
|---|
| 539 | toTableVector.add(logNum); |
|---|
| 540 | toTableVector.add(masterInc); |
|---|
| 541 | toTableVector.add(alert); |
|---|
| 542 | if (assignedUnitNums.size() != 0) { |
|---|
| 543 | toTableVector.add(assignedUnitNums.getFirst()); |
|---|
| 544 | } else { |
|---|
| 545 | toTableVector.add(""); |
|---|
| 546 | } |
|---|
| 547 | |
|---|
| 548 | String unitNums = ""; |
|---|
| 549 | for (int i = 0; i < assignedUnitNums.size(); i++) { |
|---|
| 550 | unitNums = unitNums.concat((String) assignedUnitNums.get(i)); |
|---|
| 551 | if (i == assignedUnitNums.size() - 1) { |
|---|
| 552 | break; |
|---|
| 553 | } |
|---|
| 554 | unitNums = unitNums.concat(", "); |
|---|
| 555 | } |
|---|
| 556 | toTableVector.add(unitNums); |
|---|
| 557 | toTableVector.add(additionalInfo.getType()); |
|---|
| 558 | toTableVector.add(incidentLocation.getAddress()); |
|---|
| 559 | toTableVector.add(incidentLocation.getLoc()); |
|---|
| 560 | toTableVector.add(incidentLocation.getBeat()); |
|---|
| 561 | toTableVector.add(incidentLocation.getArea()); |
|---|
| 562 | toTableVector.add(oau); |
|---|
| 563 | toTableVector.add(startTime); |
|---|
| 564 | toTableVector.add(logTime); |
|---|
| 565 | toTableVector.add(additionalInfo.getTypeCode()); |
|---|
| 566 | toTableVector.add(p); |
|---|
| 567 | toTableVector.add(genInfo.getAgy()); |
|---|
| 568 | return toTableVector; |
|---|
| 569 | } |
|---|
| 570 | |
|---|
| 571 | /* |
|---|
| 572 | * Stores the data needed to be displayed in the PendingIncidents panel and |
|---|
| 573 | * sends it out as a toTableVector. |
|---|
| 574 | */ |
|---|
| 575 | public Vector<Object> toVectorForPendingIncidents() { |
|---|
| 576 | Vector<Object> vector = new Vector<Object>(); |
|---|
| 577 | vector.add(logNum); |
|---|
| 578 | vector.add(masterInc); |
|---|
| 579 | vector.add(alert); |
|---|
| 580 | vector.add(p); |
|---|
| 581 | vector.add(additionalInfo.getType()); |
|---|
| 582 | vector.add(incidentLocation.getAddress()); |
|---|
| 583 | vector.add(incidentLocation.getLoc()); |
|---|
| 584 | vector.add(incidentLocation.getCity()); |
|---|
| 585 | vector.add(incidentLocation.getBeat()); |
|---|
| 586 | vector.add(incidentLocation.getArea()); |
|---|
| 587 | vector.add(oau); |
|---|
| 588 | vector.add(startTime); |
|---|
| 589 | vector.add(logTime); |
|---|
| 590 | vector.add(additionalInfo.getTypeCode()); |
|---|
| 591 | vector.add(genInfo.getAgy()); |
|---|
| 592 | |
|---|
| 593 | return vector; |
|---|
| 594 | } |
|---|
| 595 | |
|---|
| 596 | public Vector<Object> toVectorForIncidentEditor() { |
|---|
| 597 | toTableVector.clear(); |
|---|
| 598 | toTableVector.add(logTime); |
|---|
| 599 | toTableVector.add(additionalInfo.getTypeCode()); |
|---|
| 600 | toTableVector.add(incidentLocation.getAddress()); |
|---|
| 601 | toTableVector.add(incidentLocation.getLoc()); |
|---|
| 602 | toTableVector.add(incidentLocation.getCity()); |
|---|
| 603 | toTableVector.add(masterInc); |
|---|
| 604 | toTableVector.add("GG"); |
|---|
| 605 | toTableVector.add(incidentLocation.getArea()); |
|---|
| 606 | |
|---|
| 607 | String unitNums = ""; |
|---|
| 608 | for (int i = 0; i < assignedUnitNums.size(); i++) { |
|---|
| 609 | unitNums = unitNums.concat((String) assignedUnitNums.get(i)); |
|---|
| 610 | if (i == assignedUnitNums.size() - 1) { |
|---|
| 611 | break; |
|---|
| 612 | } |
|---|
| 613 | unitNums = unitNums.concat(", "); |
|---|
| 614 | } |
|---|
| 615 | |
|---|
| 616 | toTableVector.add("F-File"); |
|---|
| 617 | return toTableVector; |
|---|
| 618 | } |
|---|
| 619 | |
|---|
| 620 | /* |
|---|
| 621 | * Called from the tmc.simulator.cadclient.ScriptHandler.java. Handles |
|---|
| 622 | * storing data based on script tag. |
|---|
| 623 | */ |
|---|
| 624 | public void readXMLNode(String outer_tag_name, String inner_tag_name, |
|---|
| 625 | String value) { |
|---|
| 626 | if (outer_tag_name.equals(CAD_DATA_TAGS.LOCATION.tag)) { |
|---|
| 627 | incidentLocation.readXMLNode(inner_tag_name, value); |
|---|
| 628 | } else if (outer_tag_name.equals(CAD_DATA_TAGS.CALLER.tag)) { |
|---|
| 629 | incidentCaller.readXMLNode(inner_tag_name, value); |
|---|
| 630 | } else if (outer_tag_name.equals(CAD_DATA_TAGS.PROBLEM.tag)) { |
|---|
| 631 | problem.readXMLNode(inner_tag_name, value); |
|---|
| 632 | } else if (outer_tag_name.equals(CAD_DATA_TAGS.GENERAL.tag)) { |
|---|
| 633 | genInfo.readXMLNode(inner_tag_name, value); |
|---|
| 634 | } else if (outer_tag_name.equals(CAD_DATA_TAGS.RESPONSE.tag)) { |
|---|
| 635 | response.readXMLNode(inner_tag_name, value); |
|---|
| 636 | } else if (outer_tag_name.equals(CAD_DATA_TAGS.ADDITIONAL_INFO.tag)) { |
|---|
| 637 | additionalInfo.readXMLNode(inner_tag_name, value); |
|---|
| 638 | } else if (outer_tag_name.equals(CAD_DATA_TAGS.ACTIVITIES.tag)) { |
|---|
| 639 | activities.readXMLNode(inner_tag_name, value); |
|---|
| 640 | } else if (outer_tag_name.equals(CAD_DATA_TAGS.CALL_BACKS.tag)) { |
|---|
| 641 | callBacks.readXMLNode(inner_tag_name, value); |
|---|
| 642 | } else if (outer_tag_name.equals(CAD_DATA_TAGS.EDIT_LOG.tag)) { |
|---|
| 643 | editLog.readXMLNode(inner_tag_name, value); |
|---|
| 644 | } else if (outer_tag_name.equals(CAD_DATA_TAGS.INFO.tag)) { |
|---|
| 645 | info.readXMLNode(inner_tag_name, value); |
|---|
| 646 | } else if (outer_tag_name.equals(CAD_DATA_TAGS.TIMES.tag)) { |
|---|
| 647 | times.readXMLNode(inner_tag_name, value); |
|---|
| 648 | } else if (outer_tag_name.equals(CAD_DATA_TAGS.TRANSPORT_INFO.tag)) { |
|---|
| 649 | transpInfo.readXMLNode(inner_tag_name, value); |
|---|
| 650 | } else if (outer_tag_name.equals(CAD_DATA_TAGS.USER_DATA.tag)) { |
|---|
| 651 | init_userData = value; |
|---|
| 652 | setUserData(value); |
|---|
| 653 | } else if (outer_tag_name.equals(CAD_DATA_TAGS.ATTACHMENTS.tag)) { |
|---|
| 654 | init_attachments = value; |
|---|
| 655 | setAttachments(value); |
|---|
| 656 | } else if (outer_tag_name.equals(CAD_DATA_TAGS.RP.tag)) { |
|---|
| 657 | init_rp = value; |
|---|
| 658 | setRp(value); |
|---|
| 659 | } else if (outer_tag_name.equals(CAD_DATA_TAGS.ALI.tag)) { |
|---|
| 660 | init_ali = value; |
|---|
| 661 | setAli(value); |
|---|
| 662 | } else if (outer_tag_name.equals(CAD_DATA_TAGS.RP_TYPE.tag)) { |
|---|
| 663 | init_rpType = value; |
|---|
| 664 | setRpType(value); |
|---|
| 665 | } else if (outer_tag_name.equals(CAD_DATA_TAGS.MEDIA.tag)) { |
|---|
| 666 | init_media = value; |
|---|
| 667 | setMedia(value); |
|---|
| 668 | } else if (outer_tag_name.equals(CAD_DATA_TAGS.MASTER_INC_NUM.tag)) { |
|---|
| 669 | //masterInc should be unchanged,no init |
|---|
| 670 | setMasterInc(value); |
|---|
| 671 | } else if (outer_tag_name.equals(CAD_DATA_TAGS.P.tag)) { |
|---|
| 672 | init_p = value; |
|---|
| 673 | setP(value); |
|---|
| 674 | } |
|---|
| 675 | |
|---|
| 676 | } |
|---|
| 677 | } |
|---|