Changeset 109 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder/gui/ScriptBuilderFrame.java
- Timestamp:
- 09/05/2017 04:08:45 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/scriptbuilder/gui/ScriptBuilderFrame.java
r108 r109 177 177 public void update(Observable o, Object arg) 178 178 { 179 //Three major update types: whole script, and 2 event updates 179 180 if (arg instanceof SimulationScript) 180 181 { 181 182 script = (SimulationScript) arg; 182 183 184 //If we don't have exactly 10 events something is wrong 183 185 if (script.incidents.size() != 10) 184 186 { … … 186 188 } 187 189 190 //Call update on major panels 188 191 timelineTickPanel.update(script); 189 192 timeStampPanel.update(script); 190 193 194 //Call update on all timeline panels 191 195 incidentTimelinePanel1.timelinePanelUpdate(script.incidents.get(0)); 192 196 incidentTimelinePanel2.timelinePanelUpdate(script.incidents.get(1)); … … 200 204 incidentTimelinePanel10.timelinePanelUpdate(script.incidents.get(9)); 201 205 206 //Cal update on number panels 202 207 incidentNumberPanel1.update(script.incidents.get(0)); 203 208 incidentNumberPanel2.update(script.incidents.get(1)); … … 219 224 pack(); 220 225 } 226 //Mouse has changed focus to a different timeslice 221 227 else if (arg instanceof SliceChangedEvent) 222 228 { … … 229 235 } 230 236 } 237 //Mouse has changed focus to a different incident timeline panel 231 238 else if (arg instanceof IncidentFocusedEvent) 232 239 { … … 236 243 } 237 244 245 //Regardless of update type, refresh window by doing these things: 246 //Enable "+15:00" button if script is not empty 238 247 btnAddTime.setEnabled(script != null && script.numberOfIncidents > 0); 239 248 249 //enable zoom slider if script is not empty 240 250 zoomSlider.setEnabled(script != null && script.numberOfIncidents > 0); 241 251 252 //scale the zoom slider such that the most zoomed-out point allows the 253 //entire script to be visible at once 242 254 zoomSlider.setMinimum(((timelineTickPanel.getVisibleRect().width - 20) 243 255 * ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION) … … 267 279 jMenuItem6 = new javax.swing.JMenuItem(); 268 280 cadEventFrame = new javax.swing.JFrame(); 269 jLabel5= new javax.swing.JLabel();281 labelCADEntry = new javax.swing.JLabel(); 270 282 radioEventFrame = new javax.swing.JFrame(); 271 radioTypeLabel= new javax.swing.JLabel();272 jLabel7= new javax.swing.JLabel();283 labelRadioType = new javax.swing.JLabel(); 284 labelRadioMessage = new javax.swing.JLabel(); 273 285 radioTypeComboBox = new javax.swing.JComboBox(); 274 286 radioMessageScrollPane = new javax.swing.JScrollPane(); … … 280 292 deleteEventList = new javax.swing.JMenuItem(); 281 293 incidentFrame = new javax.swing.JFrame(); 282 jLabel6= new javax.swing.JLabel();283 jLabel8= new javax.swing.JLabel();284 jLabel9= new javax.swing.JLabel();285 jLabel10= new javax.swing.JLabel();286 jScrollPane1= new javax.swing.JScrollPane();294 labelIncidentNumber = new javax.swing.JLabel(); 295 labelIncidentName = new javax.swing.JLabel(); 296 labelIncidentColor = new javax.swing.JLabel(); 297 labelIncidentDescription = new javax.swing.JLabel(); 298 incidentPropertiesScrollPane = new javax.swing.JScrollPane(); 287 299 addIncidentDescription = new javax.swing.JTextArea(); 288 300 incidentOkButton = new javax.swing.JButton(); … … 290 302 addIncidentNumber = new javax.swing.JSpinner(); 291 303 addIncidentName = new javax.swing.JTextField(); 292 jLabel11= new javax.swing.JLabel();293 jLabel12= new javax.swing.JLabel();304 labelIncidentLength = new javax.swing.JLabel(); 305 labelIncidentStart = new javax.swing.JLabel(); 294 306 addIncidentStart = new javax.swing.JSpinner(); 295 jButton3= new javax.swing.JButton();307 btnChooseColor = new javax.swing.JButton(); 296 308 incidentColorField = new javax.swing.JTextField(); 297 labelIncidentLength = new javax.swing.JLabel();309 txtIncidentLength = new javax.swing.JLabel(); 298 310 addNoiseFrame = new javax.swing.JFrame(); 299 jLabel13= new javax.swing.JLabel();300 jSlider1= new javax.swing.JSlider();301 jSlider2= new javax.swing.JSlider();302 jLabel14= new javax.swing.JLabel();303 jSlider3= new javax.swing.JSlider();304 jLabel15= new javax.swing.JLabel();305 jTextArea1= new javax.swing.JTextArea();306 jSlider4= new javax.swing.JSlider();307 jLabel16= new javax.swing.JLabel();308 jSlider5= new javax.swing.JSlider();309 jLabel17= new javax.swing.JLabel();310 jButton1= new javax.swing.JButton();311 jButton2= new javax.swing.JButton();312 jLabel20= new javax.swing.JLabel();313 jLabel21= new javax.swing.JLabel();311 labelRadioChatter = new javax.swing.JLabel(); 312 radioChatterSlider = new javax.swing.JSlider(); 313 laneClosuresSlider = new javax.swing.JSlider(); 314 labelLaneClosures = new javax.swing.JLabel(); 315 TMCALSlider = new javax.swing.JSlider(); 316 labelTMCALLogs = new javax.swing.JLabel(); 317 txtNoiseDescription = new javax.swing.JTextArea(); 318 backgroundNoiseSlider = new javax.swing.JSlider(); 319 labelBackgroundNoise = new javax.swing.JLabel(); 320 minorEventsSlider = new javax.swing.JSlider(); 321 labelMinorEvents = new javax.swing.JLabel(); 322 btnCancelNoise = new javax.swing.JButton(); 323 btnGenerateNoise = new javax.swing.JButton(); 324 labelLeastFreq = new javax.swing.JLabel(); 325 labelMostFreq = new javax.swing.JLabel(); 314 326 incidentColorChooser = new javax.swing.JColorChooser(); 315 327 timelinesScrollPane = new javax.swing.JScrollPane(); … … 383 395 } 384 396 }); 397 cadEvent.addActionListener(new java.awt.event.ActionListener() 398 { 399 public void actionPerformed(java.awt.event.ActionEvent evt) 400 { 401 cadEventActionPerformed(evt); 402 } 403 }); 385 404 eventPopupMenu.add(cadEvent); 386 405 … … 409 428 cadEventFrame.setMinimumSize(new java.awt.Dimension(400, 300)); 410 429 411 jLabel5.setText("CAD Entry");430 labelCADEntry.setText("CAD Entry"); 412 431 413 432 javax.swing.GroupLayout cadEventFrameLayout = new javax.swing.GroupLayout(cadEventFrame.getContentPane()); … … 417 436 .addGroup(cadEventFrameLayout.createSequentialGroup() 418 437 .addContainerGap() 419 .addComponent( jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)438 .addComponent(labelCADEntry, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) 420 439 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 421 440 ); … … 424 443 .addGroup(cadEventFrameLayout.createSequentialGroup() 425 444 .addContainerGap() 426 .addComponent( jLabel5)445 .addComponent(labelCADEntry) 427 446 .addContainerGap(1357, Short.MAX_VALUE)) 428 447 ); … … 431 450 radioEventFrame.setMinimumSize(new java.awt.Dimension(400, 300)); 432 451 433 radioTypeLabel.setText("Radio Type:");434 435 jLabel7.setText("Radio Message:");452 labelRadioType.setText("Radio Type:"); 453 454 labelRadioMessage.setText("Radio Message:"); 436 455 437 456 radioTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "TMT", "Maintanence" })); … … 472 491 .addComponent(radioMessageScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE) 473 492 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, radioEventFrameLayout.createSequentialGroup() 474 .addComponent( radioTypeLabel)493 .addComponent(labelRadioType) 475 494 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 476 495 .addComponent(radioTypeComboBox, 0, 312, Short.MAX_VALUE)) 477 .addComponent( jLabel7, javax.swing.GroupLayout.Alignment.LEADING)496 .addComponent(labelRadioMessage, javax.swing.GroupLayout.Alignment.LEADING) 478 497 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, radioEventFrameLayout.createSequentialGroup() 479 498 .addComponent(cancelButton) … … 487 506 .addContainerGap() 488 507 .addGroup(radioEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 489 .addComponent( radioTypeLabel)508 .addComponent(labelRadioType) 490 509 .addComponent(radioTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 491 510 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 492 .addComponent( jLabel7)511 .addComponent(labelRadioMessage) 493 512 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 494 513 .addComponent(radioMessageScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 198, Short.MAX_VALUE) … … 516 535 incidentFrame.setMinimumSize(new java.awt.Dimension(400, 400)); 517 536 518 jLabel6.setText("Incident Number: ");519 520 jLabel8.setText("Incident Name:");521 522 jLabel9.setText("Incident Color: ");523 524 jLabel10.setText("Incident Description:");525 526 jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);527 jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);537 labelIncidentNumber.setText("Incident Number: "); 538 539 labelIncidentName.setText("Incident Name:"); 540 541 labelIncidentColor.setText("Incident Color: "); 542 543 labelIncidentDescription.setText("Incident Description:"); 544 545 incidentPropertiesScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); 546 incidentPropertiesScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); 528 547 529 548 addIncidentDescription.setColumns(20); … … 531 550 addIncidentDescription.setRows(5); 532 551 addIncidentDescription.setWrapStyleWord(true); 533 jScrollPane1.setViewportView(addIncidentDescription);552 incidentPropertiesScrollPane.setViewportView(addIncidentDescription); 534 553 535 554 incidentOkButton.setText("OK"); … … 553 572 addIncidentNumber.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(101), Integer.valueOf(101), null, Integer.valueOf(1))); 554 573 555 jLabel11.setText("Incident Length in Minutes: ");556 557 jLabel12.setText("Incident Start Time in Minutes:");574 labelIncidentLength.setText("Incident Length in Minutes: "); 575 576 labelIncidentStart.setText("Incident Start Time in Minutes:"); 558 577 559 578 addIncidentStart.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1))); 560 579 561 jButton3.setText("Choose...");562 jButton3.addActionListener(new java.awt.event.ActionListener()563 { 564 public void actionPerformed(java.awt.event.ActionEvent evt) 565 { 566 jButton3ActionPerformed(evt);580 btnChooseColor.setText("Choose..."); 581 btnChooseColor.addActionListener(new java.awt.event.ActionListener() 582 { 583 public void actionPerformed(java.awt.event.ActionEvent evt) 584 { 585 btnChooseColorActionPerformed(evt); 567 586 } 568 587 }); … … 571 590 incidentColorField.setBackground(new java.awt.Color(0, 0, 0)); 572 591 573 labelIncidentLength.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);574 labelIncidentLength.setText("0");575 labelIncidentLength.setToolTipText("");592 txtIncidentLength.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 593 txtIncidentLength.setText("0"); 594 txtIncidentLength.setToolTipText(""); 576 595 577 596 javax.swing.GroupLayout incidentFrameLayout = new javax.swing.GroupLayout(incidentFrame.getContentPane()); … … 582 601 .addContainerGap() 583 602 .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) 584 .addComponent( jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 322, Short.MAX_VALUE)585 .addComponent( jLabel10, javax.swing.GroupLayout.Alignment.LEADING)603 .addComponent(incidentPropertiesScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 322, Short.MAX_VALUE) 604 .addComponent(labelIncidentDescription, javax.swing.GroupLayout.Alignment.LEADING) 586 605 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, incidentFrameLayout.createSequentialGroup() 587 606 .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 588 .addComponent( jLabel6)589 .addComponent( jLabel8)590 .addComponent( jLabel9))607 .addComponent(labelIncidentNumber) 608 .addComponent(labelIncidentName) 609 .addComponent(labelIncidentColor)) 591 610 .addGap(18, 18, 18) 592 611 .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) … … 596 615 .addComponent(incidentColorField, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE) 597 616 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 598 .addComponent( jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))))617 .addComponent(btnChooseColor, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)))) 599 618 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, incidentFrameLayout.createSequentialGroup() 600 619 .addComponent(incidentCancelButton) … … 603 622 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, incidentFrameLayout.createSequentialGroup() 604 623 .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 605 .addComponent( jLabel12)606 .addComponent( jLabel11))624 .addComponent(labelIncidentStart) 625 .addComponent(labelIncidentLength)) 607 626 .addGap(18, 18, 18) 608 627 .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 609 628 .addGroup(incidentFrameLayout.createSequentialGroup() 610 629 .addGap(6, 6, 6) 611 .addComponent( labelIncidentLength, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)630 .addComponent(txtIncidentLength, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 612 631 .addGap(22, 22, 22)) 613 632 .addComponent(addIncidentStart, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE)))) … … 619 638 .addContainerGap() 620 639 .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 621 .addComponent( jLabel6)640 .addComponent(labelIncidentNumber) 622 641 .addComponent(addIncidentNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 623 642 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 624 643 .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 625 .addComponent( jLabel8)644 .addComponent(labelIncidentName) 626 645 .addComponent(addIncidentName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 627 646 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 628 647 .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 629 .addComponent( jLabel9)630 .addComponent( jButton3)648 .addComponent(labelIncidentColor) 649 .addComponent(btnChooseColor) 631 650 .addComponent(incidentColorField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 632 651 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 633 .addComponent( jLabel10)652 .addComponent(labelIncidentDescription) 634 653 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 635 .addComponent( jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)654 .addComponent(incidentPropertiesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE) 636 655 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 637 656 .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 638 657 .addComponent(addIncidentStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 639 .addComponent( jLabel12))658 .addComponent(labelIncidentStart)) 640 659 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 641 660 .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 642 .addComponent( jLabel11)643 .addComponent( labelIncidentLength))661 .addComponent(labelIncidentLength) 662 .addComponent(txtIncidentLength)) 644 663 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 645 664 .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) … … 653 672 addNoiseFrame.setResizable(false); 654 673 655 jLabel13.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N656 jLabel13.setText("Radio Chatter: ");657 658 jLabel14.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N659 jLabel14.setText("Lane Closures:");660 661 jLabel15.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N662 jLabel15.setText("TMCAL Logs:");663 664 jTextArea1.setEditable(false);665 jTextArea1.setColumns(20);666 jTextArea1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N667 jTextArea1.setLineWrap(true);668 jTextArea1.setRows(5);669 jTextArea1.setText("Noise events will be randomly generated for the simulation with frequencies based on the control selections made below");670 jTextArea1.setWrapStyleWord(true);671 jTextArea1.setAutoscrolls(false);672 jTextArea1.setBorder(null);673 jTextArea1.setDisabledTextColor(new java.awt.Color(0, 0, 0));674 jTextArea1.setFocusable(false);675 jTextArea1.setOpaque(false);676 677 jLabel16.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N678 jLabel16.setText("Background Noise: ");679 680 jLabel17.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N681 jLabel17.setText("Minor Events:");682 683 jButton1.setText("Cancel");684 jButton1.addActionListener(new java.awt.event.ActionListener()685 { 686 public void actionPerformed(java.awt.event.ActionEvent evt) 687 { 688 jButton1ActionPerformed(evt);689 } 690 }); 691 692 jButton2.setText("Generate");693 jButton2.addActionListener(new java.awt.event.ActionListener()694 { 695 public void actionPerformed(java.awt.event.ActionEvent evt) 696 { 697 jButton2ActionPerformed(evt);698 } 699 }); 700 701 jLabel20.setText("Least Frequent");702 703 jLabel21.setText("Most Frequent");674 labelRadioChatter.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N 675 labelRadioChatter.setText("Radio Chatter: "); 676 677 labelLaneClosures.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N 678 labelLaneClosures.setText("Lane Closures:"); 679 680 labelTMCALLogs.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N 681 labelTMCALLogs.setText("TMCAL Logs:"); 682 683 txtNoiseDescription.setEditable(false); 684 txtNoiseDescription.setColumns(20); 685 txtNoiseDescription.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N 686 txtNoiseDescription.setLineWrap(true); 687 txtNoiseDescription.setRows(5); 688 txtNoiseDescription.setText("Noise events will be randomly generated for the simulation with frequencies based on the control selections made below"); 689 txtNoiseDescription.setWrapStyleWord(true); 690 txtNoiseDescription.setAutoscrolls(false); 691 txtNoiseDescription.setBorder(null); 692 txtNoiseDescription.setDisabledTextColor(new java.awt.Color(0, 0, 0)); 693 txtNoiseDescription.setFocusable(false); 694 txtNoiseDescription.setOpaque(false); 695 696 labelBackgroundNoise.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N 697 labelBackgroundNoise.setText("Background Noise: "); 698 699 labelMinorEvents.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N 700 labelMinorEvents.setText("Minor Events:"); 701 702 btnCancelNoise.setText("Cancel"); 703 btnCancelNoise.addActionListener(new java.awt.event.ActionListener() 704 { 705 public void actionPerformed(java.awt.event.ActionEvent evt) 706 { 707 btnCancelNoiseActionPerformed(evt); 708 } 709 }); 710 711 btnGenerateNoise.setText("Generate"); 712 btnGenerateNoise.addActionListener(new java.awt.event.ActionListener() 713 { 714 public void actionPerformed(java.awt.event.ActionEvent evt) 715 { 716 btnGenerateNoiseActionPerformed(evt); 717 } 718 }); 719 720 labelLeastFreq.setText("Least Frequent"); 721 722 labelMostFreq.setText("Most Frequent"); 704 723 705 724 javax.swing.GroupLayout addNoiseFrameLayout = new javax.swing.GroupLayout(addNoiseFrame.getContentPane()); … … 710 729 .addContainerGap(21, Short.MAX_VALUE) 711 730 .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) 712 .addComponent( jTextArea1, javax.swing.GroupLayout.Alignment.LEADING)731 .addComponent(txtNoiseDescription, javax.swing.GroupLayout.Alignment.LEADING) 713 732 .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) 714 733 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, addNoiseFrameLayout.createSequentialGroup() 715 .addComponent( jButton1)734 .addComponent(btnCancelNoise) 716 735 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 717 .addComponent( jButton2))736 .addComponent(btnGenerateNoise)) 718 737 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, addNoiseFrameLayout.createSequentialGroup() 719 738 .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 720 739 .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) 721 .addComponent( jLabel16)722 .addComponent( jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)723 .addComponent( jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)724 .addComponent( jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))725 .addComponent( jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))740 .addComponent(labelBackgroundNoise) 741 .addComponent(labelLaneClosures, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE) 742 .addComponent(labelTMCALLogs, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE) 743 .addComponent(labelRadioChatter, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)) 744 .addComponent(labelMinorEvents, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)) 726 745 .addGap(4, 4, 4) 727 746 .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) 728 .addComponent( jSlider1, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)729 .addComponent( jSlider2, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)730 .addComponent( jSlider3, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)731 .addComponent( jSlider5, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)732 .addComponent( jSlider4, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)747 .addComponent(radioChatterSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE) 748 .addComponent(laneClosuresSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE) 749 .addComponent(TMCALSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE) 750 .addComponent(minorEventsSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE) 751 .addComponent(backgroundNoiseSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE) 733 752 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, addNoiseFrameLayout.createSequentialGroup() 734 .addComponent( jLabel20)753 .addComponent(labelLeastFreq) 735 754 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 736 .addComponent( jLabel21))))))755 .addComponent(labelMostFreq)))))) 737 756 .addGap(20, 20, 20)) 738 757 ); … … 741 760 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, addNoiseFrameLayout.createSequentialGroup() 742 761 .addContainerGap() 743 .addComponent( jTextArea1, javax.swing.GroupLayout.DEFAULT_SIZE, 39, Short.MAX_VALUE)762 .addComponent(txtNoiseDescription, javax.swing.GroupLayout.DEFAULT_SIZE, 39, Short.MAX_VALUE) 744 763 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 745 764 .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) 746 .addComponent( jLabel21)747 .addComponent( jLabel20))765 .addComponent(labelMostFreq) 766 .addComponent(labelLeastFreq)) 748 767 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 749 768 .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) 750 .addComponent( jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)751 .addComponent( jSlider1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))769 .addComponent(labelRadioChatter, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) 770 .addComponent(radioChatterSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) 752 771 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 753 772 .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) 754 .addComponent( jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)755 .addComponent( jSlider2, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))773 .addComponent(labelLaneClosures, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) 774 .addComponent(laneClosuresSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) 756 775 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 757 776 .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) 758 .addComponent( jLabel15)759 .addComponent( jSlider3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))777 .addComponent(labelTMCALLogs) 778 .addComponent(TMCALSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 760 779 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 761 780 .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) 762 .addComponent( jSlider4, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)763 .addComponent( jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))781 .addComponent(backgroundNoiseSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE) 782 .addComponent(labelBackgroundNoise, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)) 764 783 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 765 784 .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 766 .addComponent( jSlider5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)767 .addComponent( jLabel17))785 .addComponent(minorEventsSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 786 .addComponent(labelMinorEvents)) 768 787 .addGap(18, 18, 18) 769 788 .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 770 .addComponent( jButton1)771 .addComponent( jButton2))789 .addComponent(btnCancelNoise) 790 .addComponent(btnGenerateNoise)) 772 791 .addContainerGap()) 773 792 ); … … 1436 1455 */ 1437 1456 private void zoomSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_zoomSliderStateChanged 1457 //Changing the zoom level always refreshes the window 1438 1458 ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK = zoomSlider.getValue(); 1439 1459 this.update(script, script); … … 1519 1539 (Integer) addIncidentNumber.getValue(), addIncidentName.getText(), addIncidentDescription.getText(), 1520 1540 script)); 1521 // script.incidents.get(indx).length = (Integer) addIncidentLength.getValue() * 60;1522 1541 script.incidents.get(indx).setOffset((Integer) addIncidentStart.getValue() * 60); 1523 1542 script.numberOfIncidents++; … … 1526 1545 else//editing existing incident 1527 1546 { 1528 // //what the hell?1529 // ScriptIncident backup = script.incidents.get(oldIncidentIndex);1530 // script.incidents.remove(oldIncidentIndex);1531 // script.incidents.add(oldIncidentIndex, null);1532 //1533 // for (ScriptIncident i : script.incidents)1534 // {1535 // if (i != null && i.number == (Integer) addIncidentNumber.getValue())1536 // {1537 // script.incidents.remove(oldIncidentIndex);1538 // script.incidents.add(oldIncidentIndex, backup);1539 // JOptionPane.showMessageDialog(this, "Incident number already in use.",1540 // "Unable to Create Incident", JOptionPane.ERROR_MESSAGE);1541 // incidentFrame.setVisible(true);1542 // return;1543 // }1544 // }1545 //1546 // //ugh why do it like this1547 // script.incidents.remove(oldIncidentIndex);1548 // SimulationScript.incidentColors[oldIncidentIndex] = selectedColor;1549 // script.incidents.add(oldIncidentIndex,1550 // new ScriptIncident(SimulationScript.incidentColors[oldIncidentIndex],1551 // (Integer) addIncidentNumber.getValue(), addIncidentName.getText(), addIncidentDescription.getText(),1552 // script));1553 // script.incidents.get(oldIncidentIndex).length = (Integer) addIncidentLength.getValue() * 60;1554 // script.incidents.get(oldIncidentIndex).slices = backup.slices;1555 // script.incidents.get(oldIncidentIndex).offset = backup.offset;1556 // script.incidents.get(oldIncidentIndex).setOffset((Integer) addIncidentStart.getValue() * 60);1557 1558 1547 //adjust incident color 1559 1548 script.incidents.get(oldIncidentIndex).color = selectedColor; … … 1570 1559 script.incidents.get(oldIncidentIndex).number = (int) addIncidentNumber.getValue(); 1571 1560 } 1572 else 1561 else//if the updated value conflicts with an existing inc number, 1562 //the inc number update fails 1573 1563 { 1574 1564 JOptionPane.showMessageDialog(this, "Incident number already in use.", … … 1577 1567 } 1578 1568 1569 //close this frame 1579 1570 incidentFrame.setVisible(false); 1580 1571 this.update(script, script); … … 1582 1573 }//GEN-LAST:event_incidentOkButtonActionPerformed 1583 1574 1575 /** 1576 * Determine if the given incident number is already present in the script. 1577 * 1578 * @param script the current simulation script 1579 * @param num the incident log number to check 1580 * @return true if one of the existing incidents in the script uses that log 1581 * number 1582 */ 1584 1583 private boolean scriptContainsLogNum(SimulationScript script, int num) 1585 1584 { … … 1615 1614 addIncidentNumber.setValue(101); 1616 1615 addIncidentStart.setValue(0); 1617 labelIncidentLength.setText("0");1616 txtIncidentLength.setText("0"); 1618 1617 incidentColorField.setBackground(Color.BLACK); 1619 1618 selectedColor = Color.BLACK; … … 1635 1634 JFileChooser fc = new JFileChooser(); 1636 1635 1636 //Search for .xml files 1637 1637 fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)", 1638 1638 new String[] … … 1642 1642 if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) 1643 1643 { 1644 //make a new script and load it with values from the selected file 1644 1645 script = new SimulationScript(); 1645 System.out.println(fc.getSelectedFile().getName());1646 1646 script.loadScriptFromFile(fc.getSelectedFile()); 1647 1647 script.saveFile = fc.getSelectedFile(); 1648 1648 } 1649 1649 this.update(script, script); 1650 //zoom out all the way so that the whole imported script is visible 1650 1651 zoomSlider.setValue(zoomSlider.getMinimum()); 1651 1652 repaint(); … … 1681 1682 */ 1682 1683 private void fileSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileSaveActionPerformed 1684 //If the script has never been saved before, we need to name or create a 1685 //file in which to save it 1683 1686 if (script.saveFile == null) 1684 1687 { 1685 1688 fileSaveAsActionPerformed(evt); 1686 1689 } 1690 //Otherwise, just save to the previously selected save spot 1687 1691 else 1688 1692 { … … 1691 1695 }//GEN-LAST:event_fileSaveActionPerformed 1692 1696 1697 /** 1698 * Allow this window to refresh itself, after a different window loses 1699 * focus. 1700 */ 1693 1701 public void returnFocus() 1694 1702 { … … 1697 1705 } 1698 1706 1707 /** 1708 * Set up the incident details/properties window so that it reflects the 1709 * values of the selected incident. Then, make the window visible. 1710 * 1711 * @param i the incident to be represented by this details window 1712 */ 1699 1713 public void incidentDetailsScreen(ScriptIncident i) 1700 1714 { … … 1705 1719 addIncidentNumber.setValue(i.number); 1706 1720 addIncidentStart.setValue(i.offset / 60); 1707 labelIncidentLength.setText(""+(i.length/60));1708 labelIncidentLength.setHorizontalTextPosition(SwingConstants.RIGHT);1721 txtIncidentLength.setText("" + (i.length / 60)); 1722 txtIncidentLength.setHorizontalTextPosition(SwingConstants.RIGHT); 1709 1723 //addIncidentLength.setValue(i.length / 60); 1710 1724 incidentColorField.setBackground(i.color); … … 1730 1744 * @param evt the button press event 1731 1745 */ 1732 private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed1746 private void btnCancelNoiseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelNoiseActionPerformed 1733 1747 addNoiseFrame.setVisible(false); 1734 }//GEN-LAST:event_ jButton1ActionPerformed1735 1736 /** 1737 * Generates random noise upon click of the " OK" button, then hides the1738 * noise generation screen.1748 }//GEN-LAST:event_btnCancelNoiseActionPerformed 1749 1750 /** 1751 * Generates random noise upon click of the "Generate" button, then hides 1752 * the noise generation screen. 1739 1753 * 1740 1754 * @param evt the button press event 1741 1755 */ 1742 private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed1756 private void btnGenerateNoiseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGenerateNoiseActionPerformed 1743 1757 Random rng = new Random(); 1744 1758 ScriptEventType[] eventTypes = ScriptEventType.values(); 1745 1759 1746 1760 /* For prototyping purpose, ignore the sliders and average their values */ 1747 int total = jSlider1.getValue() + jSlider2.getValue() + jSlider3.getValue() + jSlider5.getValue() + jSlider4.getValue();1761 int total = radioChatterSlider.getValue() + laneClosuresSlider.getValue() + TMCALSlider.getValue() + minorEventsSlider.getValue() + backgroundNoiseSlider.getValue(); 1748 1762 total /= 5; 1749 1763 … … 1778 1792 this.update(script, script); 1779 1793 repaint(); 1780 }//GEN-LAST:event_ jButton2ActionPerformed1794 }//GEN-LAST:event_btnGenerateNoiseActionPerformed 1781 1795 1782 1796 /** … … 1790 1804 String input = ""; 1791 1805 ScriptIncident inc = null; 1806 1807 //Pick the incident to save 1792 1808 Object result = JOptionPane.showInputDialog( 1793 1809 this, … … 1798 1814 incidentList, 1799 1815 script.incidents.get(0)); 1800 1801 System.out.println("RESULT = " + result.toString());1802 1803 1816 input = result.toString(); 1804 1805 System.out.println("INPUT = " + input);1806 1807 1817 int i = 0; 1808 1818 for (ScriptIncident incident : script.incidents) … … 1812 1822 continue; 1813 1823 } 1814 System.out.println((++i) + ": " + incident.toString());1815 1824 if (incident.toString().equals(input)) 1816 1825 { … … 1821 1830 if (inc == null) 1822 1831 { 1823 System.out.println("DIDN'T FIND ANYTHING");1824 1832 return; 1825 1833 } 1826 1834 1835 //Pick the file to save it to 1827 1836 JFileChooser fc = new JFileChooser(); 1828 1837 fc.setFileFilter(new ExtensionFileFilter("Script Incident (.xml)", new String[] … … 1836 1845 }//GEN-LAST:event_saveIncidentActionPerformed 1837 1846 1847 /** 1848 * Bring up the incident palette for loading of new incidents. 1849 * 1850 * @param evt the menu click event 1851 */ 1838 1852 private void loadIncidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadIncidentActionPerformed 1839 1853 new IncidentPaletteFrame(script, this).setVisible(true); … … 1841 1855 }//GEN-LAST:event_loadIncidentActionPerformed 1842 1856 1857 //Unsupported as of 2017/09/05 1843 1858 private void generateProjectRequirementsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateProjectRequirementsActionPerformed 1844 1859 JFileChooser fc = new JFileChooser(); … … 1851 1866 }//GEN-LAST:event_generateProjectRequirementsActionPerformed 1852 1867 1868 //Unsupported as of 2017/09/05 1853 1869 private void generateNotebooksActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateNotebooksActionPerformed 1854 1870 JFileChooser fc = new JFileChooser(); … … 1861 1877 }//GEN-LAST:event_generateNotebooksActionPerformed 1862 1878 1879 //Unsupported as of 2017/09/05 1863 1880 private void generateScorecardsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateScorecardsActionPerformed 1864 1881 JFileChooser fc = new JFileChooser(); … … 1871 1888 }//GEN-LAST:event_generateScorecardsActionPerformed 1872 1889 1890 //Unsupported as of 2017/09/05 1873 1891 private void generateOrganizationChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateOrganizationChartActionPerformed 1874 1892 JFileChooser fc = new JFileChooser(); … … 1906 1924 private Color selectedColor = Color.BLACK; 1907 1925 1908 private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed 1926 private void btnChooseColorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnChooseColorActionPerformed 1927 //For whatever reason, this causes the incident properties frame to be hidden 1909 1928 Color newColor = incidentColorChooser.showDialog(this, "Incident Color", incidentColorField.getBackground()); 1910 1929 if (newColor != null) 1911 1930 { 1912 System.out.println("New color is " + newColor.toString());1931 //If the user selected a color, apply it to the properties frame 1913 1932 selectedColor = newColor; 1914 1933 incidentColorField.setBackground(newColor); 1915 1934 } 1935 //Return focus to the properties frame 1916 1936 incidentFrame.setVisible(true); 1917 }//GEN-LAST:event_ jButton3ActionPerformed1937 }//GEN-LAST:event_btnChooseColorActionPerformed 1918 1938 1919 1939 /* Help > About simply displays the current SVN revision number so … … 1926 1946 }//GEN-LAST:event_helpAboutActionPerformed 1927 1947 1948 /** 1949 * Replaces the current script with a new, blank script. 1950 * 1951 * @param evt the menu selection event 1952 */ 1928 1953 private void fileNewActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_fileNewActionPerformed 1929 1954 {//GEN-HEADEREND:event_fileNewActionPerformed … … 1934 1959 }//GEN-LAST:event_fileNewActionPerformed 1935 1960 1961 /** 1962 * Allows the user to delete an incident from the current script. 1963 * 1964 * @param evt the menu selection event 1965 */ 1936 1966 private void deleteIncidentActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_deleteIncidentActionPerformed 1937 1967 {//GEN-HEADEREND:event_deleteIncidentActionPerformed … … 1939 1969 String input = ""; 1940 1970 ScriptIncident inc = null; 1971 //Choose the incident to be deleted 1941 1972 Object result = JOptionPane.showInputDialog( 1942 1973 this, … … 1951 1982 { 1952 1983 input = result.toString(); 1953 int incidentIndex = 0;1954 1984 for (ScriptIncident incident : script.incidents) 1955 1985 { 1956 incidentIndex++;1957 1986 if (incident == null) 1958 1987 { … … 1965 1994 } 1966 1995 1996 //Allow user to verify deletion before proceeding 1967 1997 if (inc != null) 1968 1998 { … … 1971 2001 if (confirm == JOptionPane.YES_OPTION) 1972 2002 { 2003 //Remove the incident and replace it with a null placeholder 1973 2004 script.incidents.remove(inc); 1974 2005 script.incidents.add(null); … … 1977 2008 } 1978 2009 } 2010 //Refresh 1979 2011 this.update(script, script); 1980 2012 repaint(); 1981 2013 }//GEN-LAST:event_deleteIncidentActionPerformed 1982 2014 /** 2015 * Add 15 minutes to the end of the visible timeline. 2016 * 2017 * @param evt the button press event. 2018 */ 1983 2019 private void btnAddTimeActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnAddTimeActionPerformed 1984 2020 {//GEN-HEADEREND:event_btnAddTimeActionPerformed … … 1986 2022 this.update(script, script); 1987 2023 }//GEN-LAST:event_btnAddTimeActionPerformed 2024 2025 private void cadEventActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_cadEventActionPerformed 2026 {//GEN-HEADEREND:event_cadEventActionPerformed 2027 // TODO add your handling code here: 2028 }//GEN-LAST:event_cadEventActionPerformed 1988 2029 1989 2030 /** … … 2022 2063 2023 2064 /** 2024 * Runs the script builder. 2065 * Runs the script builder. This is the main method for the whole program. 2025 2066 * 2026 2067 * @param args the command line arguments … … 2032 2073 UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); 2033 2074 } 2034 catch (ClassNotFoundException ex) 2035 { 2036 } 2037 catch (InstantiationException ex) 2038 { 2039 } 2040 catch (IllegalAccessException ex) 2041 { 2042 } 2043 catch (UnsupportedLookAndFeelException ex) 2044 { 2075 catch (Exception ex) 2076 { 2077 //Apparently we don't do any special exception processing 2045 2078 } 2046 2079 … … 2049 2082 UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); 2050 2083 } 2051 catch (ClassNotFoundException ex) 2052 { 2053 } 2054 catch (InstantiationException ex) 2055 { 2056 } 2057 catch (IllegalAccessException ex) 2058 { 2059 } 2060 catch (UnsupportedLookAndFeelException ex) 2061 { 2084 catch (Exception ex) 2085 { 2086 //Apparently we don't do any special exception processing 2062 2087 } 2063 2088 … … 2072 2097 } 2073 2098 // Variables declaration - do not modify//GEN-BEGIN:variables 2099 private javax.swing.JSlider TMCALSlider; 2074 2100 private javax.swing.JTextArea addIncidentDescription; 2075 2101 private javax.swing.JTextField addIncidentName; … … 2077 2103 private javax.swing.JSpinner addIncidentStart; 2078 2104 private javax.swing.JFrame addNoiseFrame; 2105 private javax.swing.JSlider backgroundNoiseSlider; 2079 2106 private javax.swing.JButton btnAddTime; 2107 private javax.swing.JButton btnCancelNoise; 2108 private javax.swing.JButton btnChooseColor; 2109 private javax.swing.JButton btnGenerateNoise; 2080 2110 private javax.swing.JMenuItem cadEvent; 2081 2111 private javax.swing.JFrame cadEventFrame; … … 2118 2148 private javax.swing.JButton incidentOkButton; 2119 2149 private javax.swing.JPopupMenu incidentPopupMenu; 2150 private javax.swing.JScrollPane incidentPropertiesScrollPane; 2120 2151 private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel1; 2121 2152 private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel10; … … 2128 2159 private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel8; 2129 2160 private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel9; 2130 private javax.swing.JButton jButton1;2131 private javax.swing.JButton jButton2;2132 private javax.swing.JButton jButton3;2133 private javax.swing.JLabel jLabel10;2134 private javax.swing.JLabel jLabel11;2135 private javax.swing.JLabel jLabel12;2136 private javax.swing.JLabel jLabel13;2137 private javax.swing.JLabel jLabel14;2138 private javax.swing.JLabel jLabel15;2139 private javax.swing.JLabel jLabel16;2140 private javax.swing.JLabel jLabel17;2141 private javax.swing.JLabel jLabel20;2142 private javax.swing.JLabel jLabel21;2143 private javax.swing.JLabel jLabel5;2144 private javax.swing.JLabel jLabel6;2145 private javax.swing.JLabel jLabel7;2146 private javax.swing.JLabel jLabel8;2147 private javax.swing.JLabel jLabel9;2148 2161 private javax.swing.JMenuItem jMenuItem2; 2149 2162 private javax.swing.JMenuItem jMenuItem3; … … 2151 2164 private javax.swing.JMenuItem jMenuItem5; 2152 2165 private javax.swing.JMenuItem jMenuItem6; 2153 private javax.swing.JScrollPane jScrollPane1;2154 2166 private javax.swing.JPopupMenu.Separator jSeparator1; 2155 2167 private javax.swing.JPopupMenu.Separator jSeparator2; 2156 2168 private javax.swing.JPopupMenu.Separator jSeparator3; 2157 2169 private javax.swing.JPopupMenu.Separator jSeparator4; 2158 private javax.swing.JSlider jSlider1; 2159 private javax.swing.JSlider jSlider2; 2160 private javax.swing.JSlider jSlider3; 2161 private javax.swing.JSlider jSlider4; 2162 private javax.swing.JSlider jSlider5; 2163 private javax.swing.JTextArea jTextArea1; 2170 private javax.swing.JLabel labelBackgroundNoise; 2171 private javax.swing.JLabel labelCADEntry; 2172 private javax.swing.JLabel labelIncidentColor; 2173 private javax.swing.JLabel labelIncidentDescription; 2164 2174 private javax.swing.JLabel labelIncidentLength; 2175 private javax.swing.JLabel labelIncidentName; 2176 private javax.swing.JLabel labelIncidentNumber; 2177 private javax.swing.JLabel labelIncidentStart; 2178 private javax.swing.JLabel labelLaneClosures; 2179 private javax.swing.JLabel labelLeastFreq; 2180 private javax.swing.JLabel labelMinorEvents; 2181 private javax.swing.JLabel labelMostFreq; 2182 private javax.swing.JLabel labelRadioChatter; 2183 private javax.swing.JLabel labelRadioMessage; 2184 private javax.swing.JLabel labelRadioType; 2185 private javax.swing.JLabel labelTMCALLogs; 2186 private javax.swing.JSlider laneClosuresSlider; 2165 2187 private javax.swing.JMenuItem loadIncident; 2188 private javax.swing.JSlider minorEventsSlider; 2166 2189 private javax.swing.JMenuItem newIncident; 2167 2190 private javax.swing.JButton okButton; 2168 2191 private javax.swing.JMenuItem popupDeleteIncident; 2192 private javax.swing.JSlider radioChatterSlider; 2169 2193 private javax.swing.JMenuItem radioEvent; 2170 2194 private javax.swing.JFrame radioEventFrame; … … 2172 2196 private javax.swing.JScrollPane radioMessageScrollPane; 2173 2197 private javax.swing.JComboBox radioTypeComboBox; 2174 private javax.swing.JLabel radioTypeLabel;2175 2198 private javax.swing.JMenuItem saveIncident; 2176 2199 private javax.swing.JMenuBar scriptBuilderMenuBar; … … 2179 2202 private scriptbuilder.gui.panels.TimelineTickPanel timelineTickPanel; 2180 2203 private javax.swing.JScrollPane timelinesScrollPane; 2204 private javax.swing.JLabel txtIncidentLength; 2205 private javax.swing.JTextArea txtNoiseDescription; 2181 2206 private javax.swing.JLabel zoomInIcon; 2182 2207 private javax.swing.JLabel zoomOutIcon;
Note: See TracChangeset
for help on using the changeset viewer.
