Changeset 145 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder
- Timestamp:
- 11/04/2019 08:14:32 AM (6 years ago)
- Location:
- trunk/src/scriptbuilder
- Files:
-
- 1 added
- 17 edited
-
gui/IncidentEditorFrame.java (modified) (4 diffs)
-
gui/ScriptBuilderFrame.form (modified) (11 diffs)
-
gui/ScriptBuilderFrame.java (modified) (69 diffs)
-
gui/ScriptBuilderGuiConstants.java (modified) (1 diff)
-
gui/application.properties (modified) (1 diff)
-
gui/drawers/CursorDrawer.java (modified) (1 diff)
-
gui/drawers/TimeSliceDrawer.java (modified) (1 diff)
-
gui/panels/IncidentTimelinePanel.java (modified) (3 diffs)
-
structures/.directory (added)
-
structures/CadData.java (modified) (2 diffs)
-
structures/ELEMENT.java (modified) (1 diff)
-
structures/MyScriptHandler.java (modified) (3 diffs)
-
structures/ScriptEvent.java (modified) (1 diff)
-
structures/ScriptIncident.java (modified) (5 diffs)
-
structures/SimulationScript.java (modified) (7 diffs)
-
structures/TimeSlice.java (modified) (3 diffs)
-
structures/events/UnitEvent.java (modified) (1 diff)
-
structures/units/Unit.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/scriptbuilder/gui/IncidentEditorFrame.java
r135 r145 264 264 cctvButton.addKeyListener(new TimelineKeyListener()); 265 265 chpRadioButton.addKeyListener(new TimelineKeyListener()); 266 //todo: change paramics button to Traffic Modeler 266 267 paramicsButton.addKeyListener(new TimelineKeyListener()); 267 268 towButton.addKeyListener(new TimelineKeyListener()); … … 340 341 public void update(Observable o, Object arg) 341 342 { 343 System.out.println("the type of update is: " + arg.getClass()); 342 344 //Three possibilities: This is a general script update, or it's one of 343 345 //two different focus updates … … 366 368 else if (arg instanceof SliceChangedEvent) 367 369 { 370 System.out.println("you got the hover over a timeslice"); 368 371 TimeSlice slice = ((SliceChangedEvent) arg).slice; 369 372 … … 1716 1719 * @param evt the mouse event 1717 1720 */ 1721 //todo: make the zoom slider more dynamic: when it is at completely zoomed out, show the entire timeline? 1718 1722 private void zoomInIconMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_zoomInIconMouseClicked 1719 zoomSlider.setValue(zoomSlider.getValue() >= 21 ? 21 : zoomSlider.getValue() + 1); 1723 //zoomSlider.setValue(zoomSlider.getValue() >= 21 ? 21 : zoomSlider.getValue() + 1); 1724 zoomSlider.setValue(zoomSlider.getValue() + 1); 1725 1720 1726 }//GEN-LAST:event_zoomInIconMouseClicked 1721 1727 -
trunk/src/scriptbuilder/gui/ScriptBuilderFrame.form
r129 r145 13 13 <Property name="text" type="java.lang.String" value="Delete Incident..."/> 14 14 </Properties> 15 <Events> 16 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="popupDeleteIncidentActionPerformed"/> 17 </Events> 15 18 </MenuItem> 16 19 </SubComponents> … … 241 244 <DimensionLayout dim="0"> 242 245 <Group type="103" groupAlignment="0" attributes="0"> 243 <Group type="102" a lignment="1" attributes="0">244 <EmptySpace max="-2" attributes="0"/> 245 <Group type="103" groupAlignment=" 1" attributes="0">246 <Group type="102" attributes="0"> 247 <EmptySpace max="-2" attributes="0"/> 248 <Group type="103" groupAlignment="0" attributes="0"> 246 249 <Component id="incidentPropertiesScrollPane" alignment="0" pref="322" max="32767" attributes="0"/> 247 <Component id="labelIncidentDescription" alignment="0" min="-2" max="-2" attributes="0"/>248 250 <Group type="102" alignment="0" attributes="0"> 249 251 <Group type="103" groupAlignment="0" attributes="0"> … … 252 254 <Component id="labelIncidentColor" alignment="0" min="-2" max="-2" attributes="0"/> 253 255 </Group> 254 <EmptySpace type="separate" max="-2" attributes="0"/>256 <EmptySpace min="-2" pref="66" max="-2" attributes="0"/> 255 257 <Group type="103" groupAlignment="0" attributes="0"> 256 <Component id="addIncidentName" pref=" 218" max="32767" attributes="0"/>257 <Component id="addIncidentNumber" alignment="0" pref=" 218" max="32767" attributes="0"/>258 <Component id="addIncidentName" pref="199" max="32767" attributes="0"/> 259 <Component id="addIncidentNumber" alignment="0" pref="199" max="32767" attributes="0"/> 258 260 <Group type="102" alignment="1" attributes="0"> 259 <Component id="incidentColorField" pref=" 119" max="32767" attributes="0"/>261 <Component id="incidentColorField" pref="97" max="32767" attributes="0"/> 260 262 <EmptySpace max="-2" attributes="0"/> 261 263 <Component id="btnChooseColor" min="-2" pref="93" max="-2" attributes="0"/> … … 283 285 </Group> 284 286 </Group> 287 <Group type="102" alignment="0" attributes="0"> 288 <Component id="jLabel2" min="-2" max="-2" attributes="0"/> 289 <EmptySpace min="-2" pref="93" max="-2" attributes="0"/> 290 <Component id="addIncidentType" max="32767" attributes="0"/> 291 </Group> 292 <Group type="102" attributes="0"> 293 <Component id="labelIncidentDescription" min="-2" max="-2" attributes="0"/> 294 <EmptySpace min="0" pref="0" max="32767" attributes="0"/> 295 </Group> 296 <Group type="102" alignment="0" attributes="0"> 297 <Component id="jLabel1" min="-2" max="-2" attributes="0"/> 298 <EmptySpace min="-2" pref="69" max="-2" attributes="0"/> 299 <Component id="addIncidentLocation" max="32767" attributes="0"/> 300 </Group> 285 301 </Group> 286 302 <EmptySpace max="-2" attributes="0"/> … … 308 324 </Group> 309 325 <EmptySpace max="-2" attributes="0"/> 326 <Group type="103" groupAlignment="3" attributes="0"> 327 <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> 328 <Component id="addIncidentLocation" alignment="3" min="-2" max="-2" attributes="0"/> 329 </Group> 330 <EmptySpace max="-2" attributes="0"/> 331 <Group type="103" groupAlignment="3" attributes="0"> 332 <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> 333 <Component id="addIncidentType" alignment="3" min="-2" max="-2" attributes="0"/> 334 </Group> 335 <EmptySpace max="-2" attributes="0"/> 310 336 <Component id="labelIncidentDescription" min="-2" max="-2" attributes="0"/> 311 337 <EmptySpace max="-2" attributes="0"/> 312 <Component id="incidentPropertiesScrollPane" pref="1 18" max="32767" attributes="0"/>338 <Component id="incidentPropertiesScrollPane" pref="130" max="32767" attributes="0"/> 313 339 <EmptySpace max="-2" attributes="0"/> 314 340 <Group type="103" groupAlignment="3" attributes="0"> … … 397 423 </Component> 398 424 <Component class="javax.swing.JTextField" name="addIncidentName"> 425 <Events> 426 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addIncidentNameActionPerformed"/> 427 </Events> 399 428 </Component> 400 429 <Component class="javax.swing.JLabel" name="labelIncidentLength"> … … 437 466 <Property name="toolTipText" type="java.lang.String" value=""/> 438 467 </Properties> 468 </Component> 469 <Component class="javax.swing.JLabel" name="jLabel1"> 470 <Properties> 471 <Property name="text" type="java.lang.String" value="Incident Location:"/> 472 </Properties> 473 </Component> 474 <Component class="javax.swing.JTextField" name="addIncidentLocation"> 475 <Events> 476 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addIncidentLocationActionPerformed"/> 477 </Events> 478 </Component> 479 <Component class="javax.swing.JLabel" name="jLabel2"> 480 <Properties> 481 <Property name="text" type="java.lang.String" value="Incident Type:"/> 482 </Properties> 483 </Component> 484 <Component class="javax.swing.JTextField" name="addIncidentType"> 439 485 </Component> 440 486 </SubComponents> … … 641 687 </Component> 642 688 <Menu class="javax.swing.JMenuBar" name="scriptBuilderMenuBar"> 689 <Events> 690 <EventHandler event="ancestorAdded" listener="javax.swing.event.AncestorListener" parameters="javax.swing.event.AncestorEvent" handler="scriptBuilderMenuBarAncestorAdded"/> 691 </Events> 643 692 <SubComponents> 644 693 <Menu class="javax.swing.JMenu" name="fileMenu"> … … 794 843 </Events> 795 844 </MenuItem> 845 <MenuItem class="javax.swing.JMenuItem" name="deleteIncident1"> 846 <Properties> 847 <Property name="text" type="java.lang.String" value="Edit Incident..."/> 848 </Properties> 849 <Events> 850 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="incidentDetailsActionPerformed"/> 851 </Events> 852 </MenuItem> 796 853 <MenuItem class="javax.swing.JPopupMenu$Separator" name="jSeparator4"> 797 854 </MenuItem> … … 825 882 <Events> 826 883 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="generateNoiseOptionActionPerformed"/> 884 </Events> 885 </MenuItem> 886 </SubComponents> 887 </Menu> 888 <Menu class="javax.swing.JMenu" name="helpMenu1"> 889 <Properties> 890 <Property name="text" type="java.lang.String" value="Unit"/> 891 <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor"> 892 <Insets value="[0, 10, 0, 10]"/> 893 </Property> 894 </Properties> 895 <SubComponents> 896 <MenuItem class="javax.swing.JMenuItem" name="loadUnits"> 897 <Properties> 898 <Property name="text" type="java.lang.String" value="Load Units..."/> 899 </Properties> 900 <Events> 901 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="loadUnitsActionPerformed"/> 827 902 </Events> 828 903 </MenuItem> … … 862 937 </NonVisualComponents> 863 938 <Properties> 864 <Property name="defaultCloseOperation" type="int" value=" 3"/>939 <Property name="defaultCloseOperation" type="int" value="0"/> 865 940 <Property name="title" type="java.lang.String" value="Script Builder"/> 866 941 <Property name="bounds" type="java.awt.Rectangle" editor="org.netbeans.beaninfo.editors.RectangleEditor"> -
trunk/src/scriptbuilder/gui/ScriptBuilderFrame.java
r139 r145 13 13 import java.awt.event.KeyEvent; 14 14 import java.awt.event.KeyListener; 15 import java.awt.event.WindowAdapter; 16 import java.awt.event.WindowEvent; 15 17 import java.io.File; 16 18 import java.io.IOException; 19 import java.io.FileNotFoundException; 17 20 import java.net.URI; 18 21 import java.util.Observable; … … 38 41 import scriptbuilder.structures.TimeSlice; 39 42 import scriptbuilder.structures.events.I_ScriptEvent; 43 import scriptbuilder.structures.CadData; 40 44 41 45 /** … … 152 156 script.addObserver(this); 153 157 initComponents(); 158 addCustomListeners(); 159 //add to listener helper method 160 161 162 154 163 //We don't currently want the button to be present in this window 155 164 btnAddTime.setVisible(false); … … 162 171 */ 163 172 // Set listener for scroll pane 164 String t = "Script Builder: "; 165 if (script.saveFile == null) 166 { 167 t += "untitled1.xml"; 168 } 169 else 170 { 171 t += script.saveFile.getName(); 172 } 173 this.setTitle(t); 173 174 174 175 AdjustmentListener listener = new MyAdjustmentListener(); 175 176 timelinesScrollPane.getHorizontalScrollBar().addAdjustmentListener(listener); … … 177 178 repaint(); 178 179 180 } 181 182 /** 183 * Put all custom non-generated listeners in this method 184 */ 185 private void addCustomListeners(){ 186 187 String fileName = "units.xml"; 188 File unitFile = new File(fileName); 189 script.loadUnitsFromFile(unitFile); 190 //listener for window closing 191 this.addWindowListener(new WindowAdapter(){ 192 @Override 193 public void windowClosing(WindowEvent e) 194 { 195 //System.out.println("Window is closing!" + saved); 196 197 if(!script.saved){ 198 //System.out.println("window was not saved!"); 199 Object[] options = {"Yes","No","Cancel"}; 200 int result = JOptionPane.showOptionDialog(null,"Would you like to save changes before exiting?", 201 "Exit", 202 JOptionPane.YES_NO_CANCEL_OPTION, 203 JOptionPane.QUESTION_MESSAGE, 204 null, 205 options, 206 options[2]); 207 switch (result){ 208 //should save script then close 209 case 0: 210 fileSaveActionPerformed(null); 211 //System.exit(0); 212 break; 213 // should just exit 214 case 1: 215 System.exit(0); 216 break; 217 // should do nothing 218 case 2: 219 break; 220 default: 221 break; 222 } 223 224 225 226 }else{ 227 //should close current window since it is saved already 228 System.exit(0); 229 } 230 } 231 }); 179 232 } 180 233 … … 192 245 public void update(Observable o, Object arg) 193 246 { 194 //Three major update types: whole script, and 2 event updates247 checkNeedsSave(); 195 248 if (arg instanceof SimulationScript) 196 249 { 250 197 251 script = (SimulationScript) arg; 198 252 … … 236 290 * model.addElement(i); } gotoIncident.setModel(model);* 237 291 */ 292 238 293 this.setPreferredSize(this.getSize()); 239 294 pack(); 295 240 296 } 241 297 //Mouse has changed focus to a different timeslice … … 249 305 model.addElement(e); 250 306 } 307 308 309 251 310 } 252 311 //Mouse has changed focus to a different incident timeline panel … … 256 315 257 316 //gotoIncident.setSelectedItem(i); 317 258 318 } 259 319 … … 267 327 //scale the zoom slider such that the most zoomed-out point allows the 268 328 //entire script to be visible at once 329 330 //todo: interpret these two calls and make them so that they are more accurate to fit the entire window at once 269 331 zoomSlider.setMinimum(((timelineTickPanel.getVisibleRect().width - 20) 270 332 * ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION) 271 333 / Math.max(script.absoluteLength(), ScriptBuilderGuiConstants.TICK_TIMELINE_SMALLEST_LENGTH)); 272 334 zoomSlider.setMaximum(zoomSlider.getMinimum() + 20); 273 String t = "Script Builder: "; 274 if (script.saveFile == null) 275 { 276 t += "untitled1.xml"; 277 } 278 else 279 { 280 t += script.saveFile.getName(); 281 } 282 this.setTitle(t); 335 283 336 repaint(); 284 337 } … … 291 344 @SuppressWarnings("unchecked") 292 345 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents 293 private void initComponents() 294 { 346 private void initComponents() { 295 347 296 348 incidentPopupMenu = new javax.swing.JPopupMenu(); … … 333 385 incidentColorField = new javax.swing.JTextField(); 334 386 txtIncidentLength = new javax.swing.JLabel(); 387 jLabel1 = new javax.swing.JLabel(); 388 addIncidentLocation = new javax.swing.JTextField(); 389 jLabel2 = new javax.swing.JLabel(); 390 addIncidentType = new javax.swing.JTextField(); 335 391 addNoiseFrame = new javax.swing.JFrame(); 336 392 labelRadioChatter = new javax.swing.JLabel(); … … 396 452 newIncident = new javax.swing.JMenuItem(); 397 453 deleteIncident = new javax.swing.JMenuItem(); 454 deleteIncident1 = new javax.swing.JMenuItem(); 398 455 jSeparator4 = new javax.swing.JPopupMenu.Separator(); 399 456 saveIncident = new javax.swing.JMenuItem(); … … 401 458 generateNoiseMenu = new javax.swing.JMenu(); 402 459 generateNoiseOption = new javax.swing.JMenuItem(); 460 helpMenu1 = new javax.swing.JMenu(); 461 loadUnits = new javax.swing.JMenuItem(); 403 462 helpMenu = new javax.swing.JMenu(); 404 463 helpTutorial = new javax.swing.JMenuItem(); … … 406 465 407 466 popupDeleteIncident.setText("Delete Incident..."); 467 popupDeleteIncident.addActionListener(new java.awt.event.ActionListener() { 468 public void actionPerformed(java.awt.event.ActionEvent evt) { 469 popupDeleteIncidentActionPerformed(evt); 470 } 471 }); 408 472 incidentPopupMenu.add(popupDeleteIncident); 409 473 410 474 cadEvent.setText("CAD Event"); 411 cadEvent.addMouseListener(new java.awt.event.MouseAdapter() 412 { 413 public void mousePressed(java.awt.event.MouseEvent evt) 414 { 475 cadEvent.addMouseListener(new java.awt.event.MouseAdapter() { 476 public void mousePressed(java.awt.event.MouseEvent evt) { 415 477 cadEventMousePressed(evt); 416 478 } 417 public void mouseReleased(java.awt.event.MouseEvent evt) 418 { 479 public void mouseReleased(java.awt.event.MouseEvent evt) { 419 480 cadEventMouseReleased(evt); 420 481 } 421 482 }); 422 cadEvent.addActionListener(new java.awt.event.ActionListener() 423 { 424 public void actionPerformed(java.awt.event.ActionEvent evt) 425 { 483 cadEvent.addActionListener(new java.awt.event.ActionListener() { 484 public void actionPerformed(java.awt.event.ActionEvent evt) { 426 485 cadEventActionPerformed(evt); 427 486 } … … 433 492 434 493 radioEvent.setText("Radio Event"); 435 radioEvent.addMouseListener(new java.awt.event.MouseAdapter() 436 { 437 public void mousePressed(java.awt.event.MouseEvent evt) 438 { 494 radioEvent.addMouseListener(new java.awt.event.MouseAdapter() { 495 public void mousePressed(java.awt.event.MouseEvent evt) { 439 496 radioEventMousePressed(evt); 440 497 } … … 490 547 491 548 okButton.setText("OK"); 492 okButton.addActionListener(new java.awt.event.ActionListener() 493 { 494 public void actionPerformed(java.awt.event.ActionEvent evt) 495 { 549 okButton.addActionListener(new java.awt.event.ActionListener() { 550 public void actionPerformed(java.awt.event.ActionEvent evt) { 496 551 okButtonActionPerformed(evt); 497 552 } … … 499 554 500 555 cancelButton.setText("Cancel"); 501 cancelButton.addActionListener(new java.awt.event.ActionListener() 502 { 503 public void actionPerformed(java.awt.event.ActionEvent evt) 504 { 556 cancelButton.addActionListener(new java.awt.event.ActionListener() { 557 public void actionPerformed(java.awt.event.ActionEvent evt) { 505 558 cancelButtonActionPerformed(evt); 506 559 } … … 545 598 546 599 editEventList.setText("Edit..."); 547 editEventList.addActionListener(new java.awt.event.ActionListener() 548 { 549 public void actionPerformed(java.awt.event.ActionEvent evt) 550 { 600 editEventList.addActionListener(new java.awt.event.ActionListener() { 601 public void actionPerformed(java.awt.event.ActionEvent evt) { 551 602 editEventListActionPerformed(evt); 552 603 } … … 578 629 579 630 incidentOkButton.setText("OK"); 580 incidentOkButton.addActionListener(new java.awt.event.ActionListener() 581 { 582 public void actionPerformed(java.awt.event.ActionEvent evt) 583 { 631 incidentOkButton.addActionListener(new java.awt.event.ActionListener() { 632 public void actionPerformed(java.awt.event.ActionEvent evt) { 584 633 incidentOkButtonActionPerformed(evt); 585 634 } … … 587 636 588 637 incidentCancelButton.setText("Cancel"); 589 incidentCancelButton.addActionListener(new java.awt.event.ActionListener() 590 { 591 public void actionPerformed(java.awt.event.ActionEvent evt) 592 { 638 incidentCancelButton.addActionListener(new java.awt.event.ActionListener() { 639 public void actionPerformed(java.awt.event.ActionEvent evt) { 593 640 incidentCancelButtonActionPerformed(evt); 594 641 } 595 642 }); 596 643 597 addIncidentNumber.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(101), Integer.valueOf(101), null, Integer.valueOf(1))); 644 addIncidentNumber.setModel(new javax.swing.SpinnerNumberModel(101, 101, null, 1)); 645 646 addIncidentName.addActionListener(new java.awt.event.ActionListener() { 647 public void actionPerformed(java.awt.event.ActionEvent evt) { 648 addIncidentNameActionPerformed(evt); 649 } 650 }); 598 651 599 652 labelIncidentLength.setText("Incident Length in Minutes: "); … … 601 654 labelIncidentStart.setText("Incident Start Time in Minutes:"); 602 655 603 addIncidentStart.setModel(new javax.swing.SpinnerNumberModel( Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));656 addIncidentStart.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1)); 604 657 605 658 btnChooseColor.setText("Choose..."); 606 btnChooseColor.addActionListener(new java.awt.event.ActionListener() 607 { 608 public void actionPerformed(java.awt.event.ActionEvent evt) 609 { 659 btnChooseColor.addActionListener(new java.awt.event.ActionListener() { 660 public void actionPerformed(java.awt.event.ActionEvent evt) { 610 661 btnChooseColorActionPerformed(evt); 611 662 } … … 618 669 txtIncidentLength.setText("0"); 619 670 txtIncidentLength.setToolTipText(""); 671 672 jLabel1.setText("Incident Location:"); 673 674 addIncidentLocation.addActionListener(new java.awt.event.ActionListener() { 675 public void actionPerformed(java.awt.event.ActionEvent evt) { 676 addIncidentLocationActionPerformed(evt); 677 } 678 }); 679 680 jLabel2.setText("Incident Type:"); 620 681 621 682 javax.swing.GroupLayout incidentFrameLayout = new javax.swing.GroupLayout(incidentFrame.getContentPane()); … … 623 684 incidentFrameLayout.setHorizontalGroup( 624 685 incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 625 .addGroup( javax.swing.GroupLayout.Alignment.TRAILING,incidentFrameLayout.createSequentialGroup()686 .addGroup(incidentFrameLayout.createSequentialGroup() 626 687 .addContainerGap() 627 .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) 628 .addComponent(incidentPropertiesScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 322, Short.MAX_VALUE) 629 .addComponent(labelIncidentDescription, javax.swing.GroupLayout.Alignment.LEADING) 630 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, incidentFrameLayout.createSequentialGroup() 688 .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 689 .addComponent(incidentPropertiesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 322, Short.MAX_VALUE) 690 .addGroup(incidentFrameLayout.createSequentialGroup() 631 691 .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 632 692 .addComponent(labelIncidentNumber) 633 693 .addComponent(labelIncidentName) 634 694 .addComponent(labelIncidentColor)) 635 .addGap( 18, 18, 18)695 .addGap(66, 66, 66) 636 696 .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 637 .addComponent(addIncidentName, javax.swing.GroupLayout.DEFAULT_SIZE, 218, Short.MAX_VALUE)638 .addComponent(addIncidentNumber, javax.swing.GroupLayout.DEFAULT_SIZE, 218, Short.MAX_VALUE)697 .addComponent(addIncidentName, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE) 698 .addComponent(addIncidentNumber, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE) 639 699 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, incidentFrameLayout.createSequentialGroup() 640 .addComponent(incidentColorField, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE)700 .addComponent(incidentColorField, javax.swing.GroupLayout.DEFAULT_SIZE, 97, Short.MAX_VALUE) 641 701 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 642 702 .addComponent(btnChooseColor, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)))) 643 .addGroup( javax.swing.GroupLayout.Alignment.LEADING,incidentFrameLayout.createSequentialGroup()703 .addGroup(incidentFrameLayout.createSequentialGroup() 644 704 .addComponent(incidentCancelButton) 645 705 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 188, Short.MAX_VALUE) 646 706 .addComponent(incidentOkButton, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)) 647 .addGroup( javax.swing.GroupLayout.Alignment.LEADING,incidentFrameLayout.createSequentialGroup()707 .addGroup(incidentFrameLayout.createSequentialGroup() 648 708 .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 649 709 .addComponent(labelIncidentStart) … … 655 715 .addComponent(txtIncidentLength, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 656 716 .addGap(22, 22, 22)) 657 .addComponent(addIncidentStart, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE)))) 717 .addComponent(addIncidentStart, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE))) 718 .addGroup(incidentFrameLayout.createSequentialGroup() 719 .addComponent(jLabel2) 720 .addGap(93, 93, 93) 721 .addComponent(addIncidentType)) 722 .addGroup(incidentFrameLayout.createSequentialGroup() 723 .addComponent(labelIncidentDescription) 724 .addGap(0, 0, Short.MAX_VALUE)) 725 .addGroup(incidentFrameLayout.createSequentialGroup() 726 .addComponent(jLabel1) 727 .addGap(69, 69, 69) 728 .addComponent(addIncidentLocation))) 658 729 .addContainerGap()) 659 730 ); … … 675 746 .addComponent(incidentColorField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 676 747 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 748 .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 749 .addComponent(jLabel1) 750 .addComponent(addIncidentLocation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 751 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 752 .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 753 .addComponent(jLabel2) 754 .addComponent(addIncidentType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 755 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 677 756 .addComponent(labelIncidentDescription) 678 757 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 679 .addComponent(incidentPropertiesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1 18, Short.MAX_VALUE)758 .addComponent(incidentPropertiesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE) 680 759 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 681 760 .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) … … 726 805 727 806 btnCancelNoise.setText("Cancel"); 728 btnCancelNoise.addActionListener(new java.awt.event.ActionListener() 729 { 730 public void actionPerformed(java.awt.event.ActionEvent evt) 731 { 807 btnCancelNoise.addActionListener(new java.awt.event.ActionListener() { 808 public void actionPerformed(java.awt.event.ActionEvent evt) { 732 809 btnCancelNoiseActionPerformed(evt); 733 810 } … … 735 812 736 813 btnGenerateNoise.setText("Generate"); 737 btnGenerateNoise.addActionListener(new java.awt.event.ActionListener() 738 { 739 public void actionPerformed(java.awt.event.ActionEvent evt) 740 { 814 btnGenerateNoise.addActionListener(new java.awt.event.ActionListener() { 815 public void actionPerformed(java.awt.event.ActionEvent evt) { 741 816 btnGenerateNoiseActionPerformed(evt); 742 817 } … … 817 892 ); 818 893 819 setDefaultCloseOperation(javax.swing.WindowConstants. EXIT_ON_CLOSE);894 setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); 820 895 setTitle("Script Builder"); 821 896 setBounds(new java.awt.Rectangle(0, 23, 800, 700)); … … 1187 1262 zoomSlider.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); 1188 1263 zoomSlider.setFocusable(false); 1189 zoomSlider.addChangeListener(new javax.swing.event.ChangeListener() 1190 { 1191 public void stateChanged(javax.swing.event.ChangeEvent evt) 1192 { 1264 zoomSlider.addChangeListener(new javax.swing.event.ChangeListener() { 1265 public void stateChanged(javax.swing.event.ChangeEvent evt) { 1193 1266 zoomSliderStateChanged(evt); 1194 1267 } … … 1197 1270 zoomInIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/ZoomIn.png"))); // NOI18N 1198 1271 zoomInIcon.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); 1199 zoomInIcon.addMouseListener(new java.awt.event.MouseAdapter() 1200 { 1201 public void mouseClicked(java.awt.event.MouseEvent evt) 1202 { 1272 zoomInIcon.addMouseListener(new java.awt.event.MouseAdapter() { 1273 public void mouseClicked(java.awt.event.MouseEvent evt) { 1203 1274 zoomInIconMouseClicked(evt); 1204 1275 } … … 1207 1278 zoomOutIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/ZoomOut.png"))); // NOI18N 1208 1279 zoomOutIcon.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); 1209 zoomOutIcon.addMouseListener(new java.awt.event.MouseAdapter() 1210 { 1211 public void mouseClicked(java.awt.event.MouseEvent evt) 1212 { 1280 zoomOutIcon.addMouseListener(new java.awt.event.MouseAdapter() { 1281 public void mouseClicked(java.awt.event.MouseEvent evt) { 1213 1282 zoomOutIconMouseClicked(evt); 1214 1283 } … … 1233 1302 1234 1303 btnAddTime.setText("+15:00"); 1235 btnAddTime.addActionListener(new java.awt.event.ActionListener() 1236 { 1237 public void actionPerformed(java.awt.event.ActionEvent evt) 1238 { 1304 btnAddTime.addActionListener(new java.awt.event.ActionListener() { 1305 public void actionPerformed(java.awt.event.ActionEvent evt) { 1239 1306 btnAddTimeActionPerformed(evt); 1307 } 1308 }); 1309 1310 scriptBuilderMenuBar.addAncestorListener(new javax.swing.event.AncestorListener() { 1311 public void ancestorMoved(javax.swing.event.AncestorEvent evt) { 1312 } 1313 public void ancestorAdded(javax.swing.event.AncestorEvent evt) { 1314 scriptBuilderMenuBarAncestorAdded(evt); 1315 } 1316 public void ancestorRemoved(javax.swing.event.AncestorEvent evt) { 1240 1317 } 1241 1318 }); … … 1243 1320 fileMenu.setText("File"); 1244 1321 fileMenu.setMargin(new java.awt.Insets(0, 10, 0, 10)); 1245 fileMenu.addActionListener(new java.awt.event.ActionListener() 1246 { 1247 public void actionPerformed(java.awt.event.ActionEvent evt) 1248 { 1322 fileMenu.addActionListener(new java.awt.event.ActionListener() { 1323 public void actionPerformed(java.awt.event.ActionEvent evt) { 1249 1324 fileMenuActionPerformed(evt); 1250 1325 } … … 1253 1328 fileNew.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); 1254 1329 fileNew.setText("New"); 1255 fileNew.addActionListener(new java.awt.event.ActionListener() 1256 { 1257 public void actionPerformed(java.awt.event.ActionEvent evt) 1258 { 1330 fileNew.addActionListener(new java.awt.event.ActionListener() { 1331 public void actionPerformed(java.awt.event.ActionEvent evt) { 1259 1332 fileNewActionPerformed(evt); 1260 1333 } … … 1265 1338 fileOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); 1266 1339 fileOpen.setText("Open..."); 1267 fileOpen.addActionListener(new java.awt.event.ActionListener() 1268 { 1269 public void actionPerformed(java.awt.event.ActionEvent evt) 1270 { 1340 fileOpen.addActionListener(new java.awt.event.ActionListener() { 1341 public void actionPerformed(java.awt.event.ActionEvent evt) { 1271 1342 fileOpenActionPerformed(evt); 1272 1343 } … … 1277 1348 fileSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK)); 1278 1349 fileSave.setText("Save"); 1279 fileSave.addActionListener(new java.awt.event.ActionListener() 1280 { 1281 public void actionPerformed(java.awt.event.ActionEvent evt) 1282 { 1350 fileSave.addActionListener(new java.awt.event.ActionListener() { 1351 public void actionPerformed(java.awt.event.ActionEvent evt) { 1283 1352 fileSaveActionPerformed(evt); 1284 1353 } … … 1288 1357 fileSaveAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); 1289 1358 fileSaveAs.setText("Save as..."); 1290 fileSaveAs.addActionListener(new java.awt.event.ActionListener() 1291 { 1292 public void actionPerformed(java.awt.event.ActionEvent evt) 1293 { 1359 fileSaveAs.addActionListener(new java.awt.event.ActionListener() { 1360 public void actionPerformed(java.awt.event.ActionEvent evt) { 1294 1361 fileSaveAsActionPerformed(evt); 1295 1362 } … … 1304 1371 generateNotebooks.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK)); 1305 1372 generateNotebooks.setText("Generate Notebooks..."); 1306 generateNotebooks.addActionListener(new java.awt.event.ActionListener() 1307 { 1308 public void actionPerformed(java.awt.event.ActionEvent evt) 1309 { 1373 generateNotebooks.addActionListener(new java.awt.event.ActionListener() { 1374 public void actionPerformed(java.awt.event.ActionEvent evt) { 1310 1375 generateNotebooksActionPerformed(evt); 1311 1376 } … … 1315 1380 generateWebNotebook.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_W, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK)); 1316 1381 generateWebNotebook.setText("Generate Web Notebook..."); 1317 generateWebNotebook.addActionListener(new java.awt.event.ActionListener() 1318 { 1319 public void actionPerformed(java.awt.event.ActionEvent evt) 1320 { 1382 generateWebNotebook.addActionListener(new java.awt.event.ActionListener() { 1383 public void actionPerformed(java.awt.event.ActionEvent evt) { 1321 1384 generateWebNotebookActionPerformed(evt); 1322 1385 } … … 1326 1389 generateScorecards.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK)); 1327 1390 generateScorecards.setText("Generate Scorecards..."); 1328 generateScorecards.addActionListener(new java.awt.event.ActionListener() 1329 { 1330 public void actionPerformed(java.awt.event.ActionEvent evt) 1331 { 1391 generateScorecards.addActionListener(new java.awt.event.ActionListener() { 1392 public void actionPerformed(java.awt.event.ActionEvent evt) { 1332 1393 generateScorecardsActionPerformed(evt); 1333 1394 } … … 1337 1398 generateOrganizationChart.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK)); 1338 1399 generateOrganizationChart.setText("Generate D14 TMC Org Chart..."); 1339 generateOrganizationChart.addActionListener(new java.awt.event.ActionListener() 1340 { 1341 public void actionPerformed(java.awt.event.ActionEvent evt) 1342 { 1400 generateOrganizationChart.addActionListener(new java.awt.event.ActionListener() { 1401 public void actionPerformed(java.awt.event.ActionEvent evt) { 1343 1402 generateOrganizationChartActionPerformed(evt); 1344 1403 } … … 1349 1408 generateProjectRequirements.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK)); 1350 1409 generateProjectRequirements.setText("Generate Project Worklist..."); 1351 generateProjectRequirements.addActionListener(new java.awt.event.ActionListener() 1352 { 1353 public void actionPerformed(java.awt.event.ActionEvent evt) 1354 { 1410 generateProjectRequirements.addActionListener(new java.awt.event.ActionListener() { 1411 public void actionPerformed(java.awt.event.ActionEvent evt) { 1355 1412 generateProjectRequirementsActionPerformed(evt); 1356 1413 } … … 1364 1421 1365 1422 newIncident.setText("New Incident..."); 1366 newIncident.addActionListener(new java.awt.event.ActionListener() 1367 { 1368 public void actionPerformed(java.awt.event.ActionEvent evt) 1369 { 1423 newIncident.addActionListener(new java.awt.event.ActionListener() { 1424 public void actionPerformed(java.awt.event.ActionEvent evt) { 1370 1425 newIncidentActionPerformed(evt); 1371 1426 } … … 1374 1429 1375 1430 deleteIncident.setText("Delete Incident"); 1376 deleteIncident.addActionListener(new java.awt.event.ActionListener() 1377 { 1378 public void actionPerformed(java.awt.event.ActionEvent evt) 1379 { 1431 deleteIncident.addActionListener(new java.awt.event.ActionListener() { 1432 public void actionPerformed(java.awt.event.ActionEvent evt) { 1380 1433 deleteIncidentActionPerformed(evt); 1381 1434 } 1382 1435 }); 1383 1436 incidentMenu.add(deleteIncident); 1437 1438 deleteIncident1.setText("Edit Incident..."); 1439 deleteIncident1.addActionListener(new java.awt.event.ActionListener() { 1440 public void actionPerformed(java.awt.event.ActionEvent evt) { 1441 incidentDetailsActionPerformed(evt); 1442 } 1443 }); 1444 incidentMenu.add(deleteIncident1); 1384 1445 incidentMenu.add(jSeparator4); 1385 1446 1386 1447 saveIncident.setText("Save Incident..."); 1387 saveIncident.addActionListener(new java.awt.event.ActionListener() 1388 { 1389 public void actionPerformed(java.awt.event.ActionEvent evt) 1390 { 1448 saveIncident.addActionListener(new java.awt.event.ActionListener() { 1449 public void actionPerformed(java.awt.event.ActionEvent evt) { 1391 1450 saveIncidentActionPerformed(evt); 1392 1451 } … … 1395 1454 1396 1455 loadIncident.setText("Load Incident..."); 1397 loadIncident.addActionListener(new java.awt.event.ActionListener() 1398 { 1399 public void actionPerformed(java.awt.event.ActionEvent evt) 1400 { 1456 loadIncident.addActionListener(new java.awt.event.ActionListener() { 1457 public void actionPerformed(java.awt.event.ActionEvent evt) { 1401 1458 loadIncidentActionPerformed(evt); 1402 1459 } … … 1409 1466 1410 1467 generateNoiseOption.setText("Generate Noise..."); 1411 generateNoiseOption.addActionListener(new java.awt.event.ActionListener() 1412 { 1413 public void actionPerformed(java.awt.event.ActionEvent evt) 1414 { 1468 generateNoiseOption.addActionListener(new java.awt.event.ActionListener() { 1469 public void actionPerformed(java.awt.event.ActionEvent evt) { 1415 1470 generateNoiseOptionActionPerformed(evt); 1416 1471 } … … 1419 1474 1420 1475 scriptBuilderMenuBar.add(generateNoiseMenu); 1476 1477 helpMenu1.setText("Unit"); 1478 helpMenu1.setMargin(new java.awt.Insets(0, 10, 0, 10)); 1479 1480 loadUnits.setText("Load Units..."); 1481 loadUnits.addActionListener(new java.awt.event.ActionListener() { 1482 public void actionPerformed(java.awt.event.ActionEvent evt) { 1483 loadUnitsActionPerformed(evt); 1484 } 1485 }); 1486 helpMenu1.add(loadUnits); 1487 1488 scriptBuilderMenuBar.add(helpMenu1); 1421 1489 1422 1490 helpMenu.setText("Help"); … … 1425 1493 helpTutorial.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0)); 1426 1494 helpTutorial.setText("Tutorial..."); 1427 helpTutorial.addActionListener(new java.awt.event.ActionListener() 1428 { 1429 public void actionPerformed(java.awt.event.ActionEvent evt) 1430 { 1495 helpTutorial.addActionListener(new java.awt.event.ActionListener() { 1496 public void actionPerformed(java.awt.event.ActionEvent evt) { 1431 1497 helpTutorialActionPerformed(evt); 1432 1498 } … … 1435 1501 1436 1502 helpAbout.setText("About..."); 1437 helpAbout.addActionListener(new java.awt.event.ActionListener() 1438 { 1439 public void actionPerformed(java.awt.event.ActionEvent evt) 1440 { 1503 helpAbout.addActionListener(new java.awt.event.ActionListener() { 1504 public void actionPerformed(java.awt.event.ActionEvent evt) { 1441 1505 helpAboutActionPerformed(evt); 1442 1506 } … … 1574 1638 SimulationScript.incidentColors[indx] = selectedColor; 1575 1639 // Add the new incident to the list 1640 //todo: need to add new data to the ScriptIncident Object here 1576 1641 script.incidents.add(indx, 1577 1642 new ScriptIncident(SimulationScript.incidentColors[indx], 1578 1643 (Integer) addIncidentNumber.getValue(), addIncidentName.getText(), addIncidentDescription.getText(), 1579 script)); 1644 script,0)); 1645 1580 1646 script.incidents.get(indx).setOffset((Integer) addIncidentStart.getValue() * 60); 1647 script.incidents.get(indx).insertCadData((Integer) addIncidentStart.getValue(), new CadData(addIncidentType.getText(),addIncidentLocation.getText())); 1581 1648 script.numberOfIncidents++; 1649 1582 1650 IncidentEditorFrame editor = new IncidentEditorFrame(script.incidents.get(indx), this); 1583 1651 … … 1594 1662 //change offset of incident 1595 1663 script.incidents.get(oldIncidentIndex).setOffset(((int) addIncidentStart.getValue()) * 60); 1664 1665 script.incidents.get(oldIncidentIndex).insertCadData((int) addIncidentStart.getValue() * 60, new CadData(addIncidentType.getText(),addIncidentLocation.getText())); 1596 1666 //update incident number, if it was changed 1597 1667 if ((int) addIncidentNumber.getValue() == script.incidents.get(oldIncidentIndex).number … … 1613 1683 repaint(); 1614 1684 }//GEN-LAST:event_incidentOkButtonActionPerformed 1615 1616 /** 1685 /** 1686 * Calling this will check to see if the model has been updated. 1687 * @param save indicated whether or not the file needs to be saved 1688 */ 1689 private void checkNeedsSave(){ 1690 1691 if(!script.saved){ 1692 changeFrameTitle("*"); 1693 }else{ 1694 changeFrameTitle(""); 1695 } 1696 } 1697 /** 1698 * 1699 * @param ext changes title by putting ext after current title. 1700 */ 1701 private void changeFrameTitle(String ext){ 1702 String t = "Script Builder: "; 1703 if (script.saveFile == null) 1704 { 1705 t += "untitled1.xml"; 1706 } 1707 else 1708 { 1709 t += script.saveFile.getName(); 1710 } 1711 t+= ext; 1712 this.setTitle(t); 1713 } 1714 /** 1715 * 1617 1716 * Determine if the given incident number is already present in the script. 1618 1717 * … … 1653 1752 1654 1753 addIncidentName.setText(""); 1655 1656 1754 int newLogNum = 100; 1657 1755 boolean found = false; … … 1682 1780 selectedColor = Color.BLACK; 1683 1781 addIncidentDescription.setText(""); 1782 addIncidentLocation.setText(""); 1783 addIncidentType.setText(""); 1684 1784 1685 1785 incidentFrame.setVisible(true); … … 1711 1811 script.saveFile = fc.getSelectedFile(); 1712 1812 } 1813 1713 1814 this.update(script, script); 1714 1815 //zoom out all the way so that the whole imported script is visible … … 1736 1837 } 1737 1838 script.saveFile = new File("" + fName + untitledCount + ".xml"); 1839 1738 1840 } 1739 1841 … … 1755 1857 script.saveScriptToFile(new File(filename)); 1756 1858 script.saveFile = new File(filename); 1859 1757 1860 } 1758 1861 else … … 1763 1866 } 1764 1867 } 1868 1765 1869 this.update(script, 0); 1766 1870 }//GEN-LAST:event_fileSaveAsActionPerformed … … 1782 1886 else 1783 1887 { 1888 1784 1889 script.saveScriptToFile(script.saveFile); 1785 1890 } 1891 //TODO: TEST TO MAKE SURE THIS DOES NOT CREATE BADDIES 1892 this.update(script, 0); 1786 1893 }//GEN-LAST:event_fileSaveActionPerformed 1787 1894 … … 1809 1916 addIncidentName.setText(i.name); 1810 1917 addIncidentNumber.setValue(i.number); 1918 addIncidentLocation.setText(i.getCadData(i.offset).Header_FullLoc); 1919 addIncidentType.setText(i.getCadData(i.offset).Header_Type); 1811 1920 addIncidentStart.setValue(i.offset / 60); 1812 1921 txtIncidentLength.setText("" + (i.length / 60)); … … 2106 2215 {//GEN-HEADEREND:event_fileNewActionPerformed 2107 2216 script = new SimulationScript(); 2217 String fileName = "units.xml"; 2218 File f = new File(fileName); 2219 script.loadUnitsFromFile(f); 2108 2220 script.update(); 2109 2221 this.update(null, script); … … 2157 2269 script.incidents.add(null); 2158 2270 script.numberOfIncidents--; 2271 2159 2272 } 2160 2273 } 2161 2274 } 2275 //since delete is the only method in this class that actually edits the data model, needs .update() 2276 script.update(); 2162 2277 //Refresh 2163 2278 this.update(script, script); 2279 2280 2164 2281 repaint(); 2165 2282 }//GEN-LAST:event_deleteIncidentActionPerformed … … 2220 2337 // TODO add your handling code here: 2221 2338 }//GEN-LAST:event_helpTutorialActionPerformed 2339 2340 private void addIncidentLocationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addIncidentLocationActionPerformed 2341 // TODO add your handling code here: 2342 }//GEN-LAST:event_addIncidentLocationActionPerformed 2343 2344 private void addIncidentNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addIncidentNameActionPerformed 2345 // TODO add your handling code here: 2346 }//GEN-LAST:event_addIncidentNameActionPerformed 2347 2348 private void incidentDetailsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_incidentDetailsActionPerformed 2349 // TODO add your handling code here: 2350 Object[] incidentList = script.incidents.toArray(); 2351 ScriptIncident i = (ScriptIncident) JOptionPane.showInputDialog( 2352 this, 2353 "Select Incident:", 2354 "Edit Incident", 2355 JOptionPane.PLAIN_MESSAGE, 2356 null, 2357 incidentList, 2358 script.incidents.get(0)); 2359 2360 // If a valid incident was selected 2361 if (i != null) 2362 { 2363 editingIncident = true; 2364 oldIncidentIndex = script.incidents.indexOf(i); 2365 2366 addIncidentName.setText(i.name); 2367 addIncidentNumber.setValue(i.number); 2368 2369 addIncidentLocation.setText(i.getCadData(i.offset).Header_FullLoc); 2370 addIncidentType.setText(i.getCadData(i.offset).Header_Type); 2371 addIncidentStart.setValue(i.offset / 60); 2372 //addIncidentLength.setValue(i.length / 60); 2373 incidentColorField.setBackground(i.color); 2374 selectedColor = i.color; 2375 addIncidentDescription.setText(i.description); 2376 2377 incidentFrame.setVisible(true); 2378 } 2379 }//GEN-LAST:event_incidentDetailsActionPerformed 2380 2381 private void popupDeleteIncidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_popupDeleteIncidentActionPerformed 2382 // TODO add your handling code here: 2383 }//GEN-LAST:event_popupDeleteIncidentActionPerformed 2384 2385 private void loadUnitsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadUnitsActionPerformed 2386 // TODO: needs to have testing performed 2387 JFileChooser fc = new JFileChooser(); 2388 2389 //Search for .xml files 2390 fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)", 2391 new String[] 2392 { 2393 "xml" 2394 })); 2395 if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) 2396 { 2397 //load script with values from the selected file 2398 script.loadUnitsFromFile(fc.getSelectedFile()); 2399 } 2400 }//GEN-LAST:event_loadUnitsActionPerformed 2401 2402 private void scriptBuilderMenuBarAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_scriptBuilderMenuBarAncestorAdded 2403 //loads in the initial unit file 2404 // String fileName = "units.xml"; 2405 // 2406 // File f = new File(fileName); 2407 // 2408 // script.loadUnitsFromFile(f); 2409 }//GEN-LAST:event_scriptBuilderMenuBarAncestorAdded 2222 2410 2223 2411 /** … … 2292 2480 private javax.swing.JSlider TMCALSlider; 2293 2481 private javax.swing.JTextArea addIncidentDescription; 2482 private javax.swing.JTextField addIncidentLocation; 2294 2483 private javax.swing.JTextField addIncidentName; 2295 2484 private javax.swing.JSpinner addIncidentNumber; 2296 2485 private javax.swing.JSpinner addIncidentStart; 2486 private javax.swing.JTextField addIncidentType; 2297 2487 private javax.swing.JFrame addNoiseFrame; 2298 2488 private javax.swing.JSlider backgroundNoiseSlider; … … 2306 2496 private javax.swing.JMenuItem deleteEventList; 2307 2497 private javax.swing.JMenuItem deleteIncident; 2498 private javax.swing.JMenuItem deleteIncident1; 2308 2499 private javax.swing.JMenuItem editEventList; 2309 2500 private javax.swing.JPopupMenu eventListPopupMenu; … … 2324 2515 private javax.swing.JMenuItem helpAbout; 2325 2516 private javax.swing.JMenu helpMenu; 2517 private javax.swing.JMenu helpMenu1; 2326 2518 private javax.swing.JMenuItem helpTutorial; 2327 2519 private javax.swing.JButton incidentCancelButton; … … 2353 2545 private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel8; 2354 2546 private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel9; 2547 private javax.swing.JLabel jLabel1; 2548 private javax.swing.JLabel jLabel2; 2355 2549 private javax.swing.JMenuItem jMenuItem2; 2356 2550 private javax.swing.JMenuItem jMenuItem4; … … 2379 2573 private javax.swing.JSlider laneClosuresSlider; 2380 2574 private javax.swing.JMenuItem loadIncident; 2575 private javax.swing.JMenuItem loadUnits; 2381 2576 private javax.swing.JSlider minorEventsSlider; 2382 2577 private javax.swing.JMenuItem newIncident; -
trunk/src/scriptbuilder/gui/ScriptBuilderGuiConstants.java
r32 r145 16 16 { 17 17 public static int PIXEL_WIDTH_PER_HORIZONTAL_TICK = 24; 18 public static final int HORIZONTAL_TICK_RESOLUTION = 60,18 public static final int HORIZONTAL_TICK_RESOLUTION = 20,//changes how wide each tick in the timeline panel is. can add every X seconds 19 19 TIMELINE_TOP_MARGIN = 25, 20 20 MAX_NUMBER_OF_SCRIPT_EVENT_ICON = 10, -
trunk/src/scriptbuilder/gui/application.properties
r144 r145 1 #T ue, 09 Jan 2018 11:31:37 -08001 #Thu, 31 Oct 2019 16:04:24 -0700 2 2 3 Application.revision=14 33 Application.revision=144 4 4 5 Application.buildnumber= 385 Application.buildnumber=43 6 6 7 7 Incidents.directory=Incidents -
trunk/src/scriptbuilder/gui/drawers/CursorDrawer.java
r1 r145 81 81 + (seconds / 60 % 60 > 9 ? seconds / 60 % 60 82 82 : "0" + seconds / 60 % 60) 83 + ": 00",83 + ":" + (seconds % 60)/10 + "0", 84 84 x - ScriptBuilderGuiConstants.CURSOR_TIMESTAMP_TEXT_CENTER, 85 85 ScriptBuilderGuiConstants.CURSOR_TIMESTAMP_TEXT_TOP_MARGIN); -
trunk/src/scriptbuilder/gui/drawers/TimeSliceDrawer.java
r76 r145 72 72 return; 73 73 } 74 74 //System.out.println("new slice"); 75 75 // Draw the slice event icon to show that there are events here 76 76 g2d.drawImage(getSliceEventImage(), slice.getX() -
trunk/src/scriptbuilder/gui/panels/IncidentTimelinePanel.java
r133 r145 202 202 * Determine if the mouse click happened within a valid timeSlice on 203 203 * this incident; if so, activate the Editor window for that timeSlice. 204 * 205 * @param ethe mouse event204 *todo: fix bug where the event editor window appears even when a event type is not selected. 205 * @param clickEvent the mouse event 206 206 */ 207 207 @Override 208 public void mouseClicked(MouseEvent e)209 { 210 Editor ed = null;211 ScriptBuilderFrame f= null;212 IncidentEditorFrame g= null;208 public void mouseClicked(MouseEvent clickEvent) 209 { 210 Editor editor = null; 211 ScriptBuilderFrame scriptBuilderFrameCurrent = null; 212 IncidentEditorFrame incidentEditFrameCurrent = null; 213 213 if (getTopLevelAncestor() instanceof ScriptBuilderFrame) 214 214 { 215 f= (ScriptBuilderFrame) getTopLevelAncestor();215 scriptBuilderFrameCurrent = (ScriptBuilderFrame) getTopLevelAncestor(); 216 216 217 217 } 218 218 else if (getTopLevelAncestor() instanceof IncidentEditorFrame) 219 219 { 220 g = (IncidentEditorFrame) getTopLevelAncestor(); 221 ed = new Editor(g); 222 } 223 224 x = cursorTime = e.getX(); 225 y = e.getY(); 226 227 if (e.getX() % ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK 220 incidentEditFrameCurrent = (IncidentEditorFrame) getTopLevelAncestor(); 221 editor = new Editor(incidentEditFrameCurrent); 222 } 223 224 x = cursorTime = clickEvent.getX(); 225 y = clickEvent.getY(); 226 //System.out.println(cursorTime); 227 //logic that follows is used to "snap" the cursor location to the lines displayed on the timeline panel 228 if (clickEvent.getX() % ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK 228 229 > ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK / 2) 229 230 { 230 231 cursorTime += ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK 231 - e.getX()232 - clickEvent.getX() 232 233 % ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK; 233 234 } 234 235 else 235 236 { 236 cursorTime -= e.getX()237 cursorTime -= clickEvent.getX() 237 238 % ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK; 238 239 } 239 240 240 241 int newSlice = (cursorTime / ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK); 242 241 243 newSlice *= ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION; 242 244 /** … … 248 250 } 249 251 250 if (ed != null) 251 { 252 ed.setSlice(incident.slices.get(newSlice)); 253 } 252 254 253 255 254 /** 256 * Add a new icon if left mouse button was clicked *255 * Add a new icon if left mouse button was clicked 257 256 */ 258 if ( e.getButton() == MouseEvent.BUTTON1)259 { 260 257 if (clickEvent.getButton() == MouseEvent.BUTTON1) 258 { 259 261 260 if (getTopLevelAncestor() instanceof IncidentEditorFrame) 262 261 { 263 if (incident.slices.size() == 0 && newSlice != 0) 262 263 if (incidentEditFrameCurrent.currentEventType != null) 264 264 { 265 JOptionPane.showMessageDialog(g, "This is the first event in the incident.\n" 266 + "Therefore, it will be automatically positioned at time 00:00:00,\n" 267 + "relative to the start of the incident.", "Event will be moved", JOptionPane.INFORMATION_MESSAGE); 268 newSlice = 0; 269 } 270 if (g.currentEventType != null) 271 { 272 I_ScriptEvent s = ScriptEvent.factoryByType(g.currentEventType); 273 if (ed != null) 265 if ((incident.slices.size() == 0 && newSlice != 0)||(incident.slices.get(0).events.isEmpty())) 274 266 { 275 ed.addEvent(eventTypeToPropertyMap.get(g.currentEventType), s); 267 268 JOptionPane.showMessageDialog(incidentEditFrameCurrent, "This is the first event in the incident.\n" 269 + "Therefore, it will be automatically positioned at time 00:00:00,\n" 270 + "relative to the start of the incident.", "Event will be moved", JOptionPane.INFORMATION_MESSAGE); 271 newSlice = 0; 276 272 } 277 if (incident.slices.get(newSlice) == null) 273 //add the time of addition to be passed through to the event itself somewhere in here? Stored in newSlice 274 I_ScriptEvent newScriptEvent = ScriptEvent.factoryByType(incidentEditFrameCurrent.currentEventType); 275 // if (editor != null) 276 // { 277 // //this is not necessary if we just load the slices after we create a new one in the window, creates some extra dummy slice for no reason. 278 // //this adds a new event to the existing editor window 279 // editor.addEvent(eventTypeToPropertyMap.get(incidentEditFrameCurrent.currentEventType), newScriptEvent); 280 // } 281 if (incident.slices.get(newSlice) == null || incident.slices.get(newSlice).events.isEmpty()) 278 282 { 279 incident.addNewEvent(s, newSlice); 283 //if there is no slice at the newSlice time, then create a new event with a new slice at that time 284 285 incident.addNewEvent(newScriptEvent, newSlice); 286 //find out where the new slice is added and then make it 287 //possible to 288 //editor.setSlice(incident.getSlices().get(newSlice)); 280 289 } 281 290 else 282 291 { 283 incident.slices.get(newSlice).addEvent(s); 292 //if there is already a slice there, just add the event to the 293 incident.slices.get(newSlice).addEvent(newScriptEvent); 284 294 } 285 g.update(null, g.getIncident());295 incidentEditFrameCurrent.update(null, incidentEditFrameCurrent.getIncident()); 286 296 } 287 297 } 288 298 } 289 299 300 if (editor != null) 301 { 302 editor.setSlice(incident.slices.get(newSlice)); 303 } 290 304 if (incident.slices.get(newSlice) != null 291 305 && getTopLevelAncestor() instanceof IncidentEditorFrame) 292 306 { 293 ed .setVisible(true);307 editor.setVisible(true); 294 308 } 295 309 } … … 498 512 if (focused) 499 513 { 514 //System.out.println("Cursor Time: " + cursorTime); 500 515 CursorDrawer.DrawCursor(g2d, cursorTime, false); 501 516 if (this.getTopLevelAncestor() instanceof ScriptBuilderFrame) -
trunk/src/scriptbuilder/structures/CadData.java
r143 r145 15 15 locInfo = new ArrayList<Location_Info>(); 16 16 } 17 18 /** 19 * Constructor to add type and location, where TruncLoc is the first 5 letters of the fullloc. 20 * @param Header_Type 21 * @param Header_FullLoc 22 */ 23 public CadData(String Header_Type, String Header_FullLoc) 24 { 25 this.Header_Type = Header_Type; 26 this.Header_FullLoc = Header_FullLoc; 27 // if(Header_FullLoc.length()>10) 28 // { 29 // this.Header_TruncLoc = Header_FullLoc.substring(0,9); 30 // } 31 this.Header_TruncLoc = Header_FullLoc; 32 locInfo = new ArrayList<Location_Info>(); 33 } 17 34 18 35 public TimeSlice tSlice; 19 36 20 public String Header_Type = " DEFAULT";37 public String Header_Type = ""; 21 38 22 39 public String Header_Beat = ""; 23 40 24 public String Header_TruncLoc = " Default Location (short)";25 26 public String Header_FullLoc = " Default Location (long)";41 public String Header_TruncLoc = ""; 42 43 public String Header_FullLoc = ""; 27 44 28 45 public String Master_Inc_Num = ""; … … 134 151 } 135 152 136 if (hasHeaderInfo() || true) //checking to see if header info is always necessary 137 { 153 if (hasHeaderInfo()) //checking to see if header info is always necessary 154 { 155 //todo: make this logic trigger only once per incident 138 156 output += XMLWriter.openTag(ELEMENT.HEADER_INFO.tag); 139 157 -
trunk/src/scriptbuilder/structures/ELEMENT.java
r138 r145 35 35 LOCATION_INFO, 36 36 NEW_UNIT, 37 //todo: change this paramics to traffic modeler 37 38 PARAMICS,//EVENT 38 39 RADIO_EVALUATION, -
trunk/src/scriptbuilder/structures/MyScriptHandler.java
r138 r145 304 304 305 305 docPosition.push(ELEMENT.byName(qName)); 306 306 307 307 try 308 308 { … … 612 612 * SAX Handler method. Executes at the close of each XML element. 613 613 */ 614 //todo: interpret this function better so that what is loaded from the XML file is easier to know. 614 615 @Override 615 616 public void endElement(String uri, String localName, String qName) … … 670 671 { 671 672 cad.Header_Type = pcData.remove(currentElement); 673 // //change where the data is loaded in here 674 // currInc.insertCadData((int) currentEventTime, cad); 672 675 } 673 676 else if (currentElement == ELEMENT.Beat && docPosition.peek() == ELEMENT.HEADER_INFO) -
trunk/src/scriptbuilder/structures/ScriptEvent.java
r107 r145 83 83 public int length; 84 84 85 p rivateTimeSlice slice;85 public TimeSlice slice; 86 86 87 87 /** -
trunk/src/scriptbuilder/structures/ScriptIncident.java
r131 r145 46 46 */ 47 47 public String description; 48 48 49 49 /** 50 50 * Length, in seconds, of the incident. … … 72 72 public int eventCount = 0; 73 73 74 SimulationScript script;74 public SimulationScript script; 75 75 76 76 /** … … 135 135 this.setOffset(offset); 136 136 } 137 138 // /** 139 // * Constructor with type and location parameters. 140 // * @param color 141 // * @param number 142 // * @param name 143 // * @param description 144 // * @param script 145 // * @param offset 146 // * @param type 147 // * @param location 148 // */ 149 // public ScriptIncident(Color color, int number, String name, 150 // String description, SimulationScript script, 151 // int offset, String type, String location) 152 // { 153 // this.color = color; 154 // this.number = number; 155 // this.name = name; 156 // this.description = description; 157 // this.script = script; 158 // slices = new TreeMap<Integer, TimeSlice>(); 159 // this.setOffset(offset); 160 // this.location = location; 161 // this.type = type; 162 // insertCadData(offset, new CadData(type,location)); 163 // } 137 164 138 165 /** … … 293 320 } 294 321 295 void insertCadData(long currentEventTime, CadData cad)322 public void insertCadData(long currentEventTime, CadData cad) 296 323 { 297 324 int time = (int) currentEventTime; … … 305 332 slice = slices.get(time); 306 333 slice.cadData = cad; 334 } 335 336 public CadData getCadData(long currentEventTime) 337 { 338 int time = (int) currentEventTime; 339 TimeSlice slice; 340 341 slice = slices.get(time); 342 return slice.cadData; 307 343 } 308 344 -
trunk/src/scriptbuilder/structures/SimulationScript.java
r131 r145 21 21 * 22 22 * @author Bryan McGuffin <bmcguffi@calpoly.edu> 23 * @author Sebastien Danthinne <sdanthin@calpoly.edu> 23 24 * @version 2017/06/22 24 25 */ … … 61 62 * The units which participate in Unit events. 62 63 */ 63 public List<Unit> units; 64 public List<Unit> units; 64 65 65 66 //Somewhere in the code, something assumes that the list of incidents 66 67 //contains exactly 10 items. Until I can find and un-break that, this will do. 68 //todo: this incident fill count error 67 69 private final int INCIDENT_FILL_COUNT = 10; 68 70 … … 76 78 */ 77 79 private MyScriptHandler sh; 80 81 public boolean saved; 78 82 79 83 //TODO: Pretty much everything in this constructor is dummy data. … … 89 93 units = new ArrayList<Unit>(); 90 94 numberOfIncidents = 0; 95 saved = true; 91 96 92 97 //Backfill with null incidents … … 96 101 } 97 102 } 98 103 104 /** 105 * checks and sees if this object has the unit passed. 106 * @param unitID 107 * @return does this SimulationScript have unitnum? 108 */ 109 public boolean hasUnit(String unitID){ 110 boolean indicator = false; 111 if(units.size()!=0){ 112 for(Unit u : units){ 113 if(unitID.equals(u.UnitNum)){ 114 indicator = true; 115 } 116 } 117 } 118 119 return indicator; 120 } 121 /** 122 * creates a dummy unit that only has unit number 123 * @param unitNum 124 */ 125 public void addDummyUnit(String unitNum){ 126 Unit dummy = new Unit(); 127 dummy.UnitNum = unitNum; 128 units.add(dummy); 129 } 99 130 /** 100 131 * Update the script's observers. 101 * 132 * 102 133 */ 103 134 public void update() 104 135 { 105 136 // The script has changed, notify observers 137 //use to rewrite the save indicator 138 //System.out.println("Script changed"); 106 139 setChanged(); 107 140 notifyObservers(this); 108 } 141 saved = false; 142 143 144 } 145 109 146 110 147 /** … … 154 191 { 155 192 System.out.println("ERROR LOADING SCRIPT"); 193 ex.printStackTrace(); 194 } 195 System.out.println("H"); 196 for(Unit testUnit : units){ 197 System.out.println(testUnit.toXML()); 198 } 199 this.update(); 200 } 201 202 /** 203 * Load in an existing list of units from an XML file. 204 * @param f the file containing the units 205 */ 206 public void loadUnitsFromFile(File f){ 207 try 208 { 209 SAXParserFactory.newInstance().newSAXParser().parse(f, sh); 210 units.addAll(sh.getUnits()); 211 } 212 catch (Exception ex) 213 { 214 System.out.println("ERROR LOADING UNITS"); 156 215 ex.printStackTrace(); 157 216 } … … 197 256 ex.printStackTrace(); 198 257 } 258 saved = true; 199 259 } 200 260 -
trunk/src/scriptbuilder/structures/TimeSlice.java
r142 r145 56 56 } 57 57 58 59 public ScriptIncident getIncident(){ 60 return thisIncident; 61 } 58 62 /** 59 63 * Add a new script event to this time slice. Sort events by event type. … … 77 81 public int getX() 78 82 { 83 // System.out.println("position: " + seconds / ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION 84 // * ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK); 79 85 return seconds / ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION 80 86 * ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK; … … 210 216 public String toXML() 211 217 { 218 //eventsCopy2 is used to clear out eventsCopy with one element contained 212 219 ArrayList<I_ScriptEvent> eventsCopy = new ArrayList<I_ScriptEvent>(); 213 220 ArrayList<I_ScriptEvent> eventsCopy2 = new ArrayList<I_ScriptEvent>(); -
trunk/src/scriptbuilder/structures/events/UnitEvent.java
r76 r145 22 22 /** 23 23 * Constructor. 24 * //TODO: when created, add a unit to the main units list that is contained within SimulationScript 24 25 */ 25 26 public UnitEvent() 26 27 { 28 27 29 super(ScriptEventType.UNIT_EVENT); 30 28 31 } 29 32 -
trunk/src/scriptbuilder/structures/units/Unit.java
r46 r145 102 102 Unit_Status = ""; 103 103 } 104 105 public boolean equals(Unit u){ 106 return UnitNum.equals(u.UnitNum); 107 } 108 public boolean equals(String num){ 109 return UnitNum.equals(num); 110 } 104 111 105 112 @Override
Note: See TracChangeset
for help on using the changeset viewer.
