Changes in / [20:30] in tmcsimulator


Ignore:
Location:
/trunk
Files:
1 added
13 edited

Legend:

Unmodified
Added
Removed
  • /trunk/test/tmcsim/cadsimulator/CADSimulatorFixture.java

    r19 r26  
    3434            + "ATMSProperties         = empty.txt\n" 
    3535            + "MediaProperties        = empty.txt\n"; 
    36     static final String paramicsData = "ParamicsCommHost      = 192.168.251.45\n" 
     36    static final String configpData = "ParamicsCommHost = 192.168.251.45\n" 
    3737            + "ParamicsCommPort       = 4450\n" 
    3838            + "IncidentUpdateInterval = 30\n" 
     
    4242            + "CameraStatusInterval   = 30\n" 
    4343            + "CameraStatusFile       = camera_status.xml\n"; 
     44    static final String paramConfig    = "SocketPort=4450\n" 
     45            +"WorkingDirectory=.\nGUIvisible=false"; 
    4446    static final String cardfileURL = "http://pastebin.com/raw/Yr26nfp7"; 
    4547    static final String smallXMLURL = "http://pastebin.com/raw/Eqj2N5qD"; 
     
    5860        System.setOut(ps); 
    5961        writedata("config.txt", configData); 
    60         writedata("pconfig.txt", paramicsData); 
     62        writedata("pconfig.txt", configpData); 
     63        writedata("pmcprops.txt", paramConfig); 
    6164        writedata("empty.txt", ""); 
    6265        writeScriptfiles(); 
  • /trunk/IDE_metadata/NetBeans/TMCSim/build.xml

    r20 r23  
    131131      </jar> 
    132132</target> 
     133 
     134<target description="Build separate jar files for each component of the TMC system."  
     135        name="ZipForInstall" depends="package-jars"> 
     136    <!-- Notes:    Create a zip file with jars and all external resources for distributing 
     137    to other machines. 
     138    Zip the Jar files. 
     139    Zip folders for config, images, audio, scripts. 
     140    Write .bat files and .bash files to launch each app.  Put these in root folder. 
     141    Zip it all up! 
     142    --> 
     143</target> 
     144 
    133145    <!-- 
    134146 
  • /trunk/IDE_metadata/Eclipse

    • Property svn:ignore set to
      deploy
  • /trunk/IDE_metadata/Eclipse/build.xml

    r18 r30  
    5454 
    5555 
    56     <echo message="Packaging TMC into a single JAR at ${deploy.jar}"/> 
    5756 
    5857    <delete dir="${deploy.dir}"/> 
    5958    <mkdir dir="${deploy.dir}"/> 
    6059 
    61     <jar destfile="${deploy.dir}/temp_final.jar" filesetmanifest="skip"> 
    62         <zipgroupfileset dir="${workdir}/lib" includes="xercesImpl.jar"/> 
    63  
    64         <manifest> 
    65             <attribute name="Main-Class" value="${main.class}"/> 
    66         </manifest> 
    67     </jar> 
    68  
    69     <zip destfile="${deploy.jar}"> 
    70         <zipfileset src="${deploy.dir}/temp_final.jar" 
    71         excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/> 
    72     </zip> 
    73  
    74     <delete file="${deploy.dir}/temp_final.jar"/> 
    75  
     60     
    7661    <!--                   *** Build CAD Server Only Jar ***         --> 
    7762      <jar destfile="${deploy.dir}/CADserver.jar" 
  • /trunk/config/cad_simulator_paramics_config.properties

    r14 r21  
    1 #ParamicsCommHost       = 192.168.251.45 
     1ParamicsCommHost       = 192.168.251.45 
    22# For development testing 
    3 ParamicsCommHost       = 127.0.0.1 
     3#ParamicsCommHost       = 127.0.0.1 
    44ParamicsCommPort       = 4450 
    55IncidentUpdateInterval = 30 
  • /trunk/config/paramics_communicator_logging.properties

    r14 r21  
    1616 
    1717LogFile = paramics_communication_log.xml 
     18 
     19# Set properties for 2016 --jd 
     20LogFile=C:\\paramics_communicator.log 
     21# Ethernet cable in operator room 
     22#CADSimulatorHost=192.168.251.119 
     23# PC1 in operator room (Service Tag BHLLD42) 
     24CADSimulatorHost=192.168.251.116 
     25# Virtual Host: TMCSIM Manager 
     26#CADSimulatorHost=192.168.251.88 
     27# For local testing 
    1828CADSimulatorHost = 127.0.0.1 
    19 CADSimulatorRMIPort = 4450 
     29 
     30CADSimulatorRMIPort=4445 
     31#CADSimulatorRMIPort = 4450 
  • /trunk/src/tmcsim/paramicscommunicator/ParamicsFileWriter.java

    r2 r25  
    11package tmcsim.paramicscommunicator; 
    2  
    32 
    43import java.io.File; 
     
    1110import java.util.logging.Level; 
    1211import java.util.logging.Logger; 
    13  
    1412import org.apache.xml.serialize.OutputFormat; 
    1513import org.apache.xml.serialize.XMLSerializer; 
    1614import org.w3c.dom.Element; 
    17  
    1815import tmcsim.paramicscommunicator.FileIOUpdate.IO_TYPE; 
    1916 
    2017/** 
    21  * The ParamicsFileWriter handles writing messages to a target file which 
    22  * is read by Paramics. Messages are received through the writeMessage() method. 
     18 * The ParamicsFileWriter handles writing messages to a target file which is 
     19 * read by Paramics. Messages are received through the writeMessage() method. 
    2320 * This object handles queueing messages and writing as the file becomes 
    24  * available.  New data is written to the target file when it has been 
    25  * modified (cleared) by Paramics.  If this does not happen, messages 
    26  * are queued and a timer is used to periodically determine if the 
    27  * file has become available for writing. 
    28  *  
     21 * available. New data is written to the target file when it has been modified 
     22 * (cleared) by Paramics. If this does not happen, messages are queued and a 
     23 * timer is used to periodically determine if the file has become available for 
     24 * writing. 
     25 * 
    2926 * @author Matthew Cechini 
    3027 * @version 
    3128 */ 
    32 public class ParamicsFileWriter extends Observable { 
    33      
    34     /**  
    35      * Duration (in  ms) that the TimerTask will be scheduled to 
    36      * retry writing to the target file. Default = 2000ms 
     29public class ParamicsFileWriter extends Observable 
     30{ 
     31 
     32    /** 
     33     * Duration (in ms) that the TimerTask will be scheduled to retry writing to 
     34     * the target file. Default = 2000ms 
    3735     */ 
    3836    private static long TIMER_DURATION = 2000; 
    39      
    40     /** Error Logger. */ 
     37    /** 
     38     * Error Logger. 
     39     */ 
    4140    private Logger paramLogger = Logger.getLogger("tmcsim.paramicscommunicator"); 
    42      
    43     /** Linked List of messages that have been received */ 
     41    /** 
     42     * Linked List of messages that have been received 
     43     */ 
    4444    private LinkedList<Element> queuedMessages = null; 
    45      
    46     /**  */ 
     45    /** 
     46     * 
     47     */ 
    4748    private String writerID = null; 
    48  
    49     /** File name of the file where data is written */ 
     49    /** 
     50     * File name of the file where data is written 
     51     */ 
    5052    private String outputFile = null; 
    51      
    52     /** FileWriter used to write data to the output file. */ 
     53    /** 
     54     * FileWriter used to write data to the output file. 
     55     */ 
    5356    private FileWriter fileWriter = null; 
    54      
    55     /** Value (seconds since 1/1/1970) of output file's last modifcation time */ 
    56     private long lastModified = 0;   
    57      
    58     /** Timer used to schedule file writing tasks. */ 
     57    /** 
     58     * Value (seconds since 1/1/1970) of output file's last modifcation time 
     59     */ 
     60    private long lastModified = 0; 
     61    /** 
     62     * Timer used to schedule file writing tasks. 
     63     */ 
    5964    private Timer writerTimer = null; 
    60      
     65    /** 
     66     * Synchronizing lock to protect File IO and message queuing. 
     67     */ 
     68    private Object lock = null; 
     69 
    6170    /** 
    6271     * A TimerTask to retry writing messages that have been queued within this 
    63      * ParamicsWriter.  If a message has been queued, see if the target file 
    64      * has been modified since last write.  If so, write the first queued message 
    65      * to the file and remove the message from the queue.  If writing is unsuccessful, 
    66      * do not remove the message from the queue.  If there are no more messages in  
    67      * the queue, cancel this timer. 
    68      */ 
    69     private class WriterTimerTask extends TimerTask { 
    70         public void run() { 
    71  
    72             synchronized(lock) { 
    73              
     72     * ParamicsWriter. If a message has been queued, see if the target file has 
     73     * been modified since last write. If so, write the first queued message to 
     74     * the file and remove the message from the queue. If writing is 
     75     * unsuccessful, do not remove the message from the queue. If there are no 
     76     * more messages in the queue, cancel this timer. 
     77     */ 
     78    private class WriterTimerTask extends TimerTask 
     79    { 
     80 
     81        public void run() 
     82        { 
     83 
     84            synchronized (lock) 
     85            { 
     86                paramLogger.log(Level.INFO, "ParamicsFileWriter, WriterTimerTask " 
     87                        + "run() started, current queue size = " + queuedMessages.size()); 
     88 
    7489                //if we've queued something, continue. 
    75                 if(queuedMessages.size() > 0) {          
    76                      
     90                if (queuedMessages.size() > 0) 
     91                { 
     92 
    7793                    //if file has been modified, write to it 
    78                     if(lastModified < new File(outputFile).lastModified()) 
    79                     {        
    80                         try { 
     94                    if (lastModified < new File(outputFile).lastModified()) 
     95                    { 
     96                        try 
     97                        { 
    8198                            writeToFile(queuedMessages.getFirst()); 
    8299                            queuedMessages.remove(0); 
     100                        } catch (IOException ioe) 
     101                        { 
     102                            paramLogger.logp(Level.SEVERE, "ParamicsFileWriter.WriterTimerTask", 
     103                                    "run()", "Exception in writing to the target file: " 
     104                                    + outputFile + ".  Queue size = " + queuedMessages.size(), ioe); 
    83105                        } 
    84                         catch (IOException ioe) { 
    85                             paramLogger.logp(Level.SEVERE, "ParamicsFileWriter.WriterTimerTask",  
    86                                     "run()", "Exception in writing to the target file: " +  
    87                                     outputFile + ".  Queue size = " + queuedMessages.size(), ioe); 
     106 
     107                        //all queued messages gone, cancel timer 
     108                        if (queuedMessages.size() == 0) 
     109                        { 
     110                            this.cancel(); 
    88111                        } 
    89                          
    90                         //all queued messages gone, cancel timer 
    91                         if(queuedMessages.size() == 0) 
    92                             this.cancel(); 
    93                     }    
     112                    } 
    94113                } 
    95             }                
    96         } 
    97     } 
    98      
    99     /** Synchronizing lock to protect File IO and message queuing. */ 
    100     private Object lock = null;      
    101      
    102     /** 
    103      * Constructor.  Initialize data objects.  If the target file exists, delete  
    104      * it, and then create a new file.   
     114            } 
     115        } 
     116    } 
     117 
     118    /** 
     119     * Constructor. Initialize data objects. If the target file exists, delete 
     120     * it, and then create a new file. 
    105121     * 
    106122     * @param workingDir Directory path where the output file is to be written 
    107123     * @param mess The ParamicsCommMessage containing the outputFile filename. 
    108124     */ 
    109     public ParamicsFileWriter(String id, String workingDir, String targetFile) { 
    110  
    111         try { 
     125    public ParamicsFileWriter(String id, String workingDir, String targetFile) 
     126    { 
     127 
     128        try 
     129        { 
    112130            writerID = id; 
    113      
    114             queuedMessages  = new LinkedList<Element>();     
    115             lock            = new Object(); 
    116                          
    117             outputFile      = workingDir + targetFile;   
    118              
    119             File tempFile = new File(outputFile);            
    120             if(tempFile.exists()) { 
     131 
     132            queuedMessages = new LinkedList<Element>(); 
     133            lock = new Object(); 
     134 
     135            outputFile = workingDir + targetFile; 
     136 
     137            File tempFile = new File(outputFile); 
     138            if (tempFile.exists()) 
     139            { 
    121140                tempFile.delete(); 
    122141            } 
    123142 
    124             tempFile.createNewFile();            
    125                                                  
    126             writerTimer     = new Timer(); 
    127              
    128         } catch (IOException ioe) { 
    129             paramLogger.logp(Level.SEVERE, "ParamicsFileWriter", "Constructor",  
     143            tempFile.createNewFile(); 
     144 
     145            writerTimer = new Timer(); 
     146 
     147        } catch (IOException ioe) 
     148        { 
     149            paramLogger.logp(Level.SEVERE, "ParamicsFileWriter", "Constructor", 
    130150                    "Unable to create Paramics File Writer.", ioe); 
    131151        } 
    132          
    133     } 
    134      
    135      
     152 
     153    } 
     154 
    136155    /** 
    137156     * Method is called when a message has been received from the CAD Simulator. 
    138      * If the message queue is not empty, add the new message to the queue. 
    139      * If the output file has not been modified (read) since last write, 
    140      * add the message to the queue and set a timer to repeatedly check for  
    141      * modification to the output file.  Else, write the new message to the file.   
    142      * If there is an error in writing the data, queue the message start a timer 
    143      * to retry the writing. 
    144      * 
    145      * @param newMessage The received message which is to be written to  
    146      * the output file. 
    147      */ 
    148     public void writeMessage(Element messageElem) { 
    149          
    150         synchronized(lock) { 
    151              
    152             //messages already queued... get in line.            
    153             if(queuedMessages.size() > 0) { 
     157     * If the message queue is not empty, add the new message to the queue. If 
     158     * the output file has not been modified (read) since last write, add the 
     159     * message to the queue and set a timer to repeatedly check for modification 
     160     * to the output file. Else, write the new message to the file. If there is 
     161     * an error in writing the data, queue the message start a timer to retry 
     162     * the writing. 
     163     * 
     164     * @param newMessage The received message which is to be written to the 
     165     * output file. 
     166     */ 
     167    public void writeMessage(Element messageElem) 
     168    { 
     169 
     170        synchronized (lock) 
     171        { 
     172            paramLogger.log(Level.INFO, "ParamicsFileWriter, writeMessage " 
     173                    + "current queue size = " + queuedMessages.size()); 
     174 
     175            //messages already queued... get in line. 
     176            if (queuedMessages.size() > 0) 
     177            { 
    154178                queuedMessages.add(messageElem); 
    155179 
    156                 paramLogger.log(Level.INFO, "Queueing message, new queue " + 
    157                         "size = " + queuedMessages.size()); 
    158             }                
    159             //No modification since last write. (first queue)                
    160             else if (lastModified >= new File(outputFile).lastModified()) { 
    161                 queuedMessages.add(messageElem);                 
    162                                  
    163                 writerTimer.scheduleAtFixedRate(new WriterTimerTask(),  
     180                paramLogger.log(Level.INFO, "Queueing message, new queue " 
     181                        + "size = " + queuedMessages.size()); 
     182            } //No modification since last write. (first queue) 
     183            else if (lastModified >= new File(outputFile).lastModified()) 
     184            { 
     185                paramLogger.log(Level.INFO, "ParamicsFileWriter, writeMessage " 
     186                        + "adding msg to queue."); 
     187                queuedMessages.add(messageElem); 
     188 
     189                writerTimer.scheduleAtFixedRate(new WriterTimerTask(), 
    164190                        0L, TIMER_DURATION); 
    165191 
    166192                paramLogger.log(Level.INFO, "First message queued"); 
    167             }            
    168             //free and clear, write. 
    169             else { 
    170                 try { 
     193            } //free and clear, write. 
     194            else 
     195            { 
     196                paramLogger.log(Level.INFO, "ParamicsFileWriter, writeMessage " 
     197                        + "try to writeToFile" + outputFile); 
     198                try 
     199                { 
    171200                    writeToFile(messageElem); 
    172                 } 
    173                 catch(IOException ioe) { 
    174                     paramLogger.logp(Level.SEVERE, "ParamicsFileWriter",  
    175                             "writeMessage()", "Exception in writing to the " + 
    176                             "target file: " + outputFile, ioe); 
    177                      
     201                } catch (IOException ioe) 
     202                { 
     203                    paramLogger.logp(Level.SEVERE, "ParamicsFileWriter", 
     204                            "writeMessage()", "Exception in writing to the " 
     205                            + "target file: " + outputFile, ioe); 
     206 
    178207                    queuedMessages.add(messageElem); 
    179                      
    180                     writerTimer.scheduleAtFixedRate(new WriterTimerTask(),  
     208 
     209                    writerTimer.scheduleAtFixedRate(new WriterTimerTask(), 
    181210                            0L, TIMER_DURATION); 
    182211                } 
     212                paramLogger.log(Level.INFO, "ParamicsFileWriter, writeMessage " 
     213                        + "writeToFile succeeded."); 
    183214            } 
    184215        } 
    185216    } 
    186          
     217 
    187218    /** 
    188219     * Method writes data to the output file. 
    189      *  
     220     * 
    190221     * @param output Data to be written to the file. 
    191222     */ 
    192     private void writeToFile(Element output) throws IOException {        
    193          
     223    private void writeToFile(Element output) throws IOException 
     224    { 
     225 
    194226        fileWriter = new FileWriter(outputFile); 
    195          
    196         OutputFormat of = new OutputFormat("XML","ISO-8859-1",true); 
     227 
     228        OutputFormat of = new OutputFormat("XML", "ISO-8859-1", true); 
    197229        of.setIndent(1); 
    198230        of.setIndenting(true); 
    199          
     231 
    200232        XMLSerializer serializer = new XMLSerializer(fileWriter, of); 
    201233        serializer.asDOMSerializer(); 
    202234        serializer.serialize(output); 
    203235 
    204         /** Added by Nathaniel Lehrer */ 
    205         try { 
     236        /** 
     237         * Added by Nathaniel Lehrer 
     238         */ 
     239        try 
     240        { 
    206241            java.io.ByteArrayOutputStream outputStream = new java.io.ByteArrayOutputStream(); 
    207242            new XMLSerializer(outputStream, of).serialize(output); 
    208243            tmcsim.paramicslog.ParamicsLog.getInstance().writeToLog(outputStream.toString()); 
    209         } catch(Exception e) { 
     244        } catch (Exception e) 
     245        { 
    210246            System.out.println(e); 
    211247        } 
    212         /** End Add by Nathaniel Lehrer */ 
    213          
     248        /** 
     249         * End Add by Nathaniel Lehrer 
     250         */ 
    214251        fileWriter.flush(); 
    215252        fileWriter.close(); 
    216          
    217         lastModified = new File(outputFile).lastModified();      
    218          
     253 
     254        lastModified = new File(outputFile).lastModified(); 
     255 
    219256        setChanged(); 
    220257        notifyObservers(new FileIOUpdate(IO_TYPE.WRITE, writerID, new File(outputFile).length())); 
    221                              
    222     }                
     258 
     259    } 
    223260} 
  • /trunk/src/tmcsim/paramicscommunicator/ParamicsCommunicator.java

    r6 r26  
    7474 
    7575        SOCKET_PORT("SocketPort"), 
    76         WORKING_DIR("WorkingDirectory"); 
     76        WORKING_DIR("WorkingDirectory"), 
     77        GUI_VISIBLE("GUIvisible"); 
    7778        public String name; 
    7879 
     
    139140        readers = new TreeMap<String, ParamicsFileReader>(); 
    140141 
    141         theGUI = new ParamicsCommunicatorGUI(); 
    142         addObserver(theGUI); 
    143         theGUI.addWindowListener(new WindowListener() 
    144         { 
    145             public void windowActivated(WindowEvent arg0) 
    146             { 
    147             } 
    148  
    149             ; 
    150             public void windowClosed(WindowEvent arg0) 
    151             { 
    152             } 
    153  
    154             ; 
    155             public void windowClosing(WindowEvent arg0) 
    156             { 
    157                 System.exit(0); 
    158             } 
    159  
    160             public void windowDeactivated(WindowEvent arg0) 
    161             { 
    162             } 
    163  
    164             ; 
    165             public void windowDeiconified(WindowEvent arg0) 
    166             { 
    167             } 
    168  
    169             ; 
    170             public void windowIconified(WindowEvent arg0) 
    171             { 
    172             } 
    173  
    174             ; 
    175             public void windowOpened(WindowEvent arg0) 
    176             { 
    177             } 
    178         ; 
    179         }); 
    180  
    181142        try 
    182143        { 
     
    247208        } 
    248209 
     210        // Should we display the GUI? 
     211        String visibleProp = paramicsCommProp.getProperty(PROPERTIES.GUI_VISIBLE.name); 
     212        // If no property was given, or if it was given and says True 
     213        if (visibleProp == null || (visibleProp.toLowerCase().equals("true"))) 
     214        { 
     215            theGUI = new ParamicsCommunicatorGUI(); // it sets itself visible 
     216            addObserver(theGUI); 
     217            theGUI.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE); 
     218        } 
    249219 
    250220        try 
     
    359329 
    360330    /** 
    361      * Perform the action represented in the received XML document message. 
    362      * First determine if the action is from a READER, WRITER, and RESET. If the 
    363      * paramics action is REGISTER, add a new ParamicsFileReader/Writer to the 
    364      * local list of readers/writers and update the GUI with a FileRegUpdate 
    365      * object. If the paramics action is UNREGISTER, remove the 
    366      * ParamicsFileReader/Writer from the local list of readers/writers and 
    367      * update the GUI with a FileRegUpdate object. If RESET is received, clear 
    368      * all readers and writers. 
     331     * Perform the action represented in XML document message received from the 
     332     * CAD Simulator. First determine if the action is from a READER, WRITER, 
     333     * and RESET. If the paramics action is REGISTER, add a new 
     334     * ParamicsFileReader/Writer to the local list of readers/writers and update 
     335     * the GUI with a FileRegUpdate object. If the paramics action is 
     336     * UNREGISTER, remove the ParamicsFileReader/Writer from the local list of 
     337     * readers/writers and update the GUI with a FileRegUpdate object. If RESET 
     338     * is received, clear all readers and writers. 
    369339     * 
    370340     * @param mess Received XML document message. 
     
    482452            } catch (SocketTimeoutException ste) 
    483453            { 
    484                 System.out.println("...waiting..."); 
     454                System.out.println("...waiting for socket connection from the CAD Simulator..."); 
    485455            } catch (IOException ioe) 
    486456            { 
  • /trunk/src/tmcsim/paramicscommunicator/ParamicsFileReader.java

    r6 r25  
    8080        public void run() 
    8181        { 
    82  
     82            paramLogger.logp(Level.INFO, 
     83                    "ParamicsFileReader.ReaderTimerTask", "run()", 
     84                    "Waiting for " + inputFile + " to be modified."); 
    8385            if (lastModified < inputFile.lastModified()) 
    8486            { 
     87                paramLogger.logp(Level.INFO, 
     88                        "ParamicsFileReader.ReaderTimerTask", "run()", 
     89                        "Cool, " + inputFile + " has been modified, let's read it."); 
    8590 
    8691                try 
     
    96101                    Element messageElem = readerDoc.createElement(PARAMICS_COMM_TAGS.MESSAGE.tag); 
    97102                    String fileContents = readFromFile(); 
     103                    paramLogger.logp(Level.INFO, 
     104                            "ParamicsFileReader.ReaderTimerTask", "run()", 
     105                            "Nice, we read " + fileContents); 
    98106                    messageElem.appendChild(readerDoc.createTextNode(fileContents)); 
    99107                    readerElem.appendChild(messageElem); 
  • /trunk/src/tmcsim/paramicscommunicator/gui/ParamicsCommunicatorGUI.java

    r6 r29  
    1111import java.util.logging.LogRecord; 
    1212import java.util.logging.Logger; 
     13 
    1314import javax.swing.BorderFactory; 
    1415import javax.swing.Box; 
     
    2021import javax.swing.JTabbedPane; 
    2122import javax.swing.JTextArea; 
     23 
    2224import tmcsim.common.RevisionNumber; 
    2325import tmcsim.paramicscommunicator.FileIOUpdate; 
     
    207209        this.setJMenuBar(menuBar); 
    208210 
    209         fileIOTabs = new JTabbedPane(); 
    210         fileIOTabs.setAlignmentX(Box.CENTER_ALIGNMENT); 
    211         fileIOTabs.setMinimumSize(new Dimension(420, 480)); 
    212         fileIOTabs.setPreferredSize(new Dimension(420, 480)); 
    213         fileIOTabs.setMaximumSize(new Dimension(420, 480)); 
    214         fileIOTabs.setBorder(BorderFactory.createCompoundBorder( 
     211        fileReaderTabs = new JTabbedPane(); 
     212        fileReaderTabs.setAlignmentX(Box.CENTER_ALIGNMENT); 
     213        fileReaderTabs.setMinimumSize(new Dimension(420, 480)); 
     214        fileReaderTabs.setPreferredSize(new Dimension(420, 480)); 
     215        fileReaderTabs.setMaximumSize(new Dimension(420, 480)); 
     216        fileReaderTabs.setBorder(BorderFactory.createCompoundBorder( 
    215217                BorderFactory.createTitledBorder( 
    216                 BorderFactory.createRaisedBevelBorder(), "Registered I/O"), 
     218                BorderFactory.createRaisedBevelBorder(), "Registered Readers "), 
     219                BorderFactory.createEmptyBorder(5, 5, 5, 5))); 
     220         
     221        fileWriterTabs = new JTabbedPane(); 
     222        fileWriterTabs.setAlignmentX(Box.CENTER_ALIGNMENT); 
     223        fileWriterTabs.setMinimumSize(new Dimension(420, 480)); 
     224        fileWriterTabs.setPreferredSize(new Dimension(420, 480)); 
     225        fileWriterTabs.setMaximumSize(new Dimension(420, 480)); 
     226        fileWriterTabs.setBorder(BorderFactory.createCompoundBorder( 
     227                BorderFactory.createTitledBorder( 
     228                BorderFactory.createRaisedBevelBorder(), "Registered Writers "), 
    217229                BorderFactory.createEmptyBorder(5, 5, 5, 5))); 
    218230 
     
    228240                BorderFactory.createEmptyBorder(5, 5, 5, 5))); 
    229241 
    230  
     242        Box tabbedBox = new Box(BoxLayout.X_AXIS); 
     243        tabbedBox.add(fileReaderTabs); 
     244        tabbedBox.add(fileWriterTabs); 
     245         
    231246        Box guiBox = new Box(BoxLayout.Y_AXIS); 
    232         guiBox.add(fileIOTabs); 
     247        guiBox.add(tabbedBox); 
    233248        guiBox.add(Box.createVerticalStrut(10)); 
    234249        guiBox.add(errorPane); 
     
    237252 
    238253        setMinimumSize(new Dimension(420, 680)); 
    239         setPreferredSize(new Dimension(420, 680)); 
     254        setPreferredSize(new Dimension(840, 680)); 
    240255        setResizable(false); 
    241256        pack(); 
     
    260275            case READ: 
    261276                tabName = "Reader " + update.ioID; 
     277                fileReaderTabs.add(tabName, new ParamicsIOInfoPanel(update, model)); 
    262278                break; 
    263279            case WRITE: 
    264280                tabName = "Writer " + update.ioID; 
     281                fileWriterTabs.add(tabName, new ParamicsIOInfoPanel(update, model)); 
    265282                break; 
    266283        } 
    267284 
    268         fileIOTabs.add(tabName, new ParamicsIOInfoPanel(update, model)); 
    269     } 
    270     private JTabbedPane fileIOTabs; 
     285    } 
     286     
     287    private JTabbedPane fileReaderTabs; 
     288    private JTabbedPane fileWriterTabs; 
    271289    private JScrollPane errorPane; 
    272290    private JTextArea errorTA; 
  • /trunk/src/tmcsim/cadsimulator/Coordinator.java

    r2 r27  
    1  
    21package tmcsim.cadsimulator; 
    32 
    4 import java.awt.List; 
    53import java.io.File; 
    64import java.rmi.RemoteException; 
     
    1614import java.util.logging.Level; 
    1715import java.util.logging.Logger; 
    18  
    19 import javax.swing.JList; 
    20 import javax.swing.Timer; 
    2116import javax.swing.table.DefaultTableModel; 
    2217import javax.xml.parsers.SAXParserFactory; 
    23  
    2418import tmcsim.cadmodels.CADRoutedMessage; 
    2519import tmcsim.cadmodels.CMSInfo; 
     
    4337import tmcsim.client.cadclientgui.data.Incident; 
    4438import tmcsim.client.cadclientgui.data.IncidentEvent; 
    45 import tmcsim.client.cadclientgui.enums.CADDataEnums.*; 
     39import tmcsim.client.cadclientgui.enums.CADDataEnums.CARDFILE; 
     40import tmcsim.client.cadclientgui.enums.CADDataEnums.EditCommand; 
     41import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_ACTIVITIES; 
     42import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_ADD_INFO; 
     43import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_CALLBACK; 
     44import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_CALLER; 
     45import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_EDIT_LOG; 
     46import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_GEN_INFO; 
     47import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_INFO; 
     48import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_LOC; 
     49import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_PROBLEM; 
     50import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_RESP; 
     51import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_TABLE; 
     52import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_TIMES; 
     53import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_VAL; 
     54import tmcsim.client.cadclientgui.enums.CADDataEnums.TABLE; 
    4655import tmcsim.client.cadclientgui.enums.CADScriptTags.UNIT_TAGS; 
    4756import tmcsim.client.cadclientgui.enums.IncidentEnums; 
    4857import tmcsim.client.cadclientgui.enums.UnitStatusEnums; 
    49 import tmcsim.client.cadclientgui.screens.ScreenManager; 
    50 import tmcsim.common.CCTVInfo; 
     58import tmcsim.common.CADEnums.PARAMICS_STATUS; 
     59import tmcsim.common.CADEnums.SCRIPT_STATUS; 
    5160import tmcsim.common.ObserverMessage; 
    5261import tmcsim.common.ScriptException; 
    5362import tmcsim.common.SimulationException; 
    5463import tmcsim.common.XMLIncident; 
    55 import tmcsim.common.CADEnums.PARAMICS_STATUS; 
    56 import tmcsim.common.CADEnums.SCRIPT_STATUS; 
    5764import tmcsim.interfaces.CADClientInterface; 
    5865import tmcsim.interfaces.CoordinatorInterface; 
     
    6067 
    6168/** 
    62  * Coordinator is used to control and manage interactions between all CAD  
    63  * Simulator Managers.  The Coordinator is also registered as an RMI Object 
    64  * to allow remote control and access to simulation data.   A  
     69 * Coordinator is used to control and manage interactions between all CAD 
     70 * Simulator Managers. The Coordinator is also registered as an RMI Object to 
     71 * allow remote control and access to simulation data. A 
    6572 * SimulationManagerInterface Object is used to provide communication to a 
    66  * remotely connected SimulationManager.  Observers may register with the 
     73 * remotely connected SimulationManager. Observers may register with the 
    6774 * Coordinator to listen for simulation data updates. 
    6875 * 
     
    7380 * @see SimulationControlManager 
    7481 * @author Matthew Cechini 
    75  * @version  
     82 * @version 
    7683 */ 
    7784@SuppressWarnings("serial") 
    7885public class Coordinator extends UnicastRemoteObject 
    79     implements CoordinatorInterface { 
    80  
    81     /** Error logger. */ 
     86        implements CoordinatorInterface 
     87{ 
     88 
     89    /** 
     90     * Error logger. 
     91     */ 
    8292    private Logger coorLogger = Logger.getLogger("tmcsim.cadsimulator"); 
    83      
    84     /** 
    85      * List of all Observers that have been registered with the Coordinator.  Due 
    86      * to being a remote object, Coordinator cannot extend the Observable class.  
     93    /** 
     94     * List of all Observers that have been registered with the Coordinator. Due 
     95     * to being a remote object, Coordinator cannot extend the Observable class. 
    8796     * Therefore, the list is managed manually. 
    8897     */ 
    8998    private Vector<Observer> observerList = null; 
    90      
    91     /** 
    92      * Interface object for RMI communication with the Simulation Manager.  Only one Simulation Manager 
    93      * may be connected at a time.  When there is no connected Manager, this object is set to null. 
     99    /** 
     100     * Interface object for RMI communication with the Simulation Manager. Only 
     101     * one Simulation Manager may be connected at a time. When there is no 
     102     * connected Manager, this object is set to null. 
    94103     */ 
    95104    private static SimulationManagerInterface managerInt = null; 
    96      
    97105    private static LinkedList<CADClientInterface> clientList; 
    98              
    99106    private static CADData cadData; 
    100      
    101107    private static CardfileData cardfileData; 
    102      
    103     /** 
    104      * Constructor.  Call UnicastRemoteObject constructor and call  
     108 
     109    /** 
     110     * Constructor. Call UnicastRemoteObject constructor and call 
    105111     * initializeSimulation. 
    106112     * 
    107113     * @throws RemoteException 
    108114     */ 
    109     public Coordinator() throws RemoteException {            
     115    public Coordinator() throws RemoteException 
     116    { 
    110117        super(); 
    111118        clientList = new LinkedList<CADClientInterface>(); 
    112119        cadData = new CADData(); 
    113       cardfileData = new CardfileData(); 
    114         try { 
     120        cardfileData = new CardfileData(); 
     121        try 
     122        { 
    115123            CardfileReader cfr = new CardfileReader("scripts/Cardfile.xml", cardfileData); 
    116         } catch (Exception e) { 
     124        } catch (Exception e) 
     125        { 
    117126            System.out.println("Could not load cardfile script"); 
    118127        } 
    119          
     128 
    120129        observerList = new Vector<Observer>(); 
    121130    } 
    122      
    123     public void registerForCallback(CADClientInterface client) throws RemoteException{ 
     131 
     132    public void registerForCallback(CADClientInterface client) throws RemoteException 
     133    { 
    124134        clientList.add(client); 
    125135        CADSimulator.theViewer.connectClient(); 
    126     }    
    127      
    128     public void unregisterForCallback(CADClientInterface client) throws RemoteException{ 
     136    } 
     137 
     138    public void unregisterForCallback(CADClientInterface client) throws RemoteException 
     139    { 
    129140        clientList.remove(client); 
    130141        CADSimulator.theViewer.disconnectClient(); 
    131142    } 
    132      
    133     public void registerForCallback(SimulationManagerInterface simManInt) throws RemoteException{ 
     143 
     144    public void registerForCallback(SimulationManagerInterface simManInt) throws RemoteException 
     145    { 
    134146        managerInt = simManInt; 
    135147        CADSimulator.theViewer.setSimManagerStatus(true); 
    136     }    
    137      
    138     public void unregisterForCallback(SimulationManagerInterface simManInt) throws RemoteException { 
     148    } 
     149 
     150    public void unregisterForCallback(SimulationManagerInterface simManInt) throws RemoteException 
     151    { 
    139152        managerInt = null; 
    140153        CADSimulator.theViewer.setSimManagerStatus(false); 
    141     }      
    142      
    143     public void startSimulation() throws RemoteException, ScriptException { 
    144  
    145         if(!CADSimulator.theIncidentMgr.areIncidentsLoaded()) 
     154    } 
     155 
     156    public void startSimulation() throws RemoteException, ScriptException 
     157    { 
     158 
     159        coorLogger.logp(Level.INFO, "Coordinator", "startSimulation", 
     160                "starting..."); 
     161        if (!CADSimulator.theIncidentMgr.areIncidentsLoaded()) 
     162        { 
    146163            throw new ScriptException(ScriptException.NO_SCRIPT_LOADED); 
    147         else if(CADSimulator.theParamicsSimMgr.isConnected()) { 
    148             Runnable startRun = new Runnable() { 
    149                 public void run() { 
    150                     try { 
     164        } else if (CADSimulator.theParamicsSimMgr.isConnected()) 
     165        { 
     166            Runnable startRun = new Runnable() 
     167            { 
     168                public void run() 
     169                { 
     170                    try 
     171                    { 
    151172                        setScriptStatus(SCRIPT_STATUS.ATMS_SYNCHRONIZATION); 
    152                          
     173 
    153174                        long currentATMSTime = CADSimulator.theATMSMgr.getCurrentTime(); 
    154                         long sleepTime       = ((60 * 1000) - (currentATMSTime % (60 * 1000))) % (30 * 1000);                
    155  
    156                         coorLogger.logp(Level.INFO, "Coordinator", "StartSimulation",  
    157                                 "Sleeping for " + sleepTime/1000 + " seconds."); 
     175                        long sleepTime = ((60 * 1000) - (currentATMSTime % (60 * 1000))) % (30 * 1000); 
     176 
     177                        coorLogger.logp(Level.INFO, "Coordinator", "StartSimulation", 
     178                                "Sleeping for " + sleepTime / 1000 + " seconds."); 
    158179                        Thread.sleep(sleepTime); 
    159      
    160                         //currentATMSTime += sleepTime;                  
    161                         //ParamicsCommunicator.getInstance().serverTime.setTimeInMillis(currentATMSTime);                                        
    162                     } 
    163                     catch (Exception e) { 
     180 
     181                        //currentATMSTime += sleepTime; 
     182                        //ParamicsCommunicator.getInstance().serverTime.setTimeInMillis(currentATMSTime); 
     183                    } catch (Exception e) 
     184                    { 
    164185                        setScriptStatus(SCRIPT_STATUS.SCRIPT_RUNNING); 
    165                          
    166                         coorLogger.logp(Level.SEVERE, "Coordinator", "StartSimulation:run",  
     186 
     187                        coorLogger.logp(Level.SEVERE, "Coordinator", "StartSimulation:run", 
    167188                                "Unable to connect to ATMS server.", e); 
    168                     } 
    169                     finally { 
     189                    } finally 
     190                    { 
    170191                        CADSimulator.theSimulationCntrlMgr.startSimulation(); 
    171192                        CADSimulator.theParamicsSimMgr.startSimulation(); 
    172                         CADSimulator.theSoundPlayer.setAudioEnabled(true);       
     193                        CADSimulator.theSoundPlayer.setAudioEnabled(true); 
     194                        coorLogger.logp(Level.INFO, "Coordinator", "StartSimulation:run", 
     195                                "Simulation has started."); 
    173196                    } 
    174197                } 
    175198            }; 
    176          
     199 
    177200            Thread startThread = new Thread(startRun); 
    178201            startThread.start(); 
    179         } 
    180         else { 
     202        } else 
     203        { 
    181204            CADSimulator.theSimulationCntrlMgr.startSimulation(); 
    182205            CADSimulator.theSoundPlayer.setAudioEnabled(true); 
    183206        } 
    184207    } 
    185      
    186      
    187     public void pauseSimulation() throws RemoteException {       
     208 
     209    public void pauseSimulation() throws RemoteException 
     210    { 
    188211        CADSimulator.theSimulationCntrlMgr.pauseSimulation(); 
    189212        CADSimulator.theSoundPlayer.setAudioEnabled(false); 
    190213    } 
    191      
    192  
    193     public void resetSimulation() throws RemoteException {       
    194          
     214 
     215    public void resetSimulation() throws RemoteException 
     216    { 
     217 
    195218        CADSimulator.theIncidentMgr.resetIncidents(); 
    196219        cadData.resetSimulation(); 
    197          
     220 
    198221        CADSimulator.theSoundPlayer.setAudioEnabled(false); 
    199222        CADSimulator.theSoundPlayer.deQueueAll(); 
    200          
     223 
    201224        CADSimulator.theViewer.setTime(0); 
    202          
     225 
    203226        setScriptStatus(SCRIPT_STATUS.SCRIPT_STOPPED_NOT_STARTED); 
    204          
     227 
    205228        CMSDiversionDB.getInstance().resetDiversions(); 
    206          
     229 
    207230        CADSimulator.theSimulationCntrlMgr.resetSimulation(); 
    208231        CADSimulator.theParamicsSimMgr.resetSimulation(); 
    209          
    210         notifyObservers(new ObserverMessage(ObserverMessage.messageType.RESET_SIMULATION, null));       
    211  
    212     } 
    213  
    214          
    215     public void gotoSimulationTime(final long newSimTime) throws RemoteException { 
    216                  
     232 
     233        notifyObservers(new ObserverMessage(ObserverMessage.messageType.RESET_SIMULATION, null)); 
     234 
     235    } 
     236 
     237    public void gotoSimulationTime(final long newSimTime) throws RemoteException 
     238    { 
     239 
    217240        boolean audioWasEnabled = CADSimulator.theSoundPlayer.getAudioEnabled(); 
    218          
     241 
    219242        CADSimulator.theSoundPlayer.setAudioEnabled(false); 
    220          
    221         long tempTime = 0;       
    222         while(tempTime < newSimTime) { 
     243 
     244        long tempTime = 0; 
     245        while (tempTime < newSimTime) 
     246        { 
    223247            tempTime++; 
    224248 
    225249            CADSimulator.theIncidentMgr.tick(tempTime); 
    226         }        
     250        } 
    227251        CADSimulator.theSoundPlayer.setAudioEnabled(audioWasEnabled); 
    228          
     252 
    229253 
    230254        CADSimulator.theSimulationCntrlMgr.gotoSimulationTime(newSimTime); 
    231          
    232         Runnable gotoRun = new Runnable() { 
    233          
    234             public void run() { 
     255 
     256        Runnable gotoRun = new Runnable() 
     257        { 
     258            public void run() 
     259            { 
    235260                CADSimulator.theViewer.setTime(newSimTime); 
    236                  
    237                 if(managerInt != null) { 
    238                     try { 
     261 
     262                if (managerInt != null) 
     263                { 
     264                    try 
     265                    { 
    239266                        managerInt.tick(newSimTime); 
    240                     } 
    241                     catch (RemoteException re) { 
     267                    } catch (RemoteException re) 
     268                    { 
    242269                        //Simulation Manager has disappeared 
    243270                        managerInt = null; 
    244271                        CADSimulator.theViewer.setSimManagerStatus(false); 
    245                          
    246                         coorLogger.logp(Level.SEVERE, "Coordinator", "gotoSimulationTime:run",  
     272 
     273                        coorLogger.logp(Level.SEVERE, "Coordinator", "gotoSimulationTime:run", 
    247274                                "Connection to Simulation Manager has been dropped.", re); 
    248275                    } 
    249276                } 
    250             }            
     277            } 
    251278        }; 
    252          
     279 
    253280        Thread gotoThread = new Thread(gotoRun); 
    254         gotoThread.start();      
    255          
    256     } 
    257      
    258  
    259     /** 
    260      * Sets the current script status.  A thread is started to notify 
    261      * the CADSimulatorViewer and SimulationManager with the new status. 
    262      */ 
    263     public void setScriptStatus(final SCRIPT_STATUS status) { 
    264          
    265         Runnable updateRun = new Runnable() { 
    266          
    267             public void run() { 
     281        gotoThread.start(); 
     282 
     283    } 
     284 
     285    /** 
     286     * Sets the current script status. A thread is started to notify the 
     287     * CADSimulatorViewer and SimulationManager with the new status. 
     288     */ 
     289    public void setScriptStatus(final SCRIPT_STATUS status) 
     290    { 
     291 
     292        Runnable updateRun = new Runnable() 
     293        { 
     294            public void run() 
     295            { 
    268296 
    269297                CADSimulator.theViewer.setScriptStatus(status); 
    270          
    271                 if(managerInt != null) { 
    272                     try {                            
     298 
     299                if (managerInt != null) 
     300                { 
     301                    try 
     302                    { 
    273303                        managerInt.setScriptStatus(status); 
    274                     } 
    275                     catch (RemoteException re) { 
     304                    } catch (RemoteException re) 
     305                    { 
    276306                        //Simulation Manager has disappeared 
    277307                        managerInt = null; 
    278308                        CADSimulator.theViewer.setSimManagerStatus(false); 
    279309 
    280                         coorLogger.logp(Level.SEVERE, "Coordinator", "setScriptStatus:run",  
     310                        coorLogger.logp(Level.SEVERE, "Coordinator", "setScriptStatus:run", 
    281311                                "Connection to Simulation Manager has been dropped.", re); 
    282                     }                    
     312                    } 
    283313                } 
    284314            } 
    285315        }; 
    286          
     316 
    287317        Thread updateThread = new Thread(updateRun); 
    288318        updateThread.start(); 
    289     }    
    290      
    291     /** 
    292      * Sets the current paramics status.  A thread is started to notify 
    293      * the CADSimulatorViewer and SimulationManager with the new status. 
    294      */ 
    295     public void setParamicsStatus(final PARAMICS_STATUS status) { 
    296  
    297         Runnable updateRun = new Runnable(){ 
    298          
    299             public void run() { 
     319    } 
     320 
     321    /** 
     322     * Sets the current paramics status. A thread is started to notify the 
     323     * CADSimulatorViewer and SimulationManager with the new status. 
     324     */ 
     325    public void setParamicsStatus(final PARAMICS_STATUS status) 
     326    { 
     327 
     328        Runnable updateRun = new Runnable() 
     329        { 
     330            public void run() 
     331            { 
    300332                CADSimulator.theViewer.setParamicsStatus(status); 
    301                  
    302                 if(managerInt != null) { 
    303                     try {                            
     333 
     334                if (managerInt != null) 
     335                { 
     336                    try 
     337                    { 
    304338                        managerInt.setParamicsStatus(status); 
    305                     } 
    306                     catch (RemoteException re) { 
     339                    } catch (RemoteException re) 
     340                    { 
    307341                        //Simulation Manager has disappeared 
    308342                        managerInt = null; 
    309343                        CADSimulator.theViewer.setSimManagerStatus(false); 
    310344 
    311                         coorLogger.logp(Level.SEVERE, "Coordinator", "setParamicsStatus:run",  
     345                        coorLogger.logp(Level.SEVERE, "Coordinator", "setParamicsStatus:run", 
    312346                                "Connection to Simulation Manager has been dropped.", re); 
    313                     }                    
    314                 }    
    315             }        
     347                    } 
     348                } 
     349            } 
    316350        }; 
    317          
     351 
    318352        Thread updateThread = new Thread(updateRun); 
    319         updateThread.start();        
    320      
    321     } 
    322      
    323     public void connectToParamics() throws RemoteException { 
     353        updateThread.start(); 
     354 
     355    } 
     356 
     357    public void connectToParamics() throws RemoteException 
     358    { 
    324359        CADSimulator.theParamicsSimMgr.connectToParamics(); 
    325360    } 
    326     public void disconnectFromParamics() throws RemoteException { 
     361 
     362    public void disconnectFromParamics() throws RemoteException 
     363    { 
    327364        CADSimulator.theParamicsSimMgr.disconnectFromParamics(); 
    328365    } 
    329      
    330     public void loadParamicsNetwork(int networkID) throws RemoteException, SimulationException { 
     366 
     367    public void loadParamicsNetwork(int networkID) throws RemoteException, SimulationException 
     368    { 
    331369        CADSimulator.theParamicsSimMgr.loadParamicsNetwork(networkID); 
    332     }    
    333      
    334     public PARAMICS_STATUS getParamicsStatus() throws RemoteException { 
     370    } 
     371 
     372    public PARAMICS_STATUS getParamicsStatus() throws RemoteException 
     373    { 
    335374        return CADSimulator.theParamicsSimMgr.getParamicsStatus(); 
    336375    } 
    337      
    338     public int getParamicsNetworkLoaded() throws RemoteException { 
     376 
     377    public int getParamicsNetworkLoaded() throws RemoteException 
     378    { 
    339379        return CADSimulator.theParamicsSimMgr.getParamicsNetworkLoaded(); 
    340380    } 
    341381 
    342     public long getCurrentSimulationTime() throws RemoteException { 
    343         return CADSimulator.theSimulationCntrlMgr.getCurrentSimTime();   
    344     }    
    345          
    346     public void triggerIncident(Integer incidentNumber) throws RemoteException, ScriptException { 
    347          
    348         if(!CADSimulator.theSimulationCntrlMgr.simulationStarted()) 
     382    public long getCurrentSimulationTime() throws RemoteException 
     383    { 
     384        return CADSimulator.theSimulationCntrlMgr.getCurrentSimTime(); 
     385    } 
     386 
     387    public void triggerIncident(Integer incidentNumber) throws RemoteException, ScriptException 
     388    { 
     389 
     390        if (!CADSimulator.theSimulationCntrlMgr.simulationStarted()) 
     391        { 
    349392            throw new ScriptException(ScriptException.SIM_NOT_STARTED); 
    350         else if(!CADSimulator.theIncidentMgr.areIncidentsLoaded()) 
     393        } else if (!CADSimulator.theIncidentMgr.areIncidentsLoaded()) 
     394        { 
    351395            throw new ScriptException(ScriptException.NO_SCRIPT_LOADED); 
    352  
    353         CADSimulator.theIncidentMgr.triggerIncident(incidentNumber,  
     396        } 
     397 
     398        CADSimulator.theIncidentMgr.triggerIncident(incidentNumber, 
    354399                CADSimulator.theSimulationCntrlMgr.getCurrentSimTime()); 
    355400    } 
    356      
    357     public void deleteIncident(Integer incidentNumber) throws RemoteException, ScriptException { 
     401 
     402    public void deleteIncident(Integer incidentNumber) throws RemoteException, ScriptException 
     403    { 
    358404        CADSimulator.theIncidentMgr.deleteIncident(incidentNumber); 
    359          
    360         if(CADSimulator.theIncidentMgr.getIncidentList().size() == 0) { 
     405 
     406        if (CADSimulator.theIncidentMgr.getIncidentList().size() == 0) 
     407        { 
    361408            setScriptStatus(SCRIPT_STATUS.NO_SCRIPT); 
    362409        } 
    363          
    364         if(managerInt != null) { 
    365             try {                            
     410 
     411        if (managerInt != null) 
     412        { 
     413            try 
     414            { 
    366415                managerInt.incidentRemoved(incidentNumber); 
    367             } 
    368             catch (RemoteException re) { 
     416            } catch (RemoteException re) 
     417            { 
    369418                //Simulation Manager has disappeared 
    370419                managerInt = null; 
    371420                CADSimulator.theViewer.setSimManagerStatus(false); 
    372421 
    373                 coorLogger.logp(Level.SEVERE, "Coordinator", "deleteIncident",  
     422                coorLogger.logp(Level.SEVERE, "Coordinator", "deleteIncident", 
    374423                        "Connection to Simulation Manager has been dropped.", re); 
    375             }                    
    376         }    
    377     } 
    378      
    379     public void rescheduleIncident(Integer incidentNumber, long newTime)  
    380         throws RemoteException, ScriptException { 
    381          
    382         if (newTime < CADSimulator.theSimulationCntrlMgr.getCurrentSimTime()) { 
     424            } 
     425        } 
     426    } 
     427 
     428    public void rescheduleIncident(Integer incidentNumber, long newTime) 
     429            throws RemoteException, ScriptException 
     430    { 
     431 
     432        if (newTime < CADSimulator.theSimulationCntrlMgr.getCurrentSimTime()) 
     433        { 
    383434            throw new ScriptException(ScriptException.TIME_PASSED); 
    384435        } 
    385          
     436 
    386437        CADSimulator.theIncidentMgr.rescheduleIncident(incidentNumber, newTime); 
    387438    } 
    388      
    389     public void addIncident(Incident newIncident) throws RemoteException { 
     439 
     440    public void addIncident(Incident newIncident) throws RemoteException 
     441    { 
    390442 
    391443        CADSimulator.theIncidentMgr.addIncident(newIncident); 
    392          
    393         if(managerInt != null) { 
    394             try {                            
     444 
     445        if (managerInt != null) 
     446        { 
     447            try 
     448            { 
    395449                managerInt.incidentAdded(newIncident); 
    396             } 
    397             catch (RemoteException re) { 
     450            } catch (RemoteException re) 
     451            { 
    398452                //Simulation Manager has disappeared 
    399453                managerInt = null; 
    400454                CADSimulator.theViewer.setSimManagerStatus(false); 
    401455 
    402                 coorLogger.logp(Level.SEVERE, "Coordinator", "addIncident",  
     456                coorLogger.logp(Level.SEVERE, "Coordinator", "addIncident", 
    403457                        "Connection to Simulation Manager has been dropped.", re); 
    404             }                    
    405         }        
    406     } 
    407      
    408  
    409     public void loadScriptFile(File scriptFile) throws RemoteException, ScriptException {        
    410          
    411          
    412         try { 
     458            } 
     459        } 
     460    } 
     461 
     462    public void loadScriptFile(File scriptFile) throws RemoteException, ScriptException 
     463    { 
     464 
     465 
     466        try 
     467        { 
    413468            CADSimulator.theIncidentMgr.clearIncidents(); 
    414469            cadData.clearData(); 
    415              
     470 
    416471            ScriptHandler sh = new ScriptHandler(); 
    417              
     472 
    418473            SAXParserFactory.newInstance().newSAXParser().parse(scriptFile, sh); 
    419              
     474 
    420475            cadData.setIncidentsFromXML(sh.getIncidents()); 
    421476            cadData.setUnitsFromXML(sh.getUnits()); 
    422477            refreshClients(); 
    423478            CADSimulator.theIncidentMgr.addIncidents(sh.getIncidents()); 
    424              
    425             resetSimulation();      
    426         } 
    427         catch (Exception e) {e.printStackTrace();} 
    428  
    429     }    
    430  
    431     public Vector<Incident> getIncidentList() throws RemoteException { 
     479 
     480            resetSimulation(); 
     481        } catch (Exception e) 
     482        { 
     483            e.printStackTrace(); 
     484        } 
     485 
     486    } 
     487 
     488    public Vector<Incident> getIncidentList() throws RemoteException 
     489    { 
    432490        return CADSimulator.theIncidentMgr.getIncidentList(); 
    433491    } 
    434      
    435     public TreeMap<Integer, Vector<IncidentEvent>> getTriggeredEvents() throws RemoteException { 
     492 
     493    public TreeMap<Integer, Vector<IncidentEvent>> getTriggeredEvents() throws RemoteException 
     494    { 
    436495        return CADSimulator.theIncidentMgr.getTriggeredEvents(); 
    437496    } 
    438497 
    439     public SCRIPT_STATUS getScriptStatus() throws RemoteException { 
    440         if(CADSimulator.theIncidentMgr.areIncidentsLoaded()) { 
    441             if(CADSimulator.theSimulationCntrlMgr.simulationStarted())  
     498    public SCRIPT_STATUS getScriptStatus() throws RemoteException 
     499    { 
     500        if (CADSimulator.theIncidentMgr.areIncidentsLoaded()) 
     501        { 
     502            if (CADSimulator.theSimulationCntrlMgr.simulationStarted()) 
     503            { 
    442504                return SCRIPT_STATUS.SCRIPT_RUNNING; 
    443             else { 
    444                 for(Incident inc : CADSimulator.theIncidentMgr.getIncidentList()) { 
    445                     if(inc.hasOccured() == true)  
     505            } else 
     506            { 
     507                for (Incident inc : CADSimulator.theIncidentMgr.getIncidentList()) 
     508                { 
     509                    if (inc.hasOccured() == true) 
     510                    { 
    446511                        return SCRIPT_STATUS.SCRIPT_PAUSED_STARTED; 
     512                    } 
    447513                } 
    448514                return SCRIPT_STATUS.SCRIPT_STOPPED_NOT_STARTED; 
     
    451517        return SCRIPT_STATUS.NO_SCRIPT; 
    452518    } 
    453      
    454     /** 
    455      * Route a message to a CAD terminal.  If the new message is 
    456      * an incident update, the current message text will be the 
    457      * requested incident's log number.  Set the message's text  
    458      * to the XML representation of the requested IncidentInquiry  
    459      * object.  Notify observers with the new message. 
     519 
     520    /** 
     521     * Route a message to a CAD terminal. If the new message is an incident 
     522     * update, the current message text will be the requested incident's log 
     523     * number. Set the message's text to the XML representation of the requested 
     524     * IncidentInquiry object. Notify observers with the new message. 
    460525     * 
    461526     * @param newMessage Routed message received from CAD Client. 
    462527     */ 
    463     public void routeMessage(CADRoutedMessage newMessage) { 
    464          
     528    public void routeMessage(CADRoutedMessage newMessage) 
     529    { 
     530 
    465531        //if this is an incidentUpdate 
    466532        /* 
    467533         * TODO  Is this a priority?? 
    468         if(newMessage.incidentUpdate) { 
    469             IncidentInquiryModel tempII = new IncidentInquiryModel( 
    470                     newMessage.fromPosition, 
    471                     CADScreenNum.ONE,  
    472                     Integer.parseInt(newMessage.message)); 
    473              
    474             for(IncidentInquiryModel_obj iimo : getIncidentInquiryModelObjects( 
    475                     Integer.parseInt(newMessage.message))) { 
    476                 tempII.addModelObject(iimo); 
    477             } 
    478              
    479             XMLWriter tempWriter = new XMLWriter(); 
    480             tempII.toXML(tempWriter); 
    481             newMessage.message = tempWriter.getString(); 
    482         } 
    483         */ 
    484              
     534         if(newMessage.incidentUpdate) { 
     535         IncidentInquiryModel tempII = new IncidentInquiryModel( 
     536         newMessage.fromPosition, 
     537         CADScreenNum.ONE, 
     538         Integer.parseInt(newMessage.message)); 
     539 
     540         for(IncidentInquiryModel_obj iimo : getIncidentInquiryModelObjects( 
     541         Integer.parseInt(newMessage.message))) { 
     542         tempII.addModelObject(iimo); 
     543         } 
     544 
     545         XMLWriter tempWriter = new XMLWriter(); 
     546         tempII.toXML(tempWriter); 
     547         newMessage.message = tempWriter.getString(); 
     548         } 
     549         */ 
     550 
    485551        notifyObservers(new ObserverMessage(ObserverMessage.messageType.ROUTED_MESSAGE, 
    486552                newMessage)); 
    487553 
    488     }    
    489     
    490   
    491     public TreeSet<String> getCMSIDs() throws RemoteException {      
     554    } 
     555 
     556    public TreeSet<String> getCMSIDs() throws RemoteException 
     557    { 
    492558        return new TreeSet<String>(CMSDiversionDB.getInstance().getAllDiversions().keySet()); 
    493559    } 
    494      
    495     public CMSInfo getCMSDiversionInfo(String theCMSID) throws RemoteException {         
     560 
     561    public CMSInfo getCMSDiversionInfo(String theCMSID) throws RemoteException 
     562    { 
    496563        return CMSDiversionDB.getInstance().getDiversion(theCMSID); 
    497     }     
    498      
    499     public void applyDiversions(CMSInfo theDiversion) throws RemoteException { 
     564    } 
     565 
     566    public void applyDiversions(CMSInfo theDiversion) throws RemoteException 
     567    { 
    500568        CMSDiversionDB.getInstance().updateDiversions(theDiversion); 
    501569        CADSimulator.theParamicsSimMgr.updateDiversion(theDiversion); 
    502     }     
    503     
    504     /** 
    505      * Method updates the simulation with the new Incident information. 
    506      * The parameter IncidentInquiryModel_obj Object is used to create  
    507      * a new IncidentEvent Object which is finalized and sent to the 
    508      * IncidentManager for simulation updating.  
    509      *  
     570    } 
     571 
     572    /** 
     573     * Method updates the simulation with the new Incident information. The 
     574     * parameter IncidentInquiryModel_obj Object is used to create a new 
     575     * IncidentEvent Object which is finalized and sent to the IncidentManager 
     576     * for simulation updating. 
     577     * 
    510578     * @param update IncidentInquiryModel_obj containing CAD line update 
    511579     * @see IncidentManager 
    512580     */ 
    513     public void commandLineUpdate(IncidentInquiryModel_obj modelInfo) { 
    514                  
     581    public void commandLineUpdate(IncidentInquiryModel_obj modelInfo) 
     582    { 
     583 
    515584        long currentSimTime = CADSimulator.theSimulationCntrlMgr.getCurrentSimTime(); 
    516          
     585 
    517586        IncidentEvent triggeredEvent = new IncidentEvent(currentSimTime); 
    518         triggeredEvent.eventInfo     = modelInfo; 
    519          
     587        triggeredEvent.eventInfo = modelInfo; 
     588 
    520589        triggeredEvent.finalizeEvent(currentSimTime, CADSimulator.getCADTime()); 
    521590 
    522         CADSimulator.theIncidentMgr.updateIncident(modelInfo.getLogNumber(), triggeredEvent);  
    523          
     591        CADSimulator.theIncidentMgr.updateIncident(modelInfo.getLogNumber(), triggeredEvent); 
     592 
    524593        updateIncidentInGUI(modelInfo.getLogNumber(), triggeredEvent); 
    525          
    526     } 
    527      
    528      
    529     /** 
    530      * If the Simulation has started, spawn a thread to update the  
    531      * CADSimulatorViewer, SimulationManager, and IncidentManager with the new  
    532      * simulation time. If the current time is a 30 second interval, notify the  
     594 
     595    } 
     596 
     597    /** 
     598     * If the Simulation has started, spawn a thread to update the 
     599     * CADSimulatorViewer, SimulationManager, and IncidentManager with the new 
     600     * simulation time. If the current time is a 30 second interval, notify the 
    533601     * ParamicsControlManager to send an IncidentUpdate. 
    534      *  
     602     * 
    535603     * @see SimulationControlManager 
    536604     * @see ParamicsControlManager 
    537605     * @see IncidentManager 
    538606     */ 
    539     public void tick() { 
    540         if(CADSimulator.theSimulationCntrlMgr.simulationStarted()) { 
    541              
     607    public void tick() 
     608    { 
     609        if (CADSimulator.theSimulationCntrlMgr.simulationStarted()) 
     610        { 
     611 
    542612            final long currentSimTime = CADSimulator.theSimulationCntrlMgr.getCurrentSimTime(); 
    543              
    544             Runnable timeRun = new Runnable() { 
    545              
    546                 public void run() { 
     613 
     614            Runnable timeRun = new Runnable() 
     615            { 
     616                public void run() 
     617                { 
    547618                    CADSimulator.theViewer.setTime(currentSimTime); 
    548                      
     619 
    549620                    //send an update every 30 seconds 
    550                     if(currentSimTime % 30 == 0) 
     621                    if (currentSimTime % 30 == 0) 
     622                    { 
    551623                        CADSimulator.theParamicsSimMgr.sendIncidentUpdate(currentSimTime); 
    552                      
    553                     if(managerInt != null) { 
    554                         try { 
     624                    } 
     625 
     626                    if (managerInt != null) 
     627                    { 
     628                        try 
     629                        { 
    555630                            managerInt.tick(currentSimTime); 
    556                         } 
    557                         catch (RemoteException re) { 
     631                        } catch (RemoteException re) 
     632                        { 
    558633                            //Simulation Manager has disappeared 
    559634                            managerInt = null; 
    560635                            CADSimulator.theViewer.setSimManagerStatus(false); 
    561636 
    562                             coorLogger.logp(Level.SEVERE, "Coordinator", "tick:run",  
     637                            coorLogger.logp(Level.SEVERE, "Coordinator", "tick:run", 
    563638                                    "Connection to Simulation Manager has been dropped.", re); 
    564639                        } 
    565640                    } 
    566                      
     641 
    567642                    CADSimulator.theIncidentMgr.tick(currentSimTime); 
    568                 }            
     643                } 
    569644            }; 
    570              
     645 
    571646            Thread timeThread = new Thread(timeRun); 
    572             timeThread.start();                      
    573         } 
    574     }    
    575      
     647            timeThread.start(); 
     648        } 
     649    } 
    576650 
    577651    /** 
    578652     * Method notifies observers with an IncidentSummaryModel_obj to signify 
    579      * that a new Incident has started.  Then spawn a thread to notify the 
     653     * that a new Incident has started. Then spawn a thread to notify the 
    580654     * SimulationManager with the Incident's log number has started. 
    581      *  
     655     * 
    582656     * @param completedEvent Completed IncidentEvent. 
    583657     */ 
    584     public void incidentStarted(final IncidentEvent completedEvent) { 
     658    public void incidentStarted(final IncidentEvent completedEvent) 
     659    { 
    585660        notifyObservers(new ObserverMessage(ObserverMessage.messageType.INCIDENT_SUMMARY, 
    586                 new IncidentSummaryModel_obj(completedEvent.eventInfo.getHeader())));     
    587          
     661                new IncidentSummaryModel_obj(completedEvent.eventInfo.getHeader()))); 
     662 
    588663        incidentStartedInGUI(completedEvent.eventInfo.getLogNumber()); 
    589          
    590         Runnable startRun = new Runnable() {                             
    591             public void run() { 
    592                 if(managerInt != null) { 
    593                     try {                            
     664 
     665        Runnable startRun = new Runnable() 
     666        { 
     667            public void run() 
     668            { 
     669                if (managerInt != null) 
     670                { 
     671                    try 
     672                    { 
    594673                        managerInt.incidentStarted(completedEvent.eventInfo.getLogNumber()); 
    595                     } 
    596                     catch (RemoteException re) { 
     674                    } catch (RemoteException re) 
     675                    { 
    597676                        //Simulation Manager has disappeared 
    598677                        managerInt = null; 
    599678                        CADSimulator.theViewer.setSimManagerStatus(false); 
    600679 
    601                         coorLogger.logp(Level.SEVERE, "Coordinator", "updateIncidents",  
     680                        coorLogger.logp(Level.SEVERE, "Coordinator", "updateIncidents", 
    602681                                "Connection to Simulation Manager has been dropped.", re); 
    603                     }                        
    604                 }                    
    605             }                    
    606         };       
    607          
     682                    } 
     683                } 
     684            } 
     685        }; 
     686 
    608687        Thread startThread = new Thread(startRun); 
    609688        startThread.start(); 
    610     }       
    611  
    612     /** 
    613      * Method notifies observers with the IncidentEvent Object to signify 
    614      * that a new IncidentEvent has completed.  All XMLIncident Objects 
    615      * in the completed IncidentEvent is sent to the ParamicsControlManager 
    616      * for transmission to Paramics.  All CCTVInfo Objects are sent to the 
    617      * MediaManager for media control.  A thread is then spawned to notify the 
    618      * SimulationManager with the completed IncidentEvent. 
    619      *  
     689    } 
     690 
     691    /** 
     692     * Method notifies observers with the IncidentEvent Object to signify that a 
     693     * new IncidentEvent has completed. All XMLIncident Objects in the completed 
     694     * IncidentEvent is sent to the ParamicsControlManager for transmission to 
     695     * Paramics. All CCTVInfo Objects are sent to the MediaManager for media 
     696     * control. A thread is then spawned to notify the SimulationManager with 
     697     * the completed IncidentEvent. 
     698     * 
    620699     * @param completedEvent Completed IncidentEvent. 
    621700     * @see ParamicsControlManager 
    622701     * @see MediaManager 
    623702     */ 
    624     public void incidentUpdated(final IncidentEvent completedEvent) { 
     703    public void incidentUpdated(final IncidentEvent completedEvent) 
     704    { 
    625705        notifyObservers(new ObserverMessage(ObserverMessage.messageType.INCIDENT_INQUIRY, 
    626                 completedEvent.eventInfo));      
    627          
    628         for(XMLIncident xmlInc : completedEvent.XMLIncidents) 
     706                completedEvent.eventInfo)); 
     707 
     708        for (XMLIncident xmlInc : completedEvent.XMLIncidents) 
     709        { 
    629710            CADSimulator.theParamicsSimMgr.updateIncident(xmlInc); 
    630  
    631          
     711        } 
     712 
     713 
    632714        /*for(CCTVInfo info : completedEvent.cctvInfos) { 
    633             CADSimulator.theMediaMgr.triggerIncident(info,  
    634                     completedEvent.eventInfo.getLogNumber()); 
    635         }*/ 
    636          
    637         Runnable displayRun = new Runnable() {                   
    638             public void run() { 
    639                 if(managerInt != null) { 
    640                     try { 
     715         CADSimulator.theMediaMgr.triggerIncident(info, 
     716         completedEvent.eventInfo.getLogNumber()); 
     717         }*/ 
     718 
     719        Runnable displayRun = new Runnable() 
     720        { 
     721            public void run() 
     722            { 
     723                if (managerInt != null) 
     724                { 
     725                    try 
     726                    { 
    641727                        managerInt.eventOccured( 
    642                                 completedEvent.eventInfo.getLogNumber(),  
     728                                completedEvent.eventInfo.getLogNumber(), 
    643729                                completedEvent); 
    644                     } 
    645                     catch (RemoteException re) { 
     730                    } catch (RemoteException re) 
     731                    { 
    646732                        //Simulation Manager has disappeared 
    647733                        managerInt = null; 
    648734                        CADSimulator.theViewer.setSimManagerStatus(false); 
    649735 
    650                         coorLogger.logp(Level.SEVERE, "Coordinator", "updateIncidents:run",  
     736                        coorLogger.logp(Level.SEVERE, "Coordinator", "updateIncidents:run", 
    651737                                "Connection to Simulation Manager has been dropped.", re); 
    652                     }                    
     738                    } 
    653739                } 
    654740            } 
     
    656742 
    657743        Thread displayThread = new Thread(displayRun); 
    658         displayThread.start();         
    659     }       
    660      
     744        displayThread.start(); 
     745    } 
     746 
    661747    /** 
    662748     * @see IncidentManager 
    663749     */ 
    664     public boolean incidentExists(Integer logNumber) { 
     750    public boolean incidentExists(Integer logNumber) 
     751    { 
    665752        return CADSimulator.theIncidentMgr.incidentExists(logNumber); 
    666753    } 
     
    669756     * @see IncidentManager 
    670757     */ 
    671     public Vector<IncidentBoardModel_obj> getIncidentBoardModelObjects() { 
     758    public Vector<IncidentBoardModel_obj> getIncidentBoardModelObjects() 
     759    { 
    672760        return CADSimulator.theIncidentMgr.getIncidentBoardModelObjects(); 
    673     }        
     761    } 
    674762 
    675763    /** 
    676764     * @see IncidentManager 
    677765     */ 
    678     public Vector<IncidentInquiryModel_obj> getIncidentInquiryModelObjects(Integer logNumber) { 
     766    public Vector<IncidentInquiryModel_obj> getIncidentInquiryModelObjects(Integer logNumber) 
     767    { 
    679768        return CADSimulator.theIncidentMgr.getIncidentInquiryModelObjects(logNumber); 
    680     }     
     769    } 
    681770 
    682771    /** 
    683772     * @see IncidentManager 
    684773     */ 
    685     public Vector<IncidentSummaryModel_obj> getIncidentSummaryModelObjects() { 
     774    public Vector<IncidentSummaryModel_obj> getIncidentSummaryModelObjects() 
     775    { 
    686776        return CADSimulator.theIncidentMgr.getIncidentSummaryModelObjects(); 
    687     }      
    688      
    689    
     777    } 
     778 
    690779    /** 
    691780     * Adds an observer to the list of observers. 
     
    693782     * @param o New observer object. 
    694783     */ 
    695     public void addObserver(Observer o) { 
    696         observerList.add(o);     
    697     } 
    698      
    699     /**  
    700      * Removes an observer from the list of observers.  If the observer 
    701      * is not found, this method returns false, else true is returned for 
    702      * a successful removal.  
     784    public void addObserver(Observer o) 
     785    { 
     786        observerList.add(o); 
     787    } 
     788 
     789    /** 
     790     * Removes an observer from the list of observers. If the observer is not 
     791     * found, this method returns false, else true is returned for a successful 
     792     * removal. 
    703793     * 
    704794     * @param o Observer to be removed. 
    705795     * @returns True if remove was successful, false if not. 
    706      */      
    707     public boolean removeObserver(Observer o) { 
     796     */ 
     797    public boolean removeObserver(Observer o) 
     798    { 
    708799        return observerList.remove(o); 
    709800    } 
    710      
    711     /** 
    712      * Notify all registered observers with the parameter ObserverMessage object. 
     801 
     802    /** 
     803     * Notify all registered observers with the parameter ObserverMessage 
     804     * object. 
    713805     * 
    714806     * @param newMsg The ObserverMessage to be sent. 
    715807     */ 
    716     private void notifyObservers(ObserverMessage newMsg) { 
    717         for(Observer o : observerList)  
    718             o.update(null, newMsg);  
    719     } 
    720      
    721     public void refreshClients() throws RemoteException{ 
    722         for(int i = 0; i < clientList.size(); i++){ 
     808    private void notifyObservers(ObserverMessage newMsg) 
     809    { 
     810        for (Observer o : observerList) 
     811        { 
     812            o.update(null, newMsg); 
     813        } 
     814    } 
     815 
     816    public void refreshClients() throws RemoteException 
     817    { 
     818        for (int i = 0; i < clientList.size(); i++) 
     819        { 
    723820            clientList.get(i).refresh(); 
    724821        } 
    725822    } 
    726      
     823 
    727824    /** 
    728825     * Checks the CADData for an existing incident with id 
     826     * 
    729827     * @param id the incident id 
    730828     * @return true if CADData contains such an incident, otherwise false. 
    731829     * @throws RemoteException 
    732830     */ 
    733      public boolean checkForValidIncidentID(int id) throws RemoteException{ 
     831    public boolean checkForValidIncidentID(int id) throws RemoteException 
     832    { 
    734833        return cadData.checkForValidId(id); 
    735      } 
    736      
    737       
    738      /** 
     834    } 
     835 
     836    /** 
    739837     * Uses an Incident's masterInc to lookup its ID. 
     838     * 
    740839     * @param masterInc the Incident to look up 
    741840     * @return the same Incident's ID, -1 if invalid masterInc 
    742841     * @throws RemoteException 
    743842     */ 
    744      public int getIncidentId(String masterInc) throws RemoteException{ 
    745          return cadData.getIncidentId(masterInc); 
    746      } 
    747      
     843    public int getIncidentId(String masterInc) throws RemoteException 
     844    { 
     845        return cadData.getIncidentId(masterInc); 
     846    } 
     847 
    748848    /** 
    749849     * Returns a table model out of CADData based on tag. 
    750      * @param tag a CADDataEnums tag 
    751      * @throws RemoteException 
    752      */ 
    753     public DefaultTableModel getCadDataTable(TABLE tag) throws RemoteException{ 
    754         if(tag.equals(TABLE.ASSIGNED_INCIDENTS)){ 
     850     * 
     851     * @param tag a CADDataEnums tag 
     852     * @throws RemoteException 
     853     */ 
     854    public DefaultTableModel getCadDataTable(TABLE tag) throws RemoteException 
     855    { 
     856        if (tag.equals(TABLE.ASSIGNED_INCIDENTS)) 
     857        { 
    755858            return cadData.tableForAssignedIncidents(); 
    756         } 
    757         else if(tag.equals(TABLE.UNIT_STATUS)){ 
     859        } else if (tag.equals(TABLE.UNIT_STATUS)) 
     860        { 
    758861            return cadData.tableForUnitStatus(); 
    759         } 
    760         else if(tag.equals(TABLE.PENDING_INCIDENTS)){ 
     862        } else if (tag.equals(TABLE.PENDING_INCIDENTS)) 
     863        { 
    761864            return cadData.tableForPendingIncidents(); 
    762         } 
    763         else if(tag.equals(TABLE.INCIDENT_EDITOR)){ 
     865        } else if (tag.equals(TABLE.INCIDENT_EDITOR)) 
     866        { 
    764867            return cadData.tableForIncidentEditor(); 
    765         } 
    766         else{ 
     868        } else 
     869        { 
    767870            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataTable"); 
    768871        } 
    769872    } 
    770      
     873 
    771874    /** 
    772875     * Returns the specified incident's table based on the tag. 
     876     * 
    773877     * @param tag a CADDataEnums tag 
    774878     * @param incidentId the incident's ID to look up 
     
    776880     * @throws RemoteException 
    777881     */ 
    778     public DefaultTableModel getCadDataIncidentTable(INC_TABLE tag, int incidentId) throws RemoteException{ 
    779      if(tag.equals(INC_TABLE.COMMENTS_NOTES)){ 
    780          return cadData.getIncident(incidentId).getCommentsNotesTable(); 
    781      } 
    782      return null; 
    783     } 
    784      
     882    public DefaultTableModel getCadDataIncidentTable(INC_TABLE tag, int incidentId) throws RemoteException 
     883    { 
     884        if (tag.equals(INC_TABLE.COMMENTS_NOTES)) 
     885        { 
     886            return cadData.getIncident(incidentId).getCommentsNotesTable(); 
     887        } 
     888        return null; 
     889    } 
     890 
    785891    /** 
    786892     * Adds a row of data to a specified incident's table based on the tag. 
     893     * 
    787894     * @param tag a CADDataEnums tag 
    788895     * @param incidentId the incident's ID to look up 
     
    790897     * @throws RemoteException 
    791898     */ 
    792     public void addCadDataIncidentTable(INC_TABLE tag, int incidentId, String[] fields) throws RemoteException{ 
    793      if(tag.equals(INC_TABLE.COMMENTS_NOTES)){ 
    794          cadData.getIncident(incidentId).addToCommentsNotesTable(fields); 
    795      } 
    796     } 
    797      
     899    public void addCadDataIncidentTable(INC_TABLE tag, int incidentId, String[] fields) throws RemoteException 
     900    { 
     901        if (tag.equals(INC_TABLE.COMMENTS_NOTES)) 
     902        { 
     903            cadData.getIncident(incidentId).addToCommentsNotesTable(fields); 
     904        } 
     905    } 
     906 
    798907    /** 
    799908     * Adds a row to the specified data table based on the incoming fields. 
    800      * @param tag a CADDataEnums tag 
    801      * @param incidentId the incident's ID to look up 
    802      * @throws RemoteException 
    803      */ 
    804      public void addCadDataTableRow(TABLE tag, String field1, String field2, String field3, String field4) throws RemoteException{ 
    805           
    806      } 
    807      
    808       
    809       
     909     * 
     910     * @param tag a CADDataEnums tag 
     911     * @param incidentId the incident's ID to look up 
     912     * @throws RemoteException 
     913     */ 
     914    public void addCadDataTableRow(TABLE tag, String field1, String field2, String field3, String field4) throws RemoteException 
     915    { 
     916    } 
     917 
    810918    /** 
    811919     * Returns an object out of Incident based on tag. 
    812      * @param tag a CADDataEnums tag 
    813      * @param incidentId the incident's ID to look up 
    814      * @throws RemoteException 
    815      */ 
    816     public Object getCadDataIncVal(INC_VAL tag, int incidentId) throws RemoteException{ 
    817     if(tag.equals(INC_VAL.LOG_NUM)){ 
     920     * 
     921     * @param tag a CADDataEnums tag 
     922     * @param incidentId the incident's ID to look up 
     923     * @throws RemoteException 
     924     */ 
     925    public Object getCadDataIncVal(INC_VAL tag, int incidentId) throws RemoteException 
     926    { 
     927        if (tag.equals(INC_VAL.LOG_NUM)) 
     928        { 
    818929            return cadData.getIncident(incidentId).getLogNum(); 
    819         } 
    820         else if(tag.equals(INC_VAL.MASTER_INC)){ 
     930        } else if (tag.equals(INC_VAL.MASTER_INC)) 
     931        { 
    821932            return cadData.getIncident(incidentId).getMasterInc(); 
    822         } 
    823         else if(tag.equals(INC_VAL.OAU)){ 
     933        } else if (tag.equals(INC_VAL.OAU)) 
     934        { 
    824935            return cadData.getIncident(incidentId).getOau(); 
    825         } 
    826         else if(tag.equals(INC_VAL.P)){ 
     936        } else if (tag.equals(INC_VAL.P)) 
     937        { 
    827938            return cadData.getIncident(incidentId).getP(); 
    828         } 
    829         else if(tag.equals(INC_VAL.DESCRIPTION)){ 
     939        } else if (tag.equals(INC_VAL.DESCRIPTION)) 
     940        { 
    830941            return cadData.getIncident(incidentId).getDescription(); 
    831         } 
    832         else if(tag.equals(INC_VAL.RP)){ 
     942        } else if (tag.equals(INC_VAL.RP)) 
     943        { 
    833944            return cadData.getIncident(incidentId).getRp(); 
    834         } 
    835         else if(tag.equals(INC_VAL.RP_TYPE)){ 
     945        } else if (tag.equals(INC_VAL.RP_TYPE)) 
     946        { 
    836947            return cadData.getIncident(incidentId).getRpType(); 
    837         } 
    838         else if(tag.equals(INC_VAL.ALI)){ 
     948        } else if (tag.equals(INC_VAL.ALI)) 
     949        { 
    839950            return cadData.getIncident(incidentId).getAli(); 
    840         } 
    841         else if(tag.equals(INC_VAL.MEDIA)){ 
     951        } else if (tag.equals(INC_VAL.MEDIA)) 
     952        { 
    842953            return cadData.getIncident(incidentId).getMedia(); 
    843         } 
    844         else{ 
     954        } else 
     955        { 
    845956            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncVal"); 
    846957        } 
    847958    } 
    848      
     959 
    849960    /** 
    850961     * Set incidentId's field based on tag to value. 
    851      * @param tag a CADDataEnums tag 
    852      * @param incidentId the incident's ID to look up 
    853      * @throws RemoteException 
    854      */ 
    855     public void setCadDataIncVal(INC_VAL tag, int incidentId, String value) throws RemoteException{ 
    856         if(tag.equals(INC_VAL.OAU)){ 
     962     * 
     963     * @param tag a CADDataEnums tag 
     964     * @param incidentId the incident's ID to look up 
     965     * @throws RemoteException 
     966     */ 
     967    public void setCadDataIncVal(INC_VAL tag, int incidentId, String value) throws RemoteException 
     968    { 
     969        if (tag.equals(INC_VAL.OAU)) 
     970        { 
    857971            cadData.getIncident(incidentId).setOau(value); 
    858         } 
    859         else if(tag.equals(INC_VAL.P)){ 
     972        } else if (tag.equals(INC_VAL.P)) 
     973        { 
    860974            cadData.getIncident(incidentId).setP(value); 
    861         } 
    862         else if(tag.equals(INC_VAL.DESCRIPTION)){ 
     975        } else if (tag.equals(INC_VAL.DESCRIPTION)) 
     976        { 
    863977            cadData.getIncident(incidentId).setDescription(value); 
    864         } 
    865         else if(tag.equals(INC_VAL.RP)){ 
     978        } else if (tag.equals(INC_VAL.RP)) 
     979        { 
    866980            cadData.getIncident(incidentId).setRp(value); 
    867         } 
    868         else if(tag.equals(INC_VAL.RP_TYPE)){ 
     981        } else if (tag.equals(INC_VAL.RP_TYPE)) 
     982        { 
    869983            cadData.getIncident(incidentId).setRpType(value); 
    870         } 
    871         else if(tag.equals(INC_VAL.ALI)){ 
     984        } else if (tag.equals(INC_VAL.ALI)) 
     985        { 
    872986            cadData.getIncident(incidentId).setAli(value); 
    873         } 
    874         else if(tag.equals(INC_VAL.MEDIA)){ 
     987        } else if (tag.equals(INC_VAL.MEDIA)) 
     988        { 
    875989            cadData.getIncident(incidentId).setMedia(value); 
    876         } 
    877         else{ 
     990        } else 
     991        { 
    878992            throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncVal"); 
    879993        } 
    880994    } 
    881      
    882995 
    883996    /** 
    884997     * Returns a string out of IncidentLocation based on tag. 
    885      * @param tag a CADDataEnums tag 
    886      * @param incidentId the incident's ID to look up 
    887      * @throws RemoteException 
    888      */ 
    889     public String getCadDataIncLoc(INC_LOC tag, int incidentId) throws RemoteException { 
    890         if(tag.equals(INC_LOC.ADDRESS)){ 
     998     * 
     999     * @param tag a CADDataEnums tag 
     1000     * @param incidentId the incident's ID to look up 
     1001     * @throws RemoteException 
     1002     */ 
     1003    public String getCadDataIncLoc(INC_LOC tag, int incidentId) throws RemoteException 
     1004    { 
     1005        if (tag.equals(INC_LOC.ADDRESS)) 
     1006        { 
    8911007            return cadData.getIncident(incidentId).getIncidentLocation().getAddress(); 
    892         } 
    893         else if(tag.equals(INC_LOC.LOC)){ 
     1008        } else if (tag.equals(INC_LOC.LOC)) 
     1009        { 
    8941010            return cadData.getIncident(incidentId).getIncidentLocation().getLoc(); 
    895         } 
    896         else if(tag.equals(INC_LOC.CITY)){ 
     1011        } else if (tag.equals(INC_LOC.CITY)) 
     1012        { 
    8971013            return cadData.getIncident(incidentId).getIncidentLocation().getCity(); 
    898         } 
    899         else if(tag.equals(INC_LOC.COUNTY)){ 
     1014        } else if (tag.equals(INC_LOC.COUNTY)) 
     1015        { 
    9001016            return cadData.getIncident(incidentId).getIncidentLocation().getCounty(); 
    901         } 
    902         else if(tag.equals(INC_LOC.STATE)){ 
     1017        } else if (tag.equals(INC_LOC.STATE)) 
     1018        { 
    9031019            return cadData.getIncident(incidentId).getIncidentLocation().getState(); 
    904         } 
    905         else if(tag.equals(INC_LOC.ZIP)){ 
     1020        } else if (tag.equals(INC_LOC.ZIP)) 
     1021        { 
    9061022            return cadData.getIncident(incidentId).getIncidentLocation().getZip(); 
    907         } 
    908         else if(tag.equals(INC_LOC.BEAT)){ 
     1023        } else if (tag.equals(INC_LOC.BEAT)) 
     1024        { 
    9091025            return cadData.getIncident(incidentId).getIncidentLocation().getBeat(); 
    910         } 
    911         else if(tag.equals(INC_LOC.AREA)){ 
     1026        } else if (tag.equals(INC_LOC.AREA)) 
     1027        { 
    9121028            return cadData.getIncident(incidentId).getIncidentLocation().getArea(); 
    913         } 
    914         else if(tag.equals(INC_LOC.SECTOR)){ 
     1029        } else if (tag.equals(INC_LOC.SECTOR)) 
     1030        { 
    9151031            return cadData.getIncident(incidentId).getIncidentLocation().getSector(); 
    916         } 
    917         else if(tag.equals(INC_LOC.SECTOR_CODE)){ 
     1032        } else if (tag.equals(INC_LOC.SECTOR_CODE)) 
     1033        { 
    9181034            return cadData.getIncident(incidentId).getIncidentLocation().getSectorCode(); 
    919         } 
    920         else if(tag.equals(INC_LOC.DIVISION)){ 
     1035        } else if (tag.equals(INC_LOC.DIVISION)) 
     1036        { 
    9211037            return cadData.getIncident(incidentId).getIncidentLocation().getDivision(); 
    922         } 
    923         else if(tag.equals(INC_LOC.APT)){ 
     1038        } else if (tag.equals(INC_LOC.APT)) 
     1039        { 
    9241040            return cadData.getIncident(incidentId).getIncidentLocation().getApt(); 
    925         } 
    926         else if(tag.equals(INC_LOC.BUILDING)){ 
     1041        } else if (tag.equals(INC_LOC.BUILDING)) 
     1042        { 
    9271043            return cadData.getIncident(incidentId).getIncidentLocation().getBuilding(); 
    928         } 
    929         else if(tag.equals(INC_LOC.CROSS_ST)){ 
     1044        } else if (tag.equals(INC_LOC.CROSS_ST)) 
     1045        { 
    9301046            return cadData.getIncident(incidentId).getIncidentLocation().getCrossSt(); 
    931         } 
    932         else if(tag.equals(INC_LOC.LAW)){ 
     1047        } else if (tag.equals(INC_LOC.LAW)) 
     1048        { 
    9331049            return cadData.getIncident(incidentId).getIncidentLocation().getLaw(); 
    934         } 
    935         else if(tag.equals(INC_LOC.FIRE)){ 
     1050        } else if (tag.equals(INC_LOC.FIRE)) 
     1051        { 
    9361052            return cadData.getIncident(incidentId).getIncidentLocation().getFire(); 
    937         } 
    938         else if(tag.equals(INC_LOC.EMS)){ 
     1053        } else if (tag.equals(INC_LOC.EMS)) 
     1054        { 
    9391055            return cadData.getIncident(incidentId).getIncidentLocation().getEms(); 
    940         } 
    941         else{ 
     1056        } else 
     1057        { 
    9421058            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncLoc"); 
    9431059        } 
     
    9461062    /** 
    9471063     * Set incidentId's field based on tag to value. 
    948      * @param tag a CADDataEnums tag 
    949      * @param incidentId the incident's ID to look up 
    950      * @throws RemoteException 
    951      */ 
    952     public void setCadDataIncLoc(INC_LOC tag, int incidentId, String value) throws RemoteException{ 
    953         if(tag.equals(INC_LOC.ADDRESS)){ 
     1064     * 
     1065     * @param tag a CADDataEnums tag 
     1066     * @param incidentId the incident's ID to look up 
     1067     * @throws RemoteException 
     1068     */ 
     1069    public void setCadDataIncLoc(INC_LOC tag, int incidentId, String value) throws RemoteException 
     1070    { 
     1071        if (tag.equals(INC_LOC.ADDRESS)) 
     1072        { 
    9541073            cadData.getIncident(incidentId).getIncidentLocation().setAddress(value); 
    955         } 
    956         else if(tag.equals(INC_LOC.LOC)){ 
     1074        } else if (tag.equals(INC_LOC.LOC)) 
     1075        { 
    9571076            cadData.getIncident(incidentId).getIncidentLocation().setLoc(value); 
    958         } 
    959         else if(tag.equals(INC_LOC.CITY)){ 
     1077        } else if (tag.equals(INC_LOC.CITY)) 
     1078        { 
    9601079            cadData.getIncident(incidentId).getIncidentLocation().setCity(value); 
    961         } 
    962         else if(tag.equals(INC_LOC.COUNTY)){ 
     1080        } else if (tag.equals(INC_LOC.COUNTY)) 
     1081        { 
    9631082            cadData.getIncident(incidentId).getIncidentLocation().setCounty(value); 
    964         } 
    965         else if(tag.equals(INC_LOC.STATE)){ 
     1083        } else if (tag.equals(INC_LOC.STATE)) 
     1084        { 
    9661085            cadData.getIncident(incidentId).getIncidentLocation().setState(value); 
    967         } 
    968         else if(tag.equals(INC_LOC.ZIP)){ 
     1086        } else if (tag.equals(INC_LOC.ZIP)) 
     1087        { 
    9691088            cadData.getIncident(incidentId).getIncidentLocation().setZip(value); 
    970         } 
    971         else if(tag.equals(INC_LOC.BEAT)){ 
     1089        } else if (tag.equals(INC_LOC.BEAT)) 
     1090        { 
    9721091            cadData.getIncident(incidentId).getIncidentLocation().setBeat(value); 
    973         } 
    974         else if(tag.equals(INC_LOC.AREA)){ 
     1092        } else if (tag.equals(INC_LOC.AREA)) 
     1093        { 
    9751094            cadData.getIncident(incidentId).getIncidentLocation().setArea(value); 
    976         } 
    977         else if(tag.equals(INC_LOC.SECTOR)){ 
     1095        } else if (tag.equals(INC_LOC.SECTOR)) 
     1096        { 
    9781097            cadData.getIncident(incidentId).getIncidentLocation().setSector(value); 
    979         } 
    980         else if(tag.equals(INC_LOC.SECTOR_CODE)){ 
     1098        } else if (tag.equals(INC_LOC.SECTOR_CODE)) 
     1099        { 
    9811100            cadData.getIncident(incidentId).getIncidentLocation().setSectorCode(value); 
    982         } 
    983         else if(tag.equals(INC_LOC.DIVISION)){ 
     1101        } else if (tag.equals(INC_LOC.DIVISION)) 
     1102        { 
    9841103            cadData.getIncident(incidentId).getIncidentLocation().setDivision(value); 
    985         } 
    986         else if(tag.equals(INC_LOC.APT)){ 
     1104        } else if (tag.equals(INC_LOC.APT)) 
     1105        { 
    9871106            cadData.getIncident(incidentId).getIncidentLocation().setApt(value); 
    988         } 
    989         else if(tag.equals(INC_LOC.BUILDING)){ 
     1107        } else if (tag.equals(INC_LOC.BUILDING)) 
     1108        { 
    9901109            cadData.getIncident(incidentId).getIncidentLocation().setBuilding(value); 
    991         } 
    992         else if(tag.equals(INC_LOC.CROSS_ST)){ 
     1110        } else if (tag.equals(INC_LOC.CROSS_ST)) 
     1111        { 
    9931112            cadData.getIncident(incidentId).getIncidentLocation().setCrossSt(value); 
    994         } 
    995         else if(tag.equals(INC_LOC.LAW)){ 
     1113        } else if (tag.equals(INC_LOC.LAW)) 
     1114        { 
    9961115            cadData.getIncident(incidentId).getIncidentLocation().setLaw(value); 
    997         } 
    998         else if(tag.equals(INC_LOC.FIRE)){ 
     1116        } else if (tag.equals(INC_LOC.FIRE)) 
     1117        { 
    9991118            cadData.getIncident(incidentId).getIncidentLocation().setFire(value); 
    1000         } 
    1001         else if(tag.equals(INC_LOC.EMS)){ 
     1119        } else if (tag.equals(INC_LOC.EMS)) 
     1120        { 
    10021121            cadData.getIncident(incidentId).getIncidentLocation().setEms(value); 
    1003         } 
    1004         else{ 
     1122        } else 
     1123        { 
    10051124            throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncLoc"); 
    10061125        } 
    10071126    } 
    1008      
     1127 
    10091128    /** 
    10101129     * Returns a string out of IncidentCaller based on tag. 
    1011      * @param tag a CADDataEnums tag 
    1012      * @param incidentId the incident's ID to look up 
    1013      * @throws RemoteException 
    1014      */ 
    1015     public String getCadDataIncCaller(INC_CALLER tag, int incidentId) throws RemoteException { 
    1016         if(tag.equals(INC_CALLER.TYPE)){ 
     1130     * 
     1131     * @param tag a CADDataEnums tag 
     1132     * @param incidentId the incident's ID to look up 
     1133     * @throws RemoteException 
     1134     */ 
     1135    public String getCadDataIncCaller(INC_CALLER tag, int incidentId) throws RemoteException 
     1136    { 
     1137        if (tag.equals(INC_CALLER.TYPE)) 
     1138        { 
    10171139            return cadData.getIncident(incidentId).getIncidentCaller().getCallerType(); 
    1018         } 
    1019         else if(tag.equals(INC_CALLER.NAME)){ 
     1140        } else if (tag.equals(INC_CALLER.NAME)) 
     1141        { 
    10201142            return cadData.getIncident(incidentId).getIncidentCaller().getCallerName(); 
    1021         } 
    1022         else if(tag.equals(INC_CALLER.PHONE)){ 
     1143        } else if (tag.equals(INC_CALLER.PHONE)) 
     1144        { 
    10231145            return cadData.getIncident(incidentId).getIncidentCaller().getPhone(); 
    1024         } 
    1025         else if(tag.equals(INC_CALLER.EXT)){ 
     1146        } else if (tag.equals(INC_CALLER.EXT)) 
     1147        { 
    10261148            return cadData.getIncident(incidentId).getIncidentCaller().getExt(); 
    1027         } 
    1028         else{ 
     1149        } else 
     1150        { 
    10291151            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncCaller"); 
    10301152        } 
     
    10331155    /** 
    10341156     * Set incidentId's field based on tag to value. 
    1035      * @param tag a CADDataEnums tag 
    1036      * @param incidentId the incident's ID to look up 
    1037      * @throws RemoteException 
    1038      */ 
    1039     public void setCadDataIncCaller(INC_CALLER tag, int incidentId, String value) throws RemoteException{ 
    1040         if(tag.equals(INC_CALLER.TYPE)){ 
     1157     * 
     1158     * @param tag a CADDataEnums tag 
     1159     * @param incidentId the incident's ID to look up 
     1160     * @throws RemoteException 
     1161     */ 
     1162    public void setCadDataIncCaller(INC_CALLER tag, int incidentId, String value) throws RemoteException 
     1163    { 
     1164        if (tag.equals(INC_CALLER.TYPE)) 
     1165        { 
    10411166            cadData.getIncident(incidentId).getIncidentCaller().setCallerType(value); 
    1042         } 
    1043         else if(tag.equals(INC_CALLER.NAME)){ 
     1167        } else if (tag.equals(INC_CALLER.NAME)) 
     1168        { 
    10441169            cadData.getIncident(incidentId).getIncidentCaller().setCallerName(value); 
    1045         } 
    1046         else if(tag.equals(INC_CALLER.PHONE)){ 
     1170        } else if (tag.equals(INC_CALLER.PHONE)) 
     1171        { 
    10471172            cadData.getIncident(incidentId).getIncidentCaller().setPhone(value); 
    1048         } 
    1049         else if(tag.equals(INC_CALLER.EXT)){ 
     1173        } else if (tag.equals(INC_CALLER.EXT)) 
     1174        { 
    10501175            cadData.getIncident(incidentId).getIncidentCaller().setExt(value); 
    1051         } 
    1052         else{ 
     1176        } else 
     1177        { 
    10531178            throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncCaller"); 
    10541179        } 
    10551180    } 
    1056      
     1181 
    10571182    /** 
    10581183     * Returns a string out of IncidentProblem based on tag. 
    1059      * @param tag a CADDataEnums tag 
    1060      * @param incidentId the incident's ID to look up 
    1061      * @throws RemoteException 
    1062      */ 
    1063     public String getCadDataIncProblem(INC_PROBLEM tag, int incidentId) throws RemoteException { 
    1064         if(tag.equals(INC_PROBLEM.PROBLEM)){ 
     1184     * 
     1185     * @param tag a CADDataEnums tag 
     1186     * @param incidentId the incident's ID to look up 
     1187     * @throws RemoteException 
     1188     */ 
     1189    public String getCadDataIncProblem(INC_PROBLEM tag, int incidentId) throws RemoteException 
     1190    { 
     1191        if (tag.equals(INC_PROBLEM.PROBLEM)) 
     1192        { 
    10651193            return cadData.getIncident(incidentId).getProblem().getProblem(); 
    1066         } 
    1067         else if(tag.equals(INC_PROBLEM.CODE)){ 
     1194        } else if (tag.equals(INC_PROBLEM.CODE)) 
     1195        { 
    10681196            return cadData.getIncident(incidentId).getProblem().getProblemCode(); 
    1069         } 
    1070         else if(tag.equals(INC_PROBLEM.PRIORITY)){ 
     1197        } else if (tag.equals(INC_PROBLEM.PRIORITY)) 
     1198        { 
    10711199            return cadData.getIncident(incidentId).getProblem().getPriority(); 
    1072         } 
    1073         else{ 
     1200        } else 
     1201        { 
    10741202            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncProblem"); 
    10751203        } 
    10761204    } 
    1077      
     1205 
    10781206    /** 
    10791207     * Set incidentId's field based on tag to value. 
    1080      * @param tag a CADDataEnums tag 
    1081      * @param incidentId the incident's ID to look up 
    1082      * @throws RemoteException 
    1083      */ 
    1084     public void setCadDataIncProblem(INC_PROBLEM tag, int incidentId, String value) throws RemoteException{ 
    1085         if(tag.equals(INC_PROBLEM.PROBLEM)){ 
     1208     * 
     1209     * @param tag a CADDataEnums tag 
     1210     * @param incidentId the incident's ID to look up 
     1211     * @throws RemoteException 
     1212     */ 
     1213    public void setCadDataIncProblem(INC_PROBLEM tag, int incidentId, String value) throws RemoteException 
     1214    { 
     1215        if (tag.equals(INC_PROBLEM.PROBLEM)) 
     1216        { 
    10861217            cadData.getIncident(incidentId).getProblem().setProblem(value); 
    1087         } 
    1088         else if(tag.equals(INC_PROBLEM.CODE)){ 
     1218        } else if (tag.equals(INC_PROBLEM.CODE)) 
     1219        { 
    10891220            cadData.getIncident(incidentId).getProblem().setProblemCode(value); 
    1090         } 
    1091         else if(tag.equals(INC_PROBLEM.PRIORITY)){ 
     1221        } else if (tag.equals(INC_PROBLEM.PRIORITY)) 
     1222        { 
    10921223            cadData.getIncident(incidentId).getProblem().setPriority(value); 
    1093         } 
    1094         else{ 
     1224        } else 
     1225        { 
    10951226            throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncProblem"); 
    10961227        } 
     
    10991230    /** 
    11001231     * Returns a string out of IncidentGeneralInfo based on tag. 
    1101      * @param tag a CADDataEnums tag 
    1102      * @param incidentId the incident's ID to look up 
    1103      * @throws RemoteException 
    1104      */ 
    1105     public String getCadDataIncGenInfo(INC_GEN_INFO tag, int incidentId) throws RemoteException { 
    1106         if(tag.equals(INC_GEN_INFO.JURISDICTION)){ 
     1232     * 
     1233     * @param tag a CADDataEnums tag 
     1234     * @param incidentId the incident's ID to look up 
     1235     * @throws RemoteException 
     1236     */ 
     1237    public String getCadDataIncGenInfo(INC_GEN_INFO tag, int incidentId) throws RemoteException 
     1238    { 
     1239        if (tag.equals(INC_GEN_INFO.JURISDICTION)) 
     1240        { 
    11071241            return cadData.getIncident(incidentId).getGenInfo().getJurisdiction(); 
    1108         } 
    1109         else if(tag.equals(INC_GEN_INFO.ALARM)){ 
     1242        } else if (tag.equals(INC_GEN_INFO.ALARM)) 
     1243        { 
    11101244            return cadData.getIncident(incidentId).getGenInfo().getAlarm(); 
    1111         } 
    1112         else if(tag.equals(INC_GEN_INFO.AGY)){ 
     1245        } else if (tag.equals(INC_GEN_INFO.AGY)) 
     1246        { 
    11131247            return cadData.getIncident(incidentId).getGenInfo().getAgy(); 
    1114         } 
    1115         else{ 
     1248        } else 
     1249        { 
    11161250            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncGenInfo"); 
    11171251        } 
     
    11201254    /** 
    11211255     * Set incidentId's field based on tag to value. 
    1122      * @param tag a CADDataEnums tag 
    1123      * @param incidentId the incident's ID to look up 
    1124      * @throws RemoteException 
    1125      */ 
    1126     public void setCadDataIncGenInfo(INC_GEN_INFO tag, int incidentId, String value) throws RemoteException{ 
    1127         if(tag.equals(INC_GEN_INFO.JURISDICTION)){ 
     1256     * 
     1257     * @param tag a CADDataEnums tag 
     1258     * @param incidentId the incident's ID to look up 
     1259     * @throws RemoteException 
     1260     */ 
     1261    public void setCadDataIncGenInfo(INC_GEN_INFO tag, int incidentId, String value) throws RemoteException 
     1262    { 
     1263        if (tag.equals(INC_GEN_INFO.JURISDICTION)) 
     1264        { 
    11281265            cadData.getIncident(incidentId).getGenInfo().setJurisdiction(value); 
    1129         } 
    1130         else if(tag.equals(INC_GEN_INFO.ALARM)){ 
     1266        } else if (tag.equals(INC_GEN_INFO.ALARM)) 
     1267        { 
    11311268            cadData.getIncident(incidentId).getGenInfo().setAlarm(value); 
    1132         } 
    1133         else if(tag.equals(INC_GEN_INFO.AGY)){ 
     1269        } else if (tag.equals(INC_GEN_INFO.AGY)) 
     1270        { 
    11341271            cadData.getIncident(incidentId).getGenInfo().setAgy(value); 
    1135         } 
    1136         else{ 
     1272        } else 
     1273        { 
    11371274            throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncGenInfo"); 
    11381275        } 
    11391276    } 
    1140      
     1277 
    11411278    /** 
    11421279     * Returns a string out of IncidentResponse based on tag. 
    1143      * @param tag a CADDataEnums tag 
    1144      * @param incidentId the incident's ID to look up 
    1145      * @throws RemoteException 
    1146      */ 
    1147     public String getCadDataIncResp(INC_RESP tag, int incidentId) throws RemoteException { 
    1148         if(tag.equals(INC_RESP.PLAN)){ 
     1280     * 
     1281     * @param tag a CADDataEnums tag 
     1282     * @param incidentId the incident's ID to look up 
     1283     * @throws RemoteException 
     1284     */ 
     1285    public String getCadDataIncResp(INC_RESP tag, int incidentId) throws RemoteException 
     1286    { 
     1287        if (tag.equals(INC_RESP.PLAN)) 
     1288        { 
    11491289            return cadData.getIncident(incidentId).getResponse().getPlan(); 
    1150         } 
    1151         else if(tag.equals(INC_RESP.AREA)){ 
     1290        } else if (tag.equals(INC_RESP.AREA)) 
     1291        { 
    11521292            return cadData.getIncident(incidentId).getResponse().getArea(); 
    1153         } 
    1154         else{ 
     1293        } else 
     1294        { 
    11551295            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncResp"); 
    11561296        } 
    11571297    } 
    1158      
     1298 
    11591299    /** 
    11601300     * Set incidentId's field based on tag to value. 
    1161      * @param tag a CADDataEnums tag 
    1162      * @param incidentId the incident's ID to look up 
    1163      * @throws RemoteException 
    1164      */ 
    1165     public void setCadDataIncResp(INC_RESP tag, int incidentId, String value) throws RemoteException{ 
    1166         if(tag.equals(INC_RESP.PLAN)){ 
     1301     * 
     1302     * @param tag a CADDataEnums tag 
     1303     * @param incidentId the incident's ID to look up 
     1304     * @throws RemoteException 
     1305     */ 
     1306    public void setCadDataIncResp(INC_RESP tag, int incidentId, String value) throws RemoteException 
     1307    { 
     1308        if (tag.equals(INC_RESP.PLAN)) 
     1309        { 
    11671310            cadData.getIncident(incidentId).getResponse().setPlan(value); 
    1168         } 
    1169         else if(tag.equals(INC_RESP.AREA)){ 
     1311        } else if (tag.equals(INC_RESP.AREA)) 
     1312        { 
    11701313            cadData.getIncident(incidentId).getResponse().setArea(value); 
    1171         } 
    1172         else{ 
     1314        } else 
     1315        { 
    11731316            throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncResp"); 
    11741317        } 
     
    11771320    /** 
    11781321     * Returns a string out of IncidentAdditionalInfo based on tag. 
    1179      * @param tag a CADDataEnums tag 
    1180      * @param incidentId the incident's ID to look up 
    1181      * @throws RemoteException 
    1182      */ 
    1183     public String getCadDataIncAddInfo(INC_ADD_INFO tag, int incidentId) throws RemoteException { 
    1184         if(tag.equals(INC_ADD_INFO.TYPE)){ 
     1322     * 
     1323     * @param tag a CADDataEnums tag 
     1324     * @param incidentId the incident's ID to look up 
     1325     * @throws RemoteException 
     1326     */ 
     1327    public String getCadDataIncAddInfo(INC_ADD_INFO tag, int incidentId) throws RemoteException 
     1328    { 
     1329        if (tag.equals(INC_ADD_INFO.TYPE)) 
     1330        { 
    11851331            return cadData.getIncident(incidentId).getAdditionalInfo().getType(); 
    1186         } 
    1187         else if(tag.equals(INC_ADD_INFO.TYPE_CODE)){ 
     1332        } else if (tag.equals(INC_ADD_INFO.TYPE_CODE)) 
     1333        { 
    11881334            return cadData.getIncident(incidentId).getAdditionalInfo().getTypeCode(); 
    1189         } 
    1190         else if(tag.equals(INC_ADD_INFO.MACHINE)){ 
     1335        } else if (tag.equals(INC_ADD_INFO.MACHINE)) 
     1336        { 
    11911337            return cadData.getIncident(incidentId).getAdditionalInfo().getMachine(); 
    1192         } 
    1193         else if(tag.equals(INC_ADD_INFO.CALL_STATUS)){ 
     1338        } else if (tag.equals(INC_ADD_INFO.CALL_STATUS)) 
     1339        { 
    11941340            return cadData.getIncident(incidentId).getAdditionalInfo().getCallStatus(); 
    1195         } 
    1196         else if(tag.equals(INC_ADD_INFO.CALL_TAKER_EXT)){ 
     1341        } else if (tag.equals(INC_ADD_INFO.CALL_TAKER_EXT)) 
     1342        { 
    11971343            return cadData.getIncident(incidentId).getAdditionalInfo().getCallTakerExt(); 
    1198         } 
    1199         else if(tag.equals(INC_ADD_INFO.ALARM_LEVEL)){ 
     1344        } else if (tag.equals(INC_ADD_INFO.ALARM_LEVEL)) 
     1345        { 
    12001346            return cadData.getIncident(incidentId).getAdditionalInfo().getAlarmLevel(); 
    1201         } 
    1202         else if(tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA)){ 
     1347        } else if (tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA)) 
     1348        { 
    12031349            return cadData.getIncident(incidentId).getAdditionalInfo().getRotationProviderArea(); 
    1204         } 
    1205         else if(tag.equals(INC_ADD_INFO.COMMENT)){ 
     1350        } else if (tag.equals(INC_ADD_INFO.COMMENT)) 
     1351        { 
    12061352            return cadData.getIncident(incidentId).getAdditionalInfo().getComment(); 
    1207         } 
    1208         else{ 
     1353        } else 
     1354        { 
    12091355            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncAddInfo"); 
    12101356        } 
     
    12131359    /** 
    12141360     * Set incidentId's field based on tag to value. 
    1215      * @param tag a CADDataEnums tag 
    1216      * @param incidentId the incident's ID to look up 
    1217      * @throws RemoteException 
    1218      */ 
    1219     public void setCadDataIncAddInfo(INC_ADD_INFO tag, int incidentId, String value) throws RemoteException{ 
    1220         if(tag.equals(INC_ADD_INFO.TYPE)){ 
     1361     * 
     1362     * @param tag a CADDataEnums tag 
     1363     * @param incidentId the incident's ID to look up 
     1364     * @throws RemoteException 
     1365     */ 
     1366    public void setCadDataIncAddInfo(INC_ADD_INFO tag, int incidentId, String value) throws RemoteException 
     1367    { 
     1368        if (tag.equals(INC_ADD_INFO.TYPE)) 
     1369        { 
    12211370            cadData.getIncident(incidentId).getAdditionalInfo().setType(value); 
    1222         } 
    1223         else if(tag.equals(INC_ADD_INFO.TYPE_CODE)){ 
     1371        } else if (tag.equals(INC_ADD_INFO.TYPE_CODE)) 
     1372        { 
    12241373            cadData.getIncident(incidentId).getAdditionalInfo().setTypeCode(value); 
    1225         } 
    1226         else if(tag.equals(INC_ADD_INFO.MACHINE)){ 
     1374        } else if (tag.equals(INC_ADD_INFO.MACHINE)) 
     1375        { 
    12271376            cadData.getIncident(incidentId).getAdditionalInfo().setMachine(value); 
    1228         } 
    1229         else if(tag.equals(INC_ADD_INFO.CALL_STATUS)){ 
     1377        } else if (tag.equals(INC_ADD_INFO.CALL_STATUS)) 
     1378        { 
    12301379            cadData.getIncident(incidentId).getAdditionalInfo().setCallStatus(value); 
    1231         } 
    1232         else if(tag.equals(INC_ADD_INFO.CALL_TAKER_EXT)){ 
     1380        } else if (tag.equals(INC_ADD_INFO.CALL_TAKER_EXT)) 
     1381        { 
    12331382            cadData.getIncident(incidentId).getAdditionalInfo().setCallTakerExt(value); 
    1234         } 
    1235         else if(tag.equals(INC_ADD_INFO.ALARM_LEVEL)){ 
     1383        } else if (tag.equals(INC_ADD_INFO.ALARM_LEVEL)) 
     1384        { 
    12361385            cadData.getIncident(incidentId).getAdditionalInfo().setAlarmLevel(value); 
    1237         } 
    1238         else if(tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA)){ 
     1386        } else if (tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA)) 
     1387        { 
    12391388            cadData.getIncident(incidentId).getAdditionalInfo().setRotationProviderArea(value); 
    1240         } 
    1241         else if(tag.equals(INC_ADD_INFO.COMMENT)){ 
     1389        } else if (tag.equals(INC_ADD_INFO.COMMENT)) 
     1390        { 
    12421391            cadData.getIncident(incidentId).getAdditionalInfo().setComment(value); 
    1243         } 
    1244         else{ 
     1392        } else 
     1393        { 
    12451394            throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncAddInfo"); 
    12461395        } 
    12471396    } 
    1248      
     1397 
    12491398    /** 
    12501399     * Returns a string out of IncidentActivities based on tag. 
    1251      * @param tag a CADDataEnums tag 
    1252      * @param incidentId the incident's ID to look up 
    1253      * @throws RemoteException 
    1254      */ 
    1255     public String getCadDataIncActivities(INC_ACTIVITIES tag, int incidentId) throws RemoteException { 
    1256         if(tag.equals(INC_ACTIVITIES.VEHICLE)){ 
     1400     * 
     1401     * @param tag a CADDataEnums tag 
     1402     * @param incidentId the incident's ID to look up 
     1403     * @throws RemoteException 
     1404     */ 
     1405    public String getCadDataIncActivities(INC_ACTIVITIES tag, int incidentId) throws RemoteException 
     1406    { 
     1407        if (tag.equals(INC_ACTIVITIES.VEHICLE)) 
     1408        { 
    12571409            return cadData.getIncident(incidentId).getActivities().getVehicle(); 
    1258         } 
    1259         else if(tag.equals(INC_ACTIVITIES.ACTIVITY)){ 
     1410        } else if (tag.equals(INC_ACTIVITIES.ACTIVITY)) 
     1411        { 
    12601412            return cadData.getIncident(incidentId).getActivities().getActivity(); 
    1261         } 
    1262         else if(tag.equals(INC_ACTIVITIES.LOCATION)){ 
     1413        } else if (tag.equals(INC_ACTIVITIES.LOCATION)) 
     1414        { 
    12631415            return cadData.getIncident(incidentId).getActivities().getLocation(); 
    1264         } 
    1265         else if(tag.equals(INC_ACTIVITIES.COMMENT)){ 
     1416        } else if (tag.equals(INC_ACTIVITIES.COMMENT)) 
     1417        { 
    12661418            return cadData.getIncident(incidentId).getActivities().getComment(); 
    1267         } 
    1268         else if(tag.equals(INC_ACTIVITIES.DISP)){ 
     1419        } else if (tag.equals(INC_ACTIVITIES.DISP)) 
     1420        { 
    12691421            return cadData.getIncident(incidentId).getActivities().getDisp(); 
    1270         } 
    1271         else{ 
     1422        } else 
     1423        { 
    12721424            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncActivities"); 
    12731425        } 
     
    12761428    /** 
    12771429     * Set incidentId's field based on tag to value. 
    1278      * @param tag a CADDataEnums tag 
    1279      * @param incidentId the incident's ID to look up 
    1280      * @throws RemoteException 
    1281      */ 
    1282     public void setCadDataIncActivities(INC_ACTIVITIES tag, int incidentId, String value) throws RemoteException{ 
    1283         if(tag.equals(INC_ACTIVITIES.VEHICLE)){ 
     1430     * 
     1431     * @param tag a CADDataEnums tag 
     1432     * @param incidentId the incident's ID to look up 
     1433     * @throws RemoteException 
     1434     */ 
     1435    public void setCadDataIncActivities(INC_ACTIVITIES tag, int incidentId, String value) throws RemoteException 
     1436    { 
     1437        if (tag.equals(INC_ACTIVITIES.VEHICLE)) 
     1438        { 
    12841439            cadData.getIncident(incidentId).getActivities().setVehicle(value); 
    1285         } 
    1286         else if(tag.equals(INC_ACTIVITIES.ACTIVITY)){ 
     1440        } else if (tag.equals(INC_ACTIVITIES.ACTIVITY)) 
     1441        { 
    12871442            cadData.getIncident(incidentId).getActivities().setActivity(value); 
    1288         } 
    1289         else if(tag.equals(INC_ACTIVITIES.LOCATION)){ 
     1443        } else if (tag.equals(INC_ACTIVITIES.LOCATION)) 
     1444        { 
    12901445            cadData.getIncident(incidentId).getActivities().setLocation(value); 
    1291         } 
    1292         else if(tag.equals(INC_ACTIVITIES.COMMENT)){ 
     1446        } else if (tag.equals(INC_ACTIVITIES.COMMENT)) 
     1447        { 
    12931448            cadData.getIncident(incidentId).getActivities().setComment(value); 
    1294         } 
    1295         else if(tag.equals(INC_ACTIVITIES.DISP)){ 
     1449        } else if (tag.equals(INC_ACTIVITIES.DISP)) 
     1450        { 
    12961451            cadData.getIncident(incidentId).getActivities().setDisp(value); 
    1297         } 
    1298         else{ 
     1452        } else 
     1453        { 
    12991454            throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncActivities"); 
    13001455        } 
    13011456    } 
    1302      
     1457 
    13031458    /** 
    13041459     * Returns a string out of IncidentCallback based on tag. 
    1305      * @param tag a CADDataEnums tag 
    1306      * @param incidentId the incident's ID to look up 
    1307      * @throws RemoteException 
    1308      */ 
    1309     public String getCadDataIncCallBack(INC_CALLBACK tag, int incidentId) throws RemoteException { 
    1310         if(tag.equals(INC_CALLBACK.INITIAL)){ 
     1460     * 
     1461     * @param tag a CADDataEnums tag 
     1462     * @param incidentId the incident's ID to look up 
     1463     * @throws RemoteException 
     1464     */ 
     1465    public String getCadDataIncCallBack(INC_CALLBACK tag, int incidentId) throws RemoteException 
     1466    { 
     1467        if (tag.equals(INC_CALLBACK.INITIAL)) 
     1468        { 
    13111469            return cadData.getIncident(incidentId).getCallBacks().getInitial(); 
    1312         } 
    1313         else if(tag.equals(INC_CALLBACK.COMMENT)){ 
     1470        } else if (tag.equals(INC_CALLBACK.COMMENT)) 
     1471        { 
    13141472            return cadData.getIncident(incidentId).getCallBacks().getComment(); 
    1315         } 
    1316         else{ 
     1473        } else 
     1474        { 
    13171475            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncCallBack"); 
    13181476        } 
     
    13211479    /** 
    13221480     * Returns a string out of IncidentEditLog based on tag. 
    1323      * @param tag a CADDataEnums tag 
    1324      * @param incidentId the incident's ID to look up 
    1325      * @throws RemoteException 
    1326      */ 
    1327     public String getCadDataIncEditLog(INC_EDIT_LOG tag, int incidentId) throws RemoteException { 
    1328         if(tag.equals(INC_EDIT_LOG.EDIT)){ 
     1481     * 
     1482     * @param tag a CADDataEnums tag 
     1483     * @param incidentId the incident's ID to look up 
     1484     * @throws RemoteException 
     1485     */ 
     1486    public String getCadDataIncEditLog(INC_EDIT_LOG tag, int incidentId) throws RemoteException 
     1487    { 
     1488        if (tag.equals(INC_EDIT_LOG.EDIT)) 
     1489        { 
    13291490            return cadData.getIncident(incidentId).getEditLog().getEdit(); 
    1330         } 
    1331         else if(tag.equals(INC_EDIT_LOG.REASON)){ 
     1491        } else if (tag.equals(INC_EDIT_LOG.REASON)) 
     1492        { 
    13321493            return cadData.getIncident(incidentId).getEditLog().getReason(); 
    1333         } 
    1334         else if(tag.equals(INC_EDIT_LOG.CHANGE_BY)){ 
     1494        } else if (tag.equals(INC_EDIT_LOG.CHANGE_BY)) 
     1495        { 
    13351496            return cadData.getIncident(incidentId).getEditLog().getChangeBy(); 
    1336         } 
    1337         else if(tag.equals(INC_EDIT_LOG.TERMINAL)){ 
     1497        } else if (tag.equals(INC_EDIT_LOG.TERMINAL)) 
     1498        { 
    13381499            return cadData.getIncident(incidentId).getEditLog().getTerminal(); 
    1339         } 
    1340         else{ 
     1500        } else 
     1501        { 
    13411502            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncEditLog"); 
    13421503        } 
     
    13451506    /** 
    13461507     * Returns a string out of IncidentInfo based on tag. 
    1347      * @param tag a CADDataEnums tag 
    1348      * @param incidentId the incident's ID to look up 
    1349      * @throws RemoteException 
    1350      */ 
    1351     public String getCadDataIncInfo(INC_INFO tag, int incidentId) throws RemoteException { 
    1352         if(tag.equals(INC_INFO.CALL_INITIATED)){ 
     1508     * 
     1509     * @param tag a CADDataEnums tag 
     1510     * @param incidentId the incident's ID to look up 
     1511     * @throws RemoteException 
     1512     */ 
     1513    public String getCadDataIncInfo(INC_INFO tag, int incidentId) throws RemoteException 
     1514    { 
     1515        if (tag.equals(INC_INFO.CALL_INITIATED)) 
     1516        { 
    13531517            return cadData.getIncident(incidentId).getInfo().getCallInit(); 
    1354         } 
    1355         else if(tag.equals(INC_INFO.CALL_TAKEN)){ 
     1518        } else if (tag.equals(INC_INFO.CALL_TAKEN)) 
     1519        { 
    13561520            return cadData.getIncident(incidentId).getInfo().getCallTaken(); 
    1357         } 
    1358         else if(tag.equals(INC_INFO.TIME_IN_Q)){ 
     1521        } else if (tag.equals(INC_INFO.TIME_IN_Q)) 
     1522        { 
    13591523            return cadData.getIncident(incidentId).getInfo().getTimeInQ(); 
    1360         } 
    1361         else if(tag.equals(INC_INFO.LAST_UPDATED)){ 
     1524        } else if (tag.equals(INC_INFO.LAST_UPDATED)) 
     1525        { 
    13621526            return cadData.getIncident(incidentId).getInfo().getLastUpdated(); 
    1363         } 
    1364         else{ 
     1527        } else 
     1528        { 
    13651529            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncInfo"); 
    13661530        } 
     
    13691533    /** 
    13701534     * Returns a string out of IncidentTimes based on tag. 
    1371      * @param tag a CADDataEnums tag 
    1372      * @param incidentId the incident's ID to look up 
    1373      * @throws RemoteException 
    1374      */ 
    1375     public String getCadDataIncTimes(INC_TIMES tag, int incidentId) throws RemoteException { 
     1535     * 
     1536     * @param tag a CADDataEnums tag 
     1537     * @param incidentId the incident's ID to look up 
     1538     * @throws RemoteException 
     1539     */ 
     1540    public String getCadDataIncTimes(INC_TIMES tag, int incidentId) throws RemoteException 
     1541    { 
    13761542        // TODO Auto-generated method stub 
    13771543        return null; 
    13781544    } 
    1379      
     1545 
    13801546    /** 
    13811547     * Returns a CardfileList matching the tag. 
    13821548     */ 
    1383     public CardfileList getCardfileList(CARDFILE tag) throws RemoteException{ 
    1384         if(tag.equals(CARDFILE.COASTAL_DIVISION_UNITS)){ 
     1549    public CardfileList getCardfileList(CARDFILE tag) throws RemoteException 
     1550    { 
     1551        if (tag.equals(CARDFILE.COASTAL_DIVISION_UNITS)) 
     1552        { 
    13851553            return cardfileData.getCoastalDivisionUnitList(); 
    1386         } 
    1387         else if(tag.equals(CARDFILE.POLICE_SHERIFF_CORONER)){ 
     1554        } else if (tag.equals(CARDFILE.POLICE_SHERIFF_CORONER)) 
     1555        { 
    13881556            return cardfileData.getPoliceSheriffCoronerList(); 
    1389         } 
    1390         else if(tag.equals(CARDFILE.COURTS)){ 
     1557        } else if (tag.equals(CARDFILE.COURTS)) 
     1558        { 
    13911559            return cardfileData.getCourtsList(); 
    1392         } 
    1393         else if(tag.equals(CARDFILE.PUBLIC_TRANSPORTATION)){ 
     1560        } else if (tag.equals(CARDFILE.PUBLIC_TRANSPORTATION)) 
     1561        { 
    13941562            return cardfileData.getPublicTransportationList(); 
    1395         } 
    1396         else if(tag.equals(CARDFILE.GG_OTHER)){ 
     1563        } else if (tag.equals(CARDFILE.GG_OTHER)) 
     1564        { 
    13971565            return cardfileData.getGgOtherList(); 
    1398         } 
    1399         else if(tag.equals(CARDFILE.MY_MISC)){ 
     1566        } else if (tag.equals(CARDFILE.MY_MISC)) 
     1567        { 
    14001568            return cardfileData.getMyMiscList(); 
    1401         } 
    1402         else if(tag.equals(CARDFILE.SL_MISC)){ 
     1569        } else if (tag.equals(CARDFILE.SL_MISC)) 
     1570        { 
    14031571            return cardfileData.getSlMiscList(); 
    1404         } 
    1405         else if(tag.equals(CARDFILE.VT_MISC)){ 
     1572        } else if (tag.equals(CARDFILE.VT_MISC)) 
     1573        { 
    14061574            return cardfileData.getVlMiscList(); 
    1407         } 
    1408         else if(tag.equals(CARDFILE.CHP_OFFICES)){ 
     1575        } else if (tag.equals(CARDFILE.CHP_OFFICES)) 
     1576        { 
    14091577            return cardfileData.getChpOfficesList(); 
    1410         } 
    1411         else if(tag.equals(CARDFILE.STATE_AGENCIES_FACILITIES)){ 
     1578        } else if (tag.equals(CARDFILE.STATE_AGENCIES_FACILITIES)) 
     1579        { 
    14121580            return cardfileData.getStateAgenciesFacilitiesList(); 
    1413         } 
    1414         else if(tag.equals(CARDFILE.GOVERNMENT_OFFICIALS)){ 
     1581        } else if (tag.equals(CARDFILE.GOVERNMENT_OFFICIALS)) 
     1582        { 
    14151583            return cardfileData.getGovernmentOfficialsList(); 
    1416         } 
    1417         else if(tag.equals(CARDFILE.FEDERAL_AGENCIES)){ 
     1584        } else if (tag.equals(CARDFILE.FEDERAL_AGENCIES)) 
     1585        { 
    14181586            return cardfileData.getFederalAgenciesList(); 
    1419         } 
    1420         else if(tag.equals(CARDFILE.RANCHES_LIVESTOCK)){ 
     1587        } else if (tag.equals(CARDFILE.RANCHES_LIVESTOCK)) 
     1588        { 
    14211589            return cardfileData.getRanchesLivestockList(); 
    1422         } 
    1423         else if(tag.equals(CARDFILE.FIRE_EMS)){ 
     1590        } else if (tag.equals(CARDFILE.FIRE_EMS)) 
     1591        { 
    14241592            return cardfileData.getFireEmsList(); 
    1425         } 
    1426         else if(tag.equals(CARDFILE.JAILS)){ 
     1593        } else if (tag.equals(CARDFILE.JAILS)) 
     1594        { 
    14271595            return cardfileData.getJailsList(); 
    1428         } 
    1429         else if(tag.equals(CARDFILE.HOSPITALS_MED_CENTERS)){ 
     1596        } else if (tag.equals(CARDFILE.HOSPITALS_MED_CENTERS)) 
     1597        { 
    14301598            return cardfileData.getHospitalsMedCentersList(); 
    1431         } 
    1432         else if(tag.equals(CARDFILE.TOW_COMPANIES)){ 
     1599        } else if (tag.equals(CARDFILE.TOW_COMPANIES)) 
     1600        { 
    14331601            return cardfileData.getTowCompaniesList(); 
    1434         } 
    1435         else if(tag.equals(CARDFILE.CALTRANS)){ 
     1602        } else if (tag.equals(CARDFILE.CALTRANS)) 
     1603        { 
    14361604            return cardfileData.getCalTransList(); 
    1437         } 
    1438         else if(tag.equals(CARDFILE.COUNTY_ROADS)){ 
     1605        } else if (tag.equals(CARDFILE.COUNTY_ROADS)) 
     1606        { 
    14391607            return cardfileData.getCountyRoadsList(); 
    1440         } 
    1441         else if(tag.equals(CARDFILE.UTILITIES)){ 
     1608        } else if (tag.equals(CARDFILE.UTILITIES)) 
     1609        { 
    14421610            return cardfileData.getUtilitiesList(); 
    1443         } 
    1444         else if(tag.equals(CARDFILE.ANIMAL_CONTROL)){ 
     1611        } else if (tag.equals(CARDFILE.ANIMAL_CONTROL)) 
     1612        { 
    14451613            return cardfileData.getAnimalControlList(); 
    1446         } 
    1447         else if(tag.equals(CARDFILE.AIRPORTS)){ 
     1614        } else if (tag.equals(CARDFILE.AIRPORTS)) 
     1615        { 
    14481616            return cardfileData.getAirportsList(); 
    1449         } 
    1450         else if(tag.equals(CARDFILE.CREDIT_CARDS)){ 
     1617        } else if (tag.equals(CARDFILE.CREDIT_CARDS)) 
     1618        { 
    14511619            return cardfileData.getCreditCardsList(); 
    1452         } 
    1453         else if(tag.equals(CARDFILE.GG_CRISIS_SHELTERS)){ 
     1620        } else if (tag.equals(CARDFILE.GG_CRISIS_SHELTERS)) 
     1621        { 
    14541622            return cardfileData.getGgCrisisSheltersList(); 
    1455         } 
    1456         else if(tag.equals(CARDFILE.RANGES)){ 
     1623        } else if (tag.equals(CARDFILE.RANGES)) 
     1624        { 
    14571625            return cardfileData.getRangesList(); 
    1458         } 
    1459         else if(tag.equals(CARDFILE.HOTLINES)){ 
     1626        } else if (tag.equals(CARDFILE.HOTLINES)) 
     1627        { 
    14601628            return cardfileData.getHotlinesList(); 
    1461         } 
    1462         else if(tag.equals(CARDFILE.HWY_PATROLS_OOS)){ 
     1629        } else if (tag.equals(CARDFILE.HWY_PATROLS_OOS)) 
     1630        { 
    14631631            return cardfileData.getHwyPatrolsOosList(); 
    1464         } 
    1465         else if(tag.equals(CARDFILE.PARKS_RECREATION)){ 
     1632        } else if (tag.equals(CARDFILE.PARKS_RECREATION)) 
     1633        { 
    14661634            return cardfileData.getParksRecreationList(); 
    1467         } 
    1468         else if(tag.equals(CARDFILE.SHELTERS)){ 
     1635        } else if (tag.equals(CARDFILE.SHELTERS)) 
     1636        { 
    14691637            return cardfileData.getSheltersList(); 
    1470         } 
    1471         else if(tag.equals(CARDFILE.SL_COUNTY_SERVICES)){ 
     1638        } else if (tag.equals(CARDFILE.SL_COUNTY_SERVICES)) 
     1639        { 
    14721640            return cardfileData.getSlCountyServicesList(); 
    1473         } 
    1474         else if(tag.equals(CARDFILE.SL_RESOURCES)){ 
     1641        } else if (tag.equals(CARDFILE.SL_RESOURCES)) 
     1642        { 
    14751643            return cardfileData.getSlResourcesList(); 
    1476         } 
    1477         else if(tag.equals(CARDFILE.TRUCK_TIRE_REPAIR)){ 
     1644        } else if (tag.equals(CARDFILE.TRUCK_TIRE_REPAIR)) 
     1645        { 
    14781646            return cardfileData.getTruckTireRepairList(); 
    1479         } 
    1480         else if(tag.equals(CARDFILE.MCC_EMPLOYEES)){ 
     1647        } else if (tag.equals(CARDFILE.MCC_EMPLOYEES)) 
     1648        { 
    14811649            return cardfileData.getMccEmployeesList(); 
    1482         } 
    1483         else if(tag.equals(CARDFILE.GATE_ACCESS_CODES)){ 
     1650        } else if (tag.equals(CARDFILE.GATE_ACCESS_CODES)) 
     1651        { 
    14841652            return cardfileData.getGateAccessCodesList(); 
    1485         } 
    1486         else if(tag.equals(CARDFILE.VT_CALL_SIGNS)){ 
     1653        } else if (tag.equals(CARDFILE.VT_CALL_SIGNS)) 
     1654        { 
    14871655            return cardfileData.getVtCallSignsList(); 
    1488         } 
    1489         else if(tag.equals(CARDFILE.SLCC_EMPLOYEES)){ 
     1656        } else if (tag.equals(CARDFILE.SLCC_EMPLOYEES)) 
     1657        { 
    14901658            return cardfileData.getSlccEmployeesList(); 
    1491         } 
    1492         else{ 
     1659        } else 
     1660        { 
    14931661            throw new RemoteException("Wrong Enum sent into Coordinator.getCardfileList"); 
    14941662        } 
    14951663    } 
    1496      
    1497     /** 
    1498      * Receives the fields of the ChangeLog in Cardfile.java and uses those fields 
    1499      * to make changes to its own copy of the Cardfiledata. 
    1500      */ 
    1501     public void editCardfile(ChangeLog log) throws RemoteException{ 
    1502          
     1664 
     1665    /** 
     1666     * Receives the fields of the ChangeLog in Cardfile.java and uses those 
     1667     * fields to make changes to its own copy of the Cardfiledata. 
     1668     */ 
     1669    public void editCardfile(ChangeLog log) throws RemoteException 
     1670    { 
     1671 
    15031672        CardfileList selectedList; 
    1504          
    1505         if(log.listTitle.equals(CARDFILE.COASTAL_DIVISION_UNITS.tag)){ 
     1673 
     1674        if (log.listTitle.equals(CARDFILE.COASTAL_DIVISION_UNITS.tag)) 
     1675        { 
    15061676            selectedList = cardfileData.getCoastalDivisionUnitList(); 
    1507         } 
    1508         else if(log.listTitle.equals(CARDFILE.POLICE_SHERIFF_CORONER.tag)){ 
     1677        } else if (log.listTitle.equals(CARDFILE.POLICE_SHERIFF_CORONER.tag)) 
     1678        { 
    15091679            selectedList = cardfileData.getPoliceSheriffCoronerList(); 
    1510         } 
    1511         else if(log.listTitle.equals(CARDFILE.COURTS.tag)){ 
     1680        } else if (log.listTitle.equals(CARDFILE.COURTS.tag)) 
     1681        { 
    15121682            selectedList = cardfileData.getCourtsList(); 
    1513         } 
    1514         else if(log.listTitle.equals(CARDFILE.PUBLIC_TRANSPORTATION.tag)){ 
     1683        } else if (log.listTitle.equals(CARDFILE.PUBLIC_TRANSPORTATION.tag)) 
     1684        { 
    15151685            selectedList = cardfileData.getPublicTransportationList(); 
    1516         } 
    1517         else if(log.listTitle.equals(CARDFILE.GG_OTHER.tag)){ 
     1686        } else if (log.listTitle.equals(CARDFILE.GG_OTHER.tag)) 
     1687        { 
    15181688            selectedList = cardfileData.getGgOtherList(); 
    1519         } 
    1520         else if(log.listTitle.equals(CARDFILE.MY_MISC.tag)){ 
     1689        } else if (log.listTitle.equals(CARDFILE.MY_MISC.tag)) 
     1690        { 
    15211691            selectedList = cardfileData.getMyMiscList(); 
    1522         } 
    1523         else if(log.listTitle.equals(CARDFILE.SL_MISC.tag)){ 
     1692        } else if (log.listTitle.equals(CARDFILE.SL_MISC.tag)) 
     1693        { 
    15241694            selectedList = cardfileData.getSlMiscList(); 
    1525         } 
    1526         else if(log.listTitle.equals(CARDFILE.VT_MISC.tag)){ 
     1695        } else if (log.listTitle.equals(CARDFILE.VT_MISC.tag)) 
     1696        { 
    15271697            selectedList = cardfileData.getVlMiscList(); 
    1528         } 
    1529         else if(log.listTitle.equals(CARDFILE.CHP_OFFICES.tag)){ 
     1698        } else if (log.listTitle.equals(CARDFILE.CHP_OFFICES.tag)) 
     1699        { 
    15301700            selectedList = cardfileData.getChpOfficesList(); 
    1531         } 
    1532         else if(log.listTitle.equals(CARDFILE.STATE_AGENCIES_FACILITIES.tag)){ 
     1701        } else if (log.listTitle.equals(CARDFILE.STATE_AGENCIES_FACILITIES.tag)) 
     1702        { 
    15331703            selectedList = cardfileData.getStateAgenciesFacilitiesList(); 
    1534         } 
    1535         else if(log.listTitle.equals(CARDFILE.GOVERNMENT_OFFICIALS.tag)){ 
     1704        } else if (log.listTitle.equals(CARDFILE.GOVERNMENT_OFFICIALS.tag)) 
     1705        { 
    15361706            selectedList = cardfileData.getGovernmentOfficialsList(); 
    1537         } 
    1538         else if(log.listTitle.equals(CARDFILE.FEDERAL_AGENCIES.tag)){ 
     1707        } else if (log.listTitle.equals(CARDFILE.FEDERAL_AGENCIES.tag)) 
     1708        { 
    15391709            selectedList = cardfileData.getFederalAgenciesList(); 
    1540         } 
    1541         else if(log.listTitle.equals(CARDFILE.RANCHES_LIVESTOCK.tag)){ 
     1710        } else if (log.listTitle.equals(CARDFILE.RANCHES_LIVESTOCK.tag)) 
     1711        { 
    15421712            selectedList = cardfileData.getRanchesLivestockList(); 
    1543         } 
    1544         else if(log.listTitle.equals(CARDFILE.FIRE_EMS.tag)){ 
     1713        } else if (log.listTitle.equals(CARDFILE.FIRE_EMS.tag)) 
     1714        { 
    15451715            selectedList = cardfileData.getFireEmsList(); 
    1546         } 
    1547         else if(log.listTitle.equals(CARDFILE.JAILS.tag)){ 
     1716        } else if (log.listTitle.equals(CARDFILE.JAILS.tag)) 
     1717        { 
    15481718            selectedList = cardfileData.getJailsList(); 
    1549         } 
    1550         else if(log.listTitle.equals(CARDFILE.HOSPITALS_MED_CENTERS.tag)){ 
     1719        } else if (log.listTitle.equals(CARDFILE.HOSPITALS_MED_CENTERS.tag)) 
     1720        { 
    15511721            selectedList = cardfileData.getHospitalsMedCentersList(); 
    1552         } 
    1553         else if(log.listTitle.equals(CARDFILE.TOW_COMPANIES.tag)){ 
     1722        } else if (log.listTitle.equals(CARDFILE.TOW_COMPANIES.tag)) 
     1723        { 
    15541724            selectedList = cardfileData.getTowCompaniesList(); 
    1555         } 
    1556         else if(log.listTitle.equals(CARDFILE.CALTRANS.tag)){ 
     1725        } else if (log.listTitle.equals(CARDFILE.CALTRANS.tag)) 
     1726        { 
    15571727            selectedList = cardfileData.getCalTransList(); 
    1558         } 
    1559         else if(log.listTitle.equals(CARDFILE.COUNTY_ROADS.tag)){ 
     1728        } else if (log.listTitle.equals(CARDFILE.COUNTY_ROADS.tag)) 
     1729        { 
    15601730            selectedList = cardfileData.getCountyRoadsList(); 
    1561         } 
    1562         else if(log.listTitle.equals(CARDFILE.UTILITIES.tag)){ 
     1731        } else if (log.listTitle.equals(CARDFILE.UTILITIES.tag)) 
     1732        { 
    15631733            selectedList = cardfileData.getUtilitiesList(); 
    1564         } 
    1565         else if(log.listTitle.equals(CARDFILE.ANIMAL_CONTROL.tag)){ 
     1734        } else if (log.listTitle.equals(CARDFILE.ANIMAL_CONTROL.tag)) 
     1735        { 
    15661736            selectedList = cardfileData.getAnimalControlList(); 
    1567         } 
    1568         else if(log.listTitle.equals(CARDFILE.AIRPORTS.tag)){ 
     1737        } else if (log.listTitle.equals(CARDFILE.AIRPORTS.tag)) 
     1738        { 
    15691739            selectedList = cardfileData.getAirportsList(); 
    1570         } 
    1571         else if(log.listTitle.equals(CARDFILE.CREDIT_CARDS.tag)){ 
     1740        } else if (log.listTitle.equals(CARDFILE.CREDIT_CARDS.tag)) 
     1741        { 
    15721742            selectedList = cardfileData.getCreditCardsList(); 
    1573         } 
    1574         else if(log.listTitle.equals(CARDFILE.GG_CRISIS_SHELTERS.tag)){ 
     1743        } else if (log.listTitle.equals(CARDFILE.GG_CRISIS_SHELTERS.tag)) 
     1744        { 
    15751745            selectedList = cardfileData.getGgCrisisSheltersList(); 
    1576         } 
    1577         else if(log.listTitle.equals(CARDFILE.RANGES.tag)){ 
     1746        } else if (log.listTitle.equals(CARDFILE.RANGES.tag)) 
     1747        { 
    15781748            selectedList = cardfileData.getRangesList(); 
    1579         } 
    1580         else if(log.listTitle.equals(CARDFILE.HOTLINES.tag)){ 
     1749        } else if (log.listTitle.equals(CARDFILE.HOTLINES.tag)) 
     1750        { 
    15811751            selectedList = cardfileData.getHotlinesList(); 
    1582         } 
    1583         else if(log.listTitle.equals(CARDFILE.HWY_PATROLS_OOS.tag)){ 
     1752        } else if (log.listTitle.equals(CARDFILE.HWY_PATROLS_OOS.tag)) 
     1753        { 
    15841754            selectedList = cardfileData.getHwyPatrolsOosList(); 
    1585         } 
    1586         else if(log.listTitle.equals(CARDFILE.PARKS_RECREATION.tag)){ 
     1755        } else if (log.listTitle.equals(CARDFILE.PARKS_RECREATION.tag)) 
     1756        { 
    15871757            selectedList = cardfileData.getParksRecreationList(); 
    1588         } 
    1589         else if(log.listTitle.equals(CARDFILE.SHELTERS.tag)){ 
     1758        } else if (log.listTitle.equals(CARDFILE.SHELTERS.tag)) 
     1759        { 
    15901760            selectedList = cardfileData.getSheltersList(); 
    1591         } 
    1592         else if(log.listTitle.equals(CARDFILE.SL_COUNTY_SERVICES.tag)){ 
     1761        } else if (log.listTitle.equals(CARDFILE.SL_COUNTY_SERVICES.tag)) 
     1762        { 
    15931763            selectedList = cardfileData.getSlCountyServicesList(); 
    1594         } 
    1595         else if(log.listTitle.equals(CARDFILE.SL_RESOURCES.tag)){ 
     1764        } else if (log.listTitle.equals(CARDFILE.SL_RESOURCES.tag)) 
     1765        { 
    15961766            selectedList = cardfileData.getSlResourcesList(); 
    1597         } 
    1598         else if(log.listTitle.equals(CARDFILE.TRUCK_TIRE_REPAIR.tag)){ 
     1767        } else if (log.listTitle.equals(CARDFILE.TRUCK_TIRE_REPAIR.tag)) 
     1768        { 
    15991769            selectedList = cardfileData.getTruckTireRepairList(); 
    1600         } 
    1601         else if(log.listTitle.equals(CARDFILE.MCC_EMPLOYEES.tag)){ 
     1770        } else if (log.listTitle.equals(CARDFILE.MCC_EMPLOYEES.tag)) 
     1771        { 
    16021772            selectedList = cardfileData.getMccEmployeesList(); 
    1603         } 
    1604         else if(log.listTitle.equals(CARDFILE.GATE_ACCESS_CODES.tag)){ 
     1773        } else if (log.listTitle.equals(CARDFILE.GATE_ACCESS_CODES.tag)) 
     1774        { 
    16051775            selectedList = cardfileData.getGateAccessCodesList(); 
    1606         } 
    1607         else if(log.listTitle.equals(CARDFILE.VT_CALL_SIGNS.tag)){ 
     1776        } else if (log.listTitle.equals(CARDFILE.VT_CALL_SIGNS.tag)) 
     1777        { 
    16081778            selectedList = cardfileData.getVtCallSignsList(); 
    1609         } 
    1610         else if(log.listTitle.equals(CARDFILE.SLCC_EMPLOYEES.tag)){ 
     1779        } else if (log.listTitle.equals(CARDFILE.SLCC_EMPLOYEES.tag)) 
     1780        { 
    16111781            selectedList = cardfileData.getSlccEmployeesList(); 
    1612         } 
    1613         else{ 
     1782        } else 
     1783        { 
    16141784            throw new RemoteException("Wrong Enum sent into Coordinator.editCardfileDataObject"); 
    16151785        } 
    1616          
     1786 
    16171787        CardfileDataObject cfdo = cardfileData.getCardfileDataObject(selectedList, log.id); 
    1618         if(cfdo != null && log.command.equals(EditCommand.NAME)){ 
     1788        if (cfdo != null && log.command.equals(EditCommand.NAME)) 
     1789        { 
    16191790            cfdo.setName(log.newValue); 
    1620             selectedList.resort(cardfileData.getCardfileDataIndex(selectedList,log.id)); 
    1621         } 
    1622         else if(cfdo != null && log.command.equals(EditCommand.ADDRESS)){ 
     1791            selectedList.resort(cardfileData.getCardfileDataIndex(selectedList, log.id)); 
     1792        } else if (cfdo != null && log.command.equals(EditCommand.ADDRESS)) 
     1793        { 
    16231794            cfdo.setAddress(log.newValue); 
    1624         } 
    1625         else if(cfdo != null && log.command.equals(EditCommand.CITY)){ 
     1795        } else if (cfdo != null && log.command.equals(EditCommand.CITY)) 
     1796        { 
    16261797            cfdo.setCity(log.newValue); 
    1627         } 
    1628         else if(cfdo != null && log.command.equals(EditCommand.STATE)){ 
     1798        } else if (cfdo != null && log.command.equals(EditCommand.STATE)) 
     1799        { 
    16291800            cfdo.setState(log.newValue); 
    1630         } 
    1631         else if(cfdo != null && log.command.equals(EditCommand.ZIP)){ 
     1801        } else if (cfdo != null && log.command.equals(EditCommand.ZIP)) 
     1802        { 
    16321803            cfdo.setZip(log.newValue); 
    1633         } 
    1634         else if(cfdo != null && log.command.equals(EditCommand.PHONE1)){ 
     1804        } else if (cfdo != null && log.command.equals(EditCommand.PHONE1)) 
     1805        { 
    16351806            cfdo.setPhone1(log.newValue); 
    1636         } 
    1637         else if(cfdo != null && log.command.equals(EditCommand.PHONE2)){ 
     1807        } else if (cfdo != null && log.command.equals(EditCommand.PHONE2)) 
     1808        { 
    16381809            cfdo.setPhone2(log.newValue); 
    1639         } 
    1640         else if(cfdo != null && log.command.equals(EditCommand.FAX)){ 
     1810        } else if (cfdo != null && log.command.equals(EditCommand.FAX)) 
     1811        { 
    16411812            cfdo.setFax(log.newValue); 
    1642         } 
    1643         else if(log.command.equals(EditCommand.OBJECT_DELETE)){ 
    1644             selectedList.removeDataObject(cardfileData.getCardfileDataIndex(selectedList,log.id)); 
    1645         } 
    1646         else if(log.command.equals(EditCommand.OBJECT_ADD)){ 
     1813        } else if (log.command.equals(EditCommand.OBJECT_DELETE)) 
     1814        { 
     1815            selectedList.removeDataObject(cardfileData.getCardfileDataIndex(selectedList, log.id)); 
     1816        } else if (log.command.equals(EditCommand.OBJECT_ADD)) 
     1817        { 
    16471818            selectedList.addDataObject(log.newCardfileObject); 
    1648         } 
    1649         else if(log.command.equals(EditCommand.TABLE_ADD)){ 
    1650             if(cfdo != null){ 
    1651                cfdo.addComment(log.tableFields); 
     1819        } else if (log.command.equals(EditCommand.TABLE_ADD)) 
     1820        { 
     1821            if (cfdo != null) 
     1822            { 
     1823                cfdo.addComment(log.tableFields); 
    16521824            } 
    1653         } 
    1654         else if(log.command.equals(EditCommand.TABLE_DELETE)){ 
    1655             if(cfdo != null){ 
     1825        } else if (log.command.equals(EditCommand.TABLE_DELETE)) 
     1826        { 
     1827            if (cfdo != null) 
     1828            { 
    16561829                cfdo.removeComment(log.timeStamp); 
    16571830            } 
    1658         } 
    1659         else{ 
    1660              
    1661         } 
    1662          
    1663          
    1664     } 
    1665      
     1831        } else 
     1832        { 
     1833        } 
     1834 
     1835 
     1836    } 
     1837 
    16661838    /** 
    16671839     * Obtain a new unique ID for a cardfileDataObject. 
    16681840     */ 
    1669     public int obtainNewUniqueId() throws RemoteException{ 
     1841    public int obtainNewUniqueId() throws RemoteException 
     1842    { 
    16701843        return cardfileData.obtainNewUniqueId(); 
    16711844    } 
    1672      
     1845 
    16731846    /** 
    16741847     * Returns a value from Unit based on tag. 
     1848     * 
    16751849     * @param unitNum the unitNum to look up 
    1676      * @throws RemoteException  
    1677      */ 
    1678     public UnitStatusEnums getCadDataUnitStatus(String unitNum) throws RemoteException{ 
     1850     * @throws RemoteException 
     1851     */ 
     1852    public UnitStatusEnums getCadDataUnitStatus(String unitNum) throws RemoteException 
     1853    { 
    16791854        return cadData.getUnit(unitNum).getUnitStatus(); 
    16801855    } 
    1681      
     1856 
    16821857    /** 
    16831858     * Returns a string field from Unit based on tag. 
     1859     * 
    16841860     * @param tag a CADScriptTags tag 
    16851861     * @param unitNum the unitNum to look up 
     
    16871863     * @throws RemoteException 
    16881864     */ 
    1689     public String getCadDataUnitValue(String unitNum, UNIT_TAGS tag) throws RemoteException{ 
    1690         if(tag.equals(UNIT_TAGS.MASTER_INC_NUM)){ 
     1865    public String getCadDataUnitValue(String unitNum, UNIT_TAGS tag) throws RemoteException 
     1866    { 
     1867        if (tag.equals(UNIT_TAGS.MASTER_INC_NUM)) 
     1868        { 
    16911869            return cadData.getUnit(unitNum).getMasterInc(); 
    1692         } 
    1693         else if(tag.equals(UNIT_TAGS.STATUS)){ 
     1870        } else if (tag.equals(UNIT_TAGS.STATUS)) 
     1871        { 
    16941872            return cadData.getUnit(unitNum).getStatus(); 
    1695         } 
    1696         else if(tag.equals(UNIT_TAGS.OOS)){ 
     1873        } else if (tag.equals(UNIT_TAGS.OOS)) 
     1874        { 
    16971875            return cadData.getUnit(unitNum).getOos(); 
    1698         } 
    1699         else if(tag.equals(UNIT_TAGS.TYPE)){ 
     1876        } else if (tag.equals(UNIT_TAGS.TYPE)) 
     1877        { 
    17001878            return cadData.getUnit(unitNum).getType(); 
    1701         } 
    1702         else if(tag.equals(UNIT_TAGS.CURR_LOC)){ 
     1879        } else if (tag.equals(UNIT_TAGS.CURR_LOC)) 
     1880        { 
    17031881            return cadData.getUnit(unitNum).getCurrentLocation(); 
    1704         } 
    1705         else if(tag.equals(UNIT_TAGS.DESTINATION)){ 
     1882        } else if (tag.equals(UNIT_TAGS.DESTINATION)) 
     1883        { 
    17061884            return cadData.getUnit(unitNum).getDestination(); 
    1707         } 
    1708         else if(tag.equals(UNIT_TAGS.MISC_INFO)){ 
     1885        } else if (tag.equals(UNIT_TAGS.MISC_INFO)) 
     1886        { 
    17091887            return cadData.getUnit(unitNum).getMisc(); 
    1710         } 
    1711         else if(tag.equals(UNIT_TAGS.STACK)){ 
     1888        } else if (tag.equals(UNIT_TAGS.STACK)) 
     1889        { 
    17121890            return cadData.getUnit(unitNum).getStack(); 
    1713         } 
    1714         else if(tag.equals(UNIT_TAGS.AREA)){ 
     1891        } else if (tag.equals(UNIT_TAGS.AREA)) 
     1892        { 
    17151893            return cadData.getUnit(unitNum).getArea(); 
    1716         } 
    1717         else if(tag.equals(UNIT_TAGS.OFFICER)){ 
     1894        } else if (tag.equals(UNIT_TAGS.OFFICER)) 
     1895        { 
    17181896            return cadData.getUnit(unitNum).getOfficer(); 
    1719         } 
    1720         else if(tag.equals(UNIT_TAGS.BADGE_NUM)){ 
     1897        } else if (tag.equals(UNIT_TAGS.BADGE_NUM)) 
     1898        { 
    17211899            return cadData.getUnit(unitNum).getBadge(); 
    1722         } 
    1723         else if(tag.equals(UNIT_TAGS.TIMER)){ 
     1900        } else if (tag.equals(UNIT_TAGS.TIMER)) 
     1901        { 
    17241902            return cadData.getUnit(unitNum).getTimerInString(); 
    1725         } 
    1726         else if(tag.equals(UNIT_TAGS.OFFICE)){ 
     1903        } else if (tag.equals(UNIT_TAGS.OFFICE)) 
     1904        { 
    17271905            return cadData.getUnit(unitNum).getOffice(); 
    1728         } 
    1729         else if(tag.equals(UNIT_TAGS.P)){ 
     1906        } else if (tag.equals(UNIT_TAGS.P)) 
     1907        { 
    17301908            return cadData.getUnit(unitNum).getP(); 
    1731         } 
    1732         else if(tag.equals(UNIT_TAGS.AGY)){ 
     1909        } else if (tag.equals(UNIT_TAGS.AGY)) 
     1910        { 
    17331911            return cadData.getUnit(unitNum).getAgy(); 
    1734         } 
    1735         else if(tag.equals(UNIT_TAGS.ALIAS)){ 
     1912        } else if (tag.equals(UNIT_TAGS.ALIAS)) 
     1913        { 
    17361914            return cadData.getUnit(unitNum).getAlias(); 
    1737         } 
    1738         else{ 
     1915        } else 
     1916        { 
    17391917            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataUnitValue"); 
    17401918        } 
     
    17431921    /** 
    17441922     * Sets a field from Unit based on tag. 
     1923     * 
    17451924     * @param tag a CADScriptTags tag 
    17461925     * @param unitNum the unitNum to look up 
     
    17481927     * @throws RemoteException 
    17491928     */ 
    1750     public void setCadDataUnitValue(String unitNum, UNIT_TAGS tag, Object value) throws RemoteException{ 
    1751         if(tag.equals(UNIT_TAGS.MASTER_INC_NUM)){ 
    1752             cadData.getUnit(unitNum).setMasterInc((String)value); 
    1753         } 
    1754         else if(tag.equals(UNIT_TAGS.STATUS)){ 
    1755             cadData.getUnit(unitNum).setStatus((String)value); 
    1756         } 
    1757         else if(tag.equals(UNIT_TAGS.OOS)){ 
    1758             cadData.getUnit(unitNum).setOos((String)value); 
    1759         } 
    1760         else if(tag.equals(UNIT_TAGS.TYPE)){ 
    1761             cadData.getUnit(unitNum).setType((String)value); 
    1762         } 
    1763         else if(tag.equals(UNIT_TAGS.CURR_LOC)){ 
    1764             cadData.getUnit(unitNum).setCurrentLocation((String)value); 
    1765         } 
    1766         else if(tag.equals(UNIT_TAGS.DESTINATION)){ 
    1767             cadData.getUnit(unitNum).setDestination((String)value); 
    1768         } 
    1769         else if(tag.equals(UNIT_TAGS.MISC_INFO)){ 
    1770             cadData.getUnit(unitNum).setMisc((String)value); 
    1771         } 
    1772         else if(tag.equals(UNIT_TAGS.STACK)){ 
    1773             cadData.getUnit(unitNum).setStack((String)value); 
    1774         } 
    1775         else if(tag.equals(UNIT_TAGS.AREA)){ 
    1776             cadData.getUnit(unitNum).setArea((String)value); 
    1777         } 
    1778         else if(tag.equals(UNIT_TAGS.OFFICER)){ 
    1779             cadData.getUnit(unitNum).setOfficer((String)value); 
    1780         } 
    1781         else if(tag.equals(UNIT_TAGS.BADGE_NUM)){ 
    1782             cadData.getUnit(unitNum).setBadge((String)value); 
    1783         } 
    1784         else if(tag.equals(UNIT_TAGS.UNIT_STATUS)){ 
    1785             cadData.getUnit(unitNum).setUnitStatus((UnitStatusEnums)value); 
    1786         } 
    1787         else if(tag.equals(UNIT_TAGS.OFFICE)){ 
    1788             cadData.getUnit(unitNum).setOffice((String)value); 
    1789         } 
    1790         else if(tag.equals(UNIT_TAGS.P)){ 
    1791             cadData.getUnit(unitNum).setP((String)value); 
    1792         } 
    1793         else if(tag.equals(UNIT_TAGS.AGY)){ 
    1794             cadData.getUnit(unitNum).setAgy((String)value); 
    1795         } 
    1796         else if(tag.equals(UNIT_TAGS.ALIAS)){ 
    1797             cadData.getUnit(unitNum).setAlias((String)value); 
    1798         } 
    1799         else{ 
     1929    public void setCadDataUnitValue(String unitNum, UNIT_TAGS tag, Object value) throws RemoteException 
     1930    { 
     1931        if (tag.equals(UNIT_TAGS.MASTER_INC_NUM)) 
     1932        { 
     1933            cadData.getUnit(unitNum).setMasterInc((String) value); 
     1934        } else if (tag.equals(UNIT_TAGS.STATUS)) 
     1935        { 
     1936            cadData.getUnit(unitNum).setStatus((String) value); 
     1937        } else if (tag.equals(UNIT_TAGS.OOS)) 
     1938        { 
     1939            cadData.getUnit(unitNum).setOos((String) value); 
     1940        } else if (tag.equals(UNIT_TAGS.TYPE)) 
     1941        { 
     1942            cadData.getUnit(unitNum).setType((String) value); 
     1943        } else if (tag.equals(UNIT_TAGS.CURR_LOC)) 
     1944        { 
     1945            cadData.getUnit(unitNum).setCurrentLocation((String) value); 
     1946        } else if (tag.equals(UNIT_TAGS.DESTINATION)) 
     1947        { 
     1948            cadData.getUnit(unitNum).setDestination((String) value); 
     1949        } else if (tag.equals(UNIT_TAGS.MISC_INFO)) 
     1950        { 
     1951            cadData.getUnit(unitNum).setMisc((String) value); 
     1952        } else if (tag.equals(UNIT_TAGS.STACK)) 
     1953        { 
     1954            cadData.getUnit(unitNum).setStack((String) value); 
     1955        } else if (tag.equals(UNIT_TAGS.AREA)) 
     1956        { 
     1957            cadData.getUnit(unitNum).setArea((String) value); 
     1958        } else if (tag.equals(UNIT_TAGS.OFFICER)) 
     1959        { 
     1960            cadData.getUnit(unitNum).setOfficer((String) value); 
     1961        } else if (tag.equals(UNIT_TAGS.BADGE_NUM)) 
     1962        { 
     1963            cadData.getUnit(unitNum).setBadge((String) value); 
     1964        } else if (tag.equals(UNIT_TAGS.UNIT_STATUS)) 
     1965        { 
     1966            cadData.getUnit(unitNum).setUnitStatus((UnitStatusEnums) value); 
     1967        } else if (tag.equals(UNIT_TAGS.OFFICE)) 
     1968        { 
     1969            cadData.getUnit(unitNum).setOffice((String) value); 
     1970        } else if (tag.equals(UNIT_TAGS.P)) 
     1971        { 
     1972            cadData.getUnit(unitNum).setP((String) value); 
     1973        } else if (tag.equals(UNIT_TAGS.AGY)) 
     1974        { 
     1975            cadData.getUnit(unitNum).setAgy((String) value); 
     1976        } else if (tag.equals(UNIT_TAGS.ALIAS)) 
     1977        { 
     1978            cadData.getUnit(unitNum).setAlias((String) value); 
     1979        } else 
     1980        { 
    18001981            throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataUnitValue"); 
    18011982        } 
    18021983    } 
    1803      
     1984 
    18041985    /** 
    18051986     * Assigns a unit to the specified incident. 
     1987     * 
    18061988     * @param unitNum the unitNum to look up 
    18071989     * @param id the incident id that this unit is assigned to. 
    18081990     * @throws RemoteException 
    18091991     */ 
    1810     public void setCadDataUnitAssignedId(String unitNum, int id) throws RemoteException{ 
     1992    public void setCadDataUnitAssignedId(String unitNum, int id) throws RemoteException 
     1993    { 
    18111994        cadData.getUnit(unitNum).setAssignedIncidentId(id); 
    18121995    } 
    1813      
     1996 
    18141997    /** 
    18151998     * Adds a unit to the incident's list of assigned units. 
     1999     * 
    18162000     * @param incidentId the incident 
    18172001     * @param assignedUnitNum the unit that's been assigned to the incident 
    18182002     * @throws RemoteException 
    18192003     */ 
    1820     public void addCadDataIncidentAssignedUnitNum(int incidentId, String assignedUnitNum) throws RemoteException{ 
     2004    public void addCadDataIncidentAssignedUnitNum(int incidentId, String assignedUnitNum) throws RemoteException 
     2005    { 
    18212006        cadData.getIncident(incidentId).addAssignedUnitNum(assignedUnitNum); 
    18222007    } 
    1823      
     2008 
    18242009    /** 
    18252010     * Sets the specified incident to the specified status. 
     2011     * 
    18262012     * @param incidentId the incident 
    18272013     * @param status the status of the incident 
    18282014     * @throws RemoteException 
    18292015     */ 
    1830     public void setCadDataIncidentStatus(int incidentId, IncidentEnums status) throws RemoteException{ 
     2016    public void setCadDataIncidentStatus(int incidentId, IncidentEnums status) throws RemoteException 
     2017    { 
    18312018        cadData.getIncident(incidentId).setIncidentStatus(status); 
    18322019    } 
    1833      
    1834     /**  
     2020 
     2021    /** 
    18352022     * Returns a LinkedList containing entries that match the search string. 
     2023     * 
    18362024     * @param search the string entry to be searched 
    18372025     * @return linked list of CardfileDataObjects matching search 
    18382026     */ 
    1839     public LinkedList<CardfileDataObject> getSearchList(String search) throws RemoteException{ 
     2027    public LinkedList<CardfileDataObject> getSearchList(String search) throws RemoteException 
     2028    { 
    18402029        return cardfileData.getSearchList(search); 
    18412030    } 
    1842      
    1843     /**  
    1844      * Updates the server database so clients can view additional informations as events complete 
     2031 
     2032    /** 
     2033     * Updates the server database so clients can view additional informations 
     2034     * as events complete 
     2035     * 
    18452036     * @param incidentNumber the incident in which the event occurred 
    1846      * @return completedEvent IncidentEvent with information to be added to server database 
    1847      */ 
    1848     public void updateIncidentInGUI(Integer incidentNumber, IncidentEvent completedEvent) { 
     2037     * @return completedEvent IncidentEvent with information to be added to 
     2038     * server database 
     2039     */ 
     2040    public void updateIncidentInGUI(Integer incidentNumber, IncidentEvent completedEvent) 
     2041    { 
    18492042        updateDetailsInGUI(incidentNumber, completedEvent); 
    18502043        updateUnitsInGUI(incidentNumber, completedEvent); 
    18512044    } 
    1852      
    1853     /**  
    1854      * Updates the server database so clients can view details as events complete 
     2045 
     2046    /** 
     2047     * Updates the server database so clients can view details as events 
     2048     * complete 
     2049     * 
    18552050     * @param incidentNumber the incident in which the event occurred 
    1856      * @return completedEvent IncidentEvent with details to be added to server database 
    1857      */ 
    1858     public void updateDetailsInGUI(Integer incidentNumber, IncidentEvent completedEvent) { 
     2051     * @return completedEvent IncidentEvent with details to be added to server 
     2052     * database 
     2053     */ 
     2054    public void updateDetailsInGUI(Integer incidentNumber, IncidentEvent completedEvent) 
     2055    { 
    18592056        DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); 
    18602057        DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); 
    1861         for(int i = 0; i < completedEvent.eventInfo.getDetails().size(); i++){ 
    1862             String[] fields = {dateFormat.format(new Date()), 
    1863                        timeFormat.format(new Date()), 
    1864                        "","",completedEvent.eventInfo.getDetails().elementAt(i).details}; 
    1865      
    1866             try{ 
     2058        for (int i = 0; i < completedEvent.eventInfo.getDetails().size(); i++) 
     2059        { 
     2060            String[] fields = 
     2061            { 
     2062                dateFormat.format(new Date()), 
     2063                timeFormat.format(new Date()), 
     2064                "", "", completedEvent.eventInfo.getDetails().elementAt(i).details 
     2065            }; 
     2066 
     2067            try 
     2068            { 
    18672069                addCadDataIncidentTable(INC_TABLE.COMMENTS_NOTES, incidentNumber, fields); 
    1868             }catch(RemoteException e){ 
     2070            } catch (RemoteException e) 
     2071            { 
    18692072                e.printStackTrace(); 
    1870             }    
    1871         } 
    1872     } 
    1873      
    1874     /**  
    1875      * Updates the server database so clients can view unit updates as events complete 
     2073            } 
     2074        } 
     2075    } 
     2076 
     2077    /** 
     2078     * Updates the server database so clients can view unit updates as events 
     2079     * complete 
     2080     * 
    18762081     * @param incidentNumber the incident in which the event occurred 
    1877      * @return completedEvent IncidentEvent with unit updates to be added to server database 
    1878      */ 
    1879     public void updateUnitsInGUI(Integer incidentNumber, IncidentEvent completedEvent) { 
    1880         for(int i = 0; i < completedEvent.eventInfo.getUnits().size(); i++){ 
     2082     * @return completedEvent IncidentEvent with unit updates to be added to 
     2083     * server database 
     2084     */ 
     2085    public void updateUnitsInGUI(Integer incidentNumber, IncidentEvent completedEvent) 
     2086    { 
     2087        for (int i = 0; i < completedEvent.eventInfo.getUnits().size(); i++) 
     2088        { 
    18812089            IncidentInquiryUnitsAssigned unit = completedEvent.eventInfo.getUnits().get(i); 
    1882             if(unit.statusType.equals("ENRT")){ 
     2090            if (unit.statusType.equals("ENRT")) 
     2091            { 
    18832092                cadData.unitAssignedToIncident(unit.beat, incidentNumber, unit.isPrimary); 
    1884             }else if(unit.statusType.equals("1097")){ 
     2093            } else if (unit.statusType.equals("1097")) 
     2094            { 
    18852095                cadData.unitArrivedAtIncidentScene(unit.beat, incidentNumber, unit.isPrimary); 
    1886             }else if(unit.statusType.equals("1098")){ 
     2096            } else if (unit.statusType.equals("1098")) 
     2097            { 
    18872098                cadData.unitAvailable(unit.beat); 
    18882099            } 
    18892100        } 
    18902101    } 
    1891      
     2102 
    18922103    /** 
    18932104     * Sets the specified incidentNumber to viewable in the GUI. 
     2105     * 
    18942106     * @param incidentNumber the number of the Incident started 
    18952107     */ 
    1896     public void incidentStartedInGUI(Integer incidentNumber){ 
     2108    public void incidentStartedInGUI(Integer incidentNumber) 
     2109    { 
    18972110        Date date = new Date(); 
    18982111        DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); 
  • /trunk/src/tmcsim/cadsimulator/viewer/CADSimulatorViewer.java

    r8 r24  
    33import java.awt.AWTEvent; 
    44import java.awt.Dimension; 
     5import java.awt.event.ActionEvent; 
     6import java.awt.event.KeyEvent; 
    57import java.awt.event.WindowEvent; 
    6  
    78import javax.swing.JFrame; 
    89import javax.swing.JMenu; 
     
    1112import javax.swing.JOptionPane; 
    1213import javax.swing.JTabbedPane; 
    13  
     14import javax.swing.KeyStroke; 
    1415import tmcsim.cadsimulator.videocontrol.DVDStatusUpdate; 
    1516import tmcsim.cadsimulator.videocontrol.DVDTitleUpdate; 
     
    2021 
    2122/** 
    22  * This class provides a GUI to view current status information for the 
    23  * CAD Simulator. 
     23 * This class provides a GUI to view current status information for the CAD 
     24 * Simulator. 
    2425 * 
    2526 * @see SimulationStatusPanel 
    2627 * @see MediaStatusPanel 
    27  * @author Matthew Cechini  
     28 * @author Matthew Cechini 
    2829 * @version $Revision: 1.3 $ $Date: 2006/06/06 20:46:41 $ 
    2930 */ 
    3031@SuppressWarnings("serial") 
    31 public class CADSimulatorViewer extends JFrame { 
    32  
    33     /** Panel to display simulation information. */ 
     32public class CADSimulatorViewer extends JFrame 
     33{ 
     34 
     35    /** 
     36     * Panel to display simulation information. 
     37     */ 
    3438    private SimulationStatusPanel simulationPanel; 
    35      
    36     /** Panel to display media control information. */ 
     39    /** 
     40     * Panel to display media control information. 
     41     */ 
    3742    private MediaStatusPanel mediaPanel; 
    38      
    39     /** Constructor. */ 
    40     public CADSimulatorViewer() { 
     43 
     44    /** 
     45     * Constructor. 
     46     */ 
     47    public CADSimulatorViewer() 
     48    { 
    4149        super("CAD Simulator"); 
    42          
     50 
    4351        initComponents(); 
    44     }     
    45      
    46     /**  
    47      * @see SimulationStatusPanel 
    48      */ 
    49     public void connectClient() { 
     52    } 
     53 
     54    /** 
     55     * @see SimulationStatusPanel 
     56     */ 
     57    public void connectClient() 
     58    { 
    5059        simulationPanel.connectClient(); 
    5160    } 
    52      
    53     /**  
    54      * @see SimulationStatusPanel 
    55      */ 
    56     public void disconnectClient() { 
     61 
     62    /** 
     63     * @see SimulationStatusPanel 
     64     */ 
     65    public void disconnectClient() 
     66    { 
    5767        simulationPanel.disconnectClient(); 
    5868    } 
    59      
    60     /**  
    61      * @see SimulationStatusPanel 
    62      */ 
    63     public void setSimManagerStatus(boolean connection) { 
    64         simulationPanel.setSimManagerStatus(connection);         
    65     } 
    66      
    67     /**  
    68      * @see SimulationStatusPanel 
    69      */ 
    70     public void setTime(long seconds) { 
     69 
     70    /** 
     71     * @see SimulationStatusPanel 
     72     */ 
     73    public void setSimManagerStatus(boolean connection) 
     74    { 
     75        simulationPanel.setSimManagerStatus(connection); 
     76    } 
     77 
     78    /** 
     79     * @see SimulationStatusPanel 
     80     */ 
     81    public void setTime(long seconds) 
     82    { 
    7183        simulationPanel.setTime(seconds); 
    7284    } 
    7385 
    74     /**  
    75      * @see SimulationStatusPanel 
    76      */ 
    77     public void setScriptStatus(SCRIPT_STATUS newStatus) { 
    78         simulationPanel.setScriptStatus(newStatus);          
    79     } 
    80      
    81     /**  
    82      * @see SimulationStatusPanel 
    83      */ 
    84     public void setParamicsStatus(PARAMICS_STATUS newStatus) { 
    85         simulationPanel.setParamicsStatus(newStatus);        
    86     } 
    87      
    88     /**  
    89      * @see SimulationStatusPanel 
    90      */ 
    91     public void setParamicsNetworkLoaded(String networkID) { 
    92         simulationPanel.setParamicsNetworkLoaded(networkID);         
    93     } 
    94  
    95     /**  
     86    /** 
     87     * @see SimulationStatusPanel 
     88     */ 
     89    public void setScriptStatus(SCRIPT_STATUS newStatus) 
     90    { 
     91        simulationPanel.setScriptStatus(newStatus); 
     92    } 
     93 
     94    /** 
     95     * @see SimulationStatusPanel 
     96     */ 
     97    public void setParamicsStatus(PARAMICS_STATUS newStatus) 
     98    { 
     99        simulationPanel.setParamicsStatus(newStatus); 
     100    } 
     101 
     102    /** 
     103     * @see SimulationStatusPanel 
     104     */ 
     105    public void setParamicsNetworkLoaded(String networkID) 
     106    { 
     107        simulationPanel.setParamicsNetworkLoaded(networkID); 
     108    } 
     109 
     110    /** 
    96111     * @see MediaStatusPanel 
    97112     */ 
    98     public void updateDVDStatus(DVDStatusUpdate update) { 
     113    public void updateDVDStatus(DVDStatusUpdate update) 
     114    { 
    99115        mediaPanel.updateDVDStatus(update); 
    100116    } 
    101117 
    102     /**  
     118    /** 
    103119     * @see MediaStatusPanel 
    104120     */ 
    105     public void updateDVDTitle(DVDTitleUpdate update) { 
     121    public void updateDVDTitle(DVDTitleUpdate update) 
     122    { 
    106123        mediaPanel.updateDVDTitle(update); 
    107124    } 
    108      
    109     /** 
    110      * Method calls the processEvent() method with a WINDOW_CLOSING 
    111      * WindowEvent to start the application closing process. 
    112      */ 
    113     public void closeViewer() { 
     125 
     126    /** 
     127     * Method calls the processEvent() method with a WINDOW_CLOSING WindowEvent 
     128     * to start the application closing process. 
     129     */ 
     130    public void closeViewer() 
     131    { 
    114132        processEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING)); 
    115133    } 
    116134 
    117135    /** 
    118      * Overloads the processEvent method.  If the AWTEvent is a  
    119      * WINDOW_CLOSING event, prompt the user to confirm the action. 
    120      * If confirmed, close the application. 
    121      */ 
    122     protected void processEvent(AWTEvent evt) { 
    123          
    124         if(evt.getID() == WindowEvent.WINDOW_CLOSING) { 
     136     * Overloads the processEvent method. If the AWTEvent is a WINDOW_CLOSING 
     137     * event, prompt the user to confirm the action. If confirmed, close the 
     138     * application. 
     139     */ 
     140    protected void processEvent(AWTEvent evt) 
     141    { 
     142 
     143        if (evt.getID() == WindowEvent.WINDOW_CLOSING) 
     144        { 
    125145            int option = JOptionPane.showConfirmDialog(null, 
    126                     "Closing the CAD Simulator will stop the current " + 
    127                     "simulation.  Do you wish to continue exiting?", 
     146                    "Closing the CAD Simulator will stop the current " 
     147                    + "simulation.  Do you wish to continue exiting?", 
    128148                    "Confirm Exit", 
    129149                    JOptionPane.YES_NO_OPTION); 
    130              
    131             if(option != JOptionPane.NO_OPTION) { 
     150 
     151            if (option != JOptionPane.NO_OPTION) 
     152            { 
    132153                System.exit(0); 
    133             }        
     154            } 
    134155        } 
    135      } 
    136      
    137     /** Initialize GUI Components */ 
    138     private void initComponents() { 
    139  
    140          
     156    } 
     157 
     158    /** 
     159     * Initialize GUI Components 
     160     */ 
     161    private void initComponents() 
     162    { 
     163 
     164 
    141165        simulationPanel = new SimulationStatusPanel(); 
    142         mediaPanel      = new MediaStatusPanel(); 
    143          
     166        mediaPanel = new MediaStatusPanel(); 
     167 
    144168        cadSimTabbedPane = new JTabbedPane(); 
    145169        cadSimTabbedPane.addTab("Status", simulationPanel); 
    146170        cadSimTabbedPane.addTab("Media", mediaPanel); 
    147          
    148         add(cadSimTabbedPane);       
     171 
     172        add(cadSimTabbedPane); 
    149173 
    150174        menubar = new JMenuBar(); 
    151          
     175 
    152176        fileMenu = new JMenu("File"); 
     177        fileMenu.setMnemonic(KeyEvent.VK_F); 
    153178        menubar.add(fileMenu); 
    154          
     179 
    155180        exitMenuItem = new JMenuItem(new ExitAction(this)); 
     181        exitMenuItem.setAccelerator(KeyStroke.getKeyStroke( 
     182                KeyEvent.VK_X, ActionEvent.ALT_MASK)); 
    156183        fileMenu.add(exitMenuItem); 
    157          
     184 
    158185        javax.swing.JMenu helpMenu = new javax.swing.JMenu("Help"); 
    159186        javax.swing.JMenuItem aboutItem = new javax.swing.JMenuItem("About"); 
     
    169196        helpMenu.add(aboutItem); 
    170197        menubar.add(helpMenu); 
    171          
     198 
    172199        setJMenuBar(menubar); 
    173          
    174         setPreferredSize(new Dimension(500, 575));   
     200 
     201        setPreferredSize(new Dimension(500, 575)); 
    175202        pack(); 
    176203        setResizable(false); 
    177204    } 
    178      
    179      
    180205    private JTabbedPane cadSimTabbedPane; 
    181      
    182206    private JMenuBar menubar; 
    183      
    184207    private JMenu fileMenu; 
    185      
    186208    private JMenuItem exitMenuItem; 
    187      
    188209} 
  • /trunk/src/tmcsim/cadsimulator/viewer/actions/ExitAction.java

    r2 r24  
    22 
    33import java.awt.event.ActionEvent; 
    4  
    54import javax.swing.AbstractAction; 
    6  
    75import tmcsim.cadsimulator.viewer.CADSimulatorViewer; 
    86 
    97/** 
    10  * Abstract action to exit the CADSimulator. When the action is performed 
    11  * the CADSimulatorView.closeViewer() method is called. 
    12  *   
     8 * Abstract action to exit the CADSimulator. When the action is performed the 
     9 * CADSimulatorView.closeViewer() method is called. 
     10 * 
    1311 * @author Matthew Cechini 
    14  * @version  
     12 * @version 
    1513 */ 
    1614@SuppressWarnings("serial") 
    17 public class ExitAction extends AbstractAction { 
     15public class ExitAction extends AbstractAction 
     16{ 
    1817 
    19     /** Reference to the CADSimulatorViewer. */ 
     18    /** 
     19     * Reference to the CADSimulatorViewer. 
     20     */ 
    2021    private CADSimulatorViewer theViewer; 
    2122 
    22     public ExitAction(CADSimulatorViewer viewer) { 
     23    public ExitAction(CADSimulatorViewer viewer) 
     24    { 
    2325        super("Exit"); 
    24          
     26 
    2527        theViewer = viewer; 
    2628    } 
    27      
    28     public void actionPerformed(ActionEvent arg0) {      
    29         theViewer.closeViewer(); 
     29 
     30    public void actionPerformed(ActionEvent arg0) 
     31    { 
     32        //theViewer.closeViewer(); 
     33        /* closeViewer() will prompt the user for confirmation. 
     34         * 26 Apr 2016 I'm tired of seeing the confirmation message, 
     35         * so if the user chooses File>Exit, assume they intend to exit 
     36         * and don't ask for confirmation.  If they click window close 
     37         * button, they will still get the confirmation prompt. jdalbey 
     38         */ 
     39        System.exit(0); 
    3040    } 
    31  
    3241} 
Note: See TracChangeset for help on using the changeset viewer.