Changeset 203 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder
- Timestamp:
- 02/01/2020 04:18:21 PM (6 years ago)
- Location:
- trunk/src/scriptbuilder
- Files:
-
- 24 edited
- 1 moved
-
gui/panels/IncidentPaletteAddPanel.java (modified) (1 diff)
-
structures/CadData.java (modified) (2 diffs)
-
structures/Location_Info.java (modified) (1 diff)
-
structures/ScriptIncident.java (modified) (2 diffs)
-
structures/SimulationScript.java (modified) (4 diffs)
-
structures/TimeSlice.java (modified) (5 diffs)
-
structures/XMLBuilder.java (moved) (moved from trunk/src/scriptbuilder/structures/XMLWriter.java) (2 diffs)
-
structures/events/ATMSEvaluationEvent.java (modified) (3 diffs)
-
structures/events/ActivityLogEvaluationEvent.java (modified) (3 diffs)
-
structures/events/AudioEvent.java (modified) (2 diffs)
-
structures/events/CADEvaluationEvent.java (modified) (3 diffs)
-
structures/events/CADEvent.java (modified) (2 diffs)
-
structures/events/CCTVEvent.java (modified) (1 diff)
-
structures/events/CHPRadioEvent.java (modified) (2 diffs)
-
structures/events/CMSEvaluationEvent.java (modified) (3 diffs)
-
structures/events/FacilitatorEvaluationEvent.java (modified) (3 diffs)
-
structures/events/MaintenanceRadioEvent.java (modified) (2 diffs)
-
structures/events/ParamicsEvent.java (modified) (2 diffs)
-
structures/events/RadioEvaluationEvent.java (modified) (3 diffs)
-
structures/events/TMTRadioEvent.java (modified) (2 diffs)
-
structures/events/TelephoneEvent.java (modified) (2 diffs)
-
structures/events/TowEvent.java (modified) (2 diffs)
-
structures/events/UnitEvent.java (modified) (2 diffs)
-
structures/events/WitnessEvent.java (modified) (2 diffs)
-
structures/units/Unit.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/scriptbuilder/gui/panels/IncidentPaletteAddPanel.java
r76 r203 13 13 import scriptbuilder.structures.ELEMENT; 14 14 import scriptbuilder.structures.ScriptIncident; 15 import scriptbuilder.structures.XML Writer;15 import scriptbuilder.structures.XMLBuilder; 16 16 17 17 /** -
trunk/src/scriptbuilder/structures/CadData.java
r145 r203 82 82 if (!Master_Inc_Num.equals("")) 83 83 { 84 output += XML Writer.simpleTag(Master_Inc_Num, ELEMENT.MASTER_INC_NUM);84 output += XMLBuilder.simpleTag(Master_Inc_Num, ELEMENT.MASTER_INC_NUM); 85 85 } 86 86 87 87 if (!P.equals("")) 88 88 { 89 output += XML Writer.simpleTag(P, ELEMENT.P);89 output += XMLBuilder.simpleTag(P, ELEMENT.P); 90 90 } 91 91 92 92 if (hasAdditionalInfo()) 93 93 { 94 output += XML Writer.openTag(ELEMENT.ADDITIONAL_INFO.tag);95 output += XML Writer.simpleTag(Info_Type_Code, ELEMENT.TYPE_CODE);96 output += XML Writer.simpleTag(Info_Type, ELEMENT.TYPE);97 output += XML Writer.closeTag(ELEMENT.ADDITIONAL_INFO.tag);94 output += XMLBuilder.openTag(ELEMENT.ADDITIONAL_INFO.tag); 95 output += XMLBuilder.simpleTag(Info_Type_Code, ELEMENT.TYPE_CODE); 96 output += XMLBuilder.simpleTag(Info_Type, ELEMENT.TYPE); 97 output += XMLBuilder.closeTag(ELEMENT.ADDITIONAL_INFO.tag); 98 98 } 99 99 100 100 if (hasLocation()) 101 101 { 102 output += XML Writer.openTag(ELEMENT.LOCATION.tag);102 output += XMLBuilder.openTag(ELEMENT.LOCATION.tag); 103 103 if (!Location_Beat.equals("")) 104 104 { 105 output += XML Writer.simpleTag(Location_Beat, ELEMENT.BEAT);105 output += XMLBuilder.simpleTag(Location_Beat, ELEMENT.BEAT); 106 106 } 107 107 108 108 if (!Location_Address.equals("")) 109 109 { 110 output += XML Writer.simpleTag(Location_Address, ELEMENT.ADDRESS);110 output += XMLBuilder.simpleTag(Location_Address, ELEMENT.ADDRESS); 111 111 } 112 112 113 113 if (!Location_Loc.equals("")) 114 114 { 115 output += XML Writer.simpleTag(Location_Loc, ELEMENT.LOC);115 output += XMLBuilder.simpleTag(Location_Loc, ELEMENT.LOC); 116 116 } 117 117 118 118 if (!Location_City.equals("")) 119 119 { 120 output += XML Writer.simpleTag(Location_City, ELEMENT.CITY);120 output += XMLBuilder.simpleTag(Location_City, ELEMENT.CITY); 121 121 } 122 122 123 123 if (!Location_Area.equals("")) 124 124 { 125 output += XML Writer.simpleTag(Location_Area, ELEMENT.AREA);125 output += XMLBuilder.simpleTag(Location_Area, ELEMENT.AREA); 126 126 } 127 127 128 128 if (!Location_Fire.equals("")) 129 129 { 130 output += XML Writer.simpleTag(Location_Fire, ELEMENT.FIRE);130 output += XMLBuilder.simpleTag(Location_Fire, ELEMENT.FIRE); 131 131 } 132 132 133 133 if (!Location_Law.equals("")) 134 134 { 135 output += XML Writer.simpleTag(Location_Law, ELEMENT.LAW);135 output += XMLBuilder.simpleTag(Location_Law, ELEMENT.LAW); 136 136 } 137 137 138 138 if (!Location_Ems.equals("")) 139 139 { 140 output += XML Writer.simpleTag(Location_Ems, ELEMENT.EMS);141 } 142 143 output += XML Writer.closeTag(ELEMENT.LOCATION.tag);140 output += XMLBuilder.simpleTag(Location_Ems, ELEMENT.EMS); 141 } 142 143 output += XMLBuilder.closeTag(ELEMENT.LOCATION.tag); 144 144 } 145 145 146 146 if (!Agy.equals("")) 147 147 { 148 output += XML Writer.openTag(ELEMENT.GENERAL.tag);149 output += XML Writer.simpleTag(Agy, ELEMENT.AGY);150 output += XML Writer.closeTag(ELEMENT.GENERAL.tag);148 output += XMLBuilder.openTag(ELEMENT.GENERAL.tag); 149 output += XMLBuilder.simpleTag(Agy, ELEMENT.AGY); 150 output += XMLBuilder.closeTag(ELEMENT.GENERAL.tag); 151 151 } 152 152 … … 154 154 { 155 155 //todo: make this logic trigger only once per incident 156 output += XML Writer.openTag(ELEMENT.HEADER_INFO.tag);157 158 output += XML Writer.simpleTag(Header_Type, ELEMENT.Type);159 160 output += XML Writer.simpleTag(Header_Beat, ELEMENT.Beat);161 162 output += XML Writer.simpleTag(Header_TruncLoc, ELEMENT.TruncLoc);163 164 output += XML Writer.simpleTag(Header_FullLoc, ELEMENT.FullLoc);165 166 output += XML Writer.closeTag(ELEMENT.HEADER_INFO.tag);156 output += XMLBuilder.openTag(ELEMENT.HEADER_INFO.tag); 157 158 output += XMLBuilder.simpleTag(Header_Type, ELEMENT.Type); 159 160 output += XMLBuilder.simpleTag(Header_Beat, ELEMENT.Beat); 161 162 output += XMLBuilder.simpleTag(Header_TruncLoc, ELEMENT.TruncLoc); 163 164 output += XMLBuilder.simpleTag(Header_FullLoc, ELEMENT.FullLoc); 165 166 output += XMLBuilder.closeTag(ELEMENT.HEADER_INFO.tag); 167 167 } 168 168 -
trunk/src/scriptbuilder/structures/Location_Info.java
r46 r203 21 21 public String toXML() 22 22 { 23 String output = XML Writer.openTag(ELEMENT.LOCATION_INFO.tag + " ID=\"" + Location_ID + "\"");23 String output = XMLBuilder.openTag(ELEMENT.LOCATION_INFO.tag + " ID=\"" + Location_ID + "\""); 24 24 25 output += XML Writer.simpleTag(Route, ELEMENT.Route);25 output += XMLBuilder.simpleTag(Route, ELEMENT.Route); 26 26 27 output += XML Writer.simpleTag(Direction, ELEMENT.Direction);27 output += XMLBuilder.simpleTag(Direction, ELEMENT.Direction); 28 28 29 output += XML Writer.simpleTag(Postmile, ELEMENT.Postmile);29 output += XMLBuilder.simpleTag(Postmile, ELEMENT.Postmile); 30 30 31 output += XML Writer.simpleTag(Location_type, ELEMENT.Location_type);31 output += XMLBuilder.simpleTag(Location_type, ELEMENT.Location_type); 32 32 33 output += XML Writer.closeTag(ELEMENT.LOCATION_INFO.tag);33 output += XMLBuilder.closeTag(ELEMENT.LOCATION_INFO.tag); 34 34 35 35 return output; -
trunk/src/scriptbuilder/structures/ScriptIncident.java
r201 r203 413 413 { 414 414 String output = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; 415 output += XML Writer.externalDTD();416 output += XML Writer.openTag(ELEMENT.TMC_SCRIPT.tag + " title=\"" + this.script.title + "\"");415 output += XMLBuilder.externalDTD(); 416 output += XMLBuilder.openTag(ELEMENT.TMC_SCRIPT.tag + " title=\"" + this.script.title + "\""); 417 417 418 418 for (TimeSlice slice : slices.values()) … … 420 420 output += slice.toXML(); 421 421 } 422 output += XML Writer.closeTag(ELEMENT.TMC_SCRIPT.tag);422 output += XMLBuilder.closeTag(ELEMENT.TMC_SCRIPT.tag); 423 423 return output; 424 424 } -
trunk/src/scriptbuilder/structures/SimulationScript.java
r201 r203 18 18 import java.nio.file.Paths; 19 19 import java.util.TreeMap; 20 import static scriptbuilder.structures.XMLBuilder.prettyPrintXML; 20 21 21 22 /** … … 249 250 250 251 BufferedWriter bw = new BufferedWriter(new FileWriter(f)); 251 bw.write(this.toXML()); 252 // convert to XML and remove newlines 253 String xmlOut = (this.toXML()).replace("\n",""); 254 // pretty print and save to file 255 bw.write(prettyPrintXML(xmlOut)); 252 256 bw.flush(); 253 257 bw.close(); 254 255 258 } 256 259 catch (Exception ex) … … 358 361 ArrayList<TimeSlice> slices = arrangeAllSlices(); 359 362 String output = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; 360 output += XML Writer.externalDTD();361 output += XML Writer.openTag(ELEMENT.TMC_SCRIPT.tag + " title=\"" + this.title + "\"");363 output += XMLBuilder.externalDTD(); 364 output += XMLBuilder.openTag(ELEMENT.TMC_SCRIPT.tag + " title=\"" + this.title + "\""); 362 365 363 366 if (units.size() > 0) 364 367 { 365 output += XML Writer.openTag(ELEMENT.SCRIPT_DATA.tag);368 output += XMLBuilder.openTag(ELEMENT.SCRIPT_DATA.tag); 366 369 for (Unit unit : units) 367 370 { 368 371 output += unit.toXML(); 369 372 } 370 output += XML Writer.closeTag(ELEMENT.SCRIPT_DATA.tag);373 output += XMLBuilder.closeTag(ELEMENT.SCRIPT_DATA.tag); 371 374 } 372 375 for (TimeSlice slice : slices) … … 374 377 output += slice.toXML(); 375 378 } 376 output += XML Writer.closeTag(ELEMENT.TMC_SCRIPT.tag);379 output += XMLBuilder.closeTag(ELEMENT.TMC_SCRIPT.tag); 377 380 return output; 378 381 } -
trunk/src/scriptbuilder/structures/TimeSlice.java
r176 r203 225 225 } 226 226 227 String output = XML Writer.openTag(ELEMENT.SCRIPT_EVENT.tag);227 String output = XMLBuilder.openTag(ELEMENT.SCRIPT_EVENT.tag); 228 228 SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss"); 229 229 df.setTimeZone(TimeZone.getTimeZone("GMT")); 230 230 // Build the output string, starting with a newline (ticket #203) 231 output += "\n" + XML Writer.openTag(ELEMENT.TIME_INDEX.tag) + df.format(new Date(seconds * 1000))232 + XML Writer.closeTag(ELEMENT.TIME_INDEX.tag);233 234 output += XML Writer.openTag(ELEMENT.INCIDENT.tag + " LogNum=\"" + thisIncident.number + "\"");235 output += thisIncident.name + XML Writer.closeTag(ELEMENT.INCIDENT.tag);236 output += XML Writer.emptyTag(ELEMENT.COLOR.tag231 output += "\n" + XMLBuilder.openTag(ELEMENT.TIME_INDEX.tag) + df.format(new Date(seconds * 1000)) 232 + XMLBuilder.closeTag(ELEMENT.TIME_INDEX.tag); 233 234 output += XMLBuilder.openTag(ELEMENT.INCIDENT.tag + " LogNum=\"" + thisIncident.number + "\""); 235 output += thisIncident.name + XMLBuilder.closeTag(ELEMENT.INCIDENT.tag); 236 output += XMLBuilder.emptyTag(ELEMENT.COLOR.tag 237 237 + " r=\"" + thisIncident.color.getRed() + "\"" 238 238 + " g=\"" + thisIncident.color.getGreen() + "\"" … … 241 241 if ((cadData != null && cadData.hasCadData()) || containsCADIncidentEvent()) 242 242 { 243 output += XML Writer.openTag(ELEMENT.CAD_DATA.tag);243 output += XMLBuilder.openTag(ELEMENT.CAD_DATA.tag); 244 244 if (cadData != null) 245 245 { … … 249 249 if (containsCADIncidentEvent()) 250 250 { 251 output += XML Writer.openTag(ELEMENT.CAD_INCIDENT_EVENT.tag);251 output += XMLBuilder.openTag(ELEMENT.CAD_INCIDENT_EVENT.tag); 252 252 for (I_ScriptEvent ev : eventsCopy) 253 253 { … … 264 264 265 265 eventsCopy = eventsCopy2; 266 output += XML Writer.closeTag(ELEMENT.CAD_INCIDENT_EVENT.tag);267 } 268 269 output += XML Writer.closeTag(ELEMENT.CAD_DATA.tag);266 output += XMLBuilder.closeTag(ELEMENT.CAD_INCIDENT_EVENT.tag); 267 } 268 269 output += XMLBuilder.closeTag(ELEMENT.CAD_DATA.tag); 270 270 } 271 271 272 272 if (cadData != null && cadData.hasGeneralInfo()) 273 273 { 274 output += XML Writer.openTag(ELEMENT.GENERAL_INFO.tag);275 276 output += XML Writer.simpleTag(cadData.General_Title, ELEMENT.TITLE);277 278 output += XML Writer.simpleTag(cadData.General_Text, ELEMENT.TEXT);279 280 output += XML Writer.closeTag(ELEMENT.GENERAL_INFO.tag);274 output += XMLBuilder.openTag(ELEMENT.GENERAL_INFO.tag); 275 276 output += XMLBuilder.simpleTag(cadData.General_Title, ELEMENT.TITLE); 277 278 output += XMLBuilder.simpleTag(cadData.General_Text, ELEMENT.TEXT); 279 280 output += XMLBuilder.closeTag(ELEMENT.GENERAL_INFO.tag); 281 281 282 282 } … … 290 290 } 291 291 } 292 output += XML Writer.closeTag(ELEMENT.SCRIPT_EVENT.tag);292 output += XMLBuilder.closeTag(ELEMENT.SCRIPT_EVENT.tag); 293 293 return output; 294 294 } -
trunk/src/scriptbuilder/structures/XMLBuilder.java
r201 r203 1 1 package scriptbuilder.structures; 2 2 3 import java.io.IOException; 4 import java.io.StringReader; 5 import java.io.StringWriter; 6 import javax.xml.parsers.DocumentBuilder; 7 import javax.xml.parsers.DocumentBuilderFactory; 8 import javax.xml.parsers.ParserConfigurationException; 9 import javax.xml.transform.OutputKeys; 10 import javax.xml.transform.Transformer; 11 import javax.xml.transform.TransformerException; 12 import javax.xml.transform.TransformerFactory; 13 import javax.xml.transform.dom.DOMSource; 14 import javax.xml.transform.stream.StreamResult; 15 import org.w3c.dom.Document; 16 import org.xml.sax.InputSource; 17 import org.xml.sax.SAXException; 18 3 19 /** 4 * 20 * Utility methods that build XML elements from content strings. 5 21 * @author Bryan McGuffin 6 22 */ 7 public class XML Writer23 public class XMLBuilder 8 24 { 9 25 … … 78 94 return output; 79 95 } 96 97 /** 98 * Prettyprint an XML string. 99 * @param xmlString (works best if it contains no newlines) 100 * @return String that has been nicely formatted with indentation 101 */ 102 public static String prettyPrintXML(String xmlString) 103 { 104 System.out.println("prettyprint start: " + xmlString); 105 Document xmlDoc = null; 106 String formattedXML = ""; 107 try { 108 xmlDoc = toXmlDocument(xmlString); 109 formattedXML = prettyprintdoc(xmlDoc); 110 } catch (ParserConfigurationException | SAXException | IOException 111 | TransformerException e) { 112 e.printStackTrace(); 113 } 114 return formattedXML; 115 } 116 117 118 /** 119 * Prettyprint an XML document. 120 * @param document an "ugly" XML document 121 * @return String nicely formatted XML with indentation 122 * @throws TransformerException 123 */ 124 public static String prettyprintdoc(Document document) 125 throws TransformerException { 126 TransformerFactory transformerFactory = TransformerFactory 127 .newInstance(); 128 Transformer transformer = transformerFactory.newTransformer(); 129 transformer.setOutputProperty(OutputKeys.INDENT, "yes"); 130 transformer.setOutputProperty( 131 "{http://xml.apache.org/xslt}indent-amount", "2"); 132 transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); 133 DOMSource source = new DOMSource(document); 134 StringWriter strWriter = new StringWriter(); 135 StreamResult result = new StreamResult(strWriter); 136 137 transformer.transform(source, result); 138 139 return strWriter.getBuffer().toString(); 140 141 } 142 143 /** Create an XML Document from a string that is in xml format. 144 * 145 * @param str xml format content 146 * @return Document containing the specified content. 147 * @throws ParserConfigurationException 148 * @throws SAXException 149 * @throws IOException 150 */ 151 public static Document toXmlDocument(String str) 152 throws ParserConfigurationException, SAXException, IOException { 153 154 DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory 155 .newInstance(); 156 DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); 157 Document document = docBuilder.parse(new InputSource(new StringReader( 158 str))); 159 160 return document; 161 } 80 162 } -
trunk/src/scriptbuilder/structures/events/ATMSEvaluationEvent.java
r76 r203 10 10 import scriptbuilder.structures.I_XML_Writable; 11 11 import scriptbuilder.structures.ScriptEvent; 12 import scriptbuilder.structures.XML Writer;12 import scriptbuilder.structures.XMLBuilder; 13 13 14 14 /** … … 60 60 public String toXML() 61 61 { 62 String output = XML Writer.openTag(ELEMENT.ATMS_EVALUATION.tag);62 String output = XMLBuilder.openTag(ELEMENT.ATMS_EVALUATION.tag); 63 63 if (expectedAction != null) 64 64 { … … 69 69 str = ""; 70 70 } 71 output += XML Writer.simpleTag(str, ELEMENT.EXPECTED_ACTION);71 output += XMLBuilder.simpleTag(str, ELEMENT.EXPECTED_ACTION); 72 72 } 73 73 } 74 output += XML Writer.closeTag(ELEMENT.ATMS_EVALUATION.tag);74 output += XMLBuilder.closeTag(ELEMENT.ATMS_EVALUATION.tag); 75 75 76 76 return output; -
trunk/src/scriptbuilder/structures/events/ActivityLogEvaluationEvent.java
r76 r203 10 10 import scriptbuilder.structures.I_XML_Writable; 11 11 import scriptbuilder.structures.ScriptEvent; 12 import scriptbuilder.structures.XML Writer;12 import scriptbuilder.structures.XMLBuilder; 13 13 14 14 /** … … 60 60 public String toXML() 61 61 { 62 String output = XML Writer.openTag(ELEMENT.ACTIVITY_LOG_EVALUATION.tag);62 String output = XMLBuilder.openTag(ELEMENT.ACTIVITY_LOG_EVALUATION.tag); 63 63 if (expectedAction != null) 64 64 { … … 69 69 str = ""; 70 70 } 71 output += XML Writer.simpleTag(str, ELEMENT.EXPECTED_ACTION);71 output += XMLBuilder.simpleTag(str, ELEMENT.EXPECTED_ACTION); 72 72 } 73 73 } 74 output += XML Writer.closeTag(ELEMENT.ACTIVITY_LOG_EVALUATION.tag);74 output += XMLBuilder.closeTag(ELEMENT.ACTIVITY_LOG_EVALUATION.tag); 75 75 76 76 return output; -
trunk/src/scriptbuilder/structures/events/AudioEvent.java
r167 r203 9 9 import scriptbuilder.structures.I_XML_Writable; 10 10 import scriptbuilder.structures.ScriptEvent; 11 import scriptbuilder.structures.XML Writer;11 import scriptbuilder.structures.XMLBuilder; 12 12 13 13 /** … … 75 75 public String toXML() 76 76 { 77 return XML Writer.emptyTag(ELEMENT.AUDIO.tag + " Length=\"" + audioLength + "\" Path=\"" + audioPath + "\"");77 return XMLBuilder.emptyTag(ELEMENT.AUDIO.tag + " Length=\"" + audioLength + "\" Path=\"" + audioPath + "\""); 78 78 } 79 79 } -
trunk/src/scriptbuilder/structures/events/CADEvaluationEvent.java
r76 r203 10 10 import scriptbuilder.structures.I_XML_Writable; 11 11 import scriptbuilder.structures.ScriptEvent; 12 import scriptbuilder.structures.XML Writer;12 import scriptbuilder.structures.XMLBuilder; 13 13 14 14 /** … … 60 60 public String toXML() 61 61 { 62 String output = XML Writer.openTag(ELEMENT.CAD_EVALUATION.tag);62 String output = XMLBuilder.openTag(ELEMENT.CAD_EVALUATION.tag); 63 63 if (expectedAction != null) 64 64 { … … 69 69 str = ""; 70 70 } 71 output += XML Writer.simpleTag(str, ELEMENT.EXPECTED_ACTION);71 output += XMLBuilder.simpleTag(str, ELEMENT.EXPECTED_ACTION); 72 72 } 73 73 } 74 output += XML Writer.closeTag(ELEMENT.CAD_EVALUATION.tag);74 output += XMLBuilder.closeTag(ELEMENT.CAD_EVALUATION.tag); 75 75 76 76 return output; -
trunk/src/scriptbuilder/structures/events/CADEvent.java
r185 r203 10 10 import scriptbuilder.structures.I_XML_Writable; 11 11 import scriptbuilder.structures.ScriptEvent; 12 import scriptbuilder.structures.XML Writer;12 import scriptbuilder.structures.XMLBuilder; 13 13 14 14 /** … … 46 46 while (tok.hasMoreTokens()) 47 47 { 48 output += XML Writer.simpleTag(tok.nextToken(), ELEMENT.DETAIL);48 output += XMLBuilder.simpleTag(tok.nextToken(), ELEMENT.DETAIL); 49 49 } 50 50 return output; -
trunk/src/scriptbuilder/structures/events/CCTVEvent.java
r153 r203 9 9 import scriptbuilder.structures.I_XML_Writable; 10 10 import scriptbuilder.structures.ScriptEvent; 11 import scriptbuilder.structures.XML Writer;11 import scriptbuilder.structures.XMLBuilder; 12 12 13 13 /** -
trunk/src/scriptbuilder/structures/events/CHPRadioEvent.java
r175 r203 10 10 import scriptbuilder.structures.I_XML_Writable; 11 11 import scriptbuilder.structures.ScriptEvent; 12 import scriptbuilder.structures.XML Writer;12 import scriptbuilder.structures.XMLBuilder; 13 13 14 14 /** … … 101 101 public String toXML() 102 102 { 103 String output = XML Writer.openTag(ELEMENT.CHP_RADIO.tag + " RadioFile=\"" + radioFile + "\"");104 output += XML Writer.openTag(ELEMENT.DIALOG.tag);103 String output = XMLBuilder.openTag(ELEMENT.CHP_RADIO.tag + " RadioFile=\"" + radioFile + "\""); 104 output += XMLBuilder.openTag(ELEMENT.DIALOG.tag); 105 105 106 106 for (int i = 0; i < lines.size(); i++) 107 107 { 108 output += XML Writer.openTag(ELEMENT.LINE.tag + " Role=\"" + roles.get(i) + "\"");108 output += XMLBuilder.openTag(ELEMENT.LINE.tag + " Role=\"" + roles.get(i) + "\""); 109 109 output += lines.get(i); 110 output += XML Writer.closeTag(ELEMENT.LINE.tag);110 output += XMLBuilder.closeTag(ELEMENT.LINE.tag); 111 111 } 112 112 113 output += XML Writer.closeTag(ELEMENT.DIALOG.tag);114 output += XML Writer.closeTag(ELEMENT.CHP_RADIO.tag);113 output += XMLBuilder.closeTag(ELEMENT.DIALOG.tag); 114 output += XMLBuilder.closeTag(ELEMENT.CHP_RADIO.tag); 115 115 116 116 return output; -
trunk/src/scriptbuilder/structures/events/CMSEvaluationEvent.java
r76 r203 10 10 import scriptbuilder.structures.I_XML_Writable; 11 11 import scriptbuilder.structures.ScriptEvent; 12 import scriptbuilder.structures.XML Writer;12 import scriptbuilder.structures.XMLBuilder; 13 13 14 14 /** … … 66 66 public String toXML() 67 67 { 68 String output = XML Writer.openTag(ELEMENT.CMS_EVALUATION.tag + " cmsID=\"" + cmsID + "\" type=\"" + cmsType + "\"");69 output += XML Writer.simpleTag(location, ELEMENT.LOCATION);68 String output = XMLBuilder.openTag(ELEMENT.CMS_EVALUATION.tag + " cmsID=\"" + cmsID + "\" type=\"" + cmsType + "\""); 69 output += XMLBuilder.simpleTag(location, ELEMENT.LOCATION); 70 70 71 71 if (message.size() > 0) 72 72 { 73 output += XML Writer.openTag(ELEMENT.SAMPLE_MESSAGE.tag);73 output += XMLBuilder.openTag(ELEMENT.SAMPLE_MESSAGE.tag); 74 74 for (String str : message) 75 75 { … … 78 78 str = ""; 79 79 } 80 output += XML Writer.simpleTag(str, ELEMENT.CMS_LINE);80 output += XMLBuilder.simpleTag(str, ELEMENT.CMS_LINE); 81 81 } 82 output += XML Writer.closeTag(ELEMENT.SAMPLE_MESSAGE.tag);82 output += XMLBuilder.closeTag(ELEMENT.SAMPLE_MESSAGE.tag); 83 83 } 84 84 85 output += XML Writer.closeTag(ELEMENT.CMS_EVALUATION.tag);85 output += XMLBuilder.closeTag(ELEMENT.CMS_EVALUATION.tag); 86 86 87 87 return output; -
trunk/src/scriptbuilder/structures/events/FacilitatorEvaluationEvent.java
r76 r203 10 10 import scriptbuilder.structures.I_XML_Writable; 11 11 import scriptbuilder.structures.ScriptEvent; 12 import scriptbuilder.structures.XML Writer;12 import scriptbuilder.structures.XMLBuilder; 13 13 14 14 /** … … 60 60 public String toXML() 61 61 { 62 String output = XML Writer.openTag(ELEMENT.FACILITATOR_EVALUATION.tag);62 String output = XMLBuilder.openTag(ELEMENT.FACILITATOR_EVALUATION.tag); 63 63 if (expectedAction != null) 64 64 { … … 69 69 str = ""; 70 70 } 71 output += XML Writer.simpleTag(str, ELEMENT.EXPECTED_ACTION);71 output += XMLBuilder.simpleTag(str, ELEMENT.EXPECTED_ACTION); 72 72 } 73 73 } 74 output += XML Writer.closeTag(ELEMENT.FACILITATOR_EVALUATION.tag);74 output += XMLBuilder.closeTag(ELEMENT.FACILITATOR_EVALUATION.tag); 75 75 76 76 return output; -
trunk/src/scriptbuilder/structures/events/MaintenanceRadioEvent.java
r76 r203 9 9 import scriptbuilder.structures.I_XML_Writable; 10 10 import scriptbuilder.structures.ScriptEvent; 11 import scriptbuilder.structures.XML Writer;11 import scriptbuilder.structures.XMLBuilder; 12 12 13 13 /** … … 33 33 public String toXML() 34 34 { 35 String output = XML Writer.simpleTag(message, ELEMENT.MAINTENANCE_RADIO);35 String output = XMLBuilder.simpleTag(message, ELEMENT.MAINTENANCE_RADIO); 36 36 return output; 37 37 } -
trunk/src/scriptbuilder/structures/events/ParamicsEvent.java
r76 r203 10 10 import scriptbuilder.structures.I_XML_Writable; 11 11 import scriptbuilder.structures.ScriptEvent; 12 import scriptbuilder.structures.XML Writer;12 import scriptbuilder.structures.XMLBuilder; 13 13 14 14 /** … … 40 40 public String toXML() 41 41 { 42 String output = XML Writer.openTag(ELEMENT.PARAMICS.tag + " LocationID=\"" + locationID + "\"");42 String output = XMLBuilder.openTag(ELEMENT.PARAMICS.tag + " LocationID=\"" + locationID + "\""); 43 43 44 output += XML Writer.simpleTag(status, ELEMENT.Status);44 output += XMLBuilder.simpleTag(status, ELEMENT.Status); 45 45 46 46 if (!type.equals("")) 47 47 { 48 output += XML Writer.simpleTag(type, ELEMENT.Incident_type);48 output += XMLBuilder.simpleTag(type, ELEMENT.Incident_type); 49 49 } 50 50 51 51 for (Integer lane : laneNums) 52 52 { 53 output += XML Writer.simpleTag("" + lane, ELEMENT.Lane_number);53 output += XMLBuilder.simpleTag("" + lane, ELEMENT.Lane_number); 54 54 } 55 output += XML Writer.closeTag(ELEMENT.PARAMICS.tag);55 output += XMLBuilder.closeTag(ELEMENT.PARAMICS.tag); 56 56 57 57 return output; -
trunk/src/scriptbuilder/structures/events/RadioEvaluationEvent.java
r76 r203 10 10 import scriptbuilder.structures.I_XML_Writable; 11 11 import scriptbuilder.structures.ScriptEvent; 12 import scriptbuilder.structures.XML Writer;12 import scriptbuilder.structures.XMLBuilder; 13 13 14 14 /** … … 60 60 public String toXML() 61 61 { 62 String output = XML Writer.openTag(ELEMENT.RADIO_EVALUATION.tag);62 String output = XMLBuilder.openTag(ELEMENT.RADIO_EVALUATION.tag); 63 63 if (expectedAction != null) 64 64 { … … 69 69 str = ""; 70 70 } 71 output += XML Writer.simpleTag(str, ELEMENT.EXPECTED_ACTION);71 output += XMLBuilder.simpleTag(str, ELEMENT.EXPECTED_ACTION); 72 72 } 73 73 } 74 output += XML Writer.closeTag(ELEMENT.RADIO_EVALUATION.tag);74 output += XMLBuilder.closeTag(ELEMENT.RADIO_EVALUATION.tag); 75 75 76 76 return output; -
trunk/src/scriptbuilder/structures/events/TMTRadioEvent.java
r76 r203 9 9 import scriptbuilder.structures.I_XML_Writable; 10 10 import scriptbuilder.structures.ScriptEvent; 11 import scriptbuilder.structures.XML Writer;11 import scriptbuilder.structures.XMLBuilder; 12 12 13 13 /** … … 33 33 public String toXML() 34 34 { 35 String output = XML Writer.simpleTag(message, ELEMENT.TMT_RADIO);35 String output = XMLBuilder.simpleTag(message, ELEMENT.TMT_RADIO); 36 36 return output; 37 37 } -
trunk/src/scriptbuilder/structures/events/TelephoneEvent.java
r76 r203 10 10 import scriptbuilder.structures.I_XML_Writable; 11 11 import scriptbuilder.structures.ScriptEvent; 12 import scriptbuilder.structures.XML Writer;12 import scriptbuilder.structures.XMLBuilder; 13 13 14 14 /** … … 37 37 public String toXML() 38 38 { 39 String output = XML Writer.openTag(ELEMENT.TELEPHONE.tag);39 String output = XMLBuilder.openTag(ELEMENT.TELEPHONE.tag); 40 40 for (int i = 0; i < lines.size(); i++) 41 41 { 42 42 if (roles.get(i).equalsIgnoreCase(ELEMENT.STUDENT.tag)) 43 43 { 44 output += XML Writer.simpleTag(lines.get(i), ELEMENT.STUDENT);44 output += XMLBuilder.simpleTag(lines.get(i), ELEMENT.STUDENT); 45 45 } 46 46 else 47 47 { 48 output += XML Writer.openTag(ELEMENT.INSTRUCTOR.tag + " Role=\"" + roles.get(i) + "\"");48 output += XMLBuilder.openTag(ELEMENT.INSTRUCTOR.tag + " Role=\"" + roles.get(i) + "\""); 49 49 output += lines.get(i); 50 output += XML Writer.closeTag(ELEMENT.INSTRUCTOR.tag);50 output += XMLBuilder.closeTag(ELEMENT.INSTRUCTOR.tag); 51 51 } 52 52 } 53 output += XML Writer.closeTag(ELEMENT.TELEPHONE.tag);53 output += XMLBuilder.closeTag(ELEMENT.TELEPHONE.tag); 54 54 return output; 55 55 } -
trunk/src/scriptbuilder/structures/events/TowEvent.java
r76 r203 9 9 import scriptbuilder.structures.I_XML_Writable; 10 10 import scriptbuilder.structures.ScriptEvent; 11 import scriptbuilder.structures.XML Writer;11 import scriptbuilder.structures.XMLBuilder; 12 12 13 13 /** … … 39 39 public String toXML() 40 40 { 41 return XML Writer.emptyTag(ELEMENT.TOW.tag + " Company=\"" + towCompany + "\" ConfNum=\""41 return XMLBuilder.emptyTag(ELEMENT.TOW.tag + " Company=\"" + towCompany + "\" ConfNum=\"" 42 42 + towConfNum + "\" PubNum=\"" + towPubNum + "\" Beat=\"" + towBeat + "\""); 43 43 } -
trunk/src/scriptbuilder/structures/events/UnitEvent.java
r145 r203 9 9 import scriptbuilder.structures.I_XML_Writable; 10 10 import scriptbuilder.structures.ScriptEvent; 11 import scriptbuilder.structures.XML Writer;11 import scriptbuilder.structures.XMLBuilder; 12 12 13 13 /** … … 41 41 public String toXML() 42 42 { 43 return XML Writer.emptyTag(ELEMENT.UNIT.tag+" UnitNum=\""+unitNum+"\" Status=\""43 return XMLBuilder.emptyTag(ELEMENT.UNIT.tag+" UnitNum=\""+unitNum+"\" Status=\"" 44 44 +unitStatus+"\" Primary=\""+unitPrimary+"\" Active=\""+unitActive+"\""); 45 45 } -
trunk/src/scriptbuilder/structures/events/WitnessEvent.java
r46 r203 9 9 import scriptbuilder.structures.I_XML_Writable; 10 10 import scriptbuilder.structures.ScriptEvent; 11 import scriptbuilder.structures.XML Writer;11 import scriptbuilder.structures.XMLBuilder; 12 12 13 13 /** … … 37 37 public String toXML() 38 38 { 39 return XML Writer.emptyTag(ELEMENT.WITNESS.tag + " Name=\"" + witnessName + "\" Address=\""39 return XMLBuilder.emptyTag(ELEMENT.WITNESS.tag + " Name=\"" + witnessName + "\" Address=\"" 40 40 + witnessAddress + "\" PhoneNum=\"" + witnessNum + "\""); 41 41 } -
trunk/src/scriptbuilder/structures/units/Unit.java
r145 r203 8 8 import scriptbuilder.structures.ELEMENT; 9 9 import scriptbuilder.structures.I_XML_Writable; 10 import scriptbuilder.structures.XML Writer;10 import scriptbuilder.structures.XMLBuilder; 11 11 12 12 /** … … 113 113 public String toXML() 114 114 { 115 String output = XML Writer.openTag(ELEMENT.NEW_UNIT.tag + " UnitNum=\"" + UnitNum + "\"");115 String output = XMLBuilder.openTag(ELEMENT.NEW_UNIT.tag + " UnitNum=\"" + UnitNum + "\""); 116 116 117 117 if (!ID.equals("")) 118 118 { 119 output += XML Writer.simpleTag(ID, ELEMENT.ID);119 output += XMLBuilder.simpleTag(ID, ELEMENT.ID); 120 120 } 121 121 122 122 if (!Status.equals("")) 123 123 { 124 output += XML Writer.simpleTag(Status, ELEMENT.STATUS);124 output += XMLBuilder.simpleTag(Status, ELEMENT.STATUS); 125 125 } 126 126 127 127 if (!Master_Inc_Num.equals("")) 128 128 { 129 output += XML Writer.simpleTag(Master_Inc_Num, ELEMENT.MASTER_INC_NUM);129 output += XMLBuilder.simpleTag(Master_Inc_Num, ELEMENT.MASTER_INC_NUM); 130 130 } 131 131 132 132 if (!Primary.equals("")) 133 133 { 134 output += XML Writer.simpleTag(Primary, ELEMENT.PRIMARY);134 output += XMLBuilder.simpleTag(Primary, ELEMENT.PRIMARY); 135 135 } 136 136 137 137 if (!OOS.equals("")) 138 138 { 139 output += XML Writer.simpleTag(OOS, ELEMENT.OOS);139 output += XMLBuilder.simpleTag(OOS, ELEMENT.OOS); 140 140 } 141 141 142 142 if (!Type.equals("")) 143 143 { 144 output += XML Writer.simpleTag(Type, ELEMENT.TYPE);144 output += XMLBuilder.simpleTag(Type, ELEMENT.TYPE); 145 145 } 146 146 147 147 //All units have a current location field, even if it's blank 148 output += XML Writer.simpleTag(Curr_Loc, ELEMENT.CURR_LOC);148 output += XMLBuilder.simpleTag(Curr_Loc, ELEMENT.CURR_LOC); 149 149 150 150 //All units have a destination field, even if it's blank 151 output += XML Writer.simpleTag(Destination, ELEMENT.DESTINATION);151 output += XMLBuilder.simpleTag(Destination, ELEMENT.DESTINATION); 152 152 153 153 if (!Misc_Info.equals("")) 154 154 { 155 output += XML Writer.simpleTag(Misc_Info, ELEMENT.MISC_INFO);155 output += XMLBuilder.simpleTag(Misc_Info, ELEMENT.MISC_INFO); 156 156 } 157 157 158 158 if (!Stack.equals("")) 159 159 { 160 output += XML Writer.simpleTag(Stack, ELEMENT.STACK);160 output += XMLBuilder.simpleTag(Stack, ELEMENT.STACK); 161 161 } 162 162 163 163 if (!Area.equals("")) 164 164 { 165 output += XML Writer.simpleTag(Area, ELEMENT.AREA);165 output += XMLBuilder.simpleTag(Area, ELEMENT.AREA); 166 166 } 167 167 168 168 if (!Badge_Num.equals("")) 169 169 { 170 output += XML Writer.simpleTag(Badge_Num, ELEMENT.BADGE_NUM);170 output += XMLBuilder.simpleTag(Badge_Num, ELEMENT.BADGE_NUM); 171 171 } 172 172 173 173 if (!Officer.equals("")) 174 174 { 175 output += XML Writer.simpleTag(Officer, ELEMENT.OFFICER);175 output += XMLBuilder.simpleTag(Officer, ELEMENT.OFFICER); 176 176 } 177 177 178 178 if (!Office.equals("")) 179 179 { 180 output += XML Writer.simpleTag(Office, ELEMENT.OFFICE);180 output += XMLBuilder.simpleTag(Office, ELEMENT.OFFICE); 181 181 } 182 182 183 183 if (!Timer.equals("")) 184 184 { 185 output += XML Writer.simpleTag(Timer, ELEMENT.TIMER);185 output += XMLBuilder.simpleTag(Timer, ELEMENT.TIMER); 186 186 } 187 187 188 188 if (!P.equals("")) 189 189 { 190 output += XML Writer.simpleTag(P, ELEMENT.P);190 output += XMLBuilder.simpleTag(P, ELEMENT.P); 191 191 } 192 192 193 193 if (!Agy.equals("")) 194 194 { 195 output += XML Writer.simpleTag(Agy, ELEMENT.AGY);195 output += XMLBuilder.simpleTag(Agy, ELEMENT.AGY); 196 196 } 197 197 198 198 if (!Alias.equals("")) 199 199 { 200 output += XML Writer.simpleTag(Alias, ELEMENT.ALIAS);200 output += XMLBuilder.simpleTag(Alias, ELEMENT.ALIAS); 201 201 } 202 202 203 203 if (!Unit_Status.equals("")) 204 204 { 205 output += XML Writer.simpleTag(Unit_Status, ELEMENT.UNIT_STATUS);206 } 207 208 output += XML Writer.closeTag(ELEMENT.NEW_UNIT.tag);205 output += XMLBuilder.simpleTag(Unit_Status, ELEMENT.UNIT_STATUS); 206 } 207 208 output += XMLBuilder.closeTag(ELEMENT.NEW_UNIT.tag); 209 209 return output; 210 210 }
Note: See TracChangeset
for help on using the changeset viewer.
