Changeset 203 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder


Ignore:
Timestamp:
02/01/2020 04:18:21 PM (6 years ago)
Author:
jdalbey
Message:

XMLWriter.java name changed to XMLBuilder. Add pretty printing methods (ticket #237).

Location:
trunk/src/scriptbuilder
Files:
24 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/scriptbuilder/gui/panels/IncidentPaletteAddPanel.java

    r76 r203  
    1313import scriptbuilder.structures.ELEMENT; 
    1414import scriptbuilder.structures.ScriptIncident; 
    15 import scriptbuilder.structures.XMLWriter; 
     15import scriptbuilder.structures.XMLBuilder; 
    1616 
    1717/** 
  • trunk/src/scriptbuilder/structures/CadData.java

    r145 r203  
    8282        if (!Master_Inc_Num.equals("")) 
    8383        { 
    84             output += XMLWriter.simpleTag(Master_Inc_Num, ELEMENT.MASTER_INC_NUM); 
     84            output += XMLBuilder.simpleTag(Master_Inc_Num, ELEMENT.MASTER_INC_NUM); 
    8585        } 
    8686 
    8787        if (!P.equals("")) 
    8888        { 
    89             output += XMLWriter.simpleTag(P, ELEMENT.P); 
     89            output += XMLBuilder.simpleTag(P, ELEMENT.P); 
    9090        } 
    9191 
    9292        if (hasAdditionalInfo()) 
    9393        { 
    94             output += XMLWriter.openTag(ELEMENT.ADDITIONAL_INFO.tag); 
    95             output += XMLWriter.simpleTag(Info_Type_Code, ELEMENT.TYPE_CODE); 
    96             output += XMLWriter.simpleTag(Info_Type, ELEMENT.TYPE); 
    97             output += XMLWriter.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); 
    9898        } 
    9999 
    100100        if (hasLocation()) 
    101101        { 
    102             output += XMLWriter.openTag(ELEMENT.LOCATION.tag); 
     102            output += XMLBuilder.openTag(ELEMENT.LOCATION.tag); 
    103103            if (!Location_Beat.equals("")) 
    104104            { 
    105                 output += XMLWriter.simpleTag(Location_Beat, ELEMENT.BEAT); 
     105                output += XMLBuilder.simpleTag(Location_Beat, ELEMENT.BEAT); 
    106106            } 
    107107 
    108108            if (!Location_Address.equals("")) 
    109109            { 
    110                 output += XMLWriter.simpleTag(Location_Address, ELEMENT.ADDRESS); 
     110                output += XMLBuilder.simpleTag(Location_Address, ELEMENT.ADDRESS); 
    111111            } 
    112112 
    113113            if (!Location_Loc.equals("")) 
    114114            { 
    115                 output += XMLWriter.simpleTag(Location_Loc, ELEMENT.LOC); 
     115                output += XMLBuilder.simpleTag(Location_Loc, ELEMENT.LOC); 
    116116            } 
    117117 
    118118            if (!Location_City.equals("")) 
    119119            { 
    120                 output += XMLWriter.simpleTag(Location_City, ELEMENT.CITY); 
     120                output += XMLBuilder.simpleTag(Location_City, ELEMENT.CITY); 
    121121            } 
    122122 
    123123            if (!Location_Area.equals("")) 
    124124            { 
    125                 output += XMLWriter.simpleTag(Location_Area, ELEMENT.AREA); 
     125                output += XMLBuilder.simpleTag(Location_Area, ELEMENT.AREA); 
    126126            } 
    127127 
    128128            if (!Location_Fire.equals("")) 
    129129            { 
    130                 output += XMLWriter.simpleTag(Location_Fire, ELEMENT.FIRE); 
     130                output += XMLBuilder.simpleTag(Location_Fire, ELEMENT.FIRE); 
    131131            } 
    132132 
    133133            if (!Location_Law.equals("")) 
    134134            { 
    135                 output += XMLWriter.simpleTag(Location_Law, ELEMENT.LAW); 
     135                output += XMLBuilder.simpleTag(Location_Law, ELEMENT.LAW); 
    136136            } 
    137137 
    138138            if (!Location_Ems.equals("")) 
    139139            { 
    140                 output += XMLWriter.simpleTag(Location_Ems, ELEMENT.EMS); 
    141             } 
    142  
    143             output += XMLWriter.closeTag(ELEMENT.LOCATION.tag); 
     140                output += XMLBuilder.simpleTag(Location_Ems, ELEMENT.EMS); 
     141            } 
     142 
     143            output += XMLBuilder.closeTag(ELEMENT.LOCATION.tag); 
    144144        } 
    145145 
    146146        if (!Agy.equals("")) 
    147147        { 
    148             output += XMLWriter.openTag(ELEMENT.GENERAL.tag); 
    149             output += XMLWriter.simpleTag(Agy, ELEMENT.AGY); 
    150             output += XMLWriter.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); 
    151151        } 
    152152 
     
    154154        { 
    155155            //todo: make this logic trigger only once per incident 
    156             output += XMLWriter.openTag(ELEMENT.HEADER_INFO.tag); 
    157  
    158             output += XMLWriter.simpleTag(Header_Type, ELEMENT.Type); 
    159  
    160             output += XMLWriter.simpleTag(Header_Beat, ELEMENT.Beat); 
    161  
    162             output += XMLWriter.simpleTag(Header_TruncLoc, ELEMENT.TruncLoc); 
    163  
    164             output += XMLWriter.simpleTag(Header_FullLoc, ELEMENT.FullLoc); 
    165  
    166             output += XMLWriter.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); 
    167167        } 
    168168 
  • trunk/src/scriptbuilder/structures/Location_Info.java

    r46 r203  
    2121    public String toXML() 
    2222    { 
    23         String output = XMLWriter.openTag(ELEMENT.LOCATION_INFO.tag + " ID=\"" + Location_ID + "\""); 
     23        String output = XMLBuilder.openTag(ELEMENT.LOCATION_INFO.tag + " ID=\"" + Location_ID + "\""); 
    2424 
    25         output += XMLWriter.simpleTag(Route, ELEMENT.Route); 
     25        output += XMLBuilder.simpleTag(Route, ELEMENT.Route); 
    2626 
    27         output += XMLWriter.simpleTag(Direction, ELEMENT.Direction); 
     27        output += XMLBuilder.simpleTag(Direction, ELEMENT.Direction); 
    2828 
    29         output += XMLWriter.simpleTag(Postmile, ELEMENT.Postmile); 
     29        output += XMLBuilder.simpleTag(Postmile, ELEMENT.Postmile); 
    3030 
    31         output += XMLWriter.simpleTag(Location_type, ELEMENT.Location_type); 
     31        output += XMLBuilder.simpleTag(Location_type, ELEMENT.Location_type); 
    3232 
    33         output += XMLWriter.closeTag(ELEMENT.LOCATION_INFO.tag); 
     33        output += XMLBuilder.closeTag(ELEMENT.LOCATION_INFO.tag); 
    3434 
    3535        return output; 
  • trunk/src/scriptbuilder/structures/ScriptIncident.java

    r201 r203  
    413413    { 
    414414        String output = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; 
    415         output += XMLWriter.externalDTD(); 
    416         output += XMLWriter.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 + "\""); 
    417417 
    418418        for (TimeSlice slice : slices.values()) 
     
    420420            output += slice.toXML(); 
    421421        } 
    422         output += XMLWriter.closeTag(ELEMENT.TMC_SCRIPT.tag); 
     422        output += XMLBuilder.closeTag(ELEMENT.TMC_SCRIPT.tag); 
    423423        return output; 
    424424    } 
  • trunk/src/scriptbuilder/structures/SimulationScript.java

    r201 r203  
    1818import java.nio.file.Paths; 
    1919import java.util.TreeMap; 
     20import static scriptbuilder.structures.XMLBuilder.prettyPrintXML; 
    2021 
    2122/** 
     
    249250 
    250251            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)); 
    252256            bw.flush(); 
    253257            bw.close(); 
    254  
    255258        } 
    256259        catch (Exception ex) 
     
    358361        ArrayList<TimeSlice> slices = arrangeAllSlices(); 
    359362        String output = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; 
    360         output += XMLWriter.externalDTD(); 
    361         output += XMLWriter.openTag(ELEMENT.TMC_SCRIPT.tag + " title=\"" + this.title + "\""); 
     363        output += XMLBuilder.externalDTD(); 
     364        output += XMLBuilder.openTag(ELEMENT.TMC_SCRIPT.tag + " title=\"" + this.title + "\""); 
    362365 
    363366        if (units.size() > 0) 
    364367        { 
    365             output += XMLWriter.openTag(ELEMENT.SCRIPT_DATA.tag); 
     368            output += XMLBuilder.openTag(ELEMENT.SCRIPT_DATA.tag); 
    366369            for (Unit unit : units) 
    367370            { 
    368371                output += unit.toXML(); 
    369372            } 
    370             output += XMLWriter.closeTag(ELEMENT.SCRIPT_DATA.tag); 
     373            output += XMLBuilder.closeTag(ELEMENT.SCRIPT_DATA.tag); 
    371374        } 
    372375        for (TimeSlice slice : slices) 
     
    374377            output += slice.toXML(); 
    375378        } 
    376         output += XMLWriter.closeTag(ELEMENT.TMC_SCRIPT.tag); 
     379        output += XMLBuilder.closeTag(ELEMENT.TMC_SCRIPT.tag); 
    377380        return output; 
    378381    } 
  • trunk/src/scriptbuilder/structures/TimeSlice.java

    r176 r203  
    225225        } 
    226226 
    227         String output = XMLWriter.openTag(ELEMENT.SCRIPT_EVENT.tag); 
     227        String output = XMLBuilder.openTag(ELEMENT.SCRIPT_EVENT.tag); 
    228228        SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss"); 
    229229        df.setTimeZone(TimeZone.getTimeZone("GMT")); 
    230230        // Build the output string, starting with a newline (ticket #203) 
    231         output += "\n" + XMLWriter.openTag(ELEMENT.TIME_INDEX.tag) + df.format(new Date(seconds * 1000)) 
    232                 + XMLWriter.closeTag(ELEMENT.TIME_INDEX.tag); 
    233  
    234         output += XMLWriter.openTag(ELEMENT.INCIDENT.tag + " LogNum=\"" + thisIncident.number + "\""); 
    235         output += thisIncident.name + XMLWriter.closeTag(ELEMENT.INCIDENT.tag); 
    236         output += XMLWriter.emptyTag(ELEMENT.COLOR.tag 
     231        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 
    237237                + " r=\"" + thisIncident.color.getRed() + "\"" 
    238238                + " g=\"" + thisIncident.color.getGreen() + "\"" 
     
    241241        if ((cadData != null && cadData.hasCadData()) || containsCADIncidentEvent()) 
    242242        { 
    243             output += XMLWriter.openTag(ELEMENT.CAD_DATA.tag); 
     243            output += XMLBuilder.openTag(ELEMENT.CAD_DATA.tag); 
    244244            if (cadData != null) 
    245245            { 
     
    249249            if (containsCADIncidentEvent()) 
    250250            { 
    251                 output += XMLWriter.openTag(ELEMENT.CAD_INCIDENT_EVENT.tag); 
     251                output += XMLBuilder.openTag(ELEMENT.CAD_INCIDENT_EVENT.tag); 
    252252                for (I_ScriptEvent ev : eventsCopy) 
    253253                { 
     
    264264 
    265265                eventsCopy = eventsCopy2; 
    266                 output += XMLWriter.closeTag(ELEMENT.CAD_INCIDENT_EVENT.tag); 
    267             } 
    268  
    269             output += XMLWriter.closeTag(ELEMENT.CAD_DATA.tag); 
     266                output += XMLBuilder.closeTag(ELEMENT.CAD_INCIDENT_EVENT.tag); 
     267            } 
     268 
     269            output += XMLBuilder.closeTag(ELEMENT.CAD_DATA.tag); 
    270270        } 
    271271 
    272272        if (cadData != null && cadData.hasGeneralInfo()) 
    273273        { 
    274             output += XMLWriter.openTag(ELEMENT.GENERAL_INFO.tag); 
    275  
    276             output += XMLWriter.simpleTag(cadData.General_Title, ELEMENT.TITLE); 
    277  
    278             output += XMLWriter.simpleTag(cadData.General_Text, ELEMENT.TEXT); 
    279  
    280             output += XMLWriter.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); 
    281281 
    282282        } 
     
    290290            } 
    291291        } 
    292         output += XMLWriter.closeTag(ELEMENT.SCRIPT_EVENT.tag); 
     292        output += XMLBuilder.closeTag(ELEMENT.SCRIPT_EVENT.tag); 
    293293        return output; 
    294294    } 
  • trunk/src/scriptbuilder/structures/XMLBuilder.java

    r201 r203  
    11package scriptbuilder.structures; 
    22 
     3import java.io.IOException; 
     4import java.io.StringReader; 
     5import java.io.StringWriter; 
     6import javax.xml.parsers.DocumentBuilder; 
     7import javax.xml.parsers.DocumentBuilderFactory; 
     8import javax.xml.parsers.ParserConfigurationException; 
     9import javax.xml.transform.OutputKeys; 
     10import javax.xml.transform.Transformer; 
     11import javax.xml.transform.TransformerException; 
     12import javax.xml.transform.TransformerFactory; 
     13import javax.xml.transform.dom.DOMSource; 
     14import javax.xml.transform.stream.StreamResult; 
     15import org.w3c.dom.Document; 
     16import org.xml.sax.InputSource; 
     17import org.xml.sax.SAXException; 
     18 
    319/** 
    4  * 
     20 * Utility methods that build XML elements from content strings. 
    521 * @author Bryan McGuffin 
    622 */ 
    7 public class XMLWriter 
     23public class XMLBuilder 
    824{ 
    925 
     
    7894        return output; 
    7995    } 
     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    } 
    80162} 
  • trunk/src/scriptbuilder/structures/events/ATMSEvaluationEvent.java

    r76 r203  
    1010import scriptbuilder.structures.I_XML_Writable; 
    1111import scriptbuilder.structures.ScriptEvent; 
    12 import scriptbuilder.structures.XMLWriter; 
     12import scriptbuilder.structures.XMLBuilder; 
    1313 
    1414/** 
     
    6060    public String toXML() 
    6161    { 
    62         String output = XMLWriter.openTag(ELEMENT.ATMS_EVALUATION.tag); 
     62        String output = XMLBuilder.openTag(ELEMENT.ATMS_EVALUATION.tag); 
    6363        if (expectedAction != null) 
    6464        { 
     
    6969                    str = ""; 
    7070                } 
    71                 output += XMLWriter.simpleTag(str, ELEMENT.EXPECTED_ACTION); 
     71                output += XMLBuilder.simpleTag(str, ELEMENT.EXPECTED_ACTION); 
    7272            } 
    7373        } 
    74         output += XMLWriter.closeTag(ELEMENT.ATMS_EVALUATION.tag); 
     74        output += XMLBuilder.closeTag(ELEMENT.ATMS_EVALUATION.tag); 
    7575 
    7676        return output; 
  • trunk/src/scriptbuilder/structures/events/ActivityLogEvaluationEvent.java

    r76 r203  
    1010import scriptbuilder.structures.I_XML_Writable; 
    1111import scriptbuilder.structures.ScriptEvent; 
    12 import scriptbuilder.structures.XMLWriter; 
     12import scriptbuilder.structures.XMLBuilder; 
    1313 
    1414/** 
     
    6060    public String toXML() 
    6161    { 
    62         String output = XMLWriter.openTag(ELEMENT.ACTIVITY_LOG_EVALUATION.tag); 
     62        String output = XMLBuilder.openTag(ELEMENT.ACTIVITY_LOG_EVALUATION.tag); 
    6363        if (expectedAction != null) 
    6464        { 
     
    6969                    str = ""; 
    7070                } 
    71                 output += XMLWriter.simpleTag(str, ELEMENT.EXPECTED_ACTION); 
     71                output += XMLBuilder.simpleTag(str, ELEMENT.EXPECTED_ACTION); 
    7272            } 
    7373        } 
    74         output += XMLWriter.closeTag(ELEMENT.ACTIVITY_LOG_EVALUATION.tag); 
     74        output += XMLBuilder.closeTag(ELEMENT.ACTIVITY_LOG_EVALUATION.tag); 
    7575 
    7676        return output; 
  • trunk/src/scriptbuilder/structures/events/AudioEvent.java

    r167 r203  
    99import scriptbuilder.structures.I_XML_Writable; 
    1010import scriptbuilder.structures.ScriptEvent; 
    11 import scriptbuilder.structures.XMLWriter; 
     11import scriptbuilder.structures.XMLBuilder; 
    1212 
    1313/** 
     
    7575    public String toXML() 
    7676    { 
    77         return XMLWriter.emptyTag(ELEMENT.AUDIO.tag + " Length=\"" + audioLength + "\" Path=\"" + audioPath + "\""); 
     77        return XMLBuilder.emptyTag(ELEMENT.AUDIO.tag + " Length=\"" + audioLength + "\" Path=\"" + audioPath + "\""); 
    7878    } 
    7979} 
  • trunk/src/scriptbuilder/structures/events/CADEvaluationEvent.java

    r76 r203  
    1010import scriptbuilder.structures.I_XML_Writable; 
    1111import scriptbuilder.structures.ScriptEvent; 
    12 import scriptbuilder.structures.XMLWriter; 
     12import scriptbuilder.structures.XMLBuilder; 
    1313 
    1414/** 
     
    6060    public String toXML() 
    6161    { 
    62         String output = XMLWriter.openTag(ELEMENT.CAD_EVALUATION.tag); 
     62        String output = XMLBuilder.openTag(ELEMENT.CAD_EVALUATION.tag); 
    6363        if (expectedAction != null) 
    6464        { 
     
    6969                    str = ""; 
    7070                } 
    71                 output += XMLWriter.simpleTag(str, ELEMENT.EXPECTED_ACTION); 
     71                output += XMLBuilder.simpleTag(str, ELEMENT.EXPECTED_ACTION); 
    7272            } 
    7373        } 
    74         output += XMLWriter.closeTag(ELEMENT.CAD_EVALUATION.tag); 
     74        output += XMLBuilder.closeTag(ELEMENT.CAD_EVALUATION.tag); 
    7575 
    7676        return output; 
  • trunk/src/scriptbuilder/structures/events/CADEvent.java

    r185 r203  
    1010import scriptbuilder.structures.I_XML_Writable; 
    1111import scriptbuilder.structures.ScriptEvent; 
    12 import scriptbuilder.structures.XMLWriter; 
     12import scriptbuilder.structures.XMLBuilder; 
    1313 
    1414/** 
     
    4646        while (tok.hasMoreTokens()) 
    4747        { 
    48             output += XMLWriter.simpleTag(tok.nextToken(), ELEMENT.DETAIL); 
     48            output += XMLBuilder.simpleTag(tok.nextToken(), ELEMENT.DETAIL); 
    4949        } 
    5050        return output; 
  • trunk/src/scriptbuilder/structures/events/CCTVEvent.java

    r153 r203  
    99import scriptbuilder.structures.I_XML_Writable; 
    1010import scriptbuilder.structures.ScriptEvent; 
    11 import scriptbuilder.structures.XMLWriter; 
     11import scriptbuilder.structures.XMLBuilder; 
    1212 
    1313/** 
  • trunk/src/scriptbuilder/structures/events/CHPRadioEvent.java

    r175 r203  
    1010import scriptbuilder.structures.I_XML_Writable; 
    1111import scriptbuilder.structures.ScriptEvent; 
    12 import scriptbuilder.structures.XMLWriter; 
     12import scriptbuilder.structures.XMLBuilder; 
    1313 
    1414/** 
     
    101101    public String toXML() 
    102102    { 
    103         String output = XMLWriter.openTag(ELEMENT.CHP_RADIO.tag + " RadioFile=\"" + radioFile + "\""); 
    104         output += XMLWriter.openTag(ELEMENT.DIALOG.tag); 
     103        String output = XMLBuilder.openTag(ELEMENT.CHP_RADIO.tag + " RadioFile=\"" + radioFile + "\""); 
     104        output += XMLBuilder.openTag(ELEMENT.DIALOG.tag); 
    105105 
    106106        for (int i = 0; i < lines.size(); i++) 
    107107        { 
    108             output += XMLWriter.openTag(ELEMENT.LINE.tag + " Role=\"" + roles.get(i) + "\""); 
     108            output += XMLBuilder.openTag(ELEMENT.LINE.tag + " Role=\"" + roles.get(i) + "\""); 
    109109            output += lines.get(i); 
    110             output += XMLWriter.closeTag(ELEMENT.LINE.tag); 
     110            output += XMLBuilder.closeTag(ELEMENT.LINE.tag); 
    111111        } 
    112112 
    113         output += XMLWriter.closeTag(ELEMENT.DIALOG.tag); 
    114         output += XMLWriter.closeTag(ELEMENT.CHP_RADIO.tag); 
     113        output += XMLBuilder.closeTag(ELEMENT.DIALOG.tag); 
     114        output += XMLBuilder.closeTag(ELEMENT.CHP_RADIO.tag); 
    115115 
    116116        return output; 
  • trunk/src/scriptbuilder/structures/events/CMSEvaluationEvent.java

    r76 r203  
    1010import scriptbuilder.structures.I_XML_Writable; 
    1111import scriptbuilder.structures.ScriptEvent; 
    12 import scriptbuilder.structures.XMLWriter; 
     12import scriptbuilder.structures.XMLBuilder; 
    1313 
    1414/** 
     
    6666    public String toXML() 
    6767    { 
    68         String output = XMLWriter.openTag(ELEMENT.CMS_EVALUATION.tag + " cmsID=\"" + cmsID + "\" type=\"" + cmsType + "\""); 
    69         output += XMLWriter.simpleTag(location, ELEMENT.LOCATION); 
     68        String output = XMLBuilder.openTag(ELEMENT.CMS_EVALUATION.tag + " cmsID=\"" + cmsID + "\" type=\"" + cmsType + "\""); 
     69        output += XMLBuilder.simpleTag(location, ELEMENT.LOCATION); 
    7070 
    7171        if (message.size() > 0) 
    7272        { 
    73             output += XMLWriter.openTag(ELEMENT.SAMPLE_MESSAGE.tag); 
     73            output += XMLBuilder.openTag(ELEMENT.SAMPLE_MESSAGE.tag); 
    7474            for (String str : message) 
    7575            { 
     
    7878                    str = ""; 
    7979                } 
    80                 output += XMLWriter.simpleTag(str, ELEMENT.CMS_LINE); 
     80                output += XMLBuilder.simpleTag(str, ELEMENT.CMS_LINE); 
    8181            } 
    82             output += XMLWriter.closeTag(ELEMENT.SAMPLE_MESSAGE.tag); 
     82            output += XMLBuilder.closeTag(ELEMENT.SAMPLE_MESSAGE.tag); 
    8383        } 
    8484 
    85         output += XMLWriter.closeTag(ELEMENT.CMS_EVALUATION.tag); 
     85        output += XMLBuilder.closeTag(ELEMENT.CMS_EVALUATION.tag); 
    8686 
    8787        return output; 
  • trunk/src/scriptbuilder/structures/events/FacilitatorEvaluationEvent.java

    r76 r203  
    1010import scriptbuilder.structures.I_XML_Writable; 
    1111import scriptbuilder.structures.ScriptEvent; 
    12 import scriptbuilder.structures.XMLWriter; 
     12import scriptbuilder.structures.XMLBuilder; 
    1313 
    1414/** 
     
    6060    public String toXML() 
    6161    { 
    62         String output = XMLWriter.openTag(ELEMENT.FACILITATOR_EVALUATION.tag); 
     62        String output = XMLBuilder.openTag(ELEMENT.FACILITATOR_EVALUATION.tag); 
    6363        if (expectedAction != null) 
    6464        { 
     
    6969                    str = ""; 
    7070                } 
    71                 output += XMLWriter.simpleTag(str, ELEMENT.EXPECTED_ACTION); 
     71                output += XMLBuilder.simpleTag(str, ELEMENT.EXPECTED_ACTION); 
    7272            } 
    7373        } 
    74         output += XMLWriter.closeTag(ELEMENT.FACILITATOR_EVALUATION.tag); 
     74        output += XMLBuilder.closeTag(ELEMENT.FACILITATOR_EVALUATION.tag); 
    7575 
    7676        return output; 
  • trunk/src/scriptbuilder/structures/events/MaintenanceRadioEvent.java

    r76 r203  
    99import scriptbuilder.structures.I_XML_Writable; 
    1010import scriptbuilder.structures.ScriptEvent; 
    11 import scriptbuilder.structures.XMLWriter; 
     11import scriptbuilder.structures.XMLBuilder; 
    1212 
    1313/** 
     
    3333    public String toXML() 
    3434    { 
    35         String output = XMLWriter.simpleTag(message, ELEMENT.MAINTENANCE_RADIO); 
     35        String output = XMLBuilder.simpleTag(message, ELEMENT.MAINTENANCE_RADIO); 
    3636        return output; 
    3737    } 
  • trunk/src/scriptbuilder/structures/events/ParamicsEvent.java

    r76 r203  
    1010import scriptbuilder.structures.I_XML_Writable; 
    1111import scriptbuilder.structures.ScriptEvent; 
    12 import scriptbuilder.structures.XMLWriter; 
     12import scriptbuilder.structures.XMLBuilder; 
    1313 
    1414/** 
     
    4040    public String toXML() 
    4141    { 
    42         String output = XMLWriter.openTag(ELEMENT.PARAMICS.tag + " LocationID=\"" + locationID + "\""); 
     42        String output = XMLBuilder.openTag(ELEMENT.PARAMICS.tag + " LocationID=\"" + locationID + "\""); 
    4343 
    44         output += XMLWriter.simpleTag(status, ELEMENT.Status); 
     44        output += XMLBuilder.simpleTag(status, ELEMENT.Status); 
    4545 
    4646        if (!type.equals("")) 
    4747        { 
    48             output += XMLWriter.simpleTag(type, ELEMENT.Incident_type); 
     48            output += XMLBuilder.simpleTag(type, ELEMENT.Incident_type); 
    4949        } 
    5050 
    5151        for (Integer lane : laneNums) 
    5252        { 
    53             output += XMLWriter.simpleTag("" + lane, ELEMENT.Lane_number); 
     53            output += XMLBuilder.simpleTag("" + lane, ELEMENT.Lane_number); 
    5454        } 
    55         output += XMLWriter.closeTag(ELEMENT.PARAMICS.tag); 
     55        output += XMLBuilder.closeTag(ELEMENT.PARAMICS.tag); 
    5656 
    5757        return output; 
  • trunk/src/scriptbuilder/structures/events/RadioEvaluationEvent.java

    r76 r203  
    1010import scriptbuilder.structures.I_XML_Writable; 
    1111import scriptbuilder.structures.ScriptEvent; 
    12 import scriptbuilder.structures.XMLWriter; 
     12import scriptbuilder.structures.XMLBuilder; 
    1313 
    1414/** 
     
    6060    public String toXML() 
    6161    { 
    62         String output = XMLWriter.openTag(ELEMENT.RADIO_EVALUATION.tag); 
     62        String output = XMLBuilder.openTag(ELEMENT.RADIO_EVALUATION.tag); 
    6363        if (expectedAction != null) 
    6464        { 
     
    6969                    str = ""; 
    7070                } 
    71                 output += XMLWriter.simpleTag(str, ELEMENT.EXPECTED_ACTION); 
     71                output += XMLBuilder.simpleTag(str, ELEMENT.EXPECTED_ACTION); 
    7272            } 
    7373        } 
    74         output += XMLWriter.closeTag(ELEMENT.RADIO_EVALUATION.tag); 
     74        output += XMLBuilder.closeTag(ELEMENT.RADIO_EVALUATION.tag); 
    7575 
    7676        return output; 
  • trunk/src/scriptbuilder/structures/events/TMTRadioEvent.java

    r76 r203  
    99import scriptbuilder.structures.I_XML_Writable; 
    1010import scriptbuilder.structures.ScriptEvent; 
    11 import scriptbuilder.structures.XMLWriter; 
     11import scriptbuilder.structures.XMLBuilder; 
    1212 
    1313/** 
     
    3333    public String toXML() 
    3434    { 
    35         String output = XMLWriter.simpleTag(message, ELEMENT.TMT_RADIO); 
     35        String output = XMLBuilder.simpleTag(message, ELEMENT.TMT_RADIO); 
    3636        return output; 
    3737    } 
  • trunk/src/scriptbuilder/structures/events/TelephoneEvent.java

    r76 r203  
    1010import scriptbuilder.structures.I_XML_Writable; 
    1111import scriptbuilder.structures.ScriptEvent; 
    12 import scriptbuilder.structures.XMLWriter; 
     12import scriptbuilder.structures.XMLBuilder; 
    1313 
    1414/** 
     
    3737    public String toXML() 
    3838    { 
    39         String output = XMLWriter.openTag(ELEMENT.TELEPHONE.tag); 
     39        String output = XMLBuilder.openTag(ELEMENT.TELEPHONE.tag); 
    4040        for (int i = 0; i < lines.size(); i++) 
    4141        { 
    4242            if (roles.get(i).equalsIgnoreCase(ELEMENT.STUDENT.tag)) 
    4343            { 
    44                 output += XMLWriter.simpleTag(lines.get(i), ELEMENT.STUDENT); 
     44                output += XMLBuilder.simpleTag(lines.get(i), ELEMENT.STUDENT); 
    4545            } 
    4646            else 
    4747            { 
    48                 output += XMLWriter.openTag(ELEMENT.INSTRUCTOR.tag + " Role=\"" + roles.get(i) + "\""); 
     48                output += XMLBuilder.openTag(ELEMENT.INSTRUCTOR.tag + " Role=\"" + roles.get(i) + "\""); 
    4949                output += lines.get(i); 
    50                 output += XMLWriter.closeTag(ELEMENT.INSTRUCTOR.tag); 
     50                output += XMLBuilder.closeTag(ELEMENT.INSTRUCTOR.tag); 
    5151            } 
    5252        } 
    53         output += XMLWriter.closeTag(ELEMENT.TELEPHONE.tag); 
     53        output += XMLBuilder.closeTag(ELEMENT.TELEPHONE.tag); 
    5454        return output; 
    5555    } 
  • trunk/src/scriptbuilder/structures/events/TowEvent.java

    r76 r203  
    99import scriptbuilder.structures.I_XML_Writable; 
    1010import scriptbuilder.structures.ScriptEvent; 
    11 import scriptbuilder.structures.XMLWriter; 
     11import scriptbuilder.structures.XMLBuilder; 
    1212 
    1313/** 
     
    3939    public String toXML() 
    4040    { 
    41         return XMLWriter.emptyTag(ELEMENT.TOW.tag + " Company=\"" + towCompany + "\" ConfNum=\"" 
     41        return XMLBuilder.emptyTag(ELEMENT.TOW.tag + " Company=\"" + towCompany + "\" ConfNum=\"" 
    4242                + towConfNum + "\" PubNum=\"" + towPubNum + "\" Beat=\"" + towBeat + "\""); 
    4343    } 
  • trunk/src/scriptbuilder/structures/events/UnitEvent.java

    r145 r203  
    99import scriptbuilder.structures.I_XML_Writable; 
    1010import scriptbuilder.structures.ScriptEvent; 
    11 import scriptbuilder.structures.XMLWriter; 
     11import scriptbuilder.structures.XMLBuilder; 
    1212 
    1313/** 
     
    4141    public String toXML() 
    4242    { 
    43         return XMLWriter.emptyTag(ELEMENT.UNIT.tag+" UnitNum=\""+unitNum+"\" Status=\"" 
     43        return XMLBuilder.emptyTag(ELEMENT.UNIT.tag+" UnitNum=\""+unitNum+"\" Status=\"" 
    4444                +unitStatus+"\" Primary=\""+unitPrimary+"\" Active=\""+unitActive+"\""); 
    4545    } 
  • trunk/src/scriptbuilder/structures/events/WitnessEvent.java

    r46 r203  
    99import scriptbuilder.structures.I_XML_Writable; 
    1010import scriptbuilder.structures.ScriptEvent; 
    11 import scriptbuilder.structures.XMLWriter; 
     11import scriptbuilder.structures.XMLBuilder; 
    1212 
    1313/** 
     
    3737    public String toXML() 
    3838    { 
    39         return XMLWriter.emptyTag(ELEMENT.WITNESS.tag + " Name=\"" + witnessName + "\" Address=\"" 
     39        return XMLBuilder.emptyTag(ELEMENT.WITNESS.tag + " Name=\"" + witnessName + "\" Address=\"" 
    4040                + witnessAddress + "\" PhoneNum=\"" + witnessNum + "\""); 
    4141    } 
  • trunk/src/scriptbuilder/structures/units/Unit.java

    r145 r203  
    88import scriptbuilder.structures.ELEMENT; 
    99import scriptbuilder.structures.I_XML_Writable; 
    10 import scriptbuilder.structures.XMLWriter; 
     10import scriptbuilder.structures.XMLBuilder; 
    1111 
    1212/** 
     
    113113    public String toXML() 
    114114    { 
    115         String output = XMLWriter.openTag(ELEMENT.NEW_UNIT.tag + " UnitNum=\"" + UnitNum + "\""); 
     115        String output = XMLBuilder.openTag(ELEMENT.NEW_UNIT.tag + " UnitNum=\"" + UnitNum + "\""); 
    116116 
    117117        if (!ID.equals("")) 
    118118        { 
    119             output += XMLWriter.simpleTag(ID, ELEMENT.ID); 
     119            output += XMLBuilder.simpleTag(ID, ELEMENT.ID); 
    120120        } 
    121121 
    122122        if (!Status.equals("")) 
    123123        { 
    124             output += XMLWriter.simpleTag(Status, ELEMENT.STATUS); 
     124            output += XMLBuilder.simpleTag(Status, ELEMENT.STATUS); 
    125125        } 
    126126 
    127127        if (!Master_Inc_Num.equals("")) 
    128128        { 
    129             output += XMLWriter.simpleTag(Master_Inc_Num, ELEMENT.MASTER_INC_NUM); 
     129            output += XMLBuilder.simpleTag(Master_Inc_Num, ELEMENT.MASTER_INC_NUM); 
    130130        } 
    131131 
    132132        if (!Primary.equals("")) 
    133133        { 
    134             output += XMLWriter.simpleTag(Primary, ELEMENT.PRIMARY); 
     134            output += XMLBuilder.simpleTag(Primary, ELEMENT.PRIMARY); 
    135135        } 
    136136 
    137137        if (!OOS.equals("")) 
    138138        { 
    139             output += XMLWriter.simpleTag(OOS, ELEMENT.OOS); 
     139            output += XMLBuilder.simpleTag(OOS, ELEMENT.OOS); 
    140140        } 
    141141 
    142142        if (!Type.equals("")) 
    143143        { 
    144             output += XMLWriter.simpleTag(Type, ELEMENT.TYPE); 
     144            output += XMLBuilder.simpleTag(Type, ELEMENT.TYPE); 
    145145        } 
    146146 
    147147        //All units have a current location field, even if it's blank 
    148         output += XMLWriter.simpleTag(Curr_Loc, ELEMENT.CURR_LOC); 
     148        output += XMLBuilder.simpleTag(Curr_Loc, ELEMENT.CURR_LOC); 
    149149 
    150150        //All units have a destination field, even if it's blank 
    151         output += XMLWriter.simpleTag(Destination, ELEMENT.DESTINATION); 
     151        output += XMLBuilder.simpleTag(Destination, ELEMENT.DESTINATION); 
    152152 
    153153        if (!Misc_Info.equals("")) 
    154154        { 
    155             output += XMLWriter.simpleTag(Misc_Info, ELEMENT.MISC_INFO); 
     155            output += XMLBuilder.simpleTag(Misc_Info, ELEMENT.MISC_INFO); 
    156156        } 
    157157 
    158158        if (!Stack.equals("")) 
    159159        { 
    160             output += XMLWriter.simpleTag(Stack, ELEMENT.STACK); 
     160            output += XMLBuilder.simpleTag(Stack, ELEMENT.STACK); 
    161161        } 
    162162 
    163163        if (!Area.equals("")) 
    164164        { 
    165             output += XMLWriter.simpleTag(Area, ELEMENT.AREA); 
     165            output += XMLBuilder.simpleTag(Area, ELEMENT.AREA); 
    166166        } 
    167167 
    168168        if (!Badge_Num.equals("")) 
    169169        { 
    170             output += XMLWriter.simpleTag(Badge_Num, ELEMENT.BADGE_NUM); 
     170            output += XMLBuilder.simpleTag(Badge_Num, ELEMENT.BADGE_NUM); 
    171171        } 
    172172 
    173173        if (!Officer.equals("")) 
    174174        { 
    175             output += XMLWriter.simpleTag(Officer, ELEMENT.OFFICER); 
     175            output += XMLBuilder.simpleTag(Officer, ELEMENT.OFFICER); 
    176176        } 
    177177 
    178178        if (!Office.equals("")) 
    179179        { 
    180             output += XMLWriter.simpleTag(Office, ELEMENT.OFFICE); 
     180            output += XMLBuilder.simpleTag(Office, ELEMENT.OFFICE); 
    181181        } 
    182182 
    183183        if (!Timer.equals("")) 
    184184        { 
    185             output += XMLWriter.simpleTag(Timer, ELEMENT.TIMER); 
     185            output += XMLBuilder.simpleTag(Timer, ELEMENT.TIMER); 
    186186        } 
    187187 
    188188        if (!P.equals("")) 
    189189        { 
    190             output += XMLWriter.simpleTag(P, ELEMENT.P); 
     190            output += XMLBuilder.simpleTag(P, ELEMENT.P); 
    191191        } 
    192192 
    193193        if (!Agy.equals("")) 
    194194        { 
    195             output += XMLWriter.simpleTag(Agy, ELEMENT.AGY); 
     195            output += XMLBuilder.simpleTag(Agy, ELEMENT.AGY); 
    196196        } 
    197197 
    198198        if (!Alias.equals("")) 
    199199        { 
    200             output += XMLWriter.simpleTag(Alias, ELEMENT.ALIAS); 
     200            output += XMLBuilder.simpleTag(Alias, ELEMENT.ALIAS); 
    201201        } 
    202202 
    203203        if (!Unit_Status.equals("")) 
    204204        { 
    205             output += XMLWriter.simpleTag(Unit_Status, ELEMENT.UNIT_STATUS); 
    206         } 
    207  
    208         output += XMLWriter.closeTag(ELEMENT.NEW_UNIT.tag); 
     205            output += XMLBuilder.simpleTag(Unit_Status, ELEMENT.UNIT_STATUS); 
     206        } 
     207 
     208        output += XMLBuilder.closeTag(ELEMENT.NEW_UNIT.tag); 
    209209        return output; 
    210210    } 
Note: See TracChangeset for help on using the changeset viewer.