- Timestamp:
- 11/20/2019 03:22:38 PM (6 years ago)
- Location:
- trunk/src/scriptbuilder
- Files:
-
- 6 edited
-
gui/IncidentEditorFrame.form (modified) (1 diff)
-
gui/IncidentEditorFrame.java (modified) (38 diffs)
-
gui/application.properties (modified) (1 diff)
-
gui/panels/IncidentTimelinePanel.java (modified) (7 diffs)
-
structures/SimulationScript.java (modified) (3 diffs)
-
structures/events/CHPRadioEvent.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/scriptbuilder/gui/IncidentEditorFrame.form
r135 r155 579 579 </Properties> 580 580 <AuxValues> 581 <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new scriptbuilder.gui.panels.IncidentTimelinePanel( false)"/>581 <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new scriptbuilder.gui.panels.IncidentTimelinePanel(true)"/> 582 582 </AuxValues> 583 583 -
trunk/src/scriptbuilder/gui/IncidentEditorFrame.java
r145 r155 54 54 private boolean addToEnd = true; 55 55 56 private TimeSlice selectedSlice; 57 58 /** 59 * Boolean determining if selectmode for events is enabled. 60 */ 61 62 public boolean selectMode = false; 56 63 /** 57 64 * The current type of selected event. … … 209 216 newButton = null; 210 217 } 211 218 if(e.getKeyCode() == KeyEvent.VK_CONTROL) 219 { 220 selectMode = true; 221 222 } 212 223 if (newButton != null) 213 224 { … … 226 237 public void keyReleased(KeyEvent e) 227 238 { 239 if(e.getKeyCode() == KeyEvent.VK_CONTROL) 240 { 241 selectMode = false; 242 243 } 228 244 } 229 245 … … 261 277 262 278 incidentNumberPanel1.update(theIncident); 279 263 280 cadButton.addKeyListener(new TimelineKeyListener()); 264 281 cctvButton.addKeyListener(new TimelineKeyListener()); … … 341 358 public void update(Observable o, Object arg) 342 359 { 343 System.out.println("the type of update is: " + arg.getClass());360 //System.out.println("the type of update is: " + arg.getClass()); 344 361 //Three possibilities: This is a general script update, or it's one of 345 362 //two different focus updates … … 368 385 else if (arg instanceof SliceChangedEvent) 369 386 { 387 //this seems to be only called when the window is initialized again 370 388 System.out.println("you got the hover over a timeslice"); 371 389 TimeSlice slice = ((SliceChangedEvent) arg).slice; … … 409 427 @SuppressWarnings("unchecked") 410 428 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents 411 private void initComponents() 412 { 429 private void initComponents() { 413 430 414 431 eventPopupMenu = new javax.swing.JPopupMenu(); … … 450 467 timelinesScrollPane = new javax.swing.JScrollPane(); 451 468 timelineTickPanel = new scriptbuilder.gui.panels.TimelineTickPanel(); 452 incidentTimelinePanel1 = new scriptbuilder.gui.panels.IncidentTimelinePanel( false);469 incidentTimelinePanel1 = new scriptbuilder.gui.panels.IncidentTimelinePanel(true); 453 470 incidentNumberPanel1 = new scriptbuilder.gui.panels.IncidentNumberPanel(); 454 471 scriptEventsPanel = new javax.swing.JPanel(); … … 495 512 496 513 cadEvent.setText("CAD Event"); 497 cadEvent.addMouseListener(new java.awt.event.MouseAdapter() 498 { 499 public void mousePressed(java.awt.event.MouseEvent evt) 500 { 514 cadEvent.addMouseListener(new java.awt.event.MouseAdapter() { 515 public void mousePressed(java.awt.event.MouseEvent evt) { 501 516 cadEventMousePressed(evt); 502 517 } 503 public void mouseReleased(java.awt.event.MouseEvent evt) 504 { 518 public void mouseReleased(java.awt.event.MouseEvent evt) { 505 519 cadEventMouseReleased(evt); 506 520 } … … 512 526 513 527 radioEvent.setText("Radio Event"); 514 radioEvent.addMouseListener(new java.awt.event.MouseAdapter() 515 { 516 public void mousePressed(java.awt.event.MouseEvent evt) 517 { 528 radioEvent.addMouseListener(new java.awt.event.MouseAdapter() { 529 public void mousePressed(java.awt.event.MouseEvent evt) { 518 530 radioEventMousePressed(evt); 519 531 } … … 569 581 570 582 okButton.setText("OK"); 571 okButton.addActionListener(new java.awt.event.ActionListener() 572 { 573 public void actionPerformed(java.awt.event.ActionEvent evt) 574 { 583 okButton.addActionListener(new java.awt.event.ActionListener() { 584 public void actionPerformed(java.awt.event.ActionEvent evt) { 575 585 okButtonActionPerformed(evt); 576 586 } … … 578 588 579 589 cancelButton.setText("Cancel"); 580 cancelButton.addActionListener(new java.awt.event.ActionListener() 581 { 582 public void actionPerformed(java.awt.event.ActionEvent evt) 583 { 590 cancelButton.addActionListener(new java.awt.event.ActionListener() { 591 public void actionPerformed(java.awt.event.ActionEvent evt) { 584 592 cancelButtonActionPerformed(evt); 585 593 } … … 624 632 625 633 editEventList.setText("Edit..."); 626 editEventList.addActionListener(new java.awt.event.ActionListener() 627 { 628 public void actionPerformed(java.awt.event.ActionEvent evt) 629 { 634 editEventList.addActionListener(new java.awt.event.ActionListener() { 635 public void actionPerformed(java.awt.event.ActionEvent evt) { 630 636 editEventListActionPerformed(evt); 631 637 } … … 669 675 670 676 btnCancelNoise.setText("Cancel"); 671 btnCancelNoise.addActionListener(new java.awt.event.ActionListener() 672 { 673 public void actionPerformed(java.awt.event.ActionEvent evt) 674 { 677 btnCancelNoise.addActionListener(new java.awt.event.ActionListener() { 678 public void actionPerformed(java.awt.event.ActionEvent evt) { 675 679 btnCancelNoiseActionPerformed(evt); 676 680 } … … 678 682 679 683 btnGenerateNoise.setText("Generate"); 680 btnGenerateNoise.addActionListener(new java.awt.event.ActionListener() 681 { 682 public void actionPerformed(java.awt.event.ActionEvent evt) 683 { 684 btnGenerateNoise.addActionListener(new java.awt.event.ActionListener() { 685 public void actionPerformed(java.awt.event.ActionEvent evt) { 684 686 btnGenerateNoiseActionPerformed(evt); 685 687 } … … 856 858 zoomSlider.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); 857 859 zoomSlider.setFocusable(false); 858 zoomSlider.addChangeListener(new javax.swing.event.ChangeListener() 859 { 860 public void stateChanged(javax.swing.event.ChangeEvent evt) 861 { 860 zoomSlider.addChangeListener(new javax.swing.event.ChangeListener() { 861 public void stateChanged(javax.swing.event.ChangeEvent evt) { 862 862 zoomSliderStateChanged(evt); 863 863 } … … 938 938 maintenanceRadioButton.setMargin(new java.awt.Insets(2, 10, 2, 10)); 939 939 maintenanceRadioButton.setPreferredSize(new java.awt.Dimension(30, 25)); 940 maintenanceRadioButton.addActionListener(new java.awt.event.ActionListener() 941 { 942 public void actionPerformed(java.awt.event.ActionEvent evt) 943 { 940 maintenanceRadioButton.addActionListener(new java.awt.event.ActionListener() { 941 public void actionPerformed(java.awt.event.ActionEvent evt) { 944 942 maintenanceRadioButtonActionPerformed(evt); 945 943 } … … 952 950 tmtRadioButton.setMargin(new java.awt.Insets(2, 10, 2, 10)); 953 951 tmtRadioButton.setPreferredSize(new java.awt.Dimension(30, 25)); 954 tmtRadioButton.addActionListener(new java.awt.event.ActionListener() 955 { 956 public void actionPerformed(java.awt.event.ActionEvent evt) 957 { 952 tmtRadioButton.addActionListener(new java.awt.event.ActionListener() { 953 public void actionPerformed(java.awt.event.ActionEvent evt) { 958 954 tmtRadioButtonActionPerformed(evt); 959 955 } … … 966 962 telephoneButton.setMargin(new java.awt.Insets(2, 10, 2, 10)); 967 963 telephoneButton.setPreferredSize(new java.awt.Dimension(30, 25)); 968 telephoneButton.addActionListener(new java.awt.event.ActionListener() 969 { 970 public void actionPerformed(java.awt.event.ActionEvent evt) 971 { 964 telephoneButton.addActionListener(new java.awt.event.ActionListener() { 965 public void actionPerformed(java.awt.event.ActionEvent evt) { 972 966 telephoneButtonActionPerformed(evt); 973 967 } … … 980 974 unitButton.setMargin(new java.awt.Insets(2, 10, 2, 10)); 981 975 unitButton.setPreferredSize(new java.awt.Dimension(30, 25)); 982 unitButton.addActionListener(new java.awt.event.ActionListener() 983 { 984 public void actionPerformed(java.awt.event.ActionEvent evt) 985 { 976 unitButton.addActionListener(new java.awt.event.ActionListener() { 977 public void actionPerformed(java.awt.event.ActionEvent evt) { 986 978 unitButtonActionPerformed(evt); 987 979 } … … 994 986 witnessButton.setMargin(new java.awt.Insets(2, 10, 2, 10)); 995 987 witnessButton.setPreferredSize(new java.awt.Dimension(30, 25)); 996 witnessButton.addActionListener(new java.awt.event.ActionListener() 997 { 998 public void actionPerformed(java.awt.event.ActionEvent evt) 999 { 988 witnessButton.addActionListener(new java.awt.event.ActionListener() { 989 public void actionPerformed(java.awt.event.ActionEvent evt) { 1000 990 witnessButtonActionPerformed(evt); 1001 991 } … … 1008 998 paramicsButton.setMargin(new java.awt.Insets(2, 10, 2, 10)); 1009 999 paramicsButton.setPreferredSize(new java.awt.Dimension(30, 25)); 1010 paramicsButton.addActionListener(new java.awt.event.ActionListener() 1011 { 1012 public void actionPerformed(java.awt.event.ActionEvent evt) 1013 { 1000 paramicsButton.addActionListener(new java.awt.event.ActionListener() { 1001 public void actionPerformed(java.awt.event.ActionEvent evt) { 1014 1002 paramicsButtonActionPerformed(evt); 1015 1003 } … … 1022 1010 towButton.setMargin(new java.awt.Insets(2, 10, 2, 10)); 1023 1011 towButton.setPreferredSize(new java.awt.Dimension(30, 25)); 1024 towButton.addActionListener(new java.awt.event.ActionListener() 1025 { 1026 public void actionPerformed(java.awt.event.ActionEvent evt) 1027 { 1012 towButton.addActionListener(new java.awt.event.ActionListener() { 1013 public void actionPerformed(java.awt.event.ActionEvent evt) { 1028 1014 towButtonActionPerformed(evt); 1029 1015 } … … 1036 1022 audioButton.setMargin(new java.awt.Insets(2, 10, 2, 10)); 1037 1023 audioButton.setPreferredSize(new java.awt.Dimension(30, 25)); 1038 audioButton.addActionListener(new java.awt.event.ActionListener() 1039 { 1040 public void actionPerformed(java.awt.event.ActionEvent evt) 1041 { 1024 audioButton.addActionListener(new java.awt.event.ActionListener() { 1025 public void actionPerformed(java.awt.event.ActionEvent evt) { 1042 1026 audioButtonActionPerformed(evt); 1043 1027 } … … 1050 1034 cctvButton.setMargin(new java.awt.Insets(2, 10, 2, 10)); 1051 1035 cctvButton.setPreferredSize(new java.awt.Dimension(30, 25)); 1052 cctvButton.addActionListener(new java.awt.event.ActionListener() 1053 { 1054 public void actionPerformed(java.awt.event.ActionEvent evt) 1055 { 1036 cctvButton.addActionListener(new java.awt.event.ActionListener() { 1037 public void actionPerformed(java.awt.event.ActionEvent evt) { 1056 1038 cctvButtonActionPerformed(evt); 1057 1039 } … … 1064 1046 cadButton.setMargin(new java.awt.Insets(2, 10, 2, 10)); 1065 1047 cadButton.setPreferredSize(new java.awt.Dimension(30, 25)); 1066 cadButton.addActionListener(new java.awt.event.ActionListener() 1067 { 1068 public void actionPerformed(java.awt.event.ActionEvent evt) 1069 { 1048 cadButton.addActionListener(new java.awt.event.ActionListener() { 1049 public void actionPerformed(java.awt.event.ActionEvent evt) { 1070 1050 cadButtonActionPerformed(evt); 1071 1051 } … … 1078 1058 chpRadioButton.setMargin(new java.awt.Insets(2, 10, 2, 10)); 1079 1059 chpRadioButton.setPreferredSize(new java.awt.Dimension(30, 25)); 1080 chpRadioButton.addActionListener(new java.awt.event.ActionListener() 1081 { 1082 public void actionPerformed(java.awt.event.ActionEvent evt) 1083 { 1060 chpRadioButton.addActionListener(new java.awt.event.ActionListener() { 1061 public void actionPerformed(java.awt.event.ActionEvent evt) { 1084 1062 chpRadioButtonActionPerformed(evt); 1085 1063 } … … 1150 1128 atmsEvalButton.setMargin(new java.awt.Insets(2, 10, 2, 10)); 1151 1129 atmsEvalButton.setPreferredSize(new java.awt.Dimension(30, 25)); 1152 atmsEvalButton.addActionListener(new java.awt.event.ActionListener() 1153 { 1154 public void actionPerformed(java.awt.event.ActionEvent evt) 1155 { 1130 atmsEvalButton.addActionListener(new java.awt.event.ActionListener() { 1131 public void actionPerformed(java.awt.event.ActionEvent evt) { 1156 1132 atmsEvalButtonActionPerformed(evt); 1157 1133 } … … 1164 1140 cmsEvalButton.setMargin(new java.awt.Insets(2, 10, 2, 10)); 1165 1141 cmsEvalButton.setPreferredSize(new java.awt.Dimension(30, 25)); 1166 cmsEvalButton.addActionListener(new java.awt.event.ActionListener() 1167 { 1168 public void actionPerformed(java.awt.event.ActionEvent evt) 1169 { 1142 cmsEvalButton.addActionListener(new java.awt.event.ActionListener() { 1143 public void actionPerformed(java.awt.event.ActionEvent evt) { 1170 1144 cmsEvalButtonActionPerformed(evt); 1171 1145 } … … 1178 1152 cadEvalButton.setMargin(new java.awt.Insets(2, 10, 2, 10)); 1179 1153 cadEvalButton.setPreferredSize(new java.awt.Dimension(30, 25)); 1180 cadEvalButton.addActionListener(new java.awt.event.ActionListener() 1181 { 1182 public void actionPerformed(java.awt.event.ActionEvent evt) 1183 { 1154 cadEvalButton.addActionListener(new java.awt.event.ActionListener() { 1155 public void actionPerformed(java.awt.event.ActionEvent evt) { 1184 1156 cadEvalButtonActionPerformed(evt); 1185 1157 } … … 1192 1164 facilitatorEvalButton.setMargin(new java.awt.Insets(2, 10, 2, 10)); 1193 1165 facilitatorEvalButton.setPreferredSize(new java.awt.Dimension(30, 25)); 1194 facilitatorEvalButton.addActionListener(new java.awt.event.ActionListener() 1195 { 1196 public void actionPerformed(java.awt.event.ActionEvent evt) 1197 { 1166 facilitatorEvalButton.addActionListener(new java.awt.event.ActionListener() { 1167 public void actionPerformed(java.awt.event.ActionEvent evt) { 1198 1168 facilitatorEvalButtonActionPerformed(evt); 1199 1169 } … … 1206 1176 activityLogEvalButton.setMargin(new java.awt.Insets(2, 10, 2, 10)); 1207 1177 activityLogEvalButton.setPreferredSize(new java.awt.Dimension(30, 25)); 1208 activityLogEvalButton.addActionListener(new java.awt.event.ActionListener() 1209 { 1210 public void actionPerformed(java.awt.event.ActionEvent evt) 1211 { 1178 activityLogEvalButton.addActionListener(new java.awt.event.ActionListener() { 1179 public void actionPerformed(java.awt.event.ActionEvent evt) { 1212 1180 activityLogEvalButtonActionPerformed(evt); 1213 1181 } … … 1220 1188 radioEvalButton.setMargin(new java.awt.Insets(2, 10, 2, 10)); 1221 1189 radioEvalButton.setPreferredSize(new java.awt.Dimension(30, 25)); 1222 radioEvalButton.addActionListener(new java.awt.event.ActionListener() 1223 { 1224 public void actionPerformed(java.awt.event.ActionEvent evt) 1225 { 1190 radioEvalButton.addActionListener(new java.awt.event.ActionListener() { 1191 public void actionPerformed(java.awt.event.ActionEvent evt) { 1226 1192 radioEvalButtonActionPerformed(evt); 1227 1193 } … … 1267 1233 zoomInIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/ZoomIn.png"))); // NOI18N 1268 1234 zoomInIcon.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); 1269 zoomInIcon.addMouseListener(new java.awt.event.MouseAdapter() 1270 { 1271 public void mouseClicked(java.awt.event.MouseEvent evt) 1272 { 1235 zoomInIcon.addMouseListener(new java.awt.event.MouseAdapter() { 1236 public void mouseClicked(java.awt.event.MouseEvent evt) { 1273 1237 zoomInIconMouseClicked(evt); 1274 1238 } … … 1277 1241 zoomOutIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/ZoomOut.png"))); // NOI18N 1278 1242 zoomOutIcon.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); 1279 zoomOutIcon.addMouseListener(new java.awt.event.MouseAdapter() 1280 { 1281 public void mouseClicked(java.awt.event.MouseEvent evt) 1282 { 1243 zoomOutIcon.addMouseListener(new java.awt.event.MouseAdapter() { 1244 public void mouseClicked(java.awt.event.MouseEvent evt) { 1283 1245 zoomOutIconMouseClicked(evt); 1284 1246 } … … 1320 1282 1321 1283 btnAddTime.setText("+15"); 1322 btnAddTime.addActionListener(new java.awt.event.ActionListener() 1323 { 1324 public void actionPerformed(java.awt.event.ActionEvent evt) 1325 { 1284 btnAddTime.addActionListener(new java.awt.event.ActionListener() { 1285 public void actionPerformed(java.awt.event.ActionEvent evt) { 1326 1286 btnAddTimeActionPerformed(evt); 1327 1287 } … … 1329 1289 1330 1290 btnToggleTimeStart.setText("to Start"); 1331 btnToggleTimeStart.addActionListener(new java.awt.event.ActionListener() 1332 { 1333 public void actionPerformed(java.awt.event.ActionEvent evt) 1334 { 1291 btnToggleTimeStart.addActionListener(new java.awt.event.ActionListener() { 1292 public void actionPerformed(java.awt.event.ActionEvent evt) { 1335 1293 btnToggleTimeStartActionPerformed(evt); 1336 1294 } … … 1339 1297 btnToggleTimeEnd.setSelected(true); 1340 1298 btnToggleTimeEnd.setText("to End"); 1341 btnToggleTimeEnd.addActionListener(new java.awt.event.ActionListener() 1342 { 1343 public void actionPerformed(java.awt.event.ActionEvent evt) 1344 { 1299 btnToggleTimeEnd.addActionListener(new java.awt.event.ActionListener() { 1300 public void actionPerformed(java.awt.event.ActionEvent evt) { 1345 1301 btnToggleTimeEndActionPerformed(evt); 1346 1302 } -
trunk/src/scriptbuilder/gui/application.properties
r145 r155 1 # Thu, 31 Oct 2019 16:04:24 -07001 #Wed, 20 Nov 2019 16:03:11 -0800 2 2 3 Application.revision=1 443 Application.revision=154 4 4 5 5 Application.buildnumber=43 -
trunk/src/scriptbuilder/gui/panels/IncidentTimelinePanel.java
r150 r155 63 63 * If true, right-clicking on this panel will produce the popup menu. 64 64 */ 65 private boolean hasPopupAccess; 65 private boolean hasPopupAccessRightClick; 66 /** 67 * If true, left-clicking on this panel will produce the popup menu. 68 */ 69 private boolean hasPopupAccessLeftClick; 66 70 67 71 int cursorTime, lastSlice, x, y; … … 250 254 251 255 addTime = -(addTime-(addTime%20)); 252 256 //this if statement might be useless? 253 257 if(offset<=incident.offset+incident.length) 254 258 { … … 274 278 275 279 // Does user want a popup menu? 276 if (e.isPopupTrigger() && hasPopupAccess) 280 if (e.isPopupTrigger() && hasPopupAccessRightClick) 281 { 282 if(getTopLevelAncestor() instanceof IncidentEditorFrame) 283 { 284 if (((IncidentEditorFrame)getTopLevelAncestor()).currentEventType == null){ 285 JPopupMenu popup = createPopup(currentMouseX,currentMouseY); 286 popup.show(e.getComponent(), currentMouseX, currentMouseY); 287 288 } 289 290 }else 291 { 292 JPopupMenu popup = createPopup(); 293 popup.show(e.getComponent(), currentMouseX, currentMouseY); 294 } 295 296 297 298 } 299 } 300 @Override 301 public void mouseReleased(MouseEvent e) 302 { 303 int currentMouseX = e.getX(); 304 int currentMouseY = e.getY(); 305 306 // Does user want a popup menu? 307 if (e.isPopupTrigger() && hasPopupAccessRightClick) 277 308 { 278 309 if(getTopLevelAncestor() instanceof IncidentEditorFrame) … … 285 316 popup.show(e.getComponent(), currentMouseX, currentMouseY); 286 317 } 287 288 289 290 }291 }292 @Override293 public void mouseReleased(MouseEvent e)294 {295 int currentMouseX = e.getX();296 int currentMouseY = e.getY();297 298 // Does user want a popup menu?299 if (e.isPopupTrigger() && hasPopupAccess)300 {301 JPopupMenu popup = createPopup();302 popup.show(e.getComponent(), currentMouseX, currentMouseY);303 318 } 304 319 } … … 323 338 else if (getTopLevelAncestor() instanceof IncidentEditorFrame) 324 339 { 340 325 341 incidentEditFrameCurrent = (IncidentEditorFrame) getTopLevelAncestor(); 326 342 editor = new Editor(incidentEditFrameCurrent); … … 485 501 super(); 486 502 487 hasPopupAccess = true;503 hasPopupAccessRightClick = true; 488 504 489 505 requestedEditorFillerTime = 0; … … 525 541 super(); 526 542 527 hasPopupAccess = usesPopup;543 hasPopupAccessRightClick = usesPopup; 528 544 529 545 requestedEditorFillerTime = 0; -
trunk/src/scriptbuilder/structures/SimulationScript.java
r145 r155 5 5 import java.io.File; 6 6 import java.io.FileWriter; 7 import java.io.IOException; 7 8 import java.util.ArrayList; 8 9 import java.util.List; … … 12 13 import scriptbuilder.structures.ScriptIncident.IncidentFocusedEvent; 13 14 import scriptbuilder.structures.ScriptIncident.SliceChangedEvent; 15 import scriptbuilder.structures.events.*; 14 16 import scriptbuilder.structures.units.Unit; 17 import java.nio.file.Path; 18 import java.nio.file.Paths; 19 import java.util.TreeMap; 15 20 16 21 /** … … 256 261 ex.printStackTrace(); 257 262 } 263 try 264 { 265 createAudioDirectory(Paths.get(f.getCanonicalPath()).getParent()); 266 } 267 catch(IOException ex) 268 { 269 System.err.println("there was a problem creating the audio directories."); 270 } 271 272 258 273 saved = true; 259 274 } 260 275 private void createAudioDirectory(Path path){ 276 File f = new File(path.toString()+"/audio"); 277 if(!f.exists()) 278 { 279 f.mkdir(); 280 //scan through to see what is already there and then make changes accordingly. 281 } 282 for(ScriptIncident i : incidents) 283 { 284 if(i!=null) 285 { 286 String name = ((Integer) i.number).toString(); 287 File incidentFolder = new File(path.toString()+"/audio/"+name); 288 if(incidentFolder.exists()) 289 { 290 //check to see if there are already files for the given incidents 291 //not sure how the ordering of the files should be. 292 //check to see if folder needs filling 293 }else 294 { 295 296 //create an incidentfolder since one does not already exist 297 incidentFolder.mkdir(); 298 int fileCount = 1; 299 for(TimeSlice slice : i.getSlices()) 300 { 301 for(I_ScriptEvent event : slice.events) 302 { 303 if(event.getScriptEventType().equals(ScriptEvent.ScriptEventType.CHP_RADIO_EVENT)) 304 { 305 //if the event is a chp radio event 306 //then add the dummy file to the subdirectory created 307 CHPRadioEvent radioEvent = (CHPRadioEvent) event; 308 309 String output = radioEvent.toScriptFile(); 310 311 File newAudioScript = new File(path.toString()+"/audio/"+name+"/"+name+fileCount+".txt"); 312 313 fileCount++; 314 try 315 { 316 newAudioScript.createNewFile(); 317 BufferedWriter bw = new BufferedWriter(new FileWriter(newAudioScript)); 318 bw.write(output); 319 bw.flush(); 320 bw.close(); 321 }catch(Exception e) 322 { 323 System.err.println("there was a problem creating your text files"); 324 } 325 326 } 327 } 328 } 329 330 } 331 } 332 333 334 } 335 336 337 } 261 338 @Override 262 339 public String toXML() -
trunk/src/scriptbuilder/structures/events/CHPRadioEvent.java
r76 r155 45 45 public String radioFile = ""; 46 46 47 /** 48 * Returns the contents of the CHPRadioEvent to make recording easier. 49 * @return a string with the script to be said 50 */ 51 public String toScriptFile() 52 { 53 String fileContents = ""; 54 for(int lineIndex=0;lineIndex<lines.size();lineIndex++) 55 { 56 fileContents += roles.get(lineIndex) + " " + lines.get(lineIndex) + "\n"; 57 } 58 return fileContents; 59 } 60 47 61 @Override 48 62 public String toXML()
Note: See TracChangeset
for help on using the changeset viewer.
