- Timestamp:
- 06/28/2016 02:25:42 PM (10 years ago)
- Location:
- trunk/src/tmcsim
- Files:
-
- 2 added
- 8 edited
-
application.properties (modified) (1 diff)
-
paramicscommunicator/PComm.java (added)
-
paramicscommunicator/ParamicsCommunicator.java (modified) (5 diffs)
-
paramicscommunicator/ParamicsFileReader.java (modified) (7 diffs)
-
paramicscommunicator/gui/ParamicsCommunicatorGUI.java (modified) (7 diffs)
-
paramicslog/ParamicsLog.java (modified) (10 diffs)
-
paramicslog/ParamicsLogFileHandler.java (added)
-
paramicslog/gui/ParamicsLogGUI.java (modified) (4 diffs)
-
simulationmanager/SimulationManager.java (modified) (3 diffs)
-
simulationmanager/SimulationManagerView.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tmcsim/application.properties
r44 r47 1 #T hu, 23 Jun 2016 19:19:14-07001 #Tue, 28 Jun 2016 14:56:40 -0700 2 2 3 Application.revision=4 33 Application.revision=44 4 4 5 Application.buildnumber=1 5 Application.buildnumber=10 -
trunk/src/tmcsim/paramicscommunicator/ParamicsCommunicator.java
r33 r47 19 19 import java.util.logging.Level; 20 20 import java.util.logging.Logger; 21 21 import javax.swing.JFrame; 22 22 import javax.swing.JOptionPane; 23 23 import javax.swing.UIManager; … … 140 140 public ParamicsCommunicator(String propertiesFile) 141 141 { 142 paramLogger.logp(Level.INFO, "ParamicsCommunicator", "Constructor", 143 "Entering "); 142 144 143 145 writers = new TreeMap<String, ParamicsFileWriter>(); 144 146 readers = new TreeMap<String, ParamicsFileReader>(); 145 147 148 theGUI = new ParamicsCommunicatorGUI(); 149 addObserver(theGUI); 150 theGUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 146 151 try 147 152 { … … 301 306 "Dropped Connection", JOptionPane.ERROR_MESSAGE); 302 307 break; 308 } 309 try 310 { 311 Thread.sleep(2000); 312 paramLogger.logp(Level.INFO, "ParamicsCommunicator", 313 "run", "sleeping."); 314 } catch (InterruptedException ex) 315 { 316 paramLogger.logp(Level.INFO, "ParamicsCommunicator", 317 "run", "Exception in reading data from the socket.", ex); 303 318 } 304 319 } … … 456 471 } catch (SocketTimeoutException ste) 457 472 { 458 System.out.println("...waiting for socket connection from the CAD Simulator..."); 473 System.out.println("...waiting..."); 474 try 475 { 476 Thread.sleep(2000); 477 paramLogger.logp(Level.INFO, "ParamicsCommunicator", 478 "initializeSockets", "sleeping."); 479 } catch (InterruptedException ex) 480 { 481 paramLogger.logp(Level.INFO, "ParamicsCommunicator", 482 "initializeSockets", "Exception exiting for socket.", ex); 483 } 459 484 } catch (IOException ioe) 460 485 { … … 462 487 + "the receiving socket on port " + socketPort); 463 488 } 489 464 490 } 465 491 -
trunk/src/tmcsim/paramicscommunicator/ParamicsFileReader.java
r40 r47 5 5 import java.io.FileWriter; 6 6 import java.io.IOException; 7 import java.text.SimpleDateFormat; 7 8 import java.util.Observable; 8 9 import java.util.Timer; … … 67 68 */ 68 69 private long readerInterval; 70 /** 71 * Time formatter for diagnostic messages 72 */ 73 private SimpleDateFormat formatter; 69 74 70 75 /** … … 80 85 public void run() 81 86 { 82 // paramLogger.logp(Level.INFO, 83 // "ParamicsFileReader.ReaderTimerTask", "run()", 84 // "Waiting for " + inputFile + " to be modified."); 87 // System.out.println( 88 // "Checking last modified time on " + inputFile.getName() 89 // + formatter.format(lastModified) + ":" + formatter.format(inputFile.lastModified())); 90 85 91 if (lastModified < inputFile.lastModified()) 86 92 { 87 // paramLogger.logp(Level.INFO,88 // "ParamicsFileReader.ReaderTimerTask", "run()",89 // "Cool, " + inputFile + " has been modified, let's read it.");90 93 91 94 try … … 101 104 Element messageElem = readerDoc.createElement(PARAMICS_COMM_TAGS.MESSAGE.tag); 102 105 String fileContents = readFromFile(); 103 // int stringlen = Math.min(160, fileContents.length()-1);104 // Log two lines that were read105 // paramLogger.logp(Level.INFO,106 // "ParamicsFileReader.ReaderTimerTask", "run()",107 // "Nice, we read " + fileContents.length() + " bytes.");108 106 messageElem.appendChild(readerDoc.createTextNode(fileContents)); 109 107 readerElem.appendChild(messageElem); … … 142 140 try 143 141 { 142 formatter = new SimpleDateFormat("HH:mm:ss"); 144 143 readerID = id; 145 144 readerInterval = interval; … … 159 158 { 160 159 paramLogger.logp(Level.SEVERE, "ParamicsFileReader", 161 "Constructor()", "Exception in initializing file reading .", ioe);160 "Constructor()", "Exception in initializing file reading of "+workingDir + targetFile, ioe); 162 161 } 163 162 } … … 194 193 195 194 lastModified = inputFile.lastModified(); 195 // System.out.println( 196 // "Read from a file last modified at " + formatter.format(lastModified)); 196 197 197 198 setChanged(); -
trunk/src/tmcsim/paramicscommunicator/gui/ParamicsCommunicatorGUI.java
r29 r47 11 11 import java.util.logging.LogRecord; 12 12 import java.util.logging.Logger; 13 14 13 import javax.swing.BorderFactory; 15 14 import javax.swing.Box; … … 21 20 import javax.swing.JTabbedPane; 22 21 import javax.swing.JTextArea; 23 24 22 import tmcsim.common.RevisionNumber; 25 23 import tmcsim.paramicscommunicator.FileIOUpdate; … … 126 124 "Exception in receiving FileIOUpdate object.", e); 127 125 } 128 } else if (arg instanceof FileRegUpdate) 126 } 127 else if (arg instanceof FileRegUpdate) 129 128 { 130 129 try … … 218 217 BorderFactory.createRaisedBevelBorder(), "Registered Readers "), 219 218 BorderFactory.createEmptyBorder(5, 5, 5, 5))); 220 219 221 220 fileWriterTabs = new JTabbedPane(); 222 221 fileWriterTabs.setAlignmentX(Box.CENTER_ALIGNMENT); … … 243 242 tabbedBox.add(fileReaderTabs); 244 243 tabbedBox.add(fileWriterTabs); 245 244 246 245 Box guiBox = new Box(BoxLayout.Y_AXIS); 247 246 guiBox.add(tabbedBox); … … 255 254 setResizable(false); 256 255 pack(); 257 setVisible(true);256 //setVisible(true); 258 257 } 259 258 … … 284 283 285 284 } 286 287 285 private JTabbedPane fileReaderTabs; 288 286 private JTabbedPane fileWriterTabs; -
trunk/src/tmcsim/paramicslog/ParamicsLog.java
r33 r47 10 10 import java.util.logging.Level; 11 11 import java.util.logging.Logger; 12 13 12 import javax.swing.JOptionPane; 14 15 import org.w3c.dom.Element;16 17 13 import tmcsim.common.SimulationException; 18 14 import tmcsim.interfaces.CoordinatorInterface; … … 21 17 /** 22 18 * Logs communication from ParamicsCommunicator to ParamicsSimulator. 23 * 24 * The system property "PARAMICS_LOG_CONFIG" should be set to the path 25 * where theproperties file for this class is located. <br><br>19 * 20 * The system property "PARAMICS_LOG_CONFIG" should be set to the path where the 21 * properties file for this class is located. <br><br> 26 22 * The data for the properties file follows. <br> 27 23 * <code> 28 24 * -----------------------------------------------------------------<br> 29 * Log File The file to write the communication to. 30 * CAD Simulator Host The host that runs the CAD Simulator. 31 * CAD Simulator RMI Port The port on the host that runs the CAD 32 * Simulator where the RMI Coordinator 33 * object is registered to. 25 * Log File The file to write the communication to. CAD Simulator Host The host 26 * that runs the CAD Simulator. CAD Simulator RMI Port The port on the host that 27 * runs the CAD Simulator where the RMI Coordinator object is registered to. 34 28 * -----------------------------------------------------------------<br> 35 29 * Example File: <br> 36 * LogFile=c:\\log.txt 37 * CADSimulatorHost=localhost 38 * CADSimulatorRMIPort=4445 30 * LogFile=c:\\log.txt CADSimulatorHost=localhost CADSimulatorRMIPort=4445 39 31 * -----------------------------------------------------------------<br> 40 32 * </code> 41 * 33 * 42 34 * @author Nathaniel Lehrer 43 * @version 35 * @version 44 36 */ 45 public class ParamicsLog extends Observable 46 { 37 public class ParamicsLog extends Observable 38 { 39 47 40 /** 48 41 * Enmeration containing property names. 42 * 49 43 * @author Nathaniel Lehrer 50 44 */ 51 private enum PROPERTIES 52 { 53 LOG_FILE ("LogFile"), 54 CAD_SIM_HOST ("CADSimulatorHost"),55 CAD_SIM_ PORT ("CADSimulatorRMIPort");56 45 private enum PROPERTIES 46 { 47 48 LOG_FILE("LogFile"), 49 CAD_SIM_HOST("CADSimulatorHost"), 50 CAD_SIM_PORT("CADSimulatorRMIPort"); 57 51 public String name; 58 52 59 53 private PROPERTIES(String n) 60 54 { … … 62 56 } 63 57 } 64 65 private static final String CONFIG_FILE_NAME = "paramics_communicator_logging.properties"; 66 67 /** Error logger.*/58 private static final String CONFIG_FILE_NAME = "paramics_communicator_logging.properties"; 59 /** 60 * Error logger. 61 */ 68 62 private static Logger paramLogger = Logger.getLogger("tmcsim.paramicslog"); 69 70 /** Static instance. */ 63 /** 64 * Static instance. 65 */ 71 66 private static ParamicsLog instance; 72 73 /** Properties object. */ 67 /** 68 * Properties object. 69 */ 74 70 private Properties paramicsLogProp; 75 76 /** File log entries are written to */ 71 /** 72 * File log entries are written to 73 */ 77 74 private File logFile; 78 79 /** Stores the log entries. This contains the same information logFile. */ 75 /** 76 * Stores the log entries. This contains the same information logFile. 77 */ 80 78 private StringBuilder log; 81 82 /** Remote reference to the simulation */ 79 /** 80 * Remote reference to the simulation 81 */ 83 82 private CoordinatorInterface theCoorInt; 84 85 /** Object for synchronizing IO */ 83 /** 84 * Object for synchronizing IO 85 */ 86 86 Object lock; 87 87 88 88 /** 89 89 * Creates the singleton instance of this class. 90 90 */ 91 static { 92 try { 93 if(System.getProperty("CONFIG_DIR") == null){ 94 System.setProperty("CONFIG_DIR", "config"); 95 } 96 97 instance = new ParamicsLog(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + CONFIG_FILE_NAME); 98 } 99 catch (Exception e) 91 static 92 { 93 try 94 { 95 if (System.getProperty("CONFIG_DIR") == null) 96 { 97 System.setProperty("CONFIG_DIR", "config"); 98 } 99 100 instance = new ParamicsLog(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + CONFIG_FILE_NAME); 101 } catch (Exception e) 100 102 { 101 103 instance = new ParamicsLog(); 102 103 paramLogger.logp(Level.WARNING, "ParamicsLog", "static initializer", 104 105 paramLogger.logp(Level.WARNING, "ParamicsLog", "static initializer", 104 106 "Error occured initializing application", e); 105 107 106 JOptionPane.showMessageDialog(null, e.getMessage(), 107 "Error - ParamicsLog will not save log to file.", 108 JOptionPane.ERROR_MESSAGE); 109 } 110 108 JOptionPane.showMessageDialog(null, e.getMessage(), 109 "Error - ParamicsLog will not save log to file.", 110 JOptionPane.ERROR_MESSAGE); 111 } 112 111 113 instance.addObserver(ParamicsLogGUI.getInstance()); 112 114 } 113 114 /** 115 * Creates an instance of ParamicsLog that does not write to a file when 115 116 /** 117 * Creates an instance of ParamicsLog that does not write to a file when 116 118 * writeToLog is called. 117 119 */ 118 private ParamicsLog() { 119 120 private ParamicsLog() 121 { 122 120 123 lock = new Object(); 121 124 log = new StringBuilder(""); 122 125 } 123 124 /** 125 * Creates an instance of ParamicsLog that writes to a file when writeToLog is called. 126 127 /** 128 * Creates an instance of ParamicsLog that writes to a file when writeToLog 129 * is called. 130 * 126 131 * @param propertiesFile 127 132 */ 128 private ParamicsLog(String propertiesFile) { 133 private ParamicsLog(String propertiesFile) 134 { 129 135 this(); 130 136 131 137 String logFile = null; 132 138 String CADSIMHost = null; 133 139 String CADSIMPort = null; 134 135 try { 140 141 try 142 { 136 143 paramicsLogProp = new Properties(); 137 144 paramicsLogProp.load(new FileInputStream(propertiesFile)); 138 145 139 146 if ((logFile = paramicsLogProp.getProperty(PROPERTIES.LOG_FILE.name)) == null) 140 147 { … … 142 149 } 143 150 else if ((CADSIMHost = paramicsLogProp.getProperty(PROPERTIES.CAD_SIM_HOST.name)) == null) 144 { 151 { 145 152 throw new Exception("Properties file missing CAD Simulator host."); 146 153 } … … 149 156 throw new Exception("Properties file missing CAD Simulator RMI port."); 150 157 } 151 158 152 159 try 153 160 { 154 161 connect(CADSIMHost, CADSIMPort); 155 } 156 catch (Exception e) 157 { 158 JOptionPane.showMessageDialog(null, 159 "ParamicsLog: Could not connect to remote Coordinator object.", 160 "Network Error", JOptionPane.ERROR_MESSAGE); 161 } 162 163 try 162 } catch (Exception e) 163 { 164 JOptionPane.showMessageDialog(null, 165 "ParamicsLog: Could not connect to remote Coordinator object.", 166 "Network Error", JOptionPane.ERROR_MESSAGE); 167 } 168 169 try 164 170 { 165 171 createLogFile(logFile); 166 } 167 catch (Exception e) 168 { 169 JOptionPane.showMessageDialog(null, 170 "ParamicsLog: Could not create new log file.", 172 } catch (Exception e) 173 { 174 JOptionPane.showMessageDialog(null, 175 "ParamicsLog: Could not create new log file.", 171 176 "File Error", JOptionPane.ERROR_MESSAGE); 172 177 } 173 174 } catch (Exception e) { 175 176 paramLogger.logp(Level.WARNING, "ParamicsLog", "ParamicsLog constructor", 178 179 } catch (Exception e) 180 { 181 182 paramLogger.logp(Level.WARNING, "ParamicsLog", "ParamicsLog constructor", 177 183 "Properties file incorrect or missing.", e); 178 179 JOptionPane.showMessageDialog(null, 180 "ParamicsLog: Properties file invalid.", 184 185 JOptionPane.showMessageDialog(null, 186 "ParamicsLog: Properties file invalid.", 181 187 "Invalid Configuration", JOptionPane.ERROR_MESSAGE); 182 188 } 183 189 } 184 190 185 191 /** 186 192 * Creates the log file. 193 * 187 194 * @param filePath The path to the file including the file name. 188 195 * @throws IOException If the log file could not be created. … … 190 197 private void createLogFile(String filePath) throws IOException 191 198 { 192 try { 199 try 200 { 193 201 logFile = new File(filePath); 194 195 if (logFile.exists()) { 202 203 if (logFile.exists()) 204 { 196 205 logFile.delete(); 197 206 } 198 207 199 208 logFile.createNewFile(); 200 201 } catch (Exception e) { 202 209 210 } catch (Exception e) 211 { 212 203 213 logFile = null; 204 205 paramLogger.logp(Level.WARNING, "ParamicsLog", "ParamicsLog constructor", 214 215 paramLogger.logp(Level.WARNING, "ParamicsLog", "ParamicsLog constructor", 206 216 "Could not create new log file.", e); 207 217 208 218 throw new IOException("Could not create log file."); 209 } 210 } 211 219 } 220 } 221 212 222 /** 213 223 * Connect to the Coordinator's RMI object. 214 * @param hostname Host name of the CAD Simulator. 215 * @param portNumber Port number of the CAD Simulator RMI communication. 216 * @throws SimulationException if there is an error creating the RMI connection. 217 */ 218 private void connect(String hostname, String portNumber) 219 throws SimulationException { 220 224 * 225 * @param hostname Host name of the CAD Simulator. 226 * @param portNumber Port number of the CAD Simulator RMI communication. 227 * @throws SimulationException if there is an error creating the RMI 228 * connection. 229 */ 230 private void connect(String hostname, String portNumber) 231 throws SimulationException 232 { 233 221 234 String coorIntURL = ""; 222 223 try {224 coorIntURL = "rmi://" + hostname + ":" + portNumber + "/coordinator";225 226 theCoorInt = (CoordinatorInterface)Naming.lookup(coorIntURL); 227 }228 catch (Exception e)229 { 230 paramLogger.logp(Level.WARNING, "ParamicsLog", 231 "establishRMIConnection", "Unable to establish RMI " +232 "communication with the CAD Simulator. URL <" + coorIntURL + ">", e);233 } 234 } 235 235 236 try 237 { 238 coorIntURL = "rmi://" + hostname + ":" + portNumber + "/coordinator"; 239 240 theCoorInt = (CoordinatorInterface) Naming.lookup(coorIntURL); 241 } catch (Exception e) 242 { 243 paramLogger.logp(Level.WARNING, "ParamicsLog", 244 "establishRMIConnection", "Unable to establish RMI " 245 + "communication with the CAD Simulator. URL <" + coorIntURL + ">", e); 246 } 247 } 248 236 249 /** 237 250 * Accessor to the entries in the log. No file IO is used. 251 * 238 252 * @return The entries in the log. 239 253 */ 240 public String getLog() { 241 254 public String getLog() 255 { 256 242 257 return log.toString(); 243 258 } 244 245 /** 246 * Writes an entry to the log. 247 * The simulator time when the message was sent is prepended to the entry.248 * Entries are padded by a blank line before and after them.249 * TODO: Ensure output is written in order of request.259 260 /** 261 * Writes an entry to the log. The simulator time when the message was sent 262 * is prepended to the entry. Entries are padded by a blank line before and 263 * after them. TODO: Ensure output is written in order of request. 264 * 250 265 * @param entry 251 266 */ 252 public void writeToLog(String entry) { 253 267 public void writeToLog(String entry) 268 { 269 254 270 String time = "?"; 255 271 String formattedEntry; 256 272 257 273 if (theCoorInt != null) 258 274 { … … 260 276 { 261 277 time = formatTime(theCoorInt.getCurrentSimulationTime()); 262 } 263 catch (Exception e) 264 { 265 paramLogger.logp(Level.WARNING, "ParamicsLog", 278 } catch (Exception e) 279 { 280 paramLogger.logp(Level.WARNING, "ParamicsLog", 266 281 "RMICommunication", "Unable to communicate with RMI object", e); 267 282 } 268 283 } 269 284 270 285 formattedEntry = "\n" + "<!-- Time written to file: " + time + " -->\n" + entry + "\n"; 271 286 log.append(formattedEntry); 272 287 273 288 if (logFile != null) 274 289 { 275 try 276 { 277 synchronized (lock)290 try 291 { 292 synchronized (lock) 278 293 { 279 294 FileWriter writer = new FileWriter(logFile, true); … … 282 297 writer.close(); 283 298 } 284 } 285 catch (IOException e) 286 { 287 paramLogger.logp(Level.WARNING, "ParamicsLog", "writeToLog", 299 } catch (IOException e) 300 { 301 paramLogger.logp(Level.WARNING, "ParamicsLog", "writeToLog", 288 302 "Could not write to log file.", e); 289 303 } 290 304 } 291 305 292 306 setChanged(); 293 307 notifyObservers(entry); 294 308 } 295 309 296 310 /** 297 311 * Formats the time given in seconds to hh:mm:ss format. 312 * 298 313 * @param time The time in seconds. 299 314 */ 300 p rivateString formatTime(long time)315 public String formatTime(long time) 301 316 { 302 317 long seconds = time % 60; … … 306 321 return padr(hours) + ":" + padr(minutes) + ":" + padr(seconds); 307 322 } 308 323 309 324 private String padr(long n) 310 325 { … … 317 332 } 318 333 } 319 334 320 335 /** 321 336 * Accessor for static instance of this class. 337 * 322 338 * @return The instance of this class. 323 339 */ 324 public static ParamicsLog getInstance() { 325 340 public static ParamicsLog getInstance() 341 { 342 326 343 return instance; 327 344 } -
trunk/src/tmcsim/paramicslog/gui/ParamicsLogGUI.java
r2 r47 1 1 package tmcsim.paramicslog.gui; 2 2 3 import javax.swing.*;4 3 import java.awt.event.WindowEvent; 5 4 import java.util.*; 5 import javax.swing.*; 6 6 7 7 /** 8 * The UI for ParamicsLog. 8 * The UI for ParamicsLog. 9 * 9 10 * @author Nathaniel Lehrer 10 11 * @version 11 12 */ 12 public class ParamicsLogGUI extends JFrame implements Observer { 13 public class ParamicsLogGUI extends JFrame implements Observer 14 { 13 15 14 /** The static instance */ 16 /** 17 * The static instance 18 */ 15 19 private static ParamicsLogGUI instance = new ParamicsLogGUI(); 20 /** 21 * The text area to display the log in 22 */ 23 private JTextArea textArea; 16 24 17 /** The text area to display the log in */18 private JTextArea textArea;19 20 /** Creates an instance of this class */21 public ParamicsLogGUI(){22 25 /** 26 * Creates an instance of this class 27 */ 28 public ParamicsLogGUI() 29 { 30 23 31 setupGUI(); 24 32 } 25 26 /** Creates the UI */ 33 34 /** 35 * Creates the UI 36 */ 27 37 private void setupGUI() 28 38 { 29 try { 39 try 40 { 30 41 UIManager.setLookAndFeel( 31 UIManager.getSystemLookAndFeelClassName()); 32 } catch (Exception e) { 42 UIManager.getSystemLookAndFeelClassName()); 43 } catch (Exception ex) 44 { 45 System.out.println(ex.getMessage()); 33 46 System.err.println("Couldn't use system look and feel."); 34 47 } 35 36 this.addWindowListener(new java.awt.event.WindowAdapter() {37 48 49 this.addWindowListener(new java.awt.event.WindowAdapter() 50 { 38 51 public void windowClosing(WindowEvent e) 39 52 { … … 41 54 } 42 55 }); 43 44 56 57 45 58 setTitle("Paramics Log"); 46 59 47 60 textArea = new JTextArea(); 48 61 textArea.setColumns(60); 49 62 textArea.setRows(30); 50 63 JScrollPane scrollPane = new JScrollPane(textArea); 51 64 52 65 getContentPane().add(scrollPane); 53 66 54 67 } 55 56 /** Shows the UI window */ 68 69 /** 70 * Shows the UI window 71 */ 57 72 public void display() 58 73 { … … 62 77 63 78 /** 64 * Updates the text area. If the observable class given is of type ParamicsLog then 65 * the log entries are displayed. 79 * Updates the text area. If the observable class given is of type 80 * ParamicsLog then the log entries are displayed. 81 * 66 82 * @param o The model for this viewer. 67 83 * @param arg An argument that is not used. … … 72 88 { 73 89 textArea.setText(((tmcsim.paramicslog.ParamicsLog) o).getLog()); 74 } 90 } 75 91 76 92 repaint(); 77 93 } 78 94 79 95 /** 80 96 * Accessor for the instance of ParamicsLogGUI. 97 * 81 98 * @return The instance of ParamicsLogGUI. 82 99 */ 83 public static ParamicsLogGUI getInstance() { 100 public static ParamicsLogGUI getInstance() 101 { 84 102 return instance; 85 103 } 86 87 104 } -
trunk/src/tmcsim/simulationmanager/SimulationManager.java
r33 r47 9 9 import java.util.logging.Level; 10 10 import java.util.logging.Logger; 11 12 11 import javax.swing.JOptionPane; 13 12 import javax.swing.UIManager; 14 15 13 import tmcsim.common.CADEnums.PARAMICS_STATUS; 14 import tmcsim.common.ScriptException; 16 15 import tmcsim.common.SimulationException; 17 16 … … 48 47 49 48 private static final String CONFIG_FILE_NAME = "sim_manager_config.properties"; 50 /**49 /** 51 50 * Error logger. 52 51 */ … … 192 191 193 192 /** 193 * Load a simulation script from the specified file. 194 * 195 * @param scriptFile the XML file containing the simulation control script 196 * to be run. 197 * @throws ScriptException if the script throws an exception 198 * @throws SimulationException if the simulation throws an exception 199 */ 200 public void loadScript(File scriptFile) throws ScriptException, SimulationException 201 { 202 theSimManagerModel.loadScript(scriptFile); 203 } 204 205 /** 194 206 * Main class. 195 207 * 196 208 * @param args Command line arguments. 197 209 */ 198 static public void main(String[] args) { 210 static public void main(String[] args) 211 { 199 212 //System.setProperty("swing.defaultlaf", "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); 200 if(System.getProperty("CONFIG_DIR") == null){ 201 System.setProperty("CONFIG_DIR", "config"); 202 } 203 204 try { 205 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 213 if (System.getProperty("CONFIG_DIR") == null) 214 { 215 System.setProperty("CONFIG_DIR", "config"); 216 } 217 218 try 219 { 220 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 206 221 new SimulationManager(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + CONFIG_FILE_NAME); 207 } catch (Exception e) { 222 } catch (Exception e) 223 { 208 224 simManLogger.logp(Level.SEVERE, "SimulationManager", "Main", 209 225 "Error occured initializing application", e); -
trunk/src/tmcsim/simulationmanager/SimulationManagerView.java
r9 r47 866 866 paramicsStatusLabel = new JLabel("Status:"); 867 867 paramicsStatusInfoLabel = new JLabel("Unknown"); 868 paramicsStatusInfoLabel.setName("paramicsStatusInfoLabel"); 868 869 paramicsStatusBox.add(paramicsStatusLabel); 869 870 paramicsStatusBox.add(Box.createHorizontalStrut(10));
Note: See TracChangeset
for help on using the changeset viewer.
