| Revision 3,
1.1 KB
checked in by jdalbey, 10 years ago
(diff) |
|
Initial Import of project files - cadclientgui
|
| Line | |
|---|
| 1 | package tmcsim.client.cadclientgui; |
|---|
| 2 | |
|---|
| 3 | import java.io.File; |
|---|
| 4 | import java.rmi.RemoteException; |
|---|
| 5 | |
|---|
| 6 | import javax.xml.parsers.SAXParserFactory; |
|---|
| 7 | |
|---|
| 8 | import tmcsim.client.cadclientgui.data.CADData; |
|---|
| 9 | |
|---|
| 10 | /** |
|---|
| 11 | * This class loads the XML script and parses through it in the ScriptHandler. Finally it stores the data from the XML |
|---|
| 12 | * into the CADData. |
|---|
| 13 | * @author Nicholas |
|---|
| 14 | * |
|---|
| 15 | */ |
|---|
| 16 | public class GUIScriptReader { |
|---|
| 17 | |
|---|
| 18 | public GUIScriptReader(String fp, CADData cadData) throws RemoteException |
|---|
| 19 | { |
|---|
| 20 | loadScriptFile(new File(fp),cadData); |
|---|
| 21 | } |
|---|
| 22 | |
|---|
| 23 | /* |
|---|
| 24 | * loads the script from the XML and stores the data in the CADData class. |
|---|
| 25 | */ |
|---|
| 26 | public static void loadScriptFile(File scriptFile,CADData cadData) throws RemoteException { |
|---|
| 27 | try { |
|---|
| 28 | |
|---|
| 29 | ScriptHandler sh = new ScriptHandler(); |
|---|
| 30 | SAXParserFactory.newInstance().newSAXParser().parse(scriptFile, sh); |
|---|
| 31 | //cadData.setUnitsFromXML(sh.getUnits()); |
|---|
| 32 | cadData.setIncidentsFromXML(sh.getIncidents()); |
|---|
| 33 | |
|---|
| 34 | } |
|---|
| 35 | catch (Exception e) {e.printStackTrace();} |
|---|
| 36 | } |
|---|
| 37 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.