Changeset 44 in tmcsimulator


Ignore:
Timestamp:
06/23/2016 06:30:20 PM (10 years ago)
Author:
jdalbey
Message:

MultiFile? commit: Add CADViewer Interface and change CADSimulator to Observer Pattern.

Location:
trunk
Files:
6 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/IDE_metadata/NetBeans/TMCSim/build.xml

    r23 r44  
    1313    <property name="workdir" value="../../.."/> 
    1414<!--        STORE SUBVERSION BUILD STRING      --> 
    15 <!-- Store the Subversion version string every time you do clean/build. --> 
    16 <target name="-pre-compile"> 
    17   <exec executable="svnversion" osfamily="unix" 
    18     output="${workdir}/config/svn-version.txt"/> 
    19     <echo file="${workdir}/config/svn-version.txt" append="true"> 
    20         # Do not edit. This file is autogenerated by the Ant build script # 
    21     </echo> 
     15<target name="-post-init" description="Sets the buildversion for the current build"> 
     16    <exec outputproperty="svna.version" executable="svnversion"> 
     17        <arg value="-c" /> 
     18        <redirector> 
     19            <outputfilterchain> 
     20                <tokenfilter> 
     21                    <replaceregex pattern="^[0-9]*:?" replace="" flags="g"/> 
     22                    <replaceregex pattern="M" replace="" flags="g"/> 
     23                </tokenfilter> 
     24            </outputfilterchain> 
     25        </redirector> 
     26    </exec> 
     27    <propertyfile file="${src.dir}/tmcsim/application.properties"> 
     28        <entry key="Application.revision" value="${svna.version}" type="int" operation="="/> 
     29    </propertyfile> 
     30    <echo>Setting SVN version: ${svna.version}</echo> 
     31</target> 
     32<target name="-post-jar" description="Sets the buildversion for the current build"> 
     33    <propertyfile file="${src.dir}/tmcsim/application.properties"> 
     34        <entry key="Application.buildnumber" value="1" type="int" operation="+"/> 
     35    </propertyfile> 
    2236</target> 
    2337<!-- 
  • trunk/src/tmcsim/cadsimulator/CADSimulator.java

    r33 r44  
    11package tmcsim.cadsimulator; 
    22 
    3 import java.awt.event.WindowEvent; 
    4 import java.awt.event.WindowListener; 
    53import java.io.File; 
    64import java.io.FileInputStream; 
     
    108import java.util.Calendar; 
    119import java.util.Properties; 
    12 import java.util.logging.FileHandler; 
    1310import java.util.logging.Level; 
    1411import java.util.logging.Logger; 
    15  
    1612import javax.swing.JOptionPane; 
    1713import javax.swing.JWindow; 
    1814import javax.swing.UIManager; 
    1915import javax.xml.parsers.DocumentBuilderFactory; 
    20  
    2116import tmcsim.cadsimulator.db.CMSDiversionDB; 
    2217import tmcsim.cadsimulator.managers.ATMSManager; 
     
    2520import tmcsim.cadsimulator.managers.ParamicsSimulationManager; 
    2621import tmcsim.cadsimulator.managers.SimulationControlManager; 
    27 import tmcsim.cadsimulator.viewer.CADSimulatorViewer; 
    28 import tmcsim.client.cadclientgui.data.CADData; 
     22import tmcsim.cadsimulator.viewer.model.CADSimulatorModel; 
    2923import tmcsim.common.SimulationException; 
    30 import tmcsim.simulationmanager.SimulationManager; 
    31  
     24import tmcsim.interfaces.CADViewer; 
    3225 
    3326/** 
    34  * CADSimulator is main class for the CAD Simulator application.  At  
    35  * construction the Coordinator, CoordinatorViewer, and all CAD Simulator  
    36  * Managers are initialized and data relationships are established.   
    37  * Simulation control is managed through the Coordinator and Managers. 
    38  * The CADSimulator contains the instances of all Manager Objects that are used 
    39  * to control the Simulation flow of data.<br> 
     27 * CADSimulator is main class for the CAD Simulator application. At construction 
     28 * the Coordinator, CoordinatorViewer, and all CAD Simulator Managers are 
     29 * initialized and data relationships are established. Simulation control is 
     30 * managed through the Coordinator and Managers. The CADSimulator contains the 
     31 * instances of all Manager Objects that are used to control the Simulation flow 
     32 * of data.<br> 
    4033 * <br> 
    41  *  
    42  * The CADSimulator is initialized with a properties file containing the  
     34 * 
     35 * The CADSimulator is initialized with a properties file containing the 
    4336 * following data items:<br> 
    4437 * <code> 
    4538 * -----------------------------------------------------------------------------<br> 
    46  * CADClientPort          The port number to use for remote CAD Client connections.<br> 
    47  * CoordinatorRMIPort     The port number to use for binding the Coordinator.<br> 
    48  * CMSDiversionXML        The filepath for the xml file containing initialization data for the Diversion "database." 
    49  * AudioFileLocation      The root directory path where audio files are referenced from.<br> 
    50  * ParamicsProperties     The filepath for the properties file to initialize the ParamicsControlManager.<br> 
    51  * ATMSProperties         The filepath for the properties file to initialize the ATMSManager.<br> 
    52  * MediaProperties        The filepath for the properties file to initialize the MediaManager.<br> 
    53  * ErrorFile              The filename of the error file used for logging errors.<br> 
     39 * CADClientPort The port number to use for remote CAD Client connections.<br> 
     40 * CoordinatorRMIPort The port number to use for binding the Coordinator.<br> 
     41 * CMSDiversionXML The filepath for the xml file containing initialization data 
     42 * for the Diversion "database." AudioFileLocation The root directory path where 
     43 * audio files are referenced from.<br> 
     44 * ParamicsProperties The filepath for the properties file to initialize the 
     45 * ParamicsControlManager.<br> 
     46 * ATMSProperties The filepath for the properties file to initialize the 
     47 * ATMSManager.<br> 
     48 * MediaProperties The filepath for the properties file to initialize the 
     49 * MediaManager.<br> 
     50 * ErrorFile The filename of the error file used for logging errors.<br> 
    5451 * ----------------------------------------------------------------------------<br> 
    5552 * Example File:<br> 
    56  * CADClientPort          = 4444<br> 
    57  * CoordinatorRMIPort     = 4445<br> 
    58  * CMSDiversionXML        = ../data/cmsdiversions.xml<br> 
    59  * AudioFileLocation      = ../audio/<br> 
    60  * ParamicsProperties     = ../config/paramics.properties<br> 
    61  * ATMSProperties         = ../config/atms.properties<br> 
    62  * MediaProperties        = ../config/media.properties<br> 
    63  * ErrorFile              = cad_sim_error.xml<br> 
     53 * CADClientPort = 4444<br> 
     54 * CoordinatorRMIPort = 4445<br> 
     55 * CMSDiversionXML = ../data/cmsdiversions.xml<br> 
     56 * AudioFileLocation = ../audio/<br> 
     57 * ParamicsProperties = ../config/paramics.properties<br> 
     58 * ATMSProperties = ../config/atms.properties<br> 
     59 * MediaProperties = ../config/media.properties<br> 
     60 * ErrorFile = cad_sim_error.xml<br> 
    6461 * </code> 
    6562 * 
    66  * @author Matthew Cechini (mcechini@calpoly.edu) 
     63 * @author Matthew Cechini (mcechini@calpoly.edu) jdalbey 
    6764 * @version $Date: 2009/04/17 16:27:46 $ $Revision: 1.5 $ 
    6865 */ 
    69 public class CADSimulator { 
    70      
    71     /** Error logger. */ 
     66public class CADSimulator 
     67{ 
     68 
     69    private static final String CONFIG_FILE_NAME = "cad_simulator_config.properties"; 
     70    /** 
     71     * Error logger. 
     72     */ 
    7273    private static Logger cadSimLogger = Logger.getLogger("tmcsim.cadsimulator"); 
    7374 
    7475    /** 
    75      * Enumeration containing properties name values.  See CADSimulator class  
     76     * Enumeration containing properties name values. See CADSimulator class 
    7677     * description for more information. 
     78     * 
    7779     * @author Matthew 
    7880     * @see CADSimulator 
    7981     */ 
    80     private static enum CAD_PROPERTIES { 
    81         /** RMI port to accept CAD Client connections. */ 
    82         CLIENT_PORT        ("CADClientPort"),        
    83         /** RMI port to bind the Coordinator to for RMI communication. */ 
    84         COOR_RMI_PORT      ("CoordinatorRMIPort"),   
    85          
    86         CAD_RMI_PORT       ("CADRmiPort"), 
    87         /** Filepath for xml file containing diversion data. */      
    88         CMS_XML_FILE       ("CMSDiversionXML"),  
    89         /** Filepath for xml file containing dvd control data. */ 
    90         DVD_XML_FILE       ("DVDPlayerXML"),     
    91         /** Filepath for xml file containing still image control data. */ 
    92         IMAGE_XML_FILE     ("StillImagesXML"), 
    93         /** Root directory path where audio files are referenced from. */ 
    94         AUDIO_LOCATION     ("AudioFileLocation"), 
    95         /** Filepath for the properties file to initialize the media manager. */ 
    96         MEDIA_PROP_FILE    ("MediaProperties"), 
    97         /** Filepath for the properties file to initialize the paramics control manager. */ 
    98         PARAMICS_PROP_FILE ("ParamicsProperties"), 
    99         /** Filepath for the properties file to initialize the atms manager. */ 
    100         ATMS_PROP_FILE     ("ATMSProperties"); 
    101          
     82    private static enum CAD_PROPERTIES 
     83    { 
     84 
     85        /** 
     86         * RMI port to accept CAD Client connections. 
     87         */ 
     88        CLIENT_PORT("CADClientPort"), 
     89        /** 
     90         * RMI port to bind the Coordinator to for RMI communication. 
     91         */ 
     92        COOR_RMI_PORT("CoordinatorRMIPort"), 
     93        CAD_RMI_PORT("CADRmiPort"), 
     94        /** 
     95         * Filepath for xml file containing diversion data. 
     96         */ 
     97        CMS_XML_FILE("CMSDiversionXML"), 
     98        /** 
     99         * Filepath for xml file containing dvd control data. 
     100         */ 
     101        DVD_XML_FILE("DVDPlayerXML"), 
     102        /** 
     103         * Filepath for xml file containing still image control data. 
     104         */ 
     105        IMAGE_XML_FILE("StillImagesXML"), 
     106        /** 
     107         * Root directory path where audio files are referenced from. 
     108         */ 
     109        AUDIO_LOCATION("AudioFileLocation"), 
     110        /** 
     111         * Filepath for the properties file to initialize the media manager. 
     112         */ 
     113        MEDIA_PROP_FILE("MediaProperties"), 
     114        /** 
     115         * Filepath for the properties file to initialize the paramics control 
     116         * manager. 
     117         */ 
     118        PARAMICS_PROP_FILE("ParamicsProperties"), 
     119        /** 
     120         * Filepath for the properties file to initialize the atms manager. 
     121         */ 
     122        ATMS_PROP_FILE("ATMSProperties"), 
     123        /** 
     124         * Class name of desired user interface. 
     125         */ 
     126        USER_INTERFACE("UserInterface"); 
    102127        public String name; 
    103          
    104         private CAD_PROPERTIES(String n) { 
    105             name = n; 
     128 
     129        private CAD_PROPERTIES(String nam) 
     130        { 
     131            name = nam; 
    106132        } 
    107133    }; 
    108          
    109              
    110     /** CADSimulatorViewer instance. */ 
    111     protected static CADSimulatorViewer theViewer; 
    112  
    113     /** Coordinator instance. */ 
    114     protected static  Coordinator theCoordinator; 
    115      
    116     /** SoundPlayer instance. */ 
    117     protected static  SoundPlayer theSoundPlayer = null; 
    118      
    119     /** SimulationControlManager instance. */ 
    120     protected static  SimulationControlManager theSimulationCntrlMgr = null; 
    121      
    122     /**  ParamicsSimulationManager instance. */ 
    123     protected static  ParamicsSimulationManager theParamicsSimMgr = null; 
    124      
    125     /** IncidentManager instance. */ 
    126     protected static  IncidentManager theIncidentMgr = null; 
    127      
    128     /** MediaManager instance. */    
    129     protected static  MediaManager theMediaMgr = null; 
    130      
    131     /** ATMSManager instance. */ 
    132     protected static  ATMSManager theATMSMgr = null;  
    133  
    134     /** Properties file for the CADSimulator. */ 
    135     private Properties cadSimulatorProperties;   
    136      
    137     private static final String CONFIG_FILE_NAME = "cad_simulator_config.properties"; 
    138  
    139     /** 
    140      * Constructor.  Load the Properties file and initialize all CAD Simulator 
    141      * Managers and establish Manager data relationships.  A  
    142      * CADSimulatorSocketHandler is instantiated and started to being  
    143      * listening for remote CAD connections.  The CMSDiversionDB is initialized 
    144      * with the XML data(incomplete design). 
    145      *  
     134    /** 
     135     * CADSimulatorViewer instance. 
     136     */ 
     137    protected static CADViewer theViewer; 
     138    //protected static CADSimulatorViewer theViewer; 
     139    //protected static CADConsoleViewer theConsole; 
     140    protected static CADSimulatorModel theModel; 
     141    /** 
     142     * Coordinator instance. 
     143     */ 
     144    protected static Coordinator theCoordinator; 
     145    /** 
     146     * SoundPlayer instance. 
     147     */ 
     148    protected static SoundPlayer theSoundPlayer = null; 
     149    /** 
     150     * SimulationControlManager instance. 
     151     */ 
     152    protected static SimulationControlManager theSimulationCntrlMgr = null; 
     153    /** 
     154     * ParamicsSimulationManager instance. 
     155     */ 
     156    protected static ParamicsSimulationManager theParamicsSimMgr = null; 
     157    /** 
     158     * IncidentManager instance. 
     159     */ 
     160    protected static IncidentManager theIncidentMgr = null; 
     161    /** 
     162     * MediaManager instance. 
     163     */ 
     164    protected static MediaManager theMediaMgr = null; 
     165    /** 
     166     * ATMSManager instance. 
     167     */ 
     168    protected static ATMSManager theATMSMgr = null; 
     169    /** 
     170     * Properties file for the CADSimulator. 
     171     */ 
     172    private Properties cadSimulatorProperties; 
     173 
     174    /** 
     175     * Constructor. Load the Properties file and initialize all CAD Simulator 
     176     * Managers and establish Manager data relationships. A 
     177     * CADSimulatorSocketHandler is instantiated and started to being listening 
     178     * for remote CAD connections. The CMSDiversionDB is initialized with the 
     179     * XML data(incomplete design). 
     180     * 
    146181     * @param propertiesFile Filename of CAD Simulator properties file. 
    147      * @throws SimulationException if there is an error in initializing the CAD Simulator. 
    148      */ 
    149     public CADSimulator(String propertiesFile) throws SimulationException { 
    150          
    151         try { 
     182     * @throws SimulationException if there is an error in initializing the CAD 
     183     * Simulator. 
     184     */ 
     185    public CADSimulator(String propertiesFile) throws SimulationException 
     186    { 
     187 
     188        try 
     189        { 
    152190            cadSimulatorProperties = new Properties(); 
    153191            cadSimulatorProperties.load(new FileInputStream(propertiesFile)); 
    154         } 
    155         catch (Exception e) {            
    156             cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor",  
     192        } catch (Exception e) 
     193        { 
     194            cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 
    157195                    "Exception in reading properties file.", e); 
    158              
    159             throw new SimulationException(SimulationException.INITIALIZE_ERROR, e);  
    160         } 
    161      
     196 
     197            throw new SimulationException(SimulationException.INITIALIZE_ERROR, e); 
     198        } 
     199 
    162200        //Create the Coordinator and register it for RMI communicator.  Start the 
    163201        //CAD Simulator Socket Handler to begin to accept connections from CAD Clients. 
    164         try { 
    165             theViewer             = new CADSimulatorViewer(); 
    166             theCoordinator        = new Coordinator(); 
     202        try 
     203        { 
     204            String userInterfaceName = 
     205                    cadSimulatorProperties.getProperty( 
     206                    CAD_PROPERTIES.USER_INTERFACE.name); 
     207            if (userInterfaceName == null) 
     208            { 
     209                cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 
     210                        propertiesFile + " missing property for user interface."); 
     211                throw new SimulationException(SimulationException.INITIALIZE_ERROR); 
     212            } 
     213            try 
     214            { 
     215                Class uiClass = Class.forName(userInterfaceName); 
     216                theViewer = (CADViewer) uiClass.newInstance(); 
     217            } catch (Throwable exc) 
     218            { 
     219                cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 
     220                        "Unable to instantiate user interface: " + userInterfaceName); 
     221                throw new SimulationException(SimulationException.INITIALIZE_ERROR); 
     222            } 
     223            theModel = new CADSimulatorModel(); 
     224            theModel.addObserver(theViewer); 
     225 
     226            theCoordinator = new Coordinator(theModel); 
     227 
    167228            startRegistry(Integer.parseInt( 
    168229                    cadSimulatorProperties.getProperty( 
    169                             CAD_PROPERTIES.COOR_RMI_PORT.name).trim())); 
     230                    CAD_PROPERTIES.COOR_RMI_PORT.name).trim())); 
    170231            startRegistry(Integer.parseInt( 
    171232                    cadSimulatorProperties.getProperty( 
    172                             CAD_PROPERTIES.CAD_RMI_PORT.name).trim())); 
    173  
    174             theSimulationCntrlMgr = new SimulationControlManager(theCoordinator);    
    175              
    176             theATMSMgr            = new ATMSManager( 
    177                     cadSimulatorProperties.getProperty( 
    178                             CAD_PROPERTIES.ATMS_PROP_FILE.name)); 
    179              
    180             theMediaMgr           = new MediaManager( 
    181                     cadSimulatorProperties.getProperty( 
    182                             CAD_PROPERTIES.MEDIA_PROP_FILE.name), 
    183                             theATMSMgr, theViewer); 
    184              
    185             theParamicsSimMgr     = new ParamicsSimulationManager( 
    186                     cadSimulatorProperties.getProperty( 
    187                             CAD_PROPERTIES.PARAMICS_PROP_FILE.name), 
    188                             theCoordinator, theMediaMgr);    
    189              
    190             theSoundPlayer        = new SoundPlayer( 
    191                     cadSimulatorProperties.getProperty( 
    192                             CAD_PROPERTIES.AUDIO_LOCATION.name)); 
     233                    CAD_PROPERTIES.CAD_RMI_PORT.name).trim())); 
     234 
     235            theSimulationCntrlMgr = new SimulationControlManager(theCoordinator); 
     236 
     237            theATMSMgr = new ATMSManager( 
     238                    cadSimulatorProperties.getProperty( 
     239                    CAD_PROPERTIES.ATMS_PROP_FILE.name)); 
     240 
     241            theMediaMgr = new MediaManager( 
     242                    cadSimulatorProperties.getProperty( 
     243                    CAD_PROPERTIES.MEDIA_PROP_FILE.name), 
     244                    theATMSMgr, theModel); 
     245 
     246            theParamicsSimMgr = new ParamicsSimulationManager( 
     247                    cadSimulatorProperties.getProperty( 
     248                    CAD_PROPERTIES.PARAMICS_PROP_FILE.name), 
     249                    theCoordinator, theMediaMgr); 
     250 
     251            theSoundPlayer = new SoundPlayer( 
     252                    cadSimulatorProperties.getProperty( 
     253                    CAD_PROPERTIES.AUDIO_LOCATION.name)); 
    193254            theSoundPlayer.start(); 
    194              
    195             theIncidentMgr        = new IncidentManager(theCoordinator, theSoundPlayer);     
    196              
     255 
     256            theIncidentMgr = new IncidentManager(theCoordinator, theSoundPlayer); 
     257 
    197258 
    198259            //Begin accepting Client connections 
    199260            CADSimulatorSocketHandler tmsh = new CADSimulatorSocketHandler( 
    200261                    Integer.parseInt(cadSimulatorProperties.getProperty( 
    201                             CAD_PROPERTIES.CLIENT_PORT.name).trim())); 
    202             tmsh.start();    
    203         }        
    204         catch (RemoteException e) { 
    205             cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor",  
     262                    CAD_PROPERTIES.CLIENT_PORT.name).trim())); 
     263            tmsh.start(); 
     264        } catch (RemoteException e) 
     265        { 
     266            cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 
    206267                    "Exception in starting Coordinator.", e); 
    207              
     268 
    208269            throw new SimulationException(SimulationException.BINDING, e); 
    209         }        
    210          
     270        } 
     271 
    211272        //Load CMS Diversion Information from the XML file 
    212         try {        
    213             if(cadSimulatorProperties.getProperty( 
    214                     CAD_PROPERTIES.CMS_XML_FILE.name) != null) { 
    215                     CMSDiversionDB.getInstance().loadFromXML( 
     273        try 
     274        { 
     275            if (cadSimulatorProperties.getProperty( 
     276                    CAD_PROPERTIES.CMS_XML_FILE.name) != null) 
     277            { 
     278                CMSDiversionDB.getInstance().loadFromXML( 
    216279                        DocumentBuilderFactory.newInstance().newDocumentBuilder() 
    217                             .parse(new File(cadSimulatorProperties.getProperty( 
    218                                     CAD_PROPERTIES.CMS_XML_FILE.name)))); 
    219             }            
    220         } 
    221         catch (Exception e)  
    222         { 
    223             cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor",  
     280                        .parse(new File(cadSimulatorProperties.getProperty( 
     281                        CAD_PROPERTIES.CMS_XML_FILE.name)))); 
     282            } 
     283        } catch (Exception e) 
     284        { 
     285            cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Constructor", 
    224286                    "Exception in parsing CMSDiversion xml file.", e); 
    225              
    226             JOptionPane.showMessageDialog(new JWindow(), "Unable to open " +  
    227                     cadSimulatorProperties.getProperty(CAD_PROPERTIES.CMS_XML_FILE.name),  
    228                 "Initialization Error", JOptionPane.WARNING_MESSAGE);    
    229         } 
    230               
    231         theViewer.addWindowListener(new WindowListener() { 
    232             public void windowClosed(WindowEvent e)  {} 
    233             public void windowOpened(WindowEvent e)  {}             
    234             public void windowIconified(WindowEvent e)  {}          
    235             public void windowDeiconified(WindowEvent e)  {}     
    236             public void windowActivated(WindowEvent e)  {}                              
    237             public void windowDeactivated(WindowEvent e)  {}          
    238             public void windowClosing(WindowEvent e)  {    
    239                 System.exit(0); 
    240             }            
    241         }); 
    242          
     287 
     288            JOptionPane.showMessageDialog(new JWindow(), "Unable to open " 
     289                    + cadSimulatorProperties.getProperty(CAD_PROPERTIES.CMS_XML_FILE.name), 
     290                    "Initialization Error", JOptionPane.WARNING_MESSAGE); 
     291        } 
     292 
    243293        theViewer.setVisible(true); 
    244294 
    245     }  
    246      
    247     /** 
    248      * Binds the Coordinator to an RMI port so that the SimulationManager 
    249      * can communicate with it, and so that the Coordinator can perform RMI 
    250      * callback method calls.  The port numbers and RMI designators are parsed from 
    251      * the properties file file. 
     295    } 
     296 
     297    /** 
     298     * Binds the Coordinator to an RMI port so that the SimulationManager can 
     299     * communicate with it, and so that the Coordinator can perform RMI callback 
     300     * method calls. The port numbers and RMI designators are parsed from the 
     301     * properties file file. 
    252302     * 
    253303     * @param theCoor A reference to the Coordinator object. 
    254      * @throws SimulationException if there are errors in binding the RMI to  
    255      * a port and name. 
    256      */ 
    257     private void startRegistry(Integer regPort) throws SimulationException { 
    258          
    259         try{ 
    260             LocateRegistry.createRegistry(regPort);                              
    261              
     304     * @throws SimulationException if there are errors in binding the RMI to a 
     305     * port and name. 
     306     */ 
     307    private void startRegistry(Integer regPort) throws SimulationException 
     308    { 
     309 
     310        try 
     311        { 
     312//            if (LocateRegistry.getRegistry(regPort) == null) 
     313//            { 
     314            LocateRegistry.createRegistry(regPort); 
    262315            String registryURL = "rmi://localhost:" + regPort + "/coordinator"; 
    263316            Naming.rebind(registryURL, theCoordinator); 
    264         } 
    265         catch (Exception e) {            
     317//            } 
     318        } catch (Exception e) 
     319        { 
    266320            throw new SimulationException(SimulationException.BINDING, e); 
    267321        } 
     
    269323 
    270324    /** 
    271      * Method returns a String represetnation of the current time. String format 
    272      * is HHMM  
     325     * Method returns a String representation of the current time. String format 
     326     * is HHMM 
    273327     * 
    274328     * @return String representation of the current time. 
    275329     */ 
    276     public static String getCADTime() { 
    277         String time = new String();      
     330    public static String getCADTime() 
     331    { 
     332        String time = new String(); 
    278333 
    279334        Calendar rightNow = Calendar.getInstance(); 
    280          
    281         if(rightNow.get(Calendar.HOUR_OF_DAY) < 10) 
     335 
     336        if (rightNow.get(Calendar.HOUR_OF_DAY) < 10) 
     337        { 
    282338            time += "0"; 
    283          
     339        } 
     340 
    284341        time += (String.valueOf(rightNow.get(Calendar.HOUR_OF_DAY))); 
    285          
    286         if(rightNow.get(Calendar.MINUTE) < 10) 
     342 
     343        if (rightNow.get(Calendar.MINUTE) < 10) 
     344        { 
    287345            time += "0"; 
    288          
    289         time += (String.valueOf(rightNow.get(Calendar.MINUTE)));         
    290                              
    291         return time;         
    292     }            
    293      
    294     /** 
    295      * Returns a string representation of the current date.  String format is: 
     346        } 
     347 
     348        time += (String.valueOf(rightNow.get(Calendar.MINUTE))); 
     349 
     350        return time; 
     351    } 
     352 
     353    /** 
     354     * Returns a string representation of the current date. String format is: 
    296355     * MMDDYY 
    297356     * 
    298357     * @return String format of the date. 
    299358     */ 
    300     public static String getCADDate() { 
     359    public static String getCADDate() 
     360    { 
    301361        String date = new String(); 
    302          
     362 
    303363        Calendar rightNow = Calendar.getInstance(); 
    304          
     364 
    305365        //Months are zero referenced 
    306         if(rightNow.get(Calendar.MONTH) + 1 < 10) 
     366        if (rightNow.get(Calendar.MONTH) + 1 < 10) 
     367        { 
    307368            date += "0"; 
    308          
    309         date += (String.valueOf(rightNow.get(Calendar.MONTH)+ 1)); 
    310          
    311         if(rightNow.get(Calendar.DAY_OF_MONTH) < 10) 
     369        } 
     370 
     371        date += (String.valueOf(rightNow.get(Calendar.MONTH) + 1)); 
     372 
     373        if (rightNow.get(Calendar.DAY_OF_MONTH) < 10) 
     374        { 
    312375            date += "0"; 
    313          
    314         date += (String.valueOf(rightNow.get(Calendar.DAY_OF_MONTH)));       
    315                              
    316         if(rightNow.get(Calendar.YEAR) % 1000 < 10) 
     376        } 
     377 
     378        date += (String.valueOf(rightNow.get(Calendar.DAY_OF_MONTH))); 
     379 
     380        if (rightNow.get(Calendar.YEAR) % 1000 < 10) 
     381        { 
    317382            date += "0"; 
    318          
    319         date += (String.valueOf(rightNow.get(Calendar.YEAR) % 1000));                                
    320                              
    321         return date;     
    322          
     383        } 
     384 
     385        date += (String.valueOf(rightNow.get(Calendar.YEAR) % 1000)); 
     386 
     387        return date; 
     388 
    323389    } 
    324          
    325     /** 
    326      * Main class.  Instantiate a CAD Simulator with the properties file  
     390 
     391    /** 
     392     * Main class. Instantiate a CAD Simulator with the properties file 
    327393     * specified on the command line or the default properties file 
    328      *  
     394     * 
    329395     * @param args Command line arguments. 
    330396     */ 
    331     public static void main(String[] args) { 
    332         if(System.getProperty("CONFIG_DIR") == null){ 
    333                 System.setProperty("CONFIG_DIR", "config"); 
    334         } 
    335         try { 
     397    public static void main(String[] args) 
     398    { 
     399        if (System.getProperty("CONFIG_DIR") == null) 
     400        { 
     401            System.setProperty("CONFIG_DIR", "config"); 
     402        } 
     403        try 
     404        { 
    336405            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 
    337            new CADSimulator(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + CONFIG_FILE_NAME); 
    338         } 
    339         catch (Exception e) { 
    340             cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Main",  
     406            String propFile = System.getProperty("CONFIG_DIR") 
     407                    + System.getProperty("file.separator") 
     408                    + CONFIG_FILE_NAME; 
     409            new CADSimulator(propFile); 
     410        } catch (Exception e) 
     411        { 
     412            cadSimLogger.logp(Level.SEVERE, "CADSimulator", "Main", 
    341413                    "Error initializing application.", e); 
    342              
    343             JOptionPane.showMessageDialog(new JWindow(), e.getMessage(),  
    344                     "Error - Program Exiting", JOptionPane.ERROR_MESSAGE);   
    345              
     414 
     415            JOptionPane.showMessageDialog(new JWindow(), e.getMessage(), 
     416                    "Error - Program Exiting", JOptionPane.ERROR_MESSAGE); 
     417 
    346418            System.exit(-1); 
    347419        } 
    348          
     420 
    349421    } 
    350 }  
     422} 
  • trunk/src/tmcsim/cadsimulator/Coordinator.java

    r35 r44  
    2828import tmcsim.cadsimulator.managers.ParamicsSimulationManager; 
    2929import tmcsim.cadsimulator.managers.SimulationControlManager; 
     30import tmcsim.cadsimulator.viewer.model.CADSimulatorModel; 
    3031import tmcsim.client.cadclientgui.CardfileReader; 
    3132import tmcsim.client.cadclientgui.ScriptHandler; 
     
    106107    private static CADData cadData; 
    107108    private static CardfileData cardfileData; 
     109    private CADSimulatorModel cadModel; 
    108110 
    109111    /** 
     
    113115     * @throws RemoteException 
    114116     */ 
    115     public Coordinator() throws RemoteException 
     117    public Coordinator(CADSimulatorModel model) throws RemoteException 
    116118    { 
    117119        super(); 
     120        cadModel = model; 
    118121        clientList = new LinkedList<CADClientInterface>(); 
    119122        cadData = new CADData(); 
     
    133136    { 
    134137        clientList.add(client); 
    135         CADSimulator.theViewer.connectClient(); 
     138        cadModel.connectClient(); 
    136139    } 
    137140 
     
    139142    { 
    140143        clientList.remove(client); 
    141         CADSimulator.theViewer.disconnectClient(); 
     144        cadModel.disconnectClient(); 
    142145    } 
    143146 
     
    145148    { 
    146149        managerInt = simManInt; 
    147         CADSimulator.theViewer.setSimManagerStatus(true); 
     150        cadModel.setSimManagerStatus(true); 
    148151    } 
    149152 
     
    151154    { 
    152155        managerInt = null; 
    153         CADSimulator.theViewer.setSimManagerStatus(false); 
     156        cadModel.setSimManagerStatus(false); 
    154157    } 
    155158 
     
    157160    { 
    158161 
    159         coorLogger.logp(Level.INFO, "Coordinator", "startSimulation", 
    160                 "entering startSimulation()"); 
    161162        if (!CADSimulator.theIncidentMgr.areIncidentsLoaded()) 
    162163        { 
    163164            throw new ScriptException(ScriptException.NO_SCRIPT_LOADED); 
    164         } else if (CADSimulator.theParamicsSimMgr.isConnected()) 
     165        } 
     166        else if (CADSimulator.theParamicsSimMgr.isConnected()) 
    165167        { 
    166168            Runnable startRun = new Runnable() 
     
    168170                public void run() 
    169171                { 
    170 //                    try 
    171 //                    { 
    172 //                        setScriptStatus(SCRIPT_STATUS.ATMS_SYNCHRONIZATION); 
    173 // 
    174 //                        long currentATMSTime = CADSimulator.theATMSMgr.getCurrentTime(); 
    175 //                        long sleepTime = ((60 * 1000) - (currentATMSTime % (60 * 1000))) % (30 * 1000); 
    176 // 
     172                    try 
     173                    { 
     174                        setScriptStatus(SCRIPT_STATUS.ATMS_SYNCHRONIZATION); 
     175 
     176                        /* I have NO idea why this is needed. Why does it get the time from the remote 
     177                         * ATMS server instead of just our system time? Why does it need to sleep? 
     178                         * Is some process happening on the ATMS side that we need to wait for? 
     179                         */ 
     180                        long currentATMSTime = CADSimulator.theATMSMgr.getCurrentTime(); 
     181                        /* Seems like it waits 0-30 seconds, depending on what the time is on 
     182                         * the ATMS server.  Does something happen every 30 seconds over there? 
     183                         * Was it trying to make the Paramics time the same? 
     184                         */ 
     185                        long sleepTime = ((60 * 1000) - (currentATMSTime % (60 * 1000))) % (30 * 1000); 
     186 
    177187//                        coorLogger.logp(Level.INFO, "Coordinator", "StartSimulation", 
    178188//                                "Sleeping for " + sleepTime / 1000 + " seconds."); 
    179 //                        Thread.sleep(sleepTime); 
    180 // 
    181 //                        //currentATMSTime += sleepTime; 
    182 //                        //ParamicsCommunicator.getInstance().serverTime.setTimeInMillis(currentATMSTime); 
    183 //                    } catch (Exception e) 
    184 //                    { 
    185 //                        setScriptStatus(SCRIPT_STATUS.SCRIPT_RUNNING); 
    186 // 
    187 //                        coorLogger.logp(Level.SEVERE, "Coordinator", "StartSimulation:run", 
    188 //                                "Unable to connect to ATMS server.", e); 
    189 //                    } finally 
    190 //                    { 
    191                         coorLogger.logp(Level.INFO, "Coordinator", "StartSimulation", 
    192                                 "Starting WITH paramics connected "); 
     189                        // not needed   Thread.sleep(sleepTime); 
     190 
     191                        //currentATMSTime += sleepTime; 
     192                        //ParamicsCommunicator.getInstance().serverTime.setTimeInMillis(currentATMSTime); 
     193                    } catch (Exception e) 
     194                    { 
     195                        setScriptStatus(SCRIPT_STATUS.SCRIPT_RUNNING); 
     196 
     197                        coorLogger.logp(Level.SEVERE, "Coordinator", "StartSimulation:run", 
     198                                "Unable to connect to ATMS server.", e); 
     199                    } finally 
     200                    { 
    193201                        CADSimulator.theSimulationCntrlMgr.startSimulation(); 
    194202                        CADSimulator.theParamicsSimMgr.startSimulation(); 
    195203                        CADSimulator.theSoundPlayer.setAudioEnabled(true); 
    196 //                    } 
     204                    } 
    197205                } 
    198206            }; 
     
    200208            Thread startThread = new Thread(startRun); 
    201209            startThread.start(); 
    202         } else // Paramics isn't connected so start without it 
    203         { 
    204             coorLogger.logp(Level.INFO, "Coordinator", "startSimulation", 
    205                 "starting without paramics connection. ..");             
     210        } 
     211        else 
     212        { 
    206213            CADSimulator.theSimulationCntrlMgr.startSimulation(); 
    207214            CADSimulator.theSoundPlayer.setAudioEnabled(true); 
    208215        } 
    209         coorLogger.logp(Level.INFO, "Coordinator", "StartSimulation:run", 
    210                 "Simulation has started."); 
    211216    } 
    212217 
     
    226231        CADSimulator.theSoundPlayer.deQueueAll(); 
    227232 
    228         CADSimulator.theViewer.setTime(0); 
     233        cadModel.setTime(0); 
    229234 
    230235        setScriptStatus(SCRIPT_STATUS.SCRIPT_STOPPED_NOT_STARTED); 
     
    262267            public void run() 
    263268            { 
    264                 CADSimulator.theViewer.setTime(newSimTime); 
     269                cadModel.setTime(newSimTime); 
    265270 
    266271                if (managerInt != null) 
     
    273278                        //Simulation Manager has disappeared 
    274279                        managerInt = null; 
    275                         CADSimulator.theViewer.setSimManagerStatus(false); 
     280                        cadModel.setSimManagerStatus(false); 
    276281 
    277282                        coorLogger.logp(Level.SEVERE, "Coordinator", "gotoSimulationTime:run", 
     
    299304            { 
    300305 
    301                 CADSimulator.theViewer.setScriptStatus(status); 
     306                cadModel.setScriptStatus(status); 
    302307 
    303308                if (managerInt != null) 
     
    310315                        //Simulation Manager has disappeared 
    311316                        managerInt = null; 
    312                         CADSimulator.theViewer.setSimManagerStatus(false); 
     317                        cadModel.setSimManagerStatus(false); 
    313318 
    314319                        coorLogger.logp(Level.SEVERE, "Coordinator", "setScriptStatus:run", 
     
    334339            public void run() 
    335340            { 
    336                 CADSimulator.theViewer.setParamicsStatus(status); 
     341                cadModel.setParamicsStatus(status); 
     342                // Is the update for network loaded event? 
     343                // Fixes defect where network ID is never displayed. 
     344                if (status == PARAMICS_STATUS.LOADED) 
     345                { 
     346                    try 
     347                    { 
     348                        // Then we need to tell the model it has a new network ID 
     349                        int currentNetwork = getParamicsNetworkLoaded(); 
     350                        cadModel.setParamicsNetworkLoaded("" + currentNetwork); 
     351                    } catch (RemoteException ex) 
     352                    { 
     353                        coorLogger.logp(Level.SEVERE, "Coordinator", "setParamicsStatus:run", 
     354                                "Unable to get current network loaded", ex); 
     355                    } 
     356                } 
    337357 
    338358                if (managerInt != null) 
     
    345365                        //Simulation Manager has disappeared 
    346366                        managerInt = null; 
    347                         CADSimulator.theViewer.setSimManagerStatus(false); 
     367                        cadModel.setSimManagerStatus(false); 
    348368 
    349369                        coorLogger.logp(Level.SEVERE, "Coordinator", "setParamicsStatus:run", 
     
    395415        { 
    396416            throw new ScriptException(ScriptException.SIM_NOT_STARTED); 
    397         } else if (!CADSimulator.theIncidentMgr.areIncidentsLoaded()) 
     417        } 
     418        else if (!CADSimulator.theIncidentMgr.areIncidentsLoaded()) 
    398419        { 
    399420            throw new ScriptException(ScriptException.NO_SCRIPT_LOADED); 
     
    422443                //Simulation Manager has disappeared 
    423444                managerInt = null; 
    424                 CADSimulator.theViewer.setSimManagerStatus(false); 
     445                cadModel.setSimManagerStatus(false); 
    425446 
    426447                coorLogger.logp(Level.SEVERE, "Coordinator", "deleteIncident", 
     
    456477                //Simulation Manager has disappeared 
    457478                managerInt = null; 
    458                 CADSimulator.theViewer.setSimManagerStatus(false); 
     479                cadModel.setSimManagerStatus(false); 
    459480 
    460481                coorLogger.logp(Level.SEVERE, "Coordinator", "addIncident", 
     
    507528            { 
    508529                return SCRIPT_STATUS.SCRIPT_RUNNING; 
    509             } else 
     530            } 
     531            else 
    510532            { 
    511533                for (Incident inc : CADSimulator.theIncidentMgr.getIncidentList()) 
     
    620642                public void run() 
    621643                { 
    622                     CADSimulator.theViewer.setTime(currentSimTime); 
     644                    cadModel.setTime(currentSimTime); 
    623645 
    624646                    //send an update every 30 seconds 
     
    637659                            //Simulation Manager has disappeared 
    638660                            managerInt = null; 
    639                             CADSimulator.theViewer.setSimManagerStatus(false); 
     661                            cadModel.setSimManagerStatus(false); 
    640662 
    641663                            coorLogger.logp(Level.SEVERE, "Coordinator", "tick:run", 
     
    680702                        //Simulation Manager has disappeared 
    681703                        managerInt = null; 
    682                         CADSimulator.theViewer.setSimManagerStatus(false); 
     704                        cadModel.setSimManagerStatus(false); 
    683705 
    684706                        coorLogger.logp(Level.SEVERE, "Coordinator", "updateIncidents", 
     
    736758                        //Simulation Manager has disappeared 
    737759                        managerInt = null; 
    738                         CADSimulator.theViewer.setSimManagerStatus(false); 
     760                        cadModel.setSimManagerStatus(false); 
    739761 
    740762                        coorLogger.logp(Level.SEVERE, "Coordinator", "updateIncidents:run", 
     
    861883        { 
    862884            return cadData.tableForAssignedIncidents(); 
    863         } else if (tag.equals(TABLE.UNIT_STATUS)) 
     885        } 
     886        else if (tag.equals(TABLE.UNIT_STATUS)) 
    864887        { 
    865888            return cadData.tableForUnitStatus(); 
    866         } else if (tag.equals(TABLE.PENDING_INCIDENTS)) 
     889        } 
     890        else if (tag.equals(TABLE.PENDING_INCIDENTS)) 
    867891        { 
    868892            return cadData.tableForPendingIncidents(); 
    869         } else if (tag.equals(TABLE.INCIDENT_EDITOR)) 
     893        } 
     894        else if (tag.equals(TABLE.INCIDENT_EDITOR)) 
    870895        { 
    871896            return cadData.tableForIncidentEditor(); 
    872         } else 
     897        } 
     898        else 
    873899        { 
    874900            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataTable"); 
     
    932958        { 
    933959            return cadData.getIncident(incidentId).getLogNum(); 
    934         } else if (tag.equals(INC_VAL.MASTER_INC)) 
     960        } 
     961        else if (tag.equals(INC_VAL.MASTER_INC)) 
    935962        { 
    936963            return cadData.getIncident(incidentId).getMasterInc(); 
    937         } else if (tag.equals(INC_VAL.OAU)) 
     964        } 
     965        else if (tag.equals(INC_VAL.OAU)) 
    938966        { 
    939967            return cadData.getIncident(incidentId).getOau(); 
    940         } else if (tag.equals(INC_VAL.P)) 
     968        } 
     969        else if (tag.equals(INC_VAL.P)) 
    941970        { 
    942971            return cadData.getIncident(incidentId).getP(); 
    943         } else if (tag.equals(INC_VAL.DESCRIPTION)) 
     972        } 
     973        else if (tag.equals(INC_VAL.DESCRIPTION)) 
    944974        { 
    945975            return cadData.getIncident(incidentId).getDescription(); 
    946         } else if (tag.equals(INC_VAL.RP)) 
     976        } 
     977        else if (tag.equals(INC_VAL.RP)) 
    947978        { 
    948979            return cadData.getIncident(incidentId).getRp(); 
    949         } else if (tag.equals(INC_VAL.RP_TYPE)) 
     980        } 
     981        else if (tag.equals(INC_VAL.RP_TYPE)) 
    950982        { 
    951983            return cadData.getIncident(incidentId).getRpType(); 
    952         } else if (tag.equals(INC_VAL.ALI)) 
     984        } 
     985        else if (tag.equals(INC_VAL.ALI)) 
    953986        { 
    954987            return cadData.getIncident(incidentId).getAli(); 
    955         } else if (tag.equals(INC_VAL.MEDIA)) 
     988        } 
     989        else if (tag.equals(INC_VAL.MEDIA)) 
    956990        { 
    957991            return cadData.getIncident(incidentId).getMedia(); 
    958         } else 
     992        } 
     993        else 
    959994        { 
    960995            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncVal"); 
     
    9741009        { 
    9751010            cadData.getIncident(incidentId).setOau(value); 
    976         } else if (tag.equals(INC_VAL.P)) 
     1011        } 
     1012        else if (tag.equals(INC_VAL.P)) 
    9771013        { 
    9781014            cadData.getIncident(incidentId).setP(value); 
    979         } else if (tag.equals(INC_VAL.DESCRIPTION)) 
     1015        } 
     1016        else if (tag.equals(INC_VAL.DESCRIPTION)) 
    9801017        { 
    9811018            cadData.getIncident(incidentId).setDescription(value); 
    982         } else if (tag.equals(INC_VAL.RP)) 
     1019        } 
     1020        else if (tag.equals(INC_VAL.RP)) 
    9831021        { 
    9841022            cadData.getIncident(incidentId).setRp(value); 
    985         } else if (tag.equals(INC_VAL.RP_TYPE)) 
     1023        } 
     1024        else if (tag.equals(INC_VAL.RP_TYPE)) 
    9861025        { 
    9871026            cadData.getIncident(incidentId).setRpType(value); 
    988         } else if (tag.equals(INC_VAL.ALI)) 
     1027        } 
     1028        else if (tag.equals(INC_VAL.ALI)) 
    9891029        { 
    9901030            cadData.getIncident(incidentId).setAli(value); 
    991         } else if (tag.equals(INC_VAL.MEDIA)) 
     1031        } 
     1032        else if (tag.equals(INC_VAL.MEDIA)) 
    9921033        { 
    9931034            cadData.getIncident(incidentId).setMedia(value); 
    994         } else 
     1035        } 
     1036        else 
    9951037        { 
    9961038            throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncVal"); 
     
    10101052        { 
    10111053            return cadData.getIncident(incidentId).getIncidentLocation().getAddress(); 
    1012         } else if (tag.equals(INC_LOC.LOC)) 
     1054        } 
     1055        else if (tag.equals(INC_LOC.LOC)) 
    10131056        { 
    10141057            return cadData.getIncident(incidentId).getIncidentLocation().getLoc(); 
    1015         } else if (tag.equals(INC_LOC.CITY)) 
     1058        } 
     1059        else if (tag.equals(INC_LOC.CITY)) 
    10161060        { 
    10171061            return cadData.getIncident(incidentId).getIncidentLocation().getCity(); 
    1018         } else if (tag.equals(INC_LOC.COUNTY)) 
     1062        } 
     1063        else if (tag.equals(INC_LOC.COUNTY)) 
    10191064        { 
    10201065            return cadData.getIncident(incidentId).getIncidentLocation().getCounty(); 
    1021         } else if (tag.equals(INC_LOC.STATE)) 
     1066        } 
     1067        else if (tag.equals(INC_LOC.STATE)) 
    10221068        { 
    10231069            return cadData.getIncident(incidentId).getIncidentLocation().getState(); 
    1024         } else if (tag.equals(INC_LOC.ZIP)) 
     1070        } 
     1071        else if (tag.equals(INC_LOC.ZIP)) 
    10251072        { 
    10261073            return cadData.getIncident(incidentId).getIncidentLocation().getZip(); 
    1027         } else if (tag.equals(INC_LOC.BEAT)) 
     1074        } 
     1075        else if (tag.equals(INC_LOC.BEAT)) 
    10281076        { 
    10291077            return cadData.getIncident(incidentId).getIncidentLocation().getBeat(); 
    1030         } else if (tag.equals(INC_LOC.AREA)) 
     1078        } 
     1079        else if (tag.equals(INC_LOC.AREA)) 
    10311080        { 
    10321081            return cadData.getIncident(incidentId).getIncidentLocation().getArea(); 
    1033         } else if (tag.equals(INC_LOC.SECTOR)) 
     1082        } 
     1083        else if (tag.equals(INC_LOC.SECTOR)) 
    10341084        { 
    10351085            return cadData.getIncident(incidentId).getIncidentLocation().getSector(); 
    1036         } else if (tag.equals(INC_LOC.SECTOR_CODE)) 
     1086        } 
     1087        else if (tag.equals(INC_LOC.SECTOR_CODE)) 
    10371088        { 
    10381089            return cadData.getIncident(incidentId).getIncidentLocation().getSectorCode(); 
    1039         } else if (tag.equals(INC_LOC.DIVISION)) 
     1090        } 
     1091        else if (tag.equals(INC_LOC.DIVISION)) 
    10401092        { 
    10411093            return cadData.getIncident(incidentId).getIncidentLocation().getDivision(); 
    1042         } else if (tag.equals(INC_LOC.APT)) 
     1094        } 
     1095        else if (tag.equals(INC_LOC.APT)) 
    10431096        { 
    10441097            return cadData.getIncident(incidentId).getIncidentLocation().getApt(); 
    1045         } else if (tag.equals(INC_LOC.BUILDING)) 
     1098        } 
     1099        else if (tag.equals(INC_LOC.BUILDING)) 
    10461100        { 
    10471101            return cadData.getIncident(incidentId).getIncidentLocation().getBuilding(); 
    1048         } else if (tag.equals(INC_LOC.CROSS_ST)) 
     1102        } 
     1103        else if (tag.equals(INC_LOC.CROSS_ST)) 
    10491104        { 
    10501105            return cadData.getIncident(incidentId).getIncidentLocation().getCrossSt(); 
    1051         } else if (tag.equals(INC_LOC.LAW)) 
     1106        } 
     1107        else if (tag.equals(INC_LOC.LAW)) 
    10521108        { 
    10531109            return cadData.getIncident(incidentId).getIncidentLocation().getLaw(); 
    1054         } else if (tag.equals(INC_LOC.FIRE)) 
     1110        } 
     1111        else if (tag.equals(INC_LOC.FIRE)) 
    10551112        { 
    10561113            return cadData.getIncident(incidentId).getIncidentLocation().getFire(); 
    1057         } else if (tag.equals(INC_LOC.EMS)) 
     1114        } 
     1115        else if (tag.equals(INC_LOC.EMS)) 
    10581116        { 
    10591117            return cadData.getIncident(incidentId).getIncidentLocation().getEms(); 
    1060         } else 
     1118        } 
     1119        else 
    10611120        { 
    10621121            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncLoc"); 
     
    10761135        { 
    10771136            cadData.getIncident(incidentId).getIncidentLocation().setAddress(value); 
    1078         } else if (tag.equals(INC_LOC.LOC)) 
     1137        } 
     1138        else if (tag.equals(INC_LOC.LOC)) 
    10791139        { 
    10801140            cadData.getIncident(incidentId).getIncidentLocation().setLoc(value); 
    1081         } else if (tag.equals(INC_LOC.CITY)) 
     1141        } 
     1142        else if (tag.equals(INC_LOC.CITY)) 
    10821143        { 
    10831144            cadData.getIncident(incidentId).getIncidentLocation().setCity(value); 
    1084         } else if (tag.equals(INC_LOC.COUNTY)) 
     1145        } 
     1146        else if (tag.equals(INC_LOC.COUNTY)) 
    10851147        { 
    10861148            cadData.getIncident(incidentId).getIncidentLocation().setCounty(value); 
    1087         } else if (tag.equals(INC_LOC.STATE)) 
     1149        } 
     1150        else if (tag.equals(INC_LOC.STATE)) 
    10881151        { 
    10891152            cadData.getIncident(incidentId).getIncidentLocation().setState(value); 
    1090         } else if (tag.equals(INC_LOC.ZIP)) 
     1153        } 
     1154        else if (tag.equals(INC_LOC.ZIP)) 
    10911155        { 
    10921156            cadData.getIncident(incidentId).getIncidentLocation().setZip(value); 
    1093         } else if (tag.equals(INC_LOC.BEAT)) 
     1157        } 
     1158        else if (tag.equals(INC_LOC.BEAT)) 
    10941159        { 
    10951160            cadData.getIncident(incidentId).getIncidentLocation().setBeat(value); 
    1096         } else if (tag.equals(INC_LOC.AREA)) 
     1161        } 
     1162        else if (tag.equals(INC_LOC.AREA)) 
    10971163        { 
    10981164            cadData.getIncident(incidentId).getIncidentLocation().setArea(value); 
    1099         } else if (tag.equals(INC_LOC.SECTOR)) 
     1165        } 
     1166        else if (tag.equals(INC_LOC.SECTOR)) 
    11001167        { 
    11011168            cadData.getIncident(incidentId).getIncidentLocation().setSector(value); 
    1102         } else if (tag.equals(INC_LOC.SECTOR_CODE)) 
     1169        } 
     1170        else if (tag.equals(INC_LOC.SECTOR_CODE)) 
    11031171        { 
    11041172            cadData.getIncident(incidentId).getIncidentLocation().setSectorCode(value); 
    1105         } else if (tag.equals(INC_LOC.DIVISION)) 
     1173        } 
     1174        else if (tag.equals(INC_LOC.DIVISION)) 
    11061175        { 
    11071176            cadData.getIncident(incidentId).getIncidentLocation().setDivision(value); 
    1108         } else if (tag.equals(INC_LOC.APT)) 
     1177        } 
     1178        else if (tag.equals(INC_LOC.APT)) 
    11091179        { 
    11101180            cadData.getIncident(incidentId).getIncidentLocation().setApt(value); 
    1111         } else if (tag.equals(INC_LOC.BUILDING)) 
     1181        } 
     1182        else if (tag.equals(INC_LOC.BUILDING)) 
    11121183        { 
    11131184            cadData.getIncident(incidentId).getIncidentLocation().setBuilding(value); 
    1114         } else if (tag.equals(INC_LOC.CROSS_ST)) 
     1185        } 
     1186        else if (tag.equals(INC_LOC.CROSS_ST)) 
    11151187        { 
    11161188            cadData.getIncident(incidentId).getIncidentLocation().setCrossSt(value); 
    1117         } else if (tag.equals(INC_LOC.LAW)) 
     1189        } 
     1190        else if (tag.equals(INC_LOC.LAW)) 
    11181191        { 
    11191192            cadData.getIncident(incidentId).getIncidentLocation().setLaw(value); 
    1120         } else if (tag.equals(INC_LOC.FIRE)) 
     1193        } 
     1194        else if (tag.equals(INC_LOC.FIRE)) 
    11211195        { 
    11221196            cadData.getIncident(incidentId).getIncidentLocation().setFire(value); 
    1123         } else if (tag.equals(INC_LOC.EMS)) 
     1197        } 
     1198        else if (tag.equals(INC_LOC.EMS)) 
    11241199        { 
    11251200            cadData.getIncident(incidentId).getIncidentLocation().setEms(value); 
    1126         } else 
     1201        } 
     1202        else 
    11271203        { 
    11281204            throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncLoc"); 
     
    11421218        { 
    11431219            return cadData.getIncident(incidentId).getIncidentCaller().getCallerType(); 
    1144         } else if (tag.equals(INC_CALLER.NAME)) 
     1220        } 
     1221        else if (tag.equals(INC_CALLER.NAME)) 
    11451222        { 
    11461223            return cadData.getIncident(incidentId).getIncidentCaller().getCallerName(); 
    1147         } else if (tag.equals(INC_CALLER.PHONE)) 
     1224        } 
     1225        else if (tag.equals(INC_CALLER.PHONE)) 
    11481226        { 
    11491227            return cadData.getIncident(incidentId).getIncidentCaller().getPhone(); 
    1150         } else if (tag.equals(INC_CALLER.EXT)) 
     1228        } 
     1229        else if (tag.equals(INC_CALLER.EXT)) 
    11511230        { 
    11521231            return cadData.getIncident(incidentId).getIncidentCaller().getExt(); 
    1153         } else 
     1232        } 
     1233        else 
    11541234        { 
    11551235            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncCaller"); 
     
    11691249        { 
    11701250            cadData.getIncident(incidentId).getIncidentCaller().setCallerType(value); 
    1171         } else if (tag.equals(INC_CALLER.NAME)) 
     1251        } 
     1252        else if (tag.equals(INC_CALLER.NAME)) 
    11721253        { 
    11731254            cadData.getIncident(incidentId).getIncidentCaller().setCallerName(value); 
    1174         } else if (tag.equals(INC_CALLER.PHONE)) 
     1255        } 
     1256        else if (tag.equals(INC_CALLER.PHONE)) 
    11751257        { 
    11761258            cadData.getIncident(incidentId).getIncidentCaller().setPhone(value); 
    1177         } else if (tag.equals(INC_CALLER.EXT)) 
     1259        } 
     1260        else if (tag.equals(INC_CALLER.EXT)) 
    11781261        { 
    11791262            cadData.getIncident(incidentId).getIncidentCaller().setExt(value); 
    1180         } else 
     1263        } 
     1264        else 
    11811265        { 
    11821266            throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncCaller"); 
     
    11961280        { 
    11971281            return cadData.getIncident(incidentId).getProblem().getProblem(); 
    1198         } else if (tag.equals(INC_PROBLEM.CODE)) 
     1282        } 
     1283        else if (tag.equals(INC_PROBLEM.CODE)) 
    11991284        { 
    12001285            return cadData.getIncident(incidentId).getProblem().getProblemCode(); 
    1201         } else if (tag.equals(INC_PROBLEM.PRIORITY)) 
     1286        } 
     1287        else if (tag.equals(INC_PROBLEM.PRIORITY)) 
    12021288        { 
    12031289            return cadData.getIncident(incidentId).getProblem().getPriority(); 
    1204         } else 
     1290        } 
     1291        else 
    12051292        { 
    12061293            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncProblem"); 
     
    12201307        { 
    12211308            cadData.getIncident(incidentId).getProblem().setProblem(value); 
    1222         } else if (tag.equals(INC_PROBLEM.CODE)) 
     1309        } 
     1310        else if (tag.equals(INC_PROBLEM.CODE)) 
    12231311        { 
    12241312            cadData.getIncident(incidentId).getProblem().setProblemCode(value); 
    1225         } else if (tag.equals(INC_PROBLEM.PRIORITY)) 
     1313        } 
     1314        else if (tag.equals(INC_PROBLEM.PRIORITY)) 
    12261315        { 
    12271316            cadData.getIncident(incidentId).getProblem().setPriority(value); 
    1228         } else 
     1317        } 
     1318        else 
    12291319        { 
    12301320            throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncProblem"); 
     
    12441334        { 
    12451335            return cadData.getIncident(incidentId).getGenInfo().getJurisdiction(); 
    1246         } else if (tag.equals(INC_GEN_INFO.ALARM)) 
     1336        } 
     1337        else if (tag.equals(INC_GEN_INFO.ALARM)) 
    12471338        { 
    12481339            return cadData.getIncident(incidentId).getGenInfo().getAlarm(); 
    1249         } else if (tag.equals(INC_GEN_INFO.AGY)) 
     1340        } 
     1341        else if (tag.equals(INC_GEN_INFO.AGY)) 
    12501342        { 
    12511343            return cadData.getIncident(incidentId).getGenInfo().getAgy(); 
    1252         } else 
     1344        } 
     1345        else 
    12531346        { 
    12541347            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncGenInfo"); 
     
    12681361        { 
    12691362            cadData.getIncident(incidentId).getGenInfo().setJurisdiction(value); 
    1270         } else if (tag.equals(INC_GEN_INFO.ALARM)) 
     1363        } 
     1364        else if (tag.equals(INC_GEN_INFO.ALARM)) 
    12711365        { 
    12721366            cadData.getIncident(incidentId).getGenInfo().setAlarm(value); 
    1273         } else if (tag.equals(INC_GEN_INFO.AGY)) 
     1367        } 
     1368        else if (tag.equals(INC_GEN_INFO.AGY)) 
    12741369        { 
    12751370            cadData.getIncident(incidentId).getGenInfo().setAgy(value); 
    1276         } else 
     1371        } 
     1372        else 
    12771373        { 
    12781374            throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncGenInfo"); 
     
    12921388        { 
    12931389            return cadData.getIncident(incidentId).getResponse().getPlan(); 
    1294         } else if (tag.equals(INC_RESP.AREA)) 
     1390        } 
     1391        else if (tag.equals(INC_RESP.AREA)) 
    12951392        { 
    12961393            return cadData.getIncident(incidentId).getResponse().getArea(); 
    1297         } else 
     1394        } 
     1395        else 
    12981396        { 
    12991397            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncResp"); 
     
    13131411        { 
    13141412            cadData.getIncident(incidentId).getResponse().setPlan(value); 
    1315         } else if (tag.equals(INC_RESP.AREA)) 
     1413        } 
     1414        else if (tag.equals(INC_RESP.AREA)) 
    13161415        { 
    13171416            cadData.getIncident(incidentId).getResponse().setArea(value); 
    1318         } else 
     1417        } 
     1418        else 
    13191419        { 
    13201420            throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncResp"); 
     
    13341434        { 
    13351435            return cadData.getIncident(incidentId).getAdditionalInfo().getType(); 
    1336         } else if (tag.equals(INC_ADD_INFO.TYPE_CODE)) 
     1436        } 
     1437        else if (tag.equals(INC_ADD_INFO.TYPE_CODE)) 
    13371438        { 
    13381439            return cadData.getIncident(incidentId).getAdditionalInfo().getTypeCode(); 
    1339         } else if (tag.equals(INC_ADD_INFO.MACHINE)) 
     1440        } 
     1441        else if (tag.equals(INC_ADD_INFO.MACHINE)) 
    13401442        { 
    13411443            return cadData.getIncident(incidentId).getAdditionalInfo().getMachine(); 
    1342         } else if (tag.equals(INC_ADD_INFO.CALL_STATUS)) 
     1444        } 
     1445        else if (tag.equals(INC_ADD_INFO.CALL_STATUS)) 
    13431446        { 
    13441447            return cadData.getIncident(incidentId).getAdditionalInfo().getCallStatus(); 
    1345         } else if (tag.equals(INC_ADD_INFO.CALL_TAKER_EXT)) 
     1448        } 
     1449        else if (tag.equals(INC_ADD_INFO.CALL_TAKER_EXT)) 
    13461450        { 
    13471451            return cadData.getIncident(incidentId).getAdditionalInfo().getCallTakerExt(); 
    1348         } else if (tag.equals(INC_ADD_INFO.ALARM_LEVEL)) 
     1452        } 
     1453        else if (tag.equals(INC_ADD_INFO.ALARM_LEVEL)) 
    13491454        { 
    13501455            return cadData.getIncident(incidentId).getAdditionalInfo().getAlarmLevel(); 
    1351         } else if (tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA)) 
     1456        } 
     1457        else if (tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA)) 
    13521458        { 
    13531459            return cadData.getIncident(incidentId).getAdditionalInfo().getRotationProviderArea(); 
    1354         } else if (tag.equals(INC_ADD_INFO.COMMENT)) 
     1460        } 
     1461        else if (tag.equals(INC_ADD_INFO.COMMENT)) 
    13551462        { 
    13561463            return cadData.getIncident(incidentId).getAdditionalInfo().getComment(); 
    1357         } else 
     1464        } 
     1465        else 
    13581466        { 
    13591467            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncAddInfo"); 
     
    13731481        { 
    13741482            cadData.getIncident(incidentId).getAdditionalInfo().setType(value); 
    1375         } else if (tag.equals(INC_ADD_INFO.TYPE_CODE)) 
     1483        } 
     1484        else if (tag.equals(INC_ADD_INFO.TYPE_CODE)) 
    13761485        { 
    13771486            cadData.getIncident(incidentId).getAdditionalInfo().setTypeCode(value); 
    1378         } else if (tag.equals(INC_ADD_INFO.MACHINE)) 
     1487        } 
     1488        else if (tag.equals(INC_ADD_INFO.MACHINE)) 
    13791489        { 
    13801490            cadData.getIncident(incidentId).getAdditionalInfo().setMachine(value); 
    1381         } else if (tag.equals(INC_ADD_INFO.CALL_STATUS)) 
     1491        } 
     1492        else if (tag.equals(INC_ADD_INFO.CALL_STATUS)) 
    13821493        { 
    13831494            cadData.getIncident(incidentId).getAdditionalInfo().setCallStatus(value); 
    1384         } else if (tag.equals(INC_ADD_INFO.CALL_TAKER_EXT)) 
     1495        } 
     1496        else if (tag.equals(INC_ADD_INFO.CALL_TAKER_EXT)) 
    13851497        { 
    13861498            cadData.getIncident(incidentId).getAdditionalInfo().setCallTakerExt(value); 
    1387         } else if (tag.equals(INC_ADD_INFO.ALARM_LEVEL)) 
     1499        } 
     1500        else if (tag.equals(INC_ADD_INFO.ALARM_LEVEL)) 
    13881501        { 
    13891502            cadData.getIncident(incidentId).getAdditionalInfo().setAlarmLevel(value); 
    1390         } else if (tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA)) 
     1503        } 
     1504        else if (tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA)) 
    13911505        { 
    13921506            cadData.getIncident(incidentId).getAdditionalInfo().setRotationProviderArea(value); 
    1393         } else if (tag.equals(INC_ADD_INFO.COMMENT)) 
     1507        } 
     1508        else if (tag.equals(INC_ADD_INFO.COMMENT)) 
    13941509        { 
    13951510            cadData.getIncident(incidentId).getAdditionalInfo().setComment(value); 
    1396         } else 
     1511        } 
     1512        else 
    13971513        { 
    13981514            throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncAddInfo"); 
     
    14121528        { 
    14131529            return cadData.getIncident(incidentId).getActivities().getVehicle(); 
    1414         } else if (tag.equals(INC_ACTIVITIES.ACTIVITY)) 
     1530        } 
     1531        else if (tag.equals(INC_ACTIVITIES.ACTIVITY)) 
    14151532        { 
    14161533            return cadData.getIncident(incidentId).getActivities().getActivity(); 
    1417         } else if (tag.equals(INC_ACTIVITIES.LOCATION)) 
     1534        } 
     1535        else if (tag.equals(INC_ACTIVITIES.LOCATION)) 
    14181536        { 
    14191537            return cadData.getIncident(incidentId).getActivities().getLocation(); 
    1420         } else if (tag.equals(INC_ACTIVITIES.COMMENT)) 
     1538        } 
     1539        else if (tag.equals(INC_ACTIVITIES.COMMENT)) 
    14211540        { 
    14221541            return cadData.getIncident(incidentId).getActivities().getComment(); 
    1423         } else if (tag.equals(INC_ACTIVITIES.DISP)) 
     1542        } 
     1543        else if (tag.equals(INC_ACTIVITIES.DISP)) 
    14241544        { 
    14251545            return cadData.getIncident(incidentId).getActivities().getDisp(); 
    1426         } else 
     1546        } 
     1547        else 
    14271548        { 
    14281549            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncActivities"); 
     
    14421563        { 
    14431564            cadData.getIncident(incidentId).getActivities().setVehicle(value); 
    1444         } else if (tag.equals(INC_ACTIVITIES.ACTIVITY)) 
     1565        } 
     1566        else if (tag.equals(INC_ACTIVITIES.ACTIVITY)) 
    14451567        { 
    14461568            cadData.getIncident(incidentId).getActivities().setActivity(value); 
    1447         } else if (tag.equals(INC_ACTIVITIES.LOCATION)) 
     1569        } 
     1570        else if (tag.equals(INC_ACTIVITIES.LOCATION)) 
    14481571        { 
    14491572            cadData.getIncident(incidentId).getActivities().setLocation(value); 
    1450         } else if (tag.equals(INC_ACTIVITIES.COMMENT)) 
     1573        } 
     1574        else if (tag.equals(INC_ACTIVITIES.COMMENT)) 
    14511575        { 
    14521576            cadData.getIncident(incidentId).getActivities().setComment(value); 
    1453         } else if (tag.equals(INC_ACTIVITIES.DISP)) 
     1577        } 
     1578        else if (tag.equals(INC_ACTIVITIES.DISP)) 
    14541579        { 
    14551580            cadData.getIncident(incidentId).getActivities().setDisp(value); 
    1456         } else 
     1581        } 
     1582        else 
    14571583        { 
    14581584            throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncActivities"); 
     
    14721598        { 
    14731599            return cadData.getIncident(incidentId).getCallBacks().getInitial(); 
    1474         } else if (tag.equals(INC_CALLBACK.COMMENT)) 
     1600        } 
     1601        else if (tag.equals(INC_CALLBACK.COMMENT)) 
    14751602        { 
    14761603            return cadData.getIncident(incidentId).getCallBacks().getComment(); 
    1477         } else 
     1604        } 
     1605        else 
    14781606        { 
    14791607            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncCallBack"); 
     
    14931621        { 
    14941622            return cadData.getIncident(incidentId).getEditLog().getEdit(); 
    1495         } else if (tag.equals(INC_EDIT_LOG.REASON)) 
     1623        } 
     1624        else if (tag.equals(INC_EDIT_LOG.REASON)) 
    14961625        { 
    14971626            return cadData.getIncident(incidentId).getEditLog().getReason(); 
    1498         } else if (tag.equals(INC_EDIT_LOG.CHANGE_BY)) 
     1627        } 
     1628        else if (tag.equals(INC_EDIT_LOG.CHANGE_BY)) 
    14991629        { 
    15001630            return cadData.getIncident(incidentId).getEditLog().getChangeBy(); 
    1501         } else if (tag.equals(INC_EDIT_LOG.TERMINAL)) 
     1631        } 
     1632        else if (tag.equals(INC_EDIT_LOG.TERMINAL)) 
    15021633        { 
    15031634            return cadData.getIncident(incidentId).getEditLog().getTerminal(); 
    1504         } else 
     1635        } 
     1636        else 
    15051637        { 
    15061638            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncEditLog"); 
     
    15201652        { 
    15211653            return cadData.getIncident(incidentId).getInfo().getCallInit(); 
    1522         } else if (tag.equals(INC_INFO.CALL_TAKEN)) 
     1654        } 
     1655        else if (tag.equals(INC_INFO.CALL_TAKEN)) 
    15231656        { 
    15241657            return cadData.getIncident(incidentId).getInfo().getCallTaken(); 
    1525         } else if (tag.equals(INC_INFO.TIME_IN_Q)) 
     1658        } 
     1659        else if (tag.equals(INC_INFO.TIME_IN_Q)) 
    15261660        { 
    15271661            return cadData.getIncident(incidentId).getInfo().getTimeInQ(); 
    1528         } else if (tag.equals(INC_INFO.LAST_UPDATED)) 
     1662        } 
     1663        else if (tag.equals(INC_INFO.LAST_UPDATED)) 
    15291664        { 
    15301665            return cadData.getIncident(incidentId).getInfo().getLastUpdated(); 
    1531         } else 
     1666        } 
     1667        else 
    15321668        { 
    15331669            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncInfo"); 
     
    15561692        { 
    15571693            return cardfileData.getCoastalDivisionUnitList(); 
    1558         } else if (tag.equals(CARDFILE.POLICE_SHERIFF_CORONER)) 
     1694        } 
     1695        else if (tag.equals(CARDFILE.POLICE_SHERIFF_CORONER)) 
    15591696        { 
    15601697            return cardfileData.getPoliceSheriffCoronerList(); 
    1561         } else if (tag.equals(CARDFILE.COURTS)) 
     1698        } 
     1699        else if (tag.equals(CARDFILE.COURTS)) 
    15621700        { 
    15631701            return cardfileData.getCourtsList(); 
    1564         } else if (tag.equals(CARDFILE.PUBLIC_TRANSPORTATION)) 
     1702        } 
     1703        else if (tag.equals(CARDFILE.PUBLIC_TRANSPORTATION)) 
    15651704        { 
    15661705            return cardfileData.getPublicTransportationList(); 
    1567         } else if (tag.equals(CARDFILE.GG_OTHER)) 
     1706        } 
     1707        else if (tag.equals(CARDFILE.GG_OTHER)) 
    15681708        { 
    15691709            return cardfileData.getGgOtherList(); 
    1570         } else if (tag.equals(CARDFILE.MY_MISC)) 
     1710        } 
     1711        else if (tag.equals(CARDFILE.MY_MISC)) 
    15711712        { 
    15721713            return cardfileData.getMyMiscList(); 
    1573         } else if (tag.equals(CARDFILE.SL_MISC)) 
     1714        } 
     1715        else if (tag.equals(CARDFILE.SL_MISC)) 
    15741716        { 
    15751717            return cardfileData.getSlMiscList(); 
    1576         } else if (tag.equals(CARDFILE.VT_MISC)) 
     1718        } 
     1719        else if (tag.equals(CARDFILE.VT_MISC)) 
    15771720        { 
    15781721            return cardfileData.getVlMiscList(); 
    1579         } else if (tag.equals(CARDFILE.CHP_OFFICES)) 
     1722        } 
     1723        else if (tag.equals(CARDFILE.CHP_OFFICES)) 
    15801724        { 
    15811725            return cardfileData.getChpOfficesList(); 
    1582         } else if (tag.equals(CARDFILE.STATE_AGENCIES_FACILITIES)) 
     1726        } 
     1727        else if (tag.equals(CARDFILE.STATE_AGENCIES_FACILITIES)) 
    15831728        { 
    15841729            return cardfileData.getStateAgenciesFacilitiesList(); 
    1585         } else if (tag.equals(CARDFILE.GOVERNMENT_OFFICIALS)) 
     1730        } 
     1731        else if (tag.equals(CARDFILE.GOVERNMENT_OFFICIALS)) 
    15861732        { 
    15871733            return cardfileData.getGovernmentOfficialsList(); 
    1588         } else if (tag.equals(CARDFILE.FEDERAL_AGENCIES)) 
     1734        } 
     1735        else if (tag.equals(CARDFILE.FEDERAL_AGENCIES)) 
    15891736        { 
    15901737            return cardfileData.getFederalAgenciesList(); 
    1591         } else if (tag.equals(CARDFILE.RANCHES_LIVESTOCK)) 
     1738        } 
     1739        else if (tag.equals(CARDFILE.RANCHES_LIVESTOCK)) 
    15921740        { 
    15931741            return cardfileData.getRanchesLivestockList(); 
    1594         } else if (tag.equals(CARDFILE.FIRE_EMS)) 
     1742        } 
     1743        else if (tag.equals(CARDFILE.FIRE_EMS)) 
    15951744        { 
    15961745            return cardfileData.getFireEmsList(); 
    1597         } else if (tag.equals(CARDFILE.JAILS)) 
     1746        } 
     1747        else if (tag.equals(CARDFILE.JAILS)) 
    15981748        { 
    15991749            return cardfileData.getJailsList(); 
    1600         } else if (tag.equals(CARDFILE.HOSPITALS_MED_CENTERS)) 
     1750        } 
     1751        else if (tag.equals(CARDFILE.HOSPITALS_MED_CENTERS)) 
    16011752        { 
    16021753            return cardfileData.getHospitalsMedCentersList(); 
    1603         } else if (tag.equals(CARDFILE.TOW_COMPANIES)) 
     1754        } 
     1755        else if (tag.equals(CARDFILE.TOW_COMPANIES)) 
    16041756        { 
    16051757            return cardfileData.getTowCompaniesList(); 
    1606         } else if (tag.equals(CARDFILE.CALTRANS)) 
     1758        } 
     1759        else if (tag.equals(CARDFILE.CALTRANS)) 
    16071760        { 
    16081761            return cardfileData.getCalTransList(); 
    1609         } else if (tag.equals(CARDFILE.COUNTY_ROADS)) 
     1762        } 
     1763        else if (tag.equals(CARDFILE.COUNTY_ROADS)) 
    16101764        { 
    16111765            return cardfileData.getCountyRoadsList(); 
    1612         } else if (tag.equals(CARDFILE.UTILITIES)) 
     1766        } 
     1767        else if (tag.equals(CARDFILE.UTILITIES)) 
    16131768        { 
    16141769            return cardfileData.getUtilitiesList(); 
    1615         } else if (tag.equals(CARDFILE.ANIMAL_CONTROL)) 
     1770        } 
     1771        else if (tag.equals(CARDFILE.ANIMAL_CONTROL)) 
    16161772        { 
    16171773            return cardfileData.getAnimalControlList(); 
    1618         } else if (tag.equals(CARDFILE.AIRPORTS)) 
     1774        } 
     1775        else if (tag.equals(CARDFILE.AIRPORTS)) 
    16191776        { 
    16201777            return cardfileData.getAirportsList(); 
    1621         } else if (tag.equals(CARDFILE.CREDIT_CARDS)) 
     1778        } 
     1779        else if (tag.equals(CARDFILE.CREDIT_CARDS)) 
    16221780        { 
    16231781            return cardfileData.getCreditCardsList(); 
    1624         } else if (tag.equals(CARDFILE.GG_CRISIS_SHELTERS)) 
     1782        } 
     1783        else if (tag.equals(CARDFILE.GG_CRISIS_SHELTERS)) 
    16251784        { 
    16261785            return cardfileData.getGgCrisisSheltersList(); 
    1627         } else if (tag.equals(CARDFILE.RANGES)) 
     1786        } 
     1787        else if (tag.equals(CARDFILE.RANGES)) 
    16281788        { 
    16291789            return cardfileData.getRangesList(); 
    1630         } else if (tag.equals(CARDFILE.HOTLINES)) 
     1790        } 
     1791        else if (tag.equals(CARDFILE.HOTLINES)) 
    16311792        { 
    16321793            return cardfileData.getHotlinesList(); 
    1633         } else if (tag.equals(CARDFILE.HWY_PATROLS_OOS)) 
     1794        } 
     1795        else if (tag.equals(CARDFILE.HWY_PATROLS_OOS)) 
    16341796        { 
    16351797            return cardfileData.getHwyPatrolsOosList(); 
    1636         } else if (tag.equals(CARDFILE.PARKS_RECREATION)) 
     1798        } 
     1799        else if (tag.equals(CARDFILE.PARKS_RECREATION)) 
    16371800        { 
    16381801            return cardfileData.getParksRecreationList(); 
    1639         } else if (tag.equals(CARDFILE.SHELTERS)) 
     1802        } 
     1803        else if (tag.equals(CARDFILE.SHELTERS)) 
    16401804        { 
    16411805            return cardfileData.getSheltersList(); 
    1642         } else if (tag.equals(CARDFILE.SL_COUNTY_SERVICES)) 
     1806        } 
     1807        else if (tag.equals(CARDFILE.SL_COUNTY_SERVICES)) 
    16431808        { 
    16441809            return cardfileData.getSlCountyServicesList(); 
    1645         } else if (tag.equals(CARDFILE.SL_RESOURCES)) 
     1810        } 
     1811        else if (tag.equals(CARDFILE.SL_RESOURCES)) 
    16461812        { 
    16471813            return cardfileData.getSlResourcesList(); 
    1648         } else if (tag.equals(CARDFILE.TRUCK_TIRE_REPAIR)) 
     1814        } 
     1815        else if (tag.equals(CARDFILE.TRUCK_TIRE_REPAIR)) 
    16491816        { 
    16501817            return cardfileData.getTruckTireRepairList(); 
    1651         } else if (tag.equals(CARDFILE.MCC_EMPLOYEES)) 
     1818        } 
     1819        else if (tag.equals(CARDFILE.MCC_EMPLOYEES)) 
    16521820        { 
    16531821            return cardfileData.getMccEmployeesList(); 
    1654         } else if (tag.equals(CARDFILE.GATE_ACCESS_CODES)) 
     1822        } 
     1823        else if (tag.equals(CARDFILE.GATE_ACCESS_CODES)) 
    16551824        { 
    16561825            return cardfileData.getGateAccessCodesList(); 
    1657         } else if (tag.equals(CARDFILE.VT_CALL_SIGNS)) 
     1826        } 
     1827        else if (tag.equals(CARDFILE.VT_CALL_SIGNS)) 
    16581828        { 
    16591829            return cardfileData.getVtCallSignsList(); 
    1660         } else if (tag.equals(CARDFILE.SLCC_EMPLOYEES)) 
     1830        } 
     1831        else if (tag.equals(CARDFILE.SLCC_EMPLOYEES)) 
    16611832        { 
    16621833            return cardfileData.getSlccEmployeesList(); 
    1663         } else 
     1834        } 
     1835        else 
    16641836        { 
    16651837            throw new RemoteException("Wrong Enum sent into Coordinator.getCardfileList"); 
     
    16791851        { 
    16801852            selectedList = cardfileData.getCoastalDivisionUnitList(); 
    1681         } else if (log.listTitle.equals(CARDFILE.POLICE_SHERIFF_CORONER.tag)) 
     1853        } 
     1854        else if (log.listTitle.equals(CARDFILE.POLICE_SHERIFF_CORONER.tag)) 
    16821855        { 
    16831856            selectedList = cardfileData.getPoliceSheriffCoronerList(); 
    1684         } else if (log.listTitle.equals(CARDFILE.COURTS.tag)) 
     1857        } 
     1858        else if (log.listTitle.equals(CARDFILE.COURTS.tag)) 
    16851859        { 
    16861860            selectedList = cardfileData.getCourtsList(); 
    1687         } else if (log.listTitle.equals(CARDFILE.PUBLIC_TRANSPORTATION.tag)) 
     1861        } 
     1862        else if (log.listTitle.equals(CARDFILE.PUBLIC_TRANSPORTATION.tag)) 
    16881863        { 
    16891864            selectedList = cardfileData.getPublicTransportationList(); 
    1690         } else if (log.listTitle.equals(CARDFILE.GG_OTHER.tag)) 
     1865        } 
     1866        else if (log.listTitle.equals(CARDFILE.GG_OTHER.tag)) 
    16911867        { 
    16921868            selectedList = cardfileData.getGgOtherList(); 
    1693         } else if (log.listTitle.equals(CARDFILE.MY_MISC.tag)) 
     1869        } 
     1870        else if (log.listTitle.equals(CARDFILE.MY_MISC.tag)) 
    16941871        { 
    16951872            selectedList = cardfileData.getMyMiscList(); 
    1696         } else if (log.listTitle.equals(CARDFILE.SL_MISC.tag)) 
     1873        } 
     1874        else if (log.listTitle.equals(CARDFILE.SL_MISC.tag)) 
    16971875        { 
    16981876            selectedList = cardfileData.getSlMiscList(); 
    1699         } else if (log.listTitle.equals(CARDFILE.VT_MISC.tag)) 
     1877        } 
     1878        else if (log.listTitle.equals(CARDFILE.VT_MISC.tag)) 
    17001879        { 
    17011880            selectedList = cardfileData.getVlMiscList(); 
    1702         } else if (log.listTitle.equals(CARDFILE.CHP_OFFICES.tag)) 
     1881        } 
     1882        else if (log.listTitle.equals(CARDFILE.CHP_OFFICES.tag)) 
    17031883        { 
    17041884            selectedList = cardfileData.getChpOfficesList(); 
    1705         } else if (log.listTitle.equals(CARDFILE.STATE_AGENCIES_FACILITIES.tag)) 
     1885        } 
     1886        else if (log.listTitle.equals(CARDFILE.STATE_AGENCIES_FACILITIES.tag)) 
    17061887        { 
    17071888            selectedList = cardfileData.getStateAgenciesFacilitiesList(); 
    1708         } else if (log.listTitle.equals(CARDFILE.GOVERNMENT_OFFICIALS.tag)) 
     1889        } 
     1890        else if (log.listTitle.equals(CARDFILE.GOVERNMENT_OFFICIALS.tag)) 
    17091891        { 
    17101892            selectedList = cardfileData.getGovernmentOfficialsList(); 
    1711         } else if (log.listTitle.equals(CARDFILE.FEDERAL_AGENCIES.tag)) 
     1893        } 
     1894        else if (log.listTitle.equals(CARDFILE.FEDERAL_AGENCIES.tag)) 
    17121895        { 
    17131896            selectedList = cardfileData.getFederalAgenciesList(); 
    1714         } else if (log.listTitle.equals(CARDFILE.RANCHES_LIVESTOCK.tag)) 
     1897        } 
     1898        else if (log.listTitle.equals(CARDFILE.RANCHES_LIVESTOCK.tag)) 
    17151899        { 
    17161900            selectedList = cardfileData.getRanchesLivestockList(); 
    1717         } else if (log.listTitle.equals(CARDFILE.FIRE_EMS.tag)) 
     1901        } 
     1902        else if (log.listTitle.equals(CARDFILE.FIRE_EMS.tag)) 
    17181903        { 
    17191904            selectedList = cardfileData.getFireEmsList(); 
    1720         } else if (log.listTitle.equals(CARDFILE.JAILS.tag)) 
     1905        } 
     1906        else if (log.listTitle.equals(CARDFILE.JAILS.tag)) 
    17211907        { 
    17221908            selectedList = cardfileData.getJailsList(); 
    1723         } else if (log.listTitle.equals(CARDFILE.HOSPITALS_MED_CENTERS.tag)) 
     1909        } 
     1910        else if (log.listTitle.equals(CARDFILE.HOSPITALS_MED_CENTERS.tag)) 
    17241911        { 
    17251912            selectedList = cardfileData.getHospitalsMedCentersList(); 
    1726         } else if (log.listTitle.equals(CARDFILE.TOW_COMPANIES.tag)) 
     1913        } 
     1914        else if (log.listTitle.equals(CARDFILE.TOW_COMPANIES.tag)) 
    17271915        { 
    17281916            selectedList = cardfileData.getTowCompaniesList(); 
    1729         } else if (log.listTitle.equals(CARDFILE.CALTRANS.tag)) 
     1917        } 
     1918        else if (log.listTitle.equals(CARDFILE.CALTRANS.tag)) 
    17301919        { 
    17311920            selectedList = cardfileData.getCalTransList(); 
    1732         } else if (log.listTitle.equals(CARDFILE.COUNTY_ROADS.tag)) 
     1921        } 
     1922        else if (log.listTitle.equals(CARDFILE.COUNTY_ROADS.tag)) 
    17331923        { 
    17341924            selectedList = cardfileData.getCountyRoadsList(); 
    1735         } else if (log.listTitle.equals(CARDFILE.UTILITIES.tag)) 
     1925        } 
     1926        else if (log.listTitle.equals(CARDFILE.UTILITIES.tag)) 
    17361927        { 
    17371928            selectedList = cardfileData.getUtilitiesList(); 
    1738         } else if (log.listTitle.equals(CARDFILE.ANIMAL_CONTROL.tag)) 
     1929        } 
     1930        else if (log.listTitle.equals(CARDFILE.ANIMAL_CONTROL.tag)) 
    17391931        { 
    17401932            selectedList = cardfileData.getAnimalControlList(); 
    1741         } else if (log.listTitle.equals(CARDFILE.AIRPORTS.tag)) 
     1933        } 
     1934        else if (log.listTitle.equals(CARDFILE.AIRPORTS.tag)) 
    17421935        { 
    17431936            selectedList = cardfileData.getAirportsList(); 
    1744         } else if (log.listTitle.equals(CARDFILE.CREDIT_CARDS.tag)) 
     1937        } 
     1938        else if (log.listTitle.equals(CARDFILE.CREDIT_CARDS.tag)) 
    17451939        { 
    17461940            selectedList = cardfileData.getCreditCardsList(); 
    1747         } else if (log.listTitle.equals(CARDFILE.GG_CRISIS_SHELTERS.tag)) 
     1941        } 
     1942        else if (log.listTitle.equals(CARDFILE.GG_CRISIS_SHELTERS.tag)) 
    17481943        { 
    17491944            selectedList = cardfileData.getGgCrisisSheltersList(); 
    1750         } else if (log.listTitle.equals(CARDFILE.RANGES.tag)) 
     1945        } 
     1946        else if (log.listTitle.equals(CARDFILE.RANGES.tag)) 
    17511947        { 
    17521948            selectedList = cardfileData.getRangesList(); 
    1753         } else if (log.listTitle.equals(CARDFILE.HOTLINES.tag)) 
     1949        } 
     1950        else if (log.listTitle.equals(CARDFILE.HOTLINES.tag)) 
    17541951        { 
    17551952            selectedList = cardfileData.getHotlinesList(); 
    1756         } else if (log.listTitle.equals(CARDFILE.HWY_PATROLS_OOS.tag)) 
     1953        } 
     1954        else if (log.listTitle.equals(CARDFILE.HWY_PATROLS_OOS.tag)) 
    17571955        { 
    17581956            selectedList = cardfileData.getHwyPatrolsOosList(); 
    1759         } else if (log.listTitle.equals(CARDFILE.PARKS_RECREATION.tag)) 
     1957        } 
     1958        else if (log.listTitle.equals(CARDFILE.PARKS_RECREATION.tag)) 
    17601959        { 
    17611960            selectedList = cardfileData.getParksRecreationList(); 
    1762         } else if (log.listTitle.equals(CARDFILE.SHELTERS.tag)) 
     1961        } 
     1962        else if (log.listTitle.equals(CARDFILE.SHELTERS.tag)) 
    17631963        { 
    17641964            selectedList = cardfileData.getSheltersList(); 
    1765         } else if (log.listTitle.equals(CARDFILE.SL_COUNTY_SERVICES.tag)) 
     1965        } 
     1966        else if (log.listTitle.equals(CARDFILE.SL_COUNTY_SERVICES.tag)) 
    17661967        { 
    17671968            selectedList = cardfileData.getSlCountyServicesList(); 
    1768         } else if (log.listTitle.equals(CARDFILE.SL_RESOURCES.tag)) 
     1969        } 
     1970        else if (log.listTitle.equals(CARDFILE.SL_RESOURCES.tag)) 
    17691971        { 
    17701972            selectedList = cardfileData.getSlResourcesList(); 
    1771         } else if (log.listTitle.equals(CARDFILE.TRUCK_TIRE_REPAIR.tag)) 
     1973        } 
     1974        else if (log.listTitle.equals(CARDFILE.TRUCK_TIRE_REPAIR.tag)) 
    17721975        { 
    17731976            selectedList = cardfileData.getTruckTireRepairList(); 
    1774         } else if (log.listTitle.equals(CARDFILE.MCC_EMPLOYEES.tag)) 
     1977        } 
     1978        else if (log.listTitle.equals(CARDFILE.MCC_EMPLOYEES.tag)) 
    17751979        { 
    17761980            selectedList = cardfileData.getMccEmployeesList(); 
    1777         } else if (log.listTitle.equals(CARDFILE.GATE_ACCESS_CODES.tag)) 
     1981        } 
     1982        else if (log.listTitle.equals(CARDFILE.GATE_ACCESS_CODES.tag)) 
    17781983        { 
    17791984            selectedList = cardfileData.getGateAccessCodesList(); 
    1780         } else if (log.listTitle.equals(CARDFILE.VT_CALL_SIGNS.tag)) 
     1985        } 
     1986        else if (log.listTitle.equals(CARDFILE.VT_CALL_SIGNS.tag)) 
    17811987        { 
    17821988            selectedList = cardfileData.getVtCallSignsList(); 
    1783         } else if (log.listTitle.equals(CARDFILE.SLCC_EMPLOYEES.tag)) 
     1989        } 
     1990        else if (log.listTitle.equals(CARDFILE.SLCC_EMPLOYEES.tag)) 
    17841991        { 
    17851992            selectedList = cardfileData.getSlccEmployeesList(); 
    1786         } else 
     1993        } 
     1994        else 
    17871995        { 
    17881996            throw new RemoteException("Wrong Enum sent into Coordinator.editCardfileDataObject"); 
     
    17942002            cfdo.setName(log.newValue); 
    17952003            selectedList.resort(cardfileData.getCardfileDataIndex(selectedList, log.id)); 
    1796         } else if (cfdo != null && log.command.equals(EditCommand.ADDRESS)) 
     2004        } 
     2005        else if (cfdo != null && log.command.equals(EditCommand.ADDRESS)) 
    17972006        { 
    17982007            cfdo.setAddress(log.newValue); 
    1799         } else if (cfdo != null && log.command.equals(EditCommand.CITY)) 
     2008        } 
     2009        else if (cfdo != null && log.command.equals(EditCommand.CITY)) 
    18002010        { 
    18012011            cfdo.setCity(log.newValue); 
    1802         } else if (cfdo != null && log.command.equals(EditCommand.STATE)) 
     2012        } 
     2013        else if (cfdo != null && log.command.equals(EditCommand.STATE)) 
    18032014        { 
    18042015            cfdo.setState(log.newValue); 
    1805         } else if (cfdo != null && log.command.equals(EditCommand.ZIP)) 
     2016        } 
     2017        else if (cfdo != null && log.command.equals(EditCommand.ZIP)) 
    18062018        { 
    18072019            cfdo.setZip(log.newValue); 
    1808         } else if (cfdo != null && log.command.equals(EditCommand.PHONE1)) 
     2020        } 
     2021        else if (cfdo != null && log.command.equals(EditCommand.PHONE1)) 
    18092022        { 
    18102023            cfdo.setPhone1(log.newValue); 
    1811         } else if (cfdo != null && log.command.equals(EditCommand.PHONE2)) 
     2024        } 
     2025        else if (cfdo != null && log.command.equals(EditCommand.PHONE2)) 
    18122026        { 
    18132027            cfdo.setPhone2(log.newValue); 
    1814         } else if (cfdo != null && log.command.equals(EditCommand.FAX)) 
     2028        } 
     2029        else if (cfdo != null && log.command.equals(EditCommand.FAX)) 
    18152030        { 
    18162031            cfdo.setFax(log.newValue); 
    1817         } else if (log.command.equals(EditCommand.OBJECT_DELETE)) 
     2032        } 
     2033        else if (log.command.equals(EditCommand.OBJECT_DELETE)) 
    18182034        { 
    18192035            selectedList.removeDataObject(cardfileData.getCardfileDataIndex(selectedList, log.id)); 
    1820         } else if (log.command.equals(EditCommand.OBJECT_ADD)) 
     2036        } 
     2037        else if (log.command.equals(EditCommand.OBJECT_ADD)) 
    18212038        { 
    18222039            selectedList.addDataObject(log.newCardfileObject); 
    1823         } else if (log.command.equals(EditCommand.TABLE_ADD)) 
     2040        } 
     2041        else if (log.command.equals(EditCommand.TABLE_ADD)) 
    18242042        { 
    18252043            if (cfdo != null) 
     
    18272045                cfdo.addComment(log.tableFields); 
    18282046            } 
    1829         } else if (log.command.equals(EditCommand.TABLE_DELETE)) 
     2047        } 
     2048        else if (log.command.equals(EditCommand.TABLE_DELETE)) 
    18302049        { 
    18312050            if (cfdo != null) 
     
    18332052                cfdo.removeComment(log.timeStamp); 
    18342053            } 
    1835         } else 
     2054        } 
     2055        else 
    18362056        { 
    18372057        } 
     
    18722092        { 
    18732093            return cadData.getUnit(unitNum).getMasterInc(); 
    1874         } else if (tag.equals(UNIT_TAGS.STATUS)) 
     2094        } 
     2095        else if (tag.equals(UNIT_TAGS.STATUS)) 
    18752096        { 
    18762097            return cadData.getUnit(unitNum).getStatus(); 
    1877         } else if (tag.equals(UNIT_TAGS.OOS)) 
     2098        } 
     2099        else if (tag.equals(UNIT_TAGS.OOS)) 
    18782100        { 
    18792101            return cadData.getUnit(unitNum).getOos(); 
    1880         } else if (tag.equals(UNIT_TAGS.TYPE)) 
     2102        } 
     2103        else if (tag.equals(UNIT_TAGS.TYPE)) 
    18812104        { 
    18822105            return cadData.getUnit(unitNum).getType(); 
    1883         } else if (tag.equals(UNIT_TAGS.CURR_LOC)) 
     2106        } 
     2107        else if (tag.equals(UNIT_TAGS.CURR_LOC)) 
    18842108        { 
    18852109            return cadData.getUnit(unitNum).getCurrentLocation(); 
    1886         } else if (tag.equals(UNIT_TAGS.DESTINATION)) 
     2110        } 
     2111        else if (tag.equals(UNIT_TAGS.DESTINATION)) 
    18872112        { 
    18882113            return cadData.getUnit(unitNum).getDestination(); 
    1889         } else if (tag.equals(UNIT_TAGS.MISC_INFO)) 
     2114        } 
     2115        else if (tag.equals(UNIT_TAGS.MISC_INFO)) 
    18902116        { 
    18912117            return cadData.getUnit(unitNum).getMisc(); 
    1892         } else if (tag.equals(UNIT_TAGS.STACK)) 
     2118        } 
     2119        else if (tag.equals(UNIT_TAGS.STACK)) 
    18932120        { 
    18942121            return cadData.getUnit(unitNum).getStack(); 
    1895         } else if (tag.equals(UNIT_TAGS.AREA)) 
     2122        } 
     2123        else if (tag.equals(UNIT_TAGS.AREA)) 
    18962124        { 
    18972125            return cadData.getUnit(unitNum).getArea(); 
    1898         } else if (tag.equals(UNIT_TAGS.OFFICER)) 
     2126        } 
     2127        else if (tag.equals(UNIT_TAGS.OFFICER)) 
    18992128        { 
    19002129            return cadData.getUnit(unitNum).getOfficer(); 
    1901         } else if (tag.equals(UNIT_TAGS.BADGE_NUM)) 
     2130        } 
     2131        else if (tag.equals(UNIT_TAGS.BADGE_NUM)) 
    19022132        { 
    19032133            return cadData.getUnit(unitNum).getBadge(); 
    1904         } else if (tag.equals(UNIT_TAGS.TIMER)) 
     2134        } 
     2135        else if (tag.equals(UNIT_TAGS.TIMER)) 
    19052136        { 
    19062137            return cadData.getUnit(unitNum).getTimerInString(); 
    1907         } else if (tag.equals(UNIT_TAGS.OFFICE)) 
     2138        } 
     2139        else if (tag.equals(UNIT_TAGS.OFFICE)) 
    19082140        { 
    19092141            return cadData.getUnit(unitNum).getOffice(); 
    1910         } else if (tag.equals(UNIT_TAGS.P)) 
     2142        } 
     2143        else if (tag.equals(UNIT_TAGS.P)) 
    19112144        { 
    19122145            return cadData.getUnit(unitNum).getP(); 
    1913         } else if (tag.equals(UNIT_TAGS.AGY)) 
     2146        } 
     2147        else if (tag.equals(UNIT_TAGS.AGY)) 
    19142148        { 
    19152149            return cadData.getUnit(unitNum).getAgy(); 
    1916         } else if (tag.equals(UNIT_TAGS.ALIAS)) 
     2150        } 
     2151        else if (tag.equals(UNIT_TAGS.ALIAS)) 
    19172152        { 
    19182153            return cadData.getUnit(unitNum).getAlias(); 
    1919         } else 
     2154        } 
     2155        else 
    19202156        { 
    19212157            throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataUnitValue"); 
     
    19362172        { 
    19372173            cadData.getUnit(unitNum).setMasterInc((String) value); 
    1938         } else if (tag.equals(UNIT_TAGS.STATUS)) 
     2174        } 
     2175        else if (tag.equals(UNIT_TAGS.STATUS)) 
    19392176        { 
    19402177            cadData.getUnit(unitNum).setStatus((String) value); 
    1941         } else if (tag.equals(UNIT_TAGS.OOS)) 
     2178        } 
     2179        else if (tag.equals(UNIT_TAGS.OOS)) 
    19422180        { 
    19432181            cadData.getUnit(unitNum).setOos((String) value); 
    1944         } else if (tag.equals(UNIT_TAGS.TYPE)) 
     2182        } 
     2183        else if (tag.equals(UNIT_TAGS.TYPE)) 
    19452184        { 
    19462185            cadData.getUnit(unitNum).setType((String) value); 
    1947         } else if (tag.equals(UNIT_TAGS.CURR_LOC)) 
     2186        } 
     2187        else if (tag.equals(UNIT_TAGS.CURR_LOC)) 
    19482188        { 
    19492189            cadData.getUnit(unitNum).setCurrentLocation((String) value); 
    1950         } else if (tag.equals(UNIT_TAGS.DESTINATION)) 
     2190        } 
     2191        else if (tag.equals(UNIT_TAGS.DESTINATION)) 
    19512192        { 
    19522193            cadData.getUnit(unitNum).setDestination((String) value); 
    1953         } else if (tag.equals(UNIT_TAGS.MISC_INFO)) 
     2194        } 
     2195        else if (tag.equals(UNIT_TAGS.MISC_INFO)) 
    19542196        { 
    19552197            cadData.getUnit(unitNum).setMisc((String) value); 
    1956         } else if (tag.equals(UNIT_TAGS.STACK)) 
     2198        } 
     2199        else if (tag.equals(UNIT_TAGS.STACK)) 
    19572200        { 
    19582201            cadData.getUnit(unitNum).setStack((String) value); 
    1959         } else if (tag.equals(UNIT_TAGS.AREA)) 
     2202        } 
     2203        else if (tag.equals(UNIT_TAGS.AREA)) 
    19602204        { 
    19612205            cadData.getUnit(unitNum).setArea((String) value); 
    1962         } else if (tag.equals(UNIT_TAGS.OFFICER)) 
     2206        } 
     2207        else if (tag.equals(UNIT_TAGS.OFFICER)) 
    19632208        { 
    19642209            cadData.getUnit(unitNum).setOfficer((String) value); 
    1965         } else if (tag.equals(UNIT_TAGS.BADGE_NUM)) 
     2210        } 
     2211        else if (tag.equals(UNIT_TAGS.BADGE_NUM)) 
    19662212        { 
    19672213            cadData.getUnit(unitNum).setBadge((String) value); 
    1968         } else if (tag.equals(UNIT_TAGS.UNIT_STATUS)) 
     2214        } 
     2215        else if (tag.equals(UNIT_TAGS.UNIT_STATUS)) 
    19692216        { 
    19702217            cadData.getUnit(unitNum).setUnitStatus((UnitStatusEnums) value); 
    1971         } else if (tag.equals(UNIT_TAGS.OFFICE)) 
     2218        } 
     2219        else if (tag.equals(UNIT_TAGS.OFFICE)) 
    19722220        { 
    19732221            cadData.getUnit(unitNum).setOffice((String) value); 
    1974         } else if (tag.equals(UNIT_TAGS.P)) 
     2222        } 
     2223        else if (tag.equals(UNIT_TAGS.P)) 
    19752224        { 
    19762225            cadData.getUnit(unitNum).setP((String) value); 
    1977         } else if (tag.equals(UNIT_TAGS.AGY)) 
     2226        } 
     2227        else if (tag.equals(UNIT_TAGS.AGY)) 
    19782228        { 
    19792229            cadData.getUnit(unitNum).setAgy((String) value); 
    1980         } else if (tag.equals(UNIT_TAGS.ALIAS)) 
     2230        } 
     2231        else if (tag.equals(UNIT_TAGS.ALIAS)) 
    19812232        { 
    19822233            cadData.getUnit(unitNum).setAlias((String) value); 
    1983         } else 
     2234        } 
     2235        else 
    19842236        { 
    19852237            throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataUnitValue"); 
     
    20952347            { 
    20962348                cadData.unitAssignedToIncident(unit.beat, incidentNumber, unit.isPrimary); 
    2097             } else if (unit.statusType.equals("1097")) 
     2349            } 
     2350            else if (unit.statusType.equals("1097")) 
    20982351            { 
    20992352                cadData.unitArrivedAtIncidentScene(unit.beat, incidentNumber, unit.isPrimary); 
    2100             } else if (unit.statusType.equals("1098")) 
     2353            } 
     2354            else if (unit.statusType.equals("1098")) 
    21012355            { 
    21022356                cadData.unitAvailable(unit.beat); 
  • trunk/src/tmcsim/cadsimulator/managers/MediaManager.java

    r2 r44  
    1919import tmcsim.cadsimulator.videocontrol.DVDStatusUpdate; 
    2020import tmcsim.cadsimulator.videocontrol.DVDTitleUpdate; 
    21 import tmcsim.cadsimulator.viewer.CADSimulatorViewer; 
     21import tmcsim.cadsimulator.viewer.model.CADSimulatorModel; 
    2222import tmcsim.common.CCTVDirections; 
    2323import tmcsim.common.CCTVInfo; 
     
    7373    private StillImagesDB theImage_DB = null; 
    7474     
    75     /** Reference to the CADSimulatorViewer. */ 
    76     private CADSimulatorViewer theViewer; 
     75    /** Reference to the CADSimulatorModel. */ 
     76    private CADSimulatorModel theModel; 
    7777 
    7878    /** Properties object for the Media portion of the CAD. */ 
     
    9090     */ 
    9191    public MediaManager(String propertiesFile, ATMSManager theATMSManager,  
    92             CADSimulatorViewer viewer) { 
     92            CADSimulatorModel model) { 
    9393        theDVD_DB   = new DVDPlayerDB();         
    9494        theImage_DB = new StillImagesDB(); 
    9595         
    96         theViewer = viewer; 
     96        theModel = model; 
    9797 
    9898        try { 
     
    166166                        ((DVDStatusUpdate)arg).exception); 
    167167            } 
    168             theViewer.updateDVDStatus((DVDStatusUpdate)arg); 
     168            theModel.updateDVDStatus((DVDStatusUpdate)arg); 
    169169        } 
    170170        else if(arg instanceof DVDTitleUpdate) { 
    171             theViewer.updateDVDTitle((DVDTitleUpdate)arg); 
     171            theModel.updateDVDTitle((DVDTitleUpdate)arg); 
    172172        } 
    173173    } 
  • trunk/src/tmcsim/cadsimulator/managers/ParamicsSimulationManager.java

    r20 r44  
    66import java.util.logging.Level; 
    77import java.util.logging.Logger; 
    8  
    98import tmcsim.cadmodels.CMSInfo; 
    109import tmcsim.cadsimulator.Coordinator; 
     
    1312import tmcsim.cadsimulator.paramicscontrol.ParamicsIncidentWriter; 
    1413import tmcsim.cadsimulator.paramicscontrol.ParamicsStatusReader; 
     14import tmcsim.common.CADEnums.PARAMICS_STATUS; 
    1515import tmcsim.common.SimulationException; 
    1616import tmcsim.common.XMLIncident; 
    17 import tmcsim.common.CADEnums.PARAMICS_STATUS; 
    1817 
    1918/** 
     
    2221 * Upon construction all ParamicsReaders and ParamicsWriters are initialized 
    2322 * with data parsed from the Properties file. When a connection is established 
    24  * the ParamicsStatusReader is registered to read Paramics Status updates.   
    25  * These updates are received through the updateParamicsStatus() method, which  
    26  * notifies the Coordinator of the new status.  The loadParamicsNetwork() must  
    27  * be called to register the ParamicsIncidentWriter which will write the 
    28  * information to cause Paramics to begin loading a traffic network.  When the 
     23 * the ParamicsStatusReader is registered to read Paramics Status updates. These 
     24 * updates are received through the updateParamicsStatus() method, which 
     25 * notifies the Coordinator of the new status. The loadParamicsNetwork() must be 
     26 * called to register the ParamicsIncidentWriter which will write the 
     27 * information to cause Paramics to begin loading a traffic network. When the 
    2928 * status becomes LOADED, the ParamicsCameraStatusReader is registered and 
    30  * begins reading.  All camera speed updates are received through the 
    31  * updateCameraInfo() method.  The startSimulation(), resetSimulation(), and  
    32  * sendIncidentUpdate() methods are used to control the flow of Incident  
    33  * update information to Paramics.  The updateIncident() and updateDiversion()  
    34  * methods are used to update the information that is sent to Paramics. 
    35  *   
    36  *       
     29 * begins reading. All camera speed updates are received through the 
     30 * updateCameraInfo() method. The startSimulation(), resetSimulation(), and 
     31 * sendIncidentUpdate() methods are used to control the flow of Incident update 
     32 * information to Paramics. The updateIncident() and updateDiversion() methods 
     33 * are used to update the information that is sent to Paramics. 
     34 * 
     35 * 
    3736 * @see PARAMICS_STATUS 
    3837 * @author Matthew Cechini 
    3938 * @version 
    4039 */ 
    41 public class ParamicsSimulationManager { 
    42  
    43     /**  Error logger.  */ 
     40public class ParamicsSimulationManager 
     41{ 
     42 
     43    /** 
     44     * Error logger. 
     45     */ 
    4446    private static Logger paramLogger = Logger.getLogger("tmcsim.cadsimulator.paramicscontrol"); 
    45      
     47 
    4648    /** 
    4749     * Enumeration containing property names for Properties parsing. 
     50     * 
    4851     * @author Matthew Cechini 
    4952     */ 
    50     private static enum PROPERTIES { 
    51         PARAMICS_HOST        ("ParamicsCommHost"), 
    52         PARAMICS_PORT        ("ParamicsCommPort"), 
    53         INCIDENT_UPDATE_INT  ("IncidentUpdateInterval"), 
    54         INCIDENT_UPDATE_FILE ("IncidentUpdateFile"), 
    55         PARAMICS_STATUS_INT  ("ParamicsStatusInterval"), 
    56         PARAMICS_STATUS_FILE ("ParamicsStatusFile"), 
    57         CAMERA_STATUS_INT    ("CameraStatusInterval"), 
    58         CAMERA_STATUS_FILE   ("CameraStatusFile"); 
    59          
     53    private static enum PROPERTIES 
     54    { 
     55 
     56        PARAMICS_HOST("ParamicsCommHost"), 
     57        PARAMICS_PORT("ParamicsCommPort"), 
     58        INCIDENT_UPDATE_INT("IncidentUpdateInterval"), 
     59        INCIDENT_UPDATE_FILE("IncidentUpdateFile"), 
     60        PARAMICS_STATUS_INT("ParamicsStatusInterval"), 
     61        PARAMICS_STATUS_FILE("ParamicsStatusFile"), 
     62        CAMERA_STATUS_INT("CameraStatusInterval"), 
     63        CAMERA_STATUS_FILE("CameraStatusFile"); 
    6064        String name; 
    61          
    62         private PROPERTIES(String n) { 
     65 
     66        private PROPERTIES(String n) 
     67        { 
    6368            name = n; 
    6469        } 
    6570    }; 
    66      
    67     /** ParamicsCommunicator Object used for communication. */ 
     71    /** 
     72     * ParamicsCommunicator Object used for communication. 
     73     */ 
    6874    private ParamicsCommunicator theCommunicator; 
    69  
    70     /** Reference to the Coordinator Object. */ 
     75    /** 
     76     * Reference to the Coordinator Object. 
     77     */ 
    7178    private Coordinator theCoordinator; 
    72  
    73     /** Reference to the MediaManager Object. */ 
     79    /** 
     80     * Reference to the MediaManager Object. 
     81     */ 
    7482    private MediaManager theMediaMgr; 
    75      
    76     /** ParamicsIncidentWriter used to send incident updates to Paramics. */ 
    77     private ParamicsIncidentWriter paramicsIncidentWriter;     
    78      
    79     /** ParamicsStatusReader used to read status information from Paramics. */ 
     83    /** 
     84     * ParamicsIncidentWriter used to send incident updates to Paramics. 
     85     */ 
     86    private ParamicsIncidentWriter paramicsIncidentWriter; 
     87    /** 
     88     * ParamicsStatusReader used to read status information from Paramics. 
     89     */ 
    8090    private ParamicsStatusReader paramicsStatusReader; 
    81      
    82     /** ParamicsCameraStatusReader used to read speed information from Paramics. */ 
     91    /** 
     92     * ParamicsCameraStatusReader used to read speed information from Paramics. 
     93     */ 
    8394    private ParamicsCameraStatusReader paramicsCameraStatusReader; 
    84  
    85     /** Properties file. */ 
     95    /** 
     96     * Properties file. 
     97     */ 
    8698    private Properties paramicsProperties; 
    87      
    88      
    89     /** 
    90      * Constructor.  Loads the Properties file and initializes all Paramics 
     99 
     100    /** 
     101     * Constructor. Loads the Properties file and initializes all Paramics 
    91102     * Writers and Readers with the parsed data. 
    92      *  
     103     * 
    93104     * @param propertiesFile Target file path of properties file. 
    94105     * @param coor Coordinator Object. 
    95106     * @param mediaMgr MediaManager Object. 
    96107     */ 
    97     public ParamicsSimulationManager(String propertiesFile, Coordinator coor, MediaManager mediaMgr) { 
    98          
    99         try { 
     108    public ParamicsSimulationManager(String propertiesFile, Coordinator coor, MediaManager mediaMgr) 
     109    { 
     110 
     111        try 
     112        { 
    100113            paramicsProperties = new Properties(); 
    101114            paramicsProperties.load(new FileInputStream(propertiesFile)); 
    102              
     115 
    103116            theCoordinator = coor; 
    104             theMediaMgr    = mediaMgr; 
    105                    
    106             theCommunicator = new ParamicsCommunicator(this,  
     117            theMediaMgr = mediaMgr; 
     118 
     119            theCommunicator = new ParamicsCommunicator(this, 
    107120                    paramicsProperties.getProperty(PROPERTIES.PARAMICS_HOST.name), 
    108121                    Integer.parseInt(paramicsProperties.getProperty( 
    109                             PROPERTIES.PARAMICS_PORT.name).trim())); 
    110                      
     122                    PROPERTIES.PARAMICS_PORT.name).trim())); 
     123 
    111124            paramicsIncidentWriter = new ParamicsIncidentWriter(Integer.parseInt( 
    112                     paramicsProperties.getProperty(PROPERTIES.INCIDENT_UPDATE_INT.name).trim()));   
    113             paramicsIncidentWriter.writerID   = theCommunicator.nextID(); 
     125                    paramicsProperties.getProperty(PROPERTIES.INCIDENT_UPDATE_INT.name).trim())); 
     126            paramicsIncidentWriter.writerID = theCommunicator.nextID(); 
    114127            paramicsIncidentWriter.targetFile = paramicsProperties.getProperty( 
    115                     PROPERTIES.INCIDENT_UPDATE_FILE.name);       
    116              
     128                    PROPERTIES.INCIDENT_UPDATE_FILE.name); 
     129 
    117130            paramicsStatusReader = new ParamicsStatusReader(this); 
    118             paramicsStatusReader.readerID   = theCommunicator.nextID(); 
    119             paramicsStatusReader.interval   = paramicsProperties.getProperty( 
     131            paramicsStatusReader.readerID = theCommunicator.nextID(); 
     132            paramicsStatusReader.interval = paramicsProperties.getProperty( 
    120133                    PROPERTIES.PARAMICS_STATUS_INT.name).trim(); 
    121134            paramicsStatusReader.targetFile = paramicsProperties.getProperty( 
    122135                    PROPERTIES.PARAMICS_STATUS_FILE.name); 
    123              
     136 
    124137            paramicsCameraStatusReader = new ParamicsCameraStatusReader(this); 
    125             paramicsCameraStatusReader.readerID   = theCommunicator.nextID(); 
    126             paramicsCameraStatusReader.interval   = paramicsProperties.getProperty( 
     138            paramicsCameraStatusReader.readerID = theCommunicator.nextID(); 
     139            paramicsCameraStatusReader.interval = paramicsProperties.getProperty( 
    127140                    PROPERTIES.CAMERA_STATUS_INT.name).trim(); 
    128141            paramicsCameraStatusReader.targetFile = paramicsProperties.getProperty( 
    129                     PROPERTIES.CAMERA_STATUS_FILE.name);     
    130         } 
    131         catch (Exception e) { 
    132             paramLogger.logp(Level.SEVERE, "ParamicsSimulationManager",  
     142                    PROPERTIES.CAMERA_STATUS_FILE.name); 
     143        } catch (Exception e) 
     144        { 
     145            paramLogger.logp(Level.SEVERE, "ParamicsSimulationManager", 
    133146                    "Constructor", "Exception in parsing properties file.", e); 
    134147        } 
    135          
    136     } 
    137     
     148 
     149    } 
     150 
    138151    /** 
    139152     * Returns whether a connection exists to the remote ParamicsCommunicator. 
     153     * 
    140154     * @return true if a connection exists, false if not. 
    141155     */ 
    142     public boolean isConnected() { 
     156    public boolean isConnected() 
     157    { 
    143158        return theCommunicator.isConnected(); 
    144159    } 
    145      
     160 
    146161    /** 
    147162     * Returns the integer Network ID that has been loaded into Paramics. 
     163     * 
    148164     * @return Network ID. 
    149165     */ 
    150     public int getParamicsNetworkLoaded() { 
     166    public int getParamicsNetworkLoaded() 
     167    { 
    151168        return paramicsStatusReader.getNetworkID(); 
    152169    } 
    153      
     170 
    154171    /** 
    155172     * Returns the current status of the Paramics traffic modeler. 
    156      * @return Current PARAMICS_STATUS  
    157      */ 
    158     public PARAMICS_STATUS getParamicsStatus() { 
     173     * 
     174     * @return Current PARAMICS_STATUS 
     175     */ 
     176    public PARAMICS_STATUS getParamicsStatus() 
     177    { 
    159178        return paramicsStatusReader.getStatus(); 
    160179    } 
    161      
     180 
    162181    /** 
    163182     * Updates the ParamicsIncidentWriter with new Incident information. 
     183     * 
    164184     * @param xmlInc Updated Incident information. 
    165185     */ 
    166     public void updateIncident(XMLIncident xmlInc) { 
     186    public void updateIncident(XMLIncident xmlInc) 
     187    { 
    167188        paramicsIncidentWriter.updateIncident(xmlInc); 
    168189    } 
    169      
     190 
    170191    /** 
    171192     * Updates the ParamicsIncidentWriter with the new Diversion information. 
     193     * 
    172194     * @param theDiversion Updated diversion information. 
    173195     */ 
    174     public void updateDiversion(CMSInfo theDiversion) { 
     196    public void updateDiversion(CMSInfo theDiversion) 
     197    { 
    175198        paramicsIncidentWriter.updateDiversion(theDiversion); 
    176199    } 
    177      
     200 
    178201    /** 
    179202     * Notifies the ParamicsIncidentWriter to start the simulation. 
    180203     */ 
    181     public void startSimulation() { 
     204    public void startSimulation() 
     205    { 
    182206        paramicsIncidentWriter.startSimulation(); 
    183207    } 
    184      
     208 
    185209    /** 
    186210     * Notifies the ParamicsIncidentWriter to reset the simulation. 
    187211     */ 
    188     public void resetSimulation() { 
     212    public void resetSimulation() 
     213    { 
    189214        paramicsIncidentWriter.resetSimulation(); 
    190215    } 
     
    192217    /** 
    193218     * Notifies the ParamicsIncidentWriter to send an Incident update. 
     219     * 
    194220     * @param currentSimTime Current simulation time (in seconds). 
    195221     */ 
    196     public void sendIncidentUpdate(long currentSimTime) { 
     222    public void sendIncidentUpdate(long currentSimTime) 
     223    { 
    197224        paramicsIncidentWriter.sendUpdate(currentSimTime); 
    198225    } 
    199      
    200     /** 
    201      * Establish a connection to the remote ParamicsCommunicator.  Register 
    202      * the ParamicsStatusReader and update the current status to CONNECTED. 
    203      * If an exception occurs in connecting to the ParamicsCommunicator, 
    204      * update the current status to UNREACHABLE. 
    205      */ 
    206     public void connectToParamics() { 
    207         try {            
    208             theCommunicator.connect();           
     226 
     227    /** 
     228     * Establish a connection to the remote ParamicsCommunicator. Register the 
     229     * ParamicsStatusReader and update the current status to CONNECTED. If an 
     230     * exception occurs in connecting to the ParamicsCommunicator, update the 
     231     * current status to UNREACHABLE. 
     232     */ 
     233    public void connectToParamics() 
     234    { 
     235        try 
     236        { 
     237            theCommunicator.connect(); 
    209238            theCommunicator.registerReader(paramicsStatusReader); 
    210              
     239 
    211240            updateParamicsStatus(PARAMICS_STATUS.CONNECTED); 
    212         } 
    213         catch (IOException ioe) { 
    214             paramLogger.logp(Level.SEVERE, "Coordinator", "connectToParamics",  
     241        } catch (IOException ioe) 
     242        { 
     243            paramLogger.logp(Level.SEVERE, "Coordinator", "connectToParamics", 
    215244                    "Communication error in connecting to Paramics.", ioe); 
    216245 
    217246            updateParamicsStatus(PARAMICS_STATUS.UNREACHABLE); 
    218         }        
    219     } 
    220  
    221     /** 
    222      * Close the connection to the remote ParamicsCommunicator.  Unregister 
    223      * all Readers and Wrtiers from the ParamicsCommunicator. Reset the status 
    224      * information in the ParamicsStatusReader.  Update the current status to  
     247        } 
     248    } 
     249 
     250    /** 
     251     * Close the connection to the remote ParamicsCommunicator. Unregister all 
     252     * Readers and Wrtiers from the ParamicsCommunicator. Reset the status 
     253     * information in the ParamicsStatusReader. Update the current status to 
    225254     * DISCONNECTED. 
    226255     */ 
    227     public void disconnectFromParamics() {  
    228          
     256    public void disconnectFromParamics() 
     257    { 
     258 
    229259        theCommunicator.disconnect(); 
    230260        theCommunicator.unregisterReader(paramicsStatusReader); 
    231         theCommunicator.unregisterWriter(paramicsIncidentWriter);    
     261        theCommunicator.unregisterWriter(paramicsIncidentWriter); 
    232262        theCommunicator.unregisterReader(paramicsCameraStatusReader); 
    233                      
     263 
    234264        paramicsStatusReader.resetStatusInfo(); 
    235265 
    236266        updateParamicsStatus(PARAMICS_STATUS.DISCONNECTED); 
    237267    } 
    238      
    239     /** 
    240      * Updates the current paramics status.  If the new status is LOADED, 
    241      * then notify the ParamicsIncidentWriter that the network has been loaded 
    242      * and register the ParamicsCameraStatusReader with the ParamicsCommunicator. 
     268 
     269    /** 
     270     * Updates the current paramics status. If the new status is LOADED, then 
     271     * notify the ParamicsIncidentWriter that the network has been loaded and 
     272     * register the ParamicsCameraStatusReader with the ParamicsCommunicator. 
    243273     * Notify the Coordinator of all Paramics status updates. 
    244274     * 
    245      * @param  newStatus New Paramics status. 
    246      */  
    247     public void updateParamicsStatus(PARAMICS_STATUS newStatus) { 
    248                          
     275     * @param newStatus New Paramics status. 
     276     */ 
     277    public void updateParamicsStatus(PARAMICS_STATUS newStatus) 
     278    { 
     279 
    249280        //the network has finished loading 
    250         if(newStatus == PARAMICS_STATUS.LOADED) { 
    251          
     281        if (newStatus == PARAMICS_STATUS.LOADED) 
     282        { 
     283 
    252284            paramicsIncidentWriter.networkLoaded(); 
    253          
    254             theCommunicator.registerReader(paramicsCameraStatusReader);                      
    255         } 
    256         else if(newStatus == PARAMICS_STATUS.DROPPED) { 
    257             paramLogger.logp(Level.WARNING, "Coordinator", "updateParamicsStatus",  
     285 
     286            theCommunicator.registerReader(paramicsCameraStatusReader); 
     287 
     288        } else if (newStatus == PARAMICS_STATUS.DROPPED) 
     289        { 
     290            paramLogger.logp(Level.WARNING, "Coordinator", "updateParamicsStatus", 
    258291                    "Connection to Paramics has been dropped."); 
    259         }else 
    260         { 
    261             paramLogger.logp(Level.INFO, "ParamicsSimulationManager", "updateParamicsStatus", 
    262                     "Received: " + newStatus); 
    263         } 
    264          
    265         theCoordinator.setParamicsStatus(newStatus);         
    266  
    267     }  
    268      
    269     /** 
    270      * If a connection has been made, register the ParamicsIncidentWriter 
    271      * and use it to notify Paramics of the Network ID to load. 
    272      *  
     292        } 
     293 
     294        theCoordinator.setParamicsStatus(newStatus); 
     295 
     296    } 
     297 
     298    /** 
     299     * If a connection has been made, register the ParamicsIncidentWriter and 
     300     * use it to notify Paramics of the Network ID to load. 
     301     * 
    273302     * @param networkID Network ID to load. 
    274      * @throws SimulationException if a connection has not been made to the  
    275      *         remote ParamicsCommunicator. 
    276      */ 
    277     public void loadParamicsNetwork(int networkID) throws SimulationException { 
    278              
    279         if(theCommunicator.isConnected()) { 
     303     * @throws SimulationException if a connection has not been made to the 
     304     * remote ParamicsCommunicator. 
     305     */ 
     306    public void loadParamicsNetwork(int networkID) throws SimulationException 
     307    { 
     308 
     309        if (theCommunicator.isConnected()) 
     310        { 
    280311            theCommunicator.registerWriter(paramicsIncidentWriter); 
    281312            paramicsIncidentWriter.loadNetwork(networkID); 
    282         } 
    283         else  
     313        } else 
     314        { 
    284315            throw new SimulationException(SimulationException.PARAMICS_NOT_CONNECTED); 
    285     } 
    286      
    287     /** 
    288      * Receive updated camera speed information. Notify the MediaManager with  
    289      * the updated data.  
    290      *  
     316        } 
     317    } 
     318 
     319    /** 
     320     * Receive updated camera speed information. Notify the MediaManager with 
     321     * the updated data. 
     322     * 
    291323     * @param cameraID CCTV camera ID 
    292324     * @param avgSpeed_NE Average speed of traffic flowing N or E 
    293325     * @param avgSpeed_SW Average speed of traffic flowing S or W 
    294326     */ 
    295     public void updateCameraInfo(Integer cameraID, float avgSpeed_NE, float avgSpeed_SW) { 
     327    public void updateCameraInfo(Integer cameraID, float avgSpeed_NE, float avgSpeed_SW) 
     328    { 
    296329        theMediaMgr.updateCameraInfo(cameraID, avgSpeed_NE, avgSpeed_SW); 
    297330    } 
  • trunk/src/tmcsim/cadsimulator/stillimagecontrol/ATMSCommunicator.java

    r2 r44  
    77 
    88/** 
    9  * ATMSCommunicator handles communication between the CAD Simulator and the  
    10  * ATMS Server.  The funcationality provided includes querying the current time  
    11  * on the ATMS server and replacing images on the ATMS to model  
    12  * traffic flow changes.  The ATMSCommunicator uses the plink.exe external  
    13  * application to establish an SSH communication with the ATMS server, which is 
    14  * used to execute commands remotely.   
    15  *  
     9 * ATMSCommunicator handles communication between the CAD Simulator and the ATMS 
     10 * Server. The funcationality provided includes querying the current time on the 
     11 * ATMS server and replacing images on the ATMS to model traffic flow changes. 
     12 * The ATMSCommunicator uses the plink.exe external application to establish an 
     13 * SSH communication with the ATMS server, which is used to execute commands 
     14 * remotely. 
     15 * 
    1616 * @author Matthew Cechini 
    1717 * @version 
    1818 */ 
    19 public class ATMSCommunicator { 
    20      
    21     /** Connection user name. */ 
     19public class ATMSCommunicator 
     20{ 
     21 
     22    /** 
     23     * Connection user name. 
     24     */ 
    2225    protected String username; 
    23      
    24     /** Connection password. */ 
     26    /** 
     27     * Connection password. 
     28     */ 
    2529    protected String password; 
    26      
    27     /** ATMS Server Host name. */ 
     30    /** 
     31     * ATMS Server Host name. 
     32     */ 
    2833    protected String viewerHost; 
    29      
    30     /** Absolute directory path for images. */ 
     34    /** 
     35     * Absolute directory path for images. 
     36     */ 
    3137    protected String image_dir; 
    32      
    33     /** Base plink command string. */ 
     38    /** 
     39     * Base plink command string. 
     40     */ 
    3441    protected String plinkBaseCMD; 
    35      
    36     /** Constructor. */ 
    37     public ATMSCommunicator(String host, String user, String pwd, String dir) { 
     42    protected String remoteShellCmd; 
     43 
     44    /** 
     45     * Constructor. 
     46     */ 
     47    public ATMSCommunicator(String host, String user, String pwd, String dir) 
     48    { 
    3849        viewerHost = host; 
    39         username   = user; 
    40         password   = pwd; 
    41         image_dir  = dir; 
    42          
    43         plinkBaseCMD = "plink -l " + username + " -pw " + password + " " + viewerHost + " ";         
     50        username = user; 
     51        password = pwd; 
     52        image_dir = dir; 
     53        String osname = System.getProperty("os.name"); 
     54        if (osname.startsWith("Windows")) 
     55        { 
     56            remoteShellCmd = "plink -l " + username + " -pw " + password + " " + viewerHost + " \"date\""; 
     57        } 
     58        else 
     59        { 
     60            remoteShellCmd = "date"; //sshpass -p " + password + " " + "ssh -t -l " + username + viewerHost + " date &"; 
     61        } 
    4462    } 
    45      
     63 
    4664    /** 
    47      * Get the current ATMS server time as the number of seconds since Jan 1, 1970. 
    48      *  
     65     * Get the current ATMS server time as the number of seconds since Jan 1, 
     66     * 1970. 
     67     * 
    4968     * @return Current time in seconds. 
    5069     * @throws RemoteException If there is an exception in RMI communication. 
    51      */  
    52     public long getCurrentTime() throws Exception { 
    53          
     70     */ 
     71    public long getCurrentTime() throws Exception 
     72    { 
     73 
    5474        Calendar currentCal = Calendar.getInstance(); 
    5575 
    56         Process timeProc = Runtime.getRuntime().exec(plinkBaseCMD + " \"date\""); 
     76        Process timeProc = Runtime.getRuntime().exec(remoteShellCmd); 
    5777        timeProc.waitFor(); 
    58          
    59         if(timeProc.exitValue() == 0) { 
     78//        System.out.println("timeProc exit = " + timeProc.exitValue()); 
     79//        byte[] procBytes = new byte[timeProc.getInputStream().available()]; 
     80//        timeProc.getInputStream().read(procBytes); 
     81//        String returnString = new String(procBytes); 
     82//        System.out.println("timeProc returned: " + returnString); 
     83 
     84        if (timeProc.exitValue() == 0) 
     85        { 
    6086            String tempToken = null; 
    6187            byte[] dateBytes = new byte[timeProc.getInputStream().available()]; 
    6288            timeProc.getInputStream().read(dateBytes); 
    63              
     89 
    6490            StringTokenizer spaceTok = new StringTokenizer(new String(dateBytes), " "); 
    65             while(spaceTok.hasMoreTokens()) { 
     91            while (spaceTok.hasMoreTokens()) 
     92            { 
    6693                tempToken = spaceTok.nextToken(); 
    67                  
    68                 if(tempToken.indexOf(":") != -1) { 
     94 
     95                if (tempToken.indexOf(":") != -1) 
     96                { 
    6997                    StringTokenizer colonTok = new StringTokenizer(new String(tempToken), ":"); 
    70                      
     98 
    7199                    currentCal.set(Calendar.HOUR, Integer.parseInt(colonTok.nextToken())); 
    72100                    currentCal.set(Calendar.MINUTE, Integer.parseInt(colonTok.nextToken())); 
    73101                    currentCal.set(Calendar.SECOND, Integer.parseInt(colonTok.nextToken())); 
    74                      
    75                     System.out.println("Time retreieved from ATRMS server: " +  
    76                             DateFormat.getDateTimeInstance().format(currentCal.getTime()));                                  
    77                      
     102 
     103                    System.out.println("Time retreieved from ATRMS server: " 
     104                            + DateFormat.getDateTimeInstance().format(currentCal.getTime())); 
     105 
    78106                } 
    79107            } 
    80         }        
    81          
    82         return currentCal.getTimeInMillis();         
     108        } 
     109 
     110        return currentCal.getTimeInMillis(); 
    83111 
    84112    } 
    85113 
    86114    /** 
    87      * Show a new image for an ATMS camera.  The ATMS camera files are named 
    88      * <ATMS_Camera_ID>.xpm.  If a camera file exists, delete it.  Then copy 
    89      * the parameter file name to <ATMS_Camera_ID>.xpm.  If the camera ID or  
    90      * new file does not exist, throw an exception.      
    91      *  
     115     * Show a new image for an ATMS camera. The ATMS camera files are named 
     116     * <ATMS_Camera_ID>.xpm. If a camera file exists, delete it. Then copy the 
     117     * parameter file name to <ATMS_Camera_ID>.xpm. If the camera ID or new file 
     118     * does not exist, throw an exception. 
     119     * 
    92120     * @param ATMS_cameraID ATMS indexed camera ID. 
    93121     * @param fileName Filename to show. 
    94122     * @throws RemoteException If there is an exception in RMI communication. 
    95      */  
    96     public void showImage(Integer ATMS_cameraID, String fileName) throws RemoteException { 
    97          
     123     */ 
     124    public void showImage(Integer ATMS_cameraID, String fileName) throws RemoteException 
     125    { 
     126 
    98127        System.out.println("Showing CameraID " + ATMS_cameraID + ", with filename: " + fileName); 
    99128        /* 
    100         Process imageProc = Runtime.getRuntime().exec(plinkBaseCMD + "\"ls " + image_dir + "/cctvImage" + ATMS_cameraID + ".xpm\""); 
    101         imageProc.waitFor(); 
    102          
    103         if(imageProc.exitValue() != 0) { 
    104             throw new Exception(image_dir + "/cctvImage" + ATMS_cameraID + ".xpm does not exist"); 
    105         } 
    106              
    107         imageProc = Runtime.getRuntime().exec(plinkBaseCMD + "\"ls " + image_dir + "/" + fileName + ".xpm\""); 
    108         imageProc.waitFor(); 
     129         Process imageProc = Runtime.getRuntime().exec(plinkBaseCMD + "\"ls " + image_dir + "/cctvImage" + ATMS_cameraID + ".xpm\""); 
     130         imageProc.waitFor(); 
    109131 
    110         if(imageProc.exitValue() != 0) { 
    111             throw new Exception(image_dir + "/" + fileName + ".xpm does not exist"); 
    112         } 
    113      
    114         imageProc = Runtime.getRuntime().exec(plinkBaseCMD + "\"rm " + image_dir + "/cctvImage" + ATMS_cameraID + ".xpm\""); 
    115         imageProc.waitFor(); 
    116          
    117         imageProc = Runtime.getRuntime().exec(plinkBaseCMD + "\"cp " + image_dir + "/" + fileName + ".xpm" +  
    118                                   "   " + image_dir + "/" + "cctvImage" + ATMS_cameraID + ".xpm\"");         
    119         imageProc.waitFor(); 
    120         */ 
    121          
    122     }    
     132         if(imageProc.exitValue() != 0) { 
     133         throw new Exception(image_dir + "/cctvImage" + ATMS_cameraID + ".xpm does not exist"); 
     134         } 
     135 
     136         imageProc = Runtime.getRuntime().exec(plinkBaseCMD + "\"ls " + image_dir + "/" + fileName + ".xpm\""); 
     137         imageProc.waitFor(); 
     138 
     139         if(imageProc.exitValue() != 0) { 
     140         throw new Exception(image_dir + "/" + fileName + ".xpm does not exist"); 
     141         } 
     142 
     143         imageProc = Runtime.getRuntime().exec(plinkBaseCMD + "\"rm " + image_dir + "/cctvImage" + ATMS_cameraID + ".xpm\""); 
     144         imageProc.waitFor(); 
     145 
     146         imageProc = Runtime.getRuntime().exec(plinkBaseCMD + "\"cp " + image_dir + "/" + fileName + ".xpm" + 
     147         "   " + image_dir + "/" + "cctvImage" + ATMS_cameraID + ".xpm\""); 
     148         imageProc.waitFor(); 
     149         */ 
     150 
     151    } 
    123152} 
  • trunk/src/tmcsim/cadsimulator/viewer/CADSimulatorViewer.java

    r36 r44  
    66import java.awt.event.KeyEvent; 
    77import java.awt.event.WindowEvent; 
     8import java.io.IOException; 
     9import java.util.Observable; 
     10import java.util.Properties; 
     11import java.util.logging.Level; 
     12import java.util.logging.Logger; 
    813import javax.swing.JFrame; 
    914import javax.swing.JMenu; 
     
    1318import javax.swing.JTabbedPane; 
    1419import javax.swing.KeyStroke; 
    15 import tmcsim.cadsimulator.videocontrol.DVDStatusUpdate; 
    16 import tmcsim.cadsimulator.videocontrol.DVDTitleUpdate; 
    1720import tmcsim.cadsimulator.viewer.actions.ExitAction; 
    18 import tmcsim.common.CADEnums.PARAMICS_STATUS; 
    19 import tmcsim.common.CADEnums.SCRIPT_STATUS; 
    20 import tmcsim.common.RevisionNumber; 
     21import tmcsim.cadsimulator.viewer.model.CADMediaStatus; 
     22import tmcsim.cadsimulator.viewer.model.CADSimulatorStatus; 
     23import tmcsim.interfaces.CADViewer; 
    2124 
    2225/** 
     
    3033 */ 
    3134@SuppressWarnings("serial") 
    32 public class CADSimulatorViewer extends JFrame 
     35public class CADSimulatorViewer extends JFrame implements CADViewer 
    3336{ 
    3437 
     
    4548     */ 
    4649    private ConfigStatusPanel configPanel; 
     50 
    4751    /** 
    4852     * Constructor. 
    4953     */ 
    50      
    5154    public CADSimulatorViewer() 
    5255    { 
    53         super("CAD Simulator"); 
     56        super(); 
     57        setTitle("CAD Simulator " + getAppVersion()); 
    5458 
    5559        initComponents(); 
     
    5761 
    5862    /** 
    59      * @see SimulationStatusPanel 
     63     * Read the version number from the application properties. The file 
     64     * 'application.properties' is generated by build.xml. 
     65     * 
     66     * @return a version string obtained from application.properties file, or 
     67     * "Version: unknown" if an IOerror prevents us from reading the file. 
    6068     */ 
    61     public void connectClient() 
     69    private String getAppVersion() 
    6270    { 
    63         simulationPanel.connectClient(); 
    64     } 
    65  
    66     /** 
    67      * @see SimulationStatusPanel 
    68      */ 
    69     public void disconnectClient() 
    70     { 
    71         simulationPanel.disconnectClient(); 
    72     } 
    73  
    74     /** 
    75      * @see SimulationStatusPanel 
    76      */ 
    77     public void setSimManagerStatus(boolean connection) 
    78     { 
    79         simulationPanel.setSimManagerStatus(connection); 
    80     } 
    81  
    82     /** 
    83      * @see SimulationStatusPanel 
    84      */ 
    85     public void setTime(long seconds) 
    86     { 
    87         simulationPanel.setTime(seconds); 
    88     } 
    89  
    90     /** 
    91      * @see SimulationStatusPanel 
    92      */ 
    93     public void setScriptStatus(SCRIPT_STATUS newStatus) 
    94     { 
    95         simulationPanel.setScriptStatus(newStatus); 
    96     } 
    97  
    98     /** 
    99      * @see SimulationStatusPanel 
    100      */ 
    101     public void setParamicsStatus(PARAMICS_STATUS newStatus) 
    102     { 
    103         simulationPanel.setParamicsStatus(newStatus); 
    104     } 
    105  
    106     /** 
    107      * @see SimulationStatusPanel 
    108      */ 
    109     public void setParamicsNetworkLoaded(String networkID) 
    110     { 
    111         simulationPanel.setParamicsNetworkLoaded(networkID); 
    112     } 
    113  
    114     /** 
    115      * @see MediaStatusPanel 
    116      */ 
    117     public void updateDVDStatus(DVDStatusUpdate update) 
    118     { 
    119         mediaPanel.updateDVDStatus(update); 
    120     } 
    121  
    122     /** 
    123      * @see MediaStatusPanel 
    124      */ 
    125     public void updateDVDTitle(DVDTitleUpdate update) 
    126     { 
    127         mediaPanel.updateDVDTitle(update); 
     71        String propfilename = "/tmcsim/application.properties"; 
     72        String propKey = "Application.revision"; 
     73        String version = "unknown"; 
     74        try 
     75        { 
     76            Properties props = new Properties(); 
     77            props.load(this.getClass().getResourceAsStream(propfilename)); 
     78            version = (String) props.get(propKey); 
     79        } catch (IOException ex) 
     80        { 
     81            Logger.getLogger("tmcsim/cadsimulator").log(Level.SEVERE, 
     82                    "CADSimulatorView.getAppVersion()", 
     83                    "IOError reading " + propfilename); 
     84        } 
     85        return "revision: " + version; 
    12886    } 
    12987 
     
    147105        if (evt.getID() == WindowEvent.WINDOW_CLOSING) 
    148106        { 
    149             int option = JOptionPane.showConfirmDialog(null, 
    150                     "Closing the CAD Simulator will stop the current " 
    151                     + "simulation.  Do you wish to continue exiting?", 
    152                     "Confirm Exit", 
    153                     JOptionPane.YES_NO_OPTION); 
    154  
    155             if (option != JOptionPane.NO_OPTION) 
    156             { 
    157                 System.exit(0); 
    158             } 
     107//            int option = JOptionPane.showConfirmDialog(null, 
     108//                    "Closing the CAD Simulator will stop the current " 
     109//                    + "simulation.  Do you wish to continue exiting?", 
     110//                    "Confirm Exit", 
     111//                    JOptionPane.YES_NO_OPTION); 
     112// 
     113//            if (option != JOptionPane.NO_OPTION) 
     114//            { 
     115            System.exit(0); 
     116//            } 
    159117        } 
    160118    } 
     
    196154            public void actionPerformed(java.awt.event.ActionEvent evt) 
    197155            { 
    198                 String ver = RevisionNumber.getString(); 
     156                String ver = "";//RevisionNumber.getString(); 
    199157                JOptionPane.showMessageDialog(rootPane, "Version: " + ver, "About", JOptionPane.INFORMATION_MESSAGE); 
    200158            } 
     
    208166        pack(); 
    209167        setResizable(true); 
     168        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
    210169    } 
    211170    private JTabbedPane cadSimTabbedPane; 
     
    213172    private JMenu fileMenu; 
    214173    private JMenuItem exitMenuItem; 
     174 
     175    @Override 
     176    public void update(Observable obs, Object obj) 
     177    { 
     178        if (obs instanceof CADSimulatorStatus) 
     179        { 
     180            simulationPanel.refresh(obs); 
     181        } 
     182        if (obs instanceof CADMediaStatus) 
     183        { 
     184            mediaPanel.refresh(obs); 
     185        } 
     186    } 
    215187} 
  • trunk/src/tmcsim/cadsimulator/viewer/DVDInfoPanel.java

    r2 r44  
    22 
    33import java.awt.Dimension; 
    4  
    54import javax.swing.BorderFactory; 
    65import javax.swing.Box; 
     
    109import javax.swing.JTable; 
    1110import javax.swing.JTextField; 
    12  
    1311import tmcsim.cadsimulator.videocontrol.DVDStatusUpdate; 
    1412import tmcsim.cadsimulator.videocontrol.DVDTitleUpdate; 
     
    1715 
    1816/** 
    19  * DVDInfoPanel is a GUI component used in the CADSimulatorViewer.  The panel 
    20  * displays information regarding the DVD player's connection information. 
    21  * One table on the panel shows all DVD title that have been played or  
    22  * repeated.  A second table shows all DVD status updates that have been 
    23  * received from the controller.  
    24  *  
     17 * DVDInfoPanel is a GUI component used in the CADSimulatorViewer. The panel 
     18 * displays information regarding the DVD player's connection information. One 
     19 * table on the panel shows all DVD title that have been played or repeated. A 
     20 * second table shows all DVD status updates that have been received from the 
     21 * controller. 
     22 * 
    2523 * @author Matthew Cechini 
    26  * @version  
     24 * @version 
    2725 */ 
    2826@SuppressWarnings("serial") 
    29 public class DVDInfoPanel extends JPanel { 
     27public class DVDInfoPanel extends JPanel 
     28{ 
    3029 
    31     /** DVD player connection info. */ 
    32     private String connInfo = null; 
    33      
    34     /** Table model for the title table. */ 
     30    /** 
     31     * DVD player connection info. 
     32     */ 
     33    public final String connInfo; 
     34    /** 
     35     * Table model for the title table. 
     36     */ 
    3537    private DVDTitleTableModel titleTableModel; 
     38    /** 
     39     * Table to display DVD title plays and repeats. 
     40     */ 
     41    private JTable titleTable; 
     42    /** 
     43     * Table model for the Status table. 
     44     */ 
     45    private DVDStatusTableModel statusTableModel; 
     46    /** 
     47     * Table to display DVD status updates. 
     48     */ 
     49    private JTable statusTable; 
    3650 
    37     /** Table to display DVD title plays and repeats. */ 
    38     private JTable titleTable; 
    39      
    40     /** Table model for the Status table. */ 
    41     private DVDStatusTableModel statusTableModel; 
    42      
    43     /** Table to display DVD status updates. */ 
    44     private JTable statusTable; 
    45      
    46      
    4751    /** 
    48      * Constructor.  Initialize the panel GUI components. 
    49      *  
     52     * Constructor. Initialize the panel GUI components. 
     53     * 
    5054     * @param connectionInfo DVD player connection info. 
    5155     */ 
    52     public DVDInfoPanel(String connectionInfo) { 
     56    public DVDInfoPanel(String connectionInfo) 
     57    { 
    5358        connInfo = connectionInfo; 
    54          
     59 
    5560        initComponents(); 
    56     }    
    57      
     61    } 
     62 
    5863    /** 
    5964     * This method updates the DVD status table with the new update object. 
     65     * 
    6066     * @param update Update DVD Status update. 
    6167     */ 
    62     public void updateDVDStatus(DVDStatusUpdate update) { 
     68    public void updateDVDStatus(DVDStatusUpdate update) 
     69    { 
    6370        statusTableModel.addStatusUpdate(update); 
    6471    } 
     
    6673    /** 
    6774     * This method updates the DVD title table with the new update object. 
     75     * 
    6876     * @param update Update DVD Status update. 
    6977     */ 
    70     public void updateDVDTitle(DVDTitleUpdate update) { 
     78    public void updateDVDTitle(DVDTitleUpdate update) 
     79    { 
    7180        titleTableModel.addTitleUpdate(update); 
    7281    } 
    73      
     82 
    7483    /** 
    7584     * Initialize the GUI components. 
    7685     */ 
    77     private void initComponents() { 
     86    private void initComponents() 
     87    { 
    7888 
    7989        connInfoLbl = new JLabel("Connection Info:"); 
    8090        connInfoLbl.setAlignmentX(Box.LEFT_ALIGNMENT); 
    81         connInfoTF  = new JTextField(connInfo); 
     91        connInfoTF = new JTextField(connInfo); 
    8292        connInfoTF.setColumns(30); 
    8393        connInfoTF.setAlignmentX(Box.LEFT_ALIGNMENT); 
    8494        connInfoTF.setEditable(false); 
    85          
     95 
    8696        Box connInfoBox = Box.createVerticalBox(); 
    8797        connInfoBox.add(connInfoLbl); 
    8898        connInfoBox.add(connInfoTF); 
    8999        connInfoBox.setAlignmentX(Box.CENTER_ALIGNMENT); 
    90          
     100 
    91101        titleTableModel = new DVDTitleTableModel(); 
    92         titleTable      = new JTable(titleTableModel); 
    93         titleTable.getTableHeader().setReorderingAllowed(false);   
    94          
    95         for(int c = 0; c < titleTable.getColumnCount(); c++) { 
     102        titleTable = new JTable(titleTableModel); 
     103        titleTable.getTableHeader().setReorderingAllowed(false); 
     104 
     105        for (int c = 0; c < titleTable.getColumnCount(); c++) 
     106        { 
    96107            titleTable.getColumnModel().getColumn(c).setMinWidth( 
    97108                    titleTableModel.getColumnMinWidth(c)); 
     
    102113            titleTable.getColumnModel().getColumn(c).setResizable(true); 
    103114        } 
    104          
    105         titlePane       = new JScrollPane(); 
     115 
     116        titlePane = new JScrollPane(); 
    106117        titlePane.setAlignmentX(Box.CENTER_ALIGNMENT); 
    107118        //titlePane.setMinimumSize(new Dimension(,)); 
    108         titlePane.setPreferredSize(new Dimension(425, 225));         
     119        titlePane.setPreferredSize(new Dimension(425, 225)); 
    109120        titlePane.setViewportView(titleTable); 
    110121        titlePane.setBorder(BorderFactory.createTitledBorder( 
    111                     BorderFactory.createRaisedBevelBorder(), "Title Updates")); 
     122                BorderFactory.createRaisedBevelBorder(), "Title Updates")); 
    112123 
    113124        statusTableModel = new DVDStatusTableModel(); 
    114         statusTable      = new JTable(statusTableModel); 
    115         statusTable.getTableHeader().setReorderingAllowed(false);   
    116          
    117         for(int c = 0; c < statusTable.getColumnCount(); c++) { 
     125        statusTable = new JTable(statusTableModel); 
     126        statusTable.getTableHeader().setReorderingAllowed(false); 
     127 
     128        for (int c = 0; c < statusTable.getColumnCount(); c++) 
     129        { 
    118130            statusTable.getColumnModel().getColumn(c).setMinWidth( 
    119131                    statusTableModel.getColumnMinWidth(c)); 
     
    124136            statusTable.getColumnModel().getColumn(c).setResizable(true); 
    125137        } 
    126          
    127         statusPane       = new JScrollPane(); 
     138 
     139        statusPane = new JScrollPane(); 
    128140        statusPane.setAlignmentX(Box.CENTER_ALIGNMENT); 
    129141        //statusPane.setMinimumSize(new Dimension(,)); 
    130         statusPane.setPreferredSize(new Dimension(425, 150));        
     142        statusPane.setPreferredSize(new Dimension(425, 150)); 
    131143        statusPane.setViewportView(statusTable); 
    132144        statusPane.setBorder(BorderFactory.createTitledBorder( 
    133145                BorderFactory.createRaisedBevelBorder(), "Status Updates")); 
    134          
     146 
    135147        Box panelBox = Box.createVerticalBox(); 
    136148        panelBox.add(connInfoBox); 
     
    139151        panelBox.add(Box.createVerticalStrut(10)); 
    140152        panelBox.add(statusPane); 
    141         panelBox.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 
    142          
     153        panelBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); 
     154 
    143155        add(panelBox); 
    144156    } 
    145      
    146157    private JScrollPane titlePane; 
    147158    private JScrollPane statusPane; 
    148      
    149159    private JLabel connInfoLbl; 
    150      
    151160    private JTextField connInfoTF; 
    152161} 
  • trunk/src/tmcsim/cadsimulator/viewer/MediaStatusPanel.java

    r2 r44  
    11package tmcsim.cadsimulator.viewer; 
    22 
     3import java.util.Iterator; 
     4import java.util.Observable; 
    35import java.util.TreeMap; 
    4  
    56import javax.swing.JPanel; 
    67import javax.swing.JTabbedPane; 
    7  
    88import tmcsim.cadsimulator.videocontrol.DVDStatusUpdate; 
    99import tmcsim.cadsimulator.videocontrol.DVDTitleUpdate; 
     10import tmcsim.cadsimulator.viewer.model.CADMediaStatus; 
    1011 
    1112/** 
    12  * MediaStatusPanel is a GUI object used for displaying information 
    13  * for DVD connections created by the CAD Simulator.  Tabs for each 
    14  * DVD are created and information is displayed on a DVDInfoPanel. 
    15  * All status and title updates are sent to the corresponding 
    16  * DVDInfoPanel.  The DVDs are referenced by connection info, which 
    17  * is unique to each DVD player. 
    18  *  
    19  * @author Matthew Cechini 
    20  * @version 
     13 * MediaStatusPanel is a GUI object used for displaying information for DVD 
     14 * connections created by the CAD Simulator. Tabs for each DVD are created and 
     15 * information is displayed on a DVDInfoPanel. All status and title updates are 
     16 * sent to the corresponding DVDInfoPanel. The DVDs are referenced by connection 
     17 * info, which is unique to each DVD player. 
     18 * 
     19 * @author jdalbey 
    2120 */ 
    2221@SuppressWarnings("serial") 
    23 public class MediaStatusPanel extends JPanel { 
    24      
    25     /** Map of DVDInfoPanels(values) referenced by a DVD's connection info(key). */ 
     22public class MediaStatusPanel extends JPanel 
     23{ 
     24 
     25    /** 
     26     * Map of DVDInfoPanels(values) referenced by a DVD's connection info(key). 
     27     */ 
    2628    private TreeMap<String, DVDInfoPanel> dvdPanels = null; 
    2729 
    2830    /** 
    29      * Constructor.  Initialize data and GUI components. 
     31     * Constructor. Initialize data and GUI components. 
    3032     */ 
    31     public MediaStatusPanel() { 
     33    public MediaStatusPanel() 
     34    { 
    3235 
    33         dvdPanels   = new TreeMap<String, DVDInfoPanel>(); 
    34          
     36        dvdPanels = new TreeMap<String, DVDInfoPanel>(); 
     37 
    3538        initComponents(); 
    3639    } 
    37      
     40 
     41    public void refresh(Observable obs) 
     42    { 
     43        CADMediaStatus status = (CADMediaStatus) obs; 
     44        Iterator<DVDInfoPanel> iter = status.getDVDlist(); 
     45        // Remove existing tabs before adding them all back 
     46        mediaTabs.removeAll(); 
     47        // add a new tab for each dvd panel 
     48        while (iter.hasNext()) 
     49        { 
     50            DVDInfoPanel item = iter.next(); 
     51            mediaTabs.addTab( 
     52                    "DVD " + (Integer.parseInt(item.connInfo 
     53                    .substring(item.connInfo 
     54                    .indexOf(":") + 1)) % 3000), 
     55                    dvdPanels.get(item.connInfo)); 
     56        } 
     57//            mediaTabs.addTab( 
     58//                    "DVD " + (Integer.parseInt(update.connectionInfo 
     59//                    .substring(update.connectionInfo 
     60//                    .indexOf(":") + 1)) % 3000), 
     61//                    dvdPanels.get(update.connectionInfo)); 
     62 
     63    } 
     64 
    3865    /** 
    39      * Updates the current DVDInfoPanel with the status update. 
    40      * If a panel does not current exist, create one and add 
    41      * a new tab. 
    42      *  
     66     * Updates the current DVDInfoPanel with the status update. If a panel does 
     67     * not current exist, create one and add a new tab. 
     68     * 
    4369     * @param update DVD status update. 
    4470     */ 
    45     public void updateDVDStatus(DVDStatusUpdate update) { 
    46         if(dvdPanels.get(update.connectionInfo) == null) { 
     71    public void updateDVDStatus(DVDStatusUpdate update) 
     72    { 
     73        if (dvdPanels.get(update.connectionInfo) == null) 
     74        { 
    4775            dvdPanels.put(update.connectionInfo, new DVDInfoPanel( 
    4876                    update.connectionInfo)); 
     
    5078            mediaTabs.addTab( 
    5179                    "DVD " + (Integer.parseInt(update.connectionInfo 
    52                                     .substring(update.connectionInfo 
    53                                             .indexOf(":")+1)) % 3000),  
     80                    .substring(update.connectionInfo 
     81                    .indexOf(":") + 1)) % 3000), 
    5482                    dvdPanels.get(update.connectionInfo)); 
    5583        } 
    56          
    57          
     84 
     85 
    5886        dvdPanels.get(update.connectionInfo).updateDVDStatus(update); 
    5987    } 
    60      
     88 
    6189    /** 
    62      * Updates the current DVDInfoPanel with the title update. 
    63      * If a panel does not current exist, create one and add 
    64      * a new tab. 
    65      *  
     90     * Updates the current DVDInfoPanel with the title update. If a panel does 
     91     * not current exist, create one and add a new tab. 
     92     * 
    6693     * @param update DVD title update. 
    6794     */ 
    68     public void updateDVDTitle(DVDTitleUpdate update) { 
    69         if(dvdPanels.get(update.connectionInfo) == null) { 
     95    public void updateDVDTitle(DVDTitleUpdate update) 
     96    { 
     97        if (dvdPanels.get(update.connectionInfo) == null) 
     98        { 
    7099            dvdPanels.put(update.connectionInfo, new DVDInfoPanel(update.connectionInfo)); 
    71              
    72             mediaTabs.addTab("DVD " + dvdPanels.size(),  
     100 
     101            mediaTabs.addTab("DVD " + dvdPanels.size(), 
    73102                    dvdPanels.get(update.connectionInfo)); 
    74103        } 
    75          
     104 
    76105        dvdPanels.get(update.connectionInfo).updateDVDTitle(update); 
    77106    } 
    78      
     107 
    79108    /** 
    80109     * Initialize GUI components. 
    81110     */ 
    82     private void initComponents() { 
     111    private void initComponents() 
     112    { 
    83113        mediaTabs = new JTabbedPane(); 
    84          
     114 
    85115        add(mediaTabs); 
    86116    } 
    87      
    88117    private JTabbedPane mediaTabs; 
    89      
    90118} 
  • trunk/src/tmcsim/cadsimulator/viewer/SimulationStatusPanel.java

    r36 r44  
    55import java.awt.Dimension; 
    66import java.awt.Font; 
    7 import java.util.logging.Handler; 
    8 import java.util.logging.Level; 
    9 import java.util.logging.LogRecord; 
    10 import java.util.logging.Logger; 
     7import java.util.Observable; 
    118import javax.swing.BorderFactory; 
    129import javax.swing.Box; 
     
    1916import javax.swing.border.EtchedBorder; 
    2017import javax.swing.border.TitledBorder; 
     18import tmcsim.cadsimulator.viewer.model.CADSimulatorStatus; 
    2119import tmcsim.common.CADEnums.PARAMICS_STATUS; 
    2220import tmcsim.common.CADEnums.SCRIPT_STATUS; 
     
    3735 * </ul> 
    3836 * 
    39  * @author Matthew Cechini 
     37 * @author Matthew Cechini, jdalbey 
    4038 * @version 
    4139 */ 
     
    4543 
    4644    /** 
    47      * Logging Handler to listen for Information and Error messages logged for 
    48      * the CAD Simulator. Received LogRecords are displayed in the info or error 
    49      * message Text Area. 
    50      * 
    51      * @author Matthew Cechini 
    52      */ 
    53     private class SimulatorErrorHandler extends Handler 
    54     { 
    55  
    56         public void close() throws SecurityException 
    57         { 
    58         } 
    59  
    60         public void flush() 
    61         { 
    62         } 
    63  
    64         public void publish(LogRecord rec) 
    65         { 
    66             StringBuffer msgBuffer = new StringBuffer(); 
    67  
    68             msgBuffer.append(rec.getSourceClassName() + "." 
    69                     + rec.getSourceMethodName() + " = " 
    70                     + rec.getMessage()); 
    71  
    72             if (rec.getLevel() == Level.INFO) 
    73             { 
    74                 infoMessagesTA.setText(infoMessagesTA.getText() 
    75                         + msgBuffer.toString() + "\n"); 
    76             } else 
    77             { 
    78                 errorMessagesTA.setText(errorMessagesTA.getText() 
    79                         + msgBuffer.toString() + "\n"); 
    80             } 
    81         } 
     45     * Refresh this view 
     46     * 
     47     * @param obs the Observable we are watching 
     48     */ 
     49    public void refresh(Observable obs) 
     50    { 
     51        CADSimulatorStatus status = (CADSimulatorStatus) obs; 
     52        termConnectedTF.setText(String.valueOf(status.getNumClients())); 
     53        String yesno = "No"; 
     54        // Should we show yes or no? 
     55        if (status.isSimManagerConnected()) 
     56        { 
     57            yesno = "Yes"; 
     58        } 
     59        managerConnectedTF.setText(yesno); 
     60        simulationClockLabel.setText(status.getCurrentTime()); 
     61        setScriptStatus(status.getScriptStatus()); 
     62        setParamicsStatus(status.getParamicsStatus()); 
     63 
     64        String netText = status.getParmicsNetworkID(); 
     65        if (netText.length() == 0) 
     66        { 
     67            netText = "None"; 
     68        } 
     69        setParamicsNetworkLoaded(netText); 
     70 
     71        String msgOut = status.getInfoMessages(); 
     72        infoMessagesTA.setText(msgOut); 
     73        errorMessagesTA.setText(status.getErrorMessages()); 
    8274    } 
    8375    /** 
     
    8577     */ 
    8678    private int numClientsConnected = 0; 
    87     /** 
    88      * Logging ErrorHandler. 
    89      */ 
    90     private SimulatorErrorHandler errorHandler; 
    9179 
    9280    /** 
     
    10290        initMessagesPanes(); 
    10391 
    104         errorHandler = new SimulatorErrorHandler(); 
    105         Logger.getLogger("tmcsim.cadsimulator").addHandler(errorHandler); 
    106  
    107         CADSimulatorViewerBox = Box.createVerticalBox(); 
    108         CADSimulatorViewerBox.add(simulationTimeAndStatusBox); 
    109         CADSimulatorViewerBox.add(additionalInfoBox); 
    110         CADSimulatorViewerBox.add(infoMessagesPane); 
    111         CADSimulatorViewerBox.add(errorMessagesPane); 
    112  
    113         add(CADSimulatorViewerBox); 
    114     } 
    115  
    116     /** 
    117      * Method is called when a CAD Client disconnects from the CAD Simulator. 
    118      * The displayed number of connected clients is incremented by one. 
    119      */ 
    120     public void connectClient() 
    121     { 
    122  
    123         numClientsConnected++; 
    124  
    125         termConnectedTF.setText(String.valueOf(numClientsConnected)); 
    126     } 
    127  
    128     /** 
    129      * Method is called when a CAD Client disconnects from the CAD Simulator. 
    130      * The displayed number of connected clients is decremented by one. 
    131      */ 
    132     public void disconnectClient() 
    133     { 
    134  
    135         if (numClientsConnected > 0) 
    136         { 
    137             numClientsConnected--; 
    138         } 
    139  
    140         termConnectedTF.setText(String.valueOf(numClientsConnected)); 
    141     } 
    142  
    143     /** 
    144      * Method is called when Simulation Manager connects or disconnects. 
    145      * 
    146      * @param connection True if simulation manager is connected, false if not. 
    147      */ 
    148     public void setSimManagerStatus(boolean connection) 
    149     { 
    150  
    151         if (connection) 
    152         { 
    153             managerConnectedTF.setText("Yes"); 
    154         } else 
    155         { 
    156             managerConnectedTF.setText("No"); 
    157         } 
    158  
    159     } 
    160  
    161     /** 
    162      * Method called to convert current simulation time (parameter long value) 
    163      * to a string of format H:MM:SS. Time is then updated on GUI. 
    164      * 
    165      * @param seconds Long value of current time 
    166      */ 
    167     public void setTime(long seconds) 
    168     { 
    169         String time = new String(); 
    170         long timeSegment; 
    171  
    172         timeSegment = seconds / 3600; 
    173         time += String.valueOf(timeSegment) + ":"; 
    174  
    175         seconds = seconds % 3600; 
    176  
    177         timeSegment = seconds / 60; 
    178         if (timeSegment < 10) 
    179         { 
    180             time += "0"; 
    181         } 
    182  
    183         time += String.valueOf(timeSegment) + ":"; 
    184         seconds = seconds % 60; 
    185  
    186         timeSegment = seconds; 
    187         if (timeSegment < 10) 
    188         { 
    189             time += "0"; 
    190         } 
    191  
    192         time += String.valueOf(timeSegment); 
    193  
    194         simulationClockLabel.setText(time); 
    195  
     92        //  errorHandler = new SimulatorErrorHandler(); 
     93        //  Logger.getLogger("tmcsim.cadsimulator").addHandler(errorHandler); 
     94 
     95        cadSimulatorViewerBox = Box.createVerticalBox(); 
     96        cadSimulatorViewerBox.add(simulationTimeAndStatusBox); 
     97        cadSimulatorViewerBox.add(additionalInfoBox); 
     98        cadSimulatorViewerBox.add(infoMessagesPane); 
     99        cadSimulatorViewerBox.add(errorMessagesPane); 
     100 
     101        add(cadSimulatorViewerBox); 
    196102    } 
    197103 
     
    206112    protected void displayError(String errorMessage) 
    207113    { 
     114        // Do we clear or append? 
    208115        if (errorMessage == null) 
    209116        { 
    210117            errorMessagesTA.setText(""); 
    211         } else 
     118        } 
     119        else 
    212120        { 
    213121            errorMessagesTA.append(errorMessage + "\n"); 
     
    253161     * </table> 
    254162     */ 
    255     public void setScriptStatus(SCRIPT_STATUS newStatus) 
    256     { 
    257  
     163    private void setScriptStatus(SCRIPT_STATUS newStatus) 
     164    { 
     165        // Display text based on status value 
    258166        switch (newStatus) 
    259167        { 
     
    291199     * or dropped. 
    292200     */ 
    293     public void setParamicsStatus(PARAMICS_STATUS newStatus) 
    294     { 
    295  
     201    private void setParamicsStatus(PARAMICS_STATUS newStatus) 
     202    { 
     203        // Display text based on status value 
    296204        switch (newStatus) 
    297205        { 
     
    310218     * @param networkID Unique ID for Paramics network that has been loaded. 
    311219     */ 
    312     public void setParamicsNetworkLoaded(String networkID) 
     220    private void setParamicsNetworkLoaded(String networkID) 
    313221    { 
    314222        networkLoadedTF.setText(networkID); 
     
    325233        simulationStatus = new JLabel("Simulation Status"); 
    326234        simulationStatusText = new JLabel("No Script"); 
     235        simulationStatusText.setName("simulationStatusText"); 
    327236 
    328237        simulationTime.setLayout(new BorderLayout()); 
     
    470379    private Box paramicsConnectedBox; 
    471380    private Box networkLoadedBox; 
    472     private Box CADSimulatorViewerBox; 
     381    private Box cadSimulatorViewerBox; 
    473382    private Box simulationTimeAndStatusBox; 
    474383    private Box simulationStatusBox; 
  • trunk/test/tmcsim/simulationmanager/SimulationManagerSmokeTest.java

    r43 r44  
    5555                    } catch (Exception e) 
    5656                    { 
     57                        e.printStackTrace(); 
    5758                        fail("Couldn't launch CADSimulator"); 
    5859                    } 
Note: See TracChangeset for help on using the changeset viewer.