- Timestamp:
- 11/04/2019 08:14:32 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 27 edited
-
nbproject/project.properties (modified) (1 diff)
-
src/event/editor/TelephonePanel.form (modified) (3 diffs)
-
src/event/editor/TelephonePanel.java (modified) (7 diffs)
-
src/event/editor/UnitPanel.form (modified) (6 diffs)
-
src/event/editor/UnitPanel.java (modified) (15 diffs)
-
src/event/editor/WitnessPanel.form (modified) (1 diff)
-
src/event/editor/WitnessPanel.java (modified) (4 diffs)
-
src/event/editor/frame/Editor.form (modified) (6 diffs)
-
src/event/editor/frame/Editor.java (modified) (25 diffs)
-
src/event/editor/frame/PropertyModel.java (modified) (2 diffs)
-
src/scriptbuilder/gui/IncidentEditorFrame.java (modified) (4 diffs)
-
src/scriptbuilder/gui/ScriptBuilderFrame.form (modified) (11 diffs)
-
src/scriptbuilder/gui/ScriptBuilderFrame.java (modified) (69 diffs)
-
src/scriptbuilder/gui/ScriptBuilderGuiConstants.java (modified) (1 diff)
-
src/scriptbuilder/gui/application.properties (modified) (1 diff)
-
src/scriptbuilder/gui/drawers/CursorDrawer.java (modified) (1 diff)
-
src/scriptbuilder/gui/drawers/TimeSliceDrawer.java (modified) (1 diff)
-
src/scriptbuilder/gui/panels/IncidentTimelinePanel.java (modified) (3 diffs)
-
src/scriptbuilder/structures/.directory (added)
-
src/scriptbuilder/structures/CadData.java (modified) (2 diffs)
-
src/scriptbuilder/structures/ELEMENT.java (modified) (1 diff)
-
src/scriptbuilder/structures/MyScriptHandler.java (modified) (3 diffs)
-
src/scriptbuilder/structures/ScriptEvent.java (modified) (1 diff)
-
src/scriptbuilder/structures/ScriptIncident.java (modified) (5 diffs)
-
src/scriptbuilder/structures/SimulationScript.java (modified) (7 diffs)
-
src/scriptbuilder/structures/TimeSlice.java (modified) (3 diffs)
-
src/scriptbuilder/structures/events/UnitEvent.java (modified) (1 diff)
-
src/scriptbuilder/structures/units/Unit.java (modified) (1 diff)
-
units.xml (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/nbproject/project.properties
r144 r145 1 # Wed Jan 30 11:36:38PST 20191 #Mon Nov 04 09:53:02 PST 2019 2 2 excludes= 3 3 javac.deprecation=false -
trunk/src/event/editor/TelephonePanel.form
r1 r145 84 84 <Property name="toolTipText" type="java.lang.String" value="Deletes the selected row in the table"/> 85 85 </Properties> 86 <Events> 87 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="deleteSelectedButtonActionPerformed"/> 88 </Events> 86 89 </Component> 87 90 <Component class="javax.swing.JButton" name="addInstructorButton"> … … 90 93 <Property name="toolTipText" type="java.lang.String" value="Adds a row for instructor dialog in the table"/> 91 94 </Properties> 95 <Events> 96 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addInstructorButtonActionPerformed"/> 97 </Events> 92 98 </Component> 93 99 <Component class="javax.swing.JTextField" name="txtInstructorRole"> … … 108 114 <Events> 109 115 <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="removeThisProperty"/> 116 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="removeButtonActionPerformed"/> 110 117 </Events> 111 118 </Component> -
trunk/src/event/editor/TelephonePanel.java
r130 r145 53 53 public void keyPressed(KeyEvent e) 54 54 { 55 //this needs to be changed to add the instructor role when a new line is created 55 56 if (e.getKeyCode() == KeyEvent.VK_ENTER) 56 57 { … … 69 70 public void actionPerformed(ActionEvent e) 70 71 { 71 int i = event.roles.size(); 72 event.roles.add(txtInstructorRole.getText()); 73 event.lines.add(""); 72 //this listener was not working as exprected, replaced with netbeans auto generated 73 // int i = event.roles.size(); 74 // event.roles.add(txtInstructorRole.getText()); 75 // event.lines.add(""); 74 76 } 75 77 }); … … 129 131 @SuppressWarnings("unchecked") 130 132 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents 131 private void initComponents() 132 { 133 private void initComponents() { 133 134 134 135 addStudentButton = new javax.swing.JButton(); … … 147 148 deleteSelectedButton.setText("Delete Selected Line"); 148 149 deleteSelectedButton.setToolTipText("Deletes the selected row in the table"); 150 deleteSelectedButton.addActionListener(new java.awt.event.ActionListener() { 151 public void actionPerformed(java.awt.event.ActionEvent evt) { 152 deleteSelectedButtonActionPerformed(evt); 153 } 154 }); 149 155 150 156 addInstructorButton.setText("Add Instructor Line"); 151 157 addInstructorButton.setToolTipText("Adds a row for instructor dialog in the table"); 158 addInstructorButton.addActionListener(new java.awt.event.ActionListener() { 159 public void actionPerformed(java.awt.event.ActionEvent evt) { 160 addInstructorButtonActionPerformed(evt); 161 } 162 }); 152 163 153 164 txtInstructorRole.setToolTipText("Specifies the role the instructor plays"); … … 157 168 removeButton.setText("Remove"); 158 169 removeButton.setToolTipText("Removes this property"); 159 removeButton.addMouseListener(new java.awt.event.MouseAdapter() 160 { 161 public void mouseClicked(java.awt.event.MouseEvent evt) 162 { 170 removeButton.addMouseListener(new java.awt.event.MouseAdapter() { 171 public void mouseClicked(java.awt.event.MouseEvent evt) { 163 172 removeThisProperty(evt); 173 } 174 }); 175 removeButton.addActionListener(new java.awt.event.ActionListener() { 176 public void actionPerformed(java.awt.event.ActionEvent evt) { 177 removeButtonActionPerformed(evt); 164 178 } 165 179 }); … … 208 222 209 223 private void removeThisProperty(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_removeThisProperty 224 //linked to remove button - removes the current buton 210 225 if (removeListener != null) 211 226 { … … 213 228 } 214 229 }//GEN-LAST:event_removeThisProperty 230 231 private void addInstructorButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addInstructorButtonActionPerformed 232 // TODO add your handling code here: 233 buttonMap.put(addInstructorButton, txtInstructorRole.getText()); 234 int i = event.roles.size(); 235 event.roles.add(txtInstructorRole.getText()); 236 event.lines.add(""); 237 }//GEN-LAST:event_addInstructorButtonActionPerformed 238 239 private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeButtonActionPerformed 240 // TODO add your handling code here: 241 }//GEN-LAST:event_removeButtonActionPerformed 242 243 private void deleteSelectedButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteSelectedButtonActionPerformed 244 // TODO add your handling code here: 245 }//GEN-LAST:event_deleteSelectedButtonActionPerformed 215 246 216 247 -
trunk/src/event/editor/UnitPanel.form
r92 r145 23 23 <Group type="102" alignment="0" attributes="0"> 24 24 <Group type="103" groupAlignment="0" attributes="0"> 25 <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>26 <Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>27 </Group>28 <EmptySpace max="-2" attributes="0"/>29 <Group type="103" groupAlignment="0" attributes="0">30 <Component id="StatusDropdown" pref="475" max="32767" attributes="0"/>31 <Component id="txtUnitNumber" alignment="0" pref="475" max="32767" attributes="0"/>32 </Group>33 </Group>34 <Group type="102" alignment="0" attributes="0">35 <Group type="103" groupAlignment="0" attributes="0">36 25 <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/> 37 26 <Component id="jLabel4" alignment="0" min="-2" max="-2" attributes="0"/> … … 41 30 <Component id="ActiveDropdown" alignment="0" pref="475" max="32767" attributes="0"/> 42 31 <Component id="PrimaryDropdown" alignment="0" pref="475" max="32767" attributes="0"/> 32 </Group> 33 </Group> 34 <Group type="102" alignment="0" attributes="0"> 35 <Group type="103" groupAlignment="0" attributes="0"> 36 <Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/> 37 <Component id="jLabel5" alignment="0" min="-2" max="-2" attributes="0"/> 38 </Group> 39 <EmptySpace min="-2" pref="54" max="-2" attributes="0"/> 40 <Group type="103" groupAlignment="0" attributes="0"> 41 <Group type="102" attributes="0"> 42 <Component id="StatusDropdown" pref="419" max="32767" attributes="0"/> 43 <EmptySpace min="-2" pref="57" max="-2" attributes="0"/> 44 </Group> 45 <Group type="102" alignment="0" attributes="0"> 46 <Component id="unitSelector" min="-2" max="-2" attributes="0"/> 47 <EmptySpace min="0" pref="0" max="32767" attributes="0"/> 48 </Group> 43 49 </Group> 44 50 </Group> … … 51 57 <Group type="103" groupAlignment="0" attributes="0"> 52 58 <Group type="102" alignment="0" attributes="0"> 53 <EmptySpace min="-2" pref=" 47" max="-2" attributes="0"/>59 <EmptySpace min="-2" pref="82" max="-2" attributes="0"/> 54 60 <Group type="103" groupAlignment="3" attributes="0"> 55 <Component id="jLabel 1" alignment="3" min="-2" max="-2" attributes="0"/>56 <Component id=" txtUnitNumber" alignment="3" min="-2" max="-2" attributes="0"/>61 <Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/> 62 <Component id="unitSelector" alignment="3" min="-2" max="-2" attributes="0"/> 57 63 </Group> 58 <EmptySpace type="unrelated"max="-2" attributes="0"/>64 <EmptySpace max="-2" attributes="0"/> 59 65 <Group type="103" groupAlignment="3" attributes="0"> 60 66 <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> … … 71 77 <Component id="ActiveDropdown" alignment="3" min="-2" max="-2" attributes="0"/> 72 78 </Group> 73 <EmptySpace pref="1 28" max="32767" attributes="0"/>79 <EmptySpace pref="100" max="32767" attributes="0"/> 74 80 <Component id="help" min="-2" pref="20" max="-2" attributes="0"/> 75 81 <EmptySpace max="-2" attributes="0"/> … … 79 85 </Layout> 80 86 <SubComponents> 81 <Component class="javax.swing.JLabel" name="jLabel1">82 <Properties>83 <Property name="text" type="java.lang.String" value="Unit Number"/>84 </Properties>85 </Component>86 <Component class="javax.swing.JFormattedTextField" name="txtUnitNumber">87 <Properties>88 <Property name="text" type="java.lang.String" value=" - "/>89 <Property name="toolTipText" type="java.lang.String" value=""/>90 </Properties>91 </Component>92 87 <Component class="javax.swing.JLabel" name="jLabel2"> 93 88 <Properties> … … 138 133 <Component class="javax.swing.JLabel" name="help"> 139 134 </Component> 135 <Component class="javax.swing.JLabel" name="jLabel5"> 136 <Properties> 137 <Property name="text" type="java.lang.String" value="Unit"/> 138 </Properties> 139 </Component> 140 <Component class="javax.swing.JComboBox" name="unitSelector"> 141 <Properties> 142 <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> 143 <StringArray count="0"/> 144 </Property> 145 </Properties> 146 <Events> 147 <EventHandler event="ancestorAdded" listener="javax.swing.event.AncestorListener" parameters="javax.swing.event.AncestorEvent" handler="unitSelectorAncestorAdded"/> 148 <EventHandler event="mouseEntered" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="unitSelectorMouseEntered"/> 149 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="unitSelectorActionPerformed"/> 150 </Events> 151 <AuxValues> 152 <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/> 153 </AuxValues> 154 </Component> 140 155 </SubComponents> 141 156 </Form> -
trunk/src/event/editor/UnitPanel.java
r140 r145 3 3 import java.awt.event.*; 4 4 import java.util.Observable; 5 import java.util.List; 6 import java.util.ArrayList; 7 import javax.swing.DefaultComboBoxModel; 8 import javax.swing.ComboBoxModel; 5 9 import scriptbuilder.structures.events.I_ScriptEvent; 10 import scriptbuilder.structures.units.Unit; 6 11 import scriptbuilder.structures.events.UnitEvent; 7 12 … … 9 14 * 10 15 * @author nathaniellehrer 16 * 17 * 11 18 */ 12 19 public class UnitPanel extends javax.swing.JPanel implements I_ScriptEventEditorPanel … … 15 22 private ActionListener removeListener; 16 23 private UnitEvent event; 17 24 private List<Unit> units; 25 26 List<String> names = new ArrayList<String>(); 18 27 /** 19 28 * Creates new form UnitPanel … … 22 31 { 23 32 initComponents(); 24 25 txtUnitNumber.addFocusListener(new FocusListener() 26 { 27 28 public void focusGained(FocusEvent e) 29 { 30 help.setText("Unit number is formatted as #-#\t\tExample: 5-5"); 31 } 32 33 public void focusLost(FocusEvent e) 34 { 35 help.setText(""); 36 } 37 38 }); 39 } 40 33 34 //units = event.slice.getIncident().script.units; 35 36 } 37 38 /** 39 * Loads the event information into the event editor window. 40 * @param sei Scriptevent that is being loaded in 41 */ 41 42 @Override 42 43 public void getEventObject(I_ScriptEvent sei) 43 44 { 45 44 46 event = (UnitEvent) sei; 45 txtUnitNumber.setText(event.unitNum); 47 //loads the current unit list into the combobox on re-opening of unit event 48 loadSelector(); 46 49 for (int i = 0; i < ActiveDropdown.getItemCount(); i++) 47 50 { … … 49 52 { 50 53 ActiveDropdown.setSelectedIndex(i); 54 } 55 } 56 57 //for each name in the names list 58 for (int i = 0; i < names.size(); i++) 59 { 60 //which event equals which index in the names list? 61 if (event.unitNum.equalsIgnoreCase((String) names.get(i))) 62 { 63 64 //set the unit selector to the data model value 65 unitSelector.setSelectedIndex(i); 66 51 67 } 52 68 } … … 80 96 public void update(Observable o, Object arg) 81 97 { 98 //todo: make supported 82 99 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 83 100 } … … 90 107 return true; 91 108 } 109 110 111 private void loadSelector(){ 112 //checks if the event is exist 113 if(event != null) 114 { 115 //loads the names list from the top data model 116 loadNames(); 117 //asks if the unitselector already has some units added into it 118 119 if(unitSelector.getModel().equals(new DefaultComboBoxModel(names.toArray())) || (unitSelector.getModel().getSize() == 0)) 120 { 121 //if combobox empty, load combobox 122 unitSelector.setModel(new DefaultComboBoxModel(names.toArray())); 123 } 124 125 126 127 } 128 129 } 130 131 /** 132 * Loads the unit names from the unit list in SimulationScript 133 */ 134 private void loadNames(){ 135 //checks if the event is exist 136 if(event!=null) 137 { 138 //this sucks! try to change it sometime 139 //grabs the unit list from the top of the SimulationScript and 140 //appends them to the names list 141 units = event.slice.getIncident().script.units; 142 143 for(Unit u : units) 144 { 145 names.add(u.UnitNum); 146 } 147 } 148 } 92 149 93 150 @Override 151 /** 152 * when window is closed, these values are set. 153 */ 94 154 public void uponClose() 95 155 { 96 if (event != null) 97 { 98 event.unitNum = txtUnitNumber.getText(); 156 157 if (event != null && unitSelector.getItemCount() != 0) 158 { 159 event.unitNum = unitSelector.getSelectedItem().toString(); 99 160 event.unitActive = ActiveDropdown.getSelectedItem().toString(); 100 161 event.unitPrimary = PrimaryDropdown.getSelectedItem().toString(); 101 162 event.unitStatus = StatusDropdown.getSelectedItem().toString(); 163 164 //old logic for creating dummy unit 165 /*if(event.slice.getIncident().script.hasUnit(txtUnitNumber.getText())){ 166 //checks to see if there is already a unit selected there 167 //event.unitNum = (txtUnitNumber.getText()); 168 169 }else{ 170 //Creates a dummy unit here 171 event.slice.getIncident().script.addDummyUnit(txtUnitNumber.getText()); 172 //event.unitNum = (txtUnitNumber.getText()); 173 event.unitActive = ActiveDropdown.getSelectedItem().toString(); 174 event.unitPrimary = PrimaryDropdown.getSelectedItem().toString(); 175 event.unitStatus = StatusDropdown.getSelectedItem().toString(); 176 //System.out.println("invalid unit number"); 177 }*/ 178 102 179 } 103 180 } … … 110 187 @SuppressWarnings("unchecked") 111 188 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents 112 private void initComponents() 113 { 114 115 jLabel1 = new javax.swing.JLabel(); 116 txtUnitNumber = new javax.swing.JFormattedTextField(); 189 private void initComponents() { 190 117 191 jLabel2 = new javax.swing.JLabel(); 118 192 StatusDropdown = new javax.swing.JComboBox(); … … 122 196 ActiveDropdown = new javax.swing.JComboBox(); 123 197 help = new javax.swing.JLabel(); 124 125 jLabel1.setText("Unit Number"); 126 127 txtUnitNumber.setText(" - "); 128 txtUnitNumber.setToolTipText(""); 198 jLabel5 = new javax.swing.JLabel(); 199 unitSelector = new javax.swing.JComboBox<>(); 129 200 130 201 jLabel2.setText("Status"); … … 139 210 140 211 ActiveDropdown.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "True", "False" })); 212 213 jLabel5.setText("Unit"); 214 215 unitSelector.addAncestorListener(new javax.swing.event.AncestorListener() { 216 public void ancestorMoved(javax.swing.event.AncestorEvent evt) { 217 } 218 public void ancestorAdded(javax.swing.event.AncestorEvent evt) { 219 unitSelectorAncestorAdded(evt); 220 } 221 public void ancestorRemoved(javax.swing.event.AncestorEvent evt) { 222 } 223 }); 224 unitSelector.addMouseListener(new java.awt.event.MouseAdapter() { 225 public void mouseEntered(java.awt.event.MouseEvent evt) { 226 unitSelectorMouseEntered(evt); 227 } 228 }); 229 unitSelector.addActionListener(new java.awt.event.ActionListener() { 230 public void actionPerformed(java.awt.event.ActionEvent evt) { 231 unitSelectorActionPerformed(evt); 232 } 233 }); 141 234 142 235 org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); … … 150 243 .add(layout.createSequentialGroup() 151 244 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 152 .add(jLabel1)153 .add(jLabel2))154 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)155 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)156 .add(StatusDropdown, 0, 475, Short.MAX_VALUE)157 .add(txtUnitNumber, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 475, Short.MAX_VALUE)))158 .add(layout.createSequentialGroup()159 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)160 245 .add(jLabel3) 161 246 .add(jLabel4)) … … 163 248 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 164 249 .add(ActiveDropdown, 0, 475, Short.MAX_VALUE) 165 .add(PrimaryDropdown, 0, 475, Short.MAX_VALUE)))) 250 .add(PrimaryDropdown, 0, 475, Short.MAX_VALUE))) 251 .add(layout.createSequentialGroup() 252 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 253 .add(jLabel2) 254 .add(jLabel5)) 255 .add(54, 54, 54) 256 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 257 .add(layout.createSequentialGroup() 258 .add(StatusDropdown, 0, 419, Short.MAX_VALUE) 259 .add(57, 57, 57)) 260 .add(layout.createSequentialGroup() 261 .add(unitSelector, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 262 .add(0, 0, Short.MAX_VALUE))))) 166 263 .addContainerGap()) 167 264 ); … … 169 266 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 170 267 .add(layout.createSequentialGroup() 171 .add( 47, 47, 47)268 .add(82, 82, 82) 172 269 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 173 .add(jLabel 1)174 .add( txtUnitNumber, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))175 .addPreferredGap(org.jdesktop.layout.LayoutStyle. UNRELATED)270 .add(jLabel5) 271 .add(unitSelector, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 272 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 176 273 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 177 274 .add(jLabel2) … … 185 282 .add(jLabel4) 186 283 .add(ActiveDropdown, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 187 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 1 28, Short.MAX_VALUE)284 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 100, Short.MAX_VALUE) 188 285 .add(help, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 189 286 .addContainerGap()) 190 287 ); 191 288 }// </editor-fold>//GEN-END:initComponents 289 290 private void unitSelectorAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_unitSelectorAncestorAdded 291 //loads the unitSelector on the initialization of the window 292 loadSelector(); 293 }//GEN-LAST:event_unitSelectorAncestorAdded 294 295 private void unitSelectorMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_unitSelectorMouseEntered 296 297 }//GEN-LAST:event_unitSelectorMouseEntered 298 299 private void unitSelectorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unitSelectorActionPerformed 300 // TODO add your handling code here: 301 }//GEN-LAST:event_unitSelectorActionPerformed 192 302 193 303 … … 197 307 private javax.swing.JComboBox StatusDropdown; 198 308 private javax.swing.JLabel help; 199 private javax.swing.JLabel jLabel1;200 309 private javax.swing.JLabel jLabel2; 201 310 private javax.swing.JLabel jLabel3; 202 311 private javax.swing.JLabel jLabel4; 203 private javax.swing.JFormattedTextField txtUnitNumber; 312 private javax.swing.JLabel jLabel5; 313 private javax.swing.JComboBox<String> unitSelector; 204 314 // End of variables declaration//GEN-END:variables 205 315 -
trunk/src/event/editor/WitnessPanel.form
r92 r145 103 103 <Format format="(###)###-####" subtype="-1" type="0"/> 104 104 </Property> 105 <Property name="focusLostBehavior" type="int" value="3"/> 105 106 </Properties> 107 <Events> 108 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="txtPhoneNumberActionPerformed"/> 109 </Events> 106 110 </Component> 107 111 </SubComponents> -
trunk/src/event/editor/WitnessPanel.java
r140 r145 42 42 43 43 txtPhoneNumber.setText("" + event.witnessNum); 44 System.out.println("you just loaded a new witness event into the editor"); 44 45 45 46 txtAddress.setText(event.witnessAddress); … … 79 80 @SuppressWarnings("unchecked") 80 81 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents 81 private void initComponents() 82 { 82 private void initComponents() { 83 83 84 84 jLabel1 = new javax.swing.JLabel(); … … 100 100 101 101 txtPhoneNumber.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("(###)###-####")))); 102 txtPhoneNumber.setFocusLostBehavior(javax.swing.JFormattedTextField.PERSIST); 103 txtPhoneNumber.addActionListener(new java.awt.event.ActionListener() { 104 public void actionPerformed(java.awt.event.ActionEvent evt) { 105 txtPhoneNumberActionPerformed(evt); 106 } 107 }); 102 108 103 109 org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); … … 147 153 }// </editor-fold>//GEN-END:initComponents 148 154 155 private void txtPhoneNumberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtPhoneNumberActionPerformed 156 // TODO add your handling code here: 157 }//GEN-LAST:event_txtPhoneNumberActionPerformed 158 149 159 150 160 // Variables declaration - do not modify//GEN-BEGIN:variables -
trunk/src/event/editor/frame/Editor.form
r134 r145 251 251 </NonVisualComponents> 252 252 <Properties> 253 <Property name="defaultCloseOperation" type="int" value=" 2"/>253 <Property name="defaultCloseOperation" type="int" value="0"/> 254 254 <Property name="title" type="java.lang.String" value="Event Editor"/> 255 255 </Properties> … … 279 279 <Component id="txtEventStart" min="-2" max="-2" attributes="0"/> 280 280 <EmptySpace max="-2" attributes="0"/> 281 <Component id="jLabel1" min="-2" max="-2" attributes="0"/> 282 <EmptySpace max="-2" attributes="0"/> 283 <Component id="timeHourComboSelector" min="-2" max="-2" attributes="0"/> 284 <EmptySpace max="-2" attributes="0"/> 285 <Component id="jLabel2" min="-2" max="-2" attributes="0"/> 286 <EmptySpace max="-2" attributes="0"/> 287 <Component id="timeMinuteComboSelector" min="-2" max="-2" attributes="0"/> 288 <EmptySpace max="-2" attributes="0"/> 289 <Component id="jLabel3" min="-2" max="-2" attributes="0"/> 290 <EmptySpace max="-2" attributes="0"/> 291 <Component id="timeSecondComboSelector" min="-2" max="-2" attributes="0"/> 292 <EmptySpace max="-2" attributes="0"/> 281 293 <Component id="bottomFramePanel" max="32767" attributes="0"/> 282 294 <EmptySpace max="-2" attributes="0"/> 283 295 <Component id="btnRemoveCurrentEvent" min="-2" pref="226" max="-2" attributes="0"/> 296 <EmptySpace max="-2" attributes="0"/> 297 <Component id="saveCloseBtn" min="-2" max="-2" attributes="0"/> 284 298 <EmptySpace max="-2" attributes="0"/> 285 299 </Group> … … 290 304 <Group type="102" alignment="0" attributes="0"> 291 305 <EmptySpace max="-2" attributes="0"/> 292 <Component id="eventTabsPane" pref="534" max="32767" attributes="0"/>306 <Component id="eventTabsPane" min="-2" pref="523" max="-2" attributes="0"/> 293 307 <EmptySpace max="-2" attributes="0"/> 294 308 <Group type="103" groupAlignment="0" attributes="0"> 295 309 <Component id="bottomFramePanel" min="-2" max="-2" attributes="0"/> 296 <Component id="txtEventStart" min="-2" max="-2" attributes="0"/> 297 <Component id="btnRemoveCurrentEvent" min="-2" max="-2" attributes="0"/> 310 <Group type="103" groupAlignment="3" attributes="0"> 311 <Component id="txtEventStart" alignment="3" min="-2" max="-2" attributes="0"/> 312 <Component id="timeSecondComboSelector" alignment="3" min="-2" max="-2" attributes="0"/> 313 <Component id="timeMinuteComboSelector" alignment="3" min="-2" max="-2" attributes="0"/> 314 <Component id="timeHourComboSelector" alignment="3" min="-2" max="-2" attributes="0"/> 315 <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> 316 <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> 317 <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/> 318 </Group> 319 <Group type="103" groupAlignment="3" attributes="0"> 320 <Component id="saveCloseBtn" alignment="3" min="-2" max="-2" attributes="0"/> 321 <Component id="btnRemoveCurrentEvent" alignment="3" min="-2" max="-2" attributes="0"/> 322 </Group> 298 323 </Group> 299 324 </Group> … … 311 336 <DimensionLayout dim="0"> 312 337 <Group type="103" groupAlignment="0" attributes="0"> 313 <EmptySpace min="0" pref=" 613" max="32767" attributes="0"/>338 <EmptySpace min="0" pref="70" max="32767" attributes="0"/> 314 339 </Group> 315 340 </DimensionLayout> 316 341 <DimensionLayout dim="1"> 317 342 <Group type="103" groupAlignment="0" attributes="0"> 318 <EmptySpace min="0" pref=" 34" max="32767" attributes="0"/>343 <EmptySpace min="0" pref="45" max="32767" attributes="0"/> 319 344 </Group> 320 345 </DimensionLayout> … … 325 350 <Property name="text" type="java.lang.String" value="00:00:00"/> 326 351 </Properties> 352 <Events> 353 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="txtEventStartActionPerformed"/> 354 </Events> 355 </Component> 356 <Component class="javax.swing.JButton" name="saveCloseBtn"> 357 <Properties> 358 <Property name="text" type="java.lang.String" value="Save and Close"/> 359 </Properties> 360 <Events> 361 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="saveCloseBtnActionPerformed"/> 362 </Events> 327 363 </Component> 328 364 <Component class="javax.swing.JButton" name="btnRemoveCurrentEvent"> … … 334 370 </Events> 335 371 </Component> 372 <Component class="javax.swing.JComboBox" name="timeSecondComboSelector"> 373 <Properties> 374 <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> 375 <StringArray count="1"> 376 <StringItem index="0" value="Second"/> 377 </StringArray> 378 </Property> 379 </Properties> 380 <Events> 381 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="timeSecondComboSelectorActionPerformed"/> 382 </Events> 383 <AuxValues> 384 <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/> 385 </AuxValues> 386 </Component> 387 <Component class="javax.swing.JComboBox" name="timeMinuteComboSelector"> 388 <Properties> 389 <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> 390 <StringArray count="1"> 391 <StringItem index="0" value="Minute"/> 392 </StringArray> 393 </Property> 394 </Properties> 395 <Events> 396 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="timeMinuteComboSelectorActionPerformed"/> 397 </Events> 398 <AuxValues> 399 <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/> 400 </AuxValues> 401 </Component> 402 <Component class="javax.swing.JComboBox" name="timeHourComboSelector"> 403 <Properties> 404 <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> 405 <StringArray count="1"> 406 <StringItem index="0" value="Hour"/> 407 </StringArray> 408 </Property> 409 </Properties> 410 <AuxValues> 411 <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/> 412 </AuxValues> 413 </Component> 414 <Component class="javax.swing.JLabel" name="jLabel1"> 415 <Properties> 416 <Property name="text" type="java.lang.String" value="Hour"/> 417 </Properties> 418 </Component> 419 <Component class="javax.swing.JLabel" name="jLabel2"> 420 <Properties> 421 <Property name="text" type="java.lang.String" value="Minute"/> 422 </Properties> 423 </Component> 424 <Component class="javax.swing.JLabel" name="jLabel3"> 425 <Properties> 426 <Property name="text" type="java.lang.String" value="Second"/> 427 </Properties> 428 </Component> 336 429 </SubComponents> 337 430 </Form> -
trunk/src/event/editor/frame/Editor.java
r134 r145 11 11 import scriptbuilder.gui.IncidentEditorFrame; 12 12 import scriptbuilder.gui.ScriptBuilderFrame; 13 import scriptbuilder.gui.ScriptBuilderGuiConstants; 13 14 import scriptbuilder.gui.panels.IncidentTimelinePanel; 14 15 import scriptbuilder.structures.ScriptEvent; … … 32 33 model.addEventPanel(property, se); 33 34 } 34 35 /** 36 * adds all of the events from the timeslice to the incidentTimelinePanel 37 * @param ts the timeslice to be added 38 */ 35 39 public void setSlice(TimeSlice ts) 36 40 { … … 42 46 for (I_ScriptEvent se : slice.events) 43 47 { 44 48 45 49 this.addEvent(IncidentTimelinePanel.eventTypeToPropertyMap.get(se.getScriptEventType()), se); 46 50 … … 52 56 System.out.println("[" + eventTime + "]"); 53 57 txtEventStart.setText(eventTime); 58 List<Integer> timesS = timeGenerator(eventTime,"s"); 59 List<Integer> timesM = timeGenerator(eventTime,"m"); 60 List<Integer> timesH = timeGenerator(eventTime,"h"); 61 timeHourComboSelector.setModel(new DefaultComboBoxModel(timesH.toArray())); 62 timeMinuteComboSelector.setModel(new DefaultComboBoxModel(timesM.toArray())); 63 timeSecondComboSelector.setModel(new DefaultComboBoxModel(timesS.toArray())); 64 timeHourComboSelector.setSelectedItem(slice.getTime()/3600); 65 timeMinuteComboSelector.setSelectedItem((slice.getTime()%3600)/60); 66 timeSecondComboSelector.setSelectedItem(slice.getTime()%60); 54 67 } 55 68 56 69 } 70 71 private List<Integer> timeGenerator(String time,String type) 72 { 73 List<Integer> times = new ArrayList<Integer>(); 74 String[] timeArray = time.split(":"); 75 int currTime = 0; 76 switch(type) 77 { 78 case "h": 79 { 80 currTime = Integer.parseInt(timeArray[0]); 81 for(int i = 0;i< ScriptBuilderGuiConstants.MAX_SIMULATION_LENGTH/3600;i++) 82 { 83 times.add(i); 84 } 85 break; 86 } 87 case "m": 88 { 89 currTime = Integer.parseInt(timeArray[1]); 90 for(int i = 0; i<60;i++) 91 { 92 times.add(i); 93 } 94 95 break; 96 } 97 case "s": 98 { 99 //includes times 0,20,40,80 100 currTime = Integer.parseInt(timeArray[2]); 101 for(int i = 0; i<60;i+=ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION) 102 { 103 times.add(i); 104 } 105 break; 106 } 107 default: 108 { 109 } 110 111 } 112 113 114 //times.add(time); 115 116 return times; 117 } 118 119 57 120 58 121 private ActionListener optionalChangeListener = new ActionListener() … … 123 186 124 187 } 125 188 //this eventTime might need to be initialized to the correct time 126 189 String eventTime = ""; 127 190 … … 159 222 //If we deleted the first event(s), this will add the offsets, 160 223 //to ensure that events stay at the correct times 161 model.closePanels(); 162 } 163 }); 224 Object[] options = {"Yes","Cancel"}; 225 int result = JOptionPane.showOptionDialog(null,"Are you sure you want to exit without saving?", 226 "Exit", 227 JOptionPane.YES_NO_OPTION, 228 JOptionPane.QUESTION_MESSAGE, 229 null, 230 options, 231 options[1]); 232 switch (result){ 233 //should just close 234 case 0: 235 closeWindow(); 236 //this.setVisible(true); 237 break; 238 // should do nothing 239 case 1: 240 241 break; 242 default: 243 break; 244 } 245 //add a do you want to close without saving popup window here 246 247 } 248 }); 249 } 250 private void closeWindow(){ 251 this.dispose(); 164 252 } 165 253 … … 171 259 @SuppressWarnings("unchecked") 172 260 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents 173 private void initComponents() 174 { 261 private void initComponents() { 175 262 176 263 eventTabsPane = new javax.swing.JTabbedPane(); 177 264 bottomFramePanel = new javax.swing.JPanel(); 178 265 txtEventStart = new javax.swing.JTextField(); 266 saveCloseBtn = new javax.swing.JButton(); 179 267 btnRemoveCurrentEvent = new javax.swing.JButton(); 268 timeSecondComboSelector = new javax.swing.JComboBox<>(); 269 timeMinuteComboSelector = new javax.swing.JComboBox<>(); 270 timeHourComboSelector = new javax.swing.JComboBox<>(); 271 jLabel1 = new javax.swing.JLabel(); 272 jLabel2 = new javax.swing.JLabel(); 273 jLabel3 = new javax.swing.JLabel(); 180 274 editorMenuBar = new javax.swing.JMenuBar(); 181 275 menuEvaluations = new javax.swing.JMenu(); … … 200 294 Witness = new javax.swing.JMenuItem(); 201 295 202 setDefaultCloseOperation(javax.swing.WindowConstants.D ISPOSE_ON_CLOSE);296 setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); 203 297 setTitle("Event Editor"); 204 298 … … 207 301 bottomFramePanelLayout.setHorizontalGroup( 208 302 bottomFramePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 209 .add(0, 613, Short.MAX_VALUE)303 .add(0, 70, Short.MAX_VALUE) 210 304 ); 211 305 bottomFramePanelLayout.setVerticalGroup( 212 306 bottomFramePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 213 .add(0, 34, Short.MAX_VALUE)307 .add(0, 45, Short.MAX_VALUE) 214 308 ); 215 309 216 310 txtEventStart.setText("00:00:00"); 311 txtEventStart.addActionListener(new java.awt.event.ActionListener() { 312 public void actionPerformed(java.awt.event.ActionEvent evt) { 313 txtEventStartActionPerformed(evt); 314 } 315 }); 316 317 saveCloseBtn.setText("Save and Close"); 318 saveCloseBtn.addActionListener(new java.awt.event.ActionListener() { 319 public void actionPerformed(java.awt.event.ActionEvent evt) { 320 saveCloseBtnActionPerformed(evt); 321 } 322 }); 217 323 218 324 btnRemoveCurrentEvent.setText("Remove This Event"); 219 btnRemoveCurrentEvent.addActionListener(new java.awt.event.ActionListener() 220 { 221 public void actionPerformed(java.awt.event.ActionEvent evt) 222 { 325 btnRemoveCurrentEvent.addActionListener(new java.awt.event.ActionListener() { 326 public void actionPerformed(java.awt.event.ActionEvent evt) { 223 327 btnRemoveCurrentEventActionPerformed(evt); 224 328 } 225 329 }); 330 331 timeSecondComboSelector.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Second" })); 332 timeSecondComboSelector.addActionListener(new java.awt.event.ActionListener() { 333 public void actionPerformed(java.awt.event.ActionEvent evt) { 334 timeSecondComboSelectorActionPerformed(evt); 335 } 336 }); 337 338 timeMinuteComboSelector.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Minute" })); 339 timeMinuteComboSelector.addActionListener(new java.awt.event.ActionListener() { 340 public void actionPerformed(java.awt.event.ActionEvent evt) { 341 timeMinuteComboSelectorActionPerformed(evt); 342 } 343 }); 344 345 timeHourComboSelector.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Hour" })); 346 347 jLabel1.setText("Hour"); 348 349 jLabel2.setText("Minute"); 350 351 jLabel3.setText("Second"); 226 352 227 353 menuEvaluations.setText("Evaluations"); … … 230 356 ATMS.setText("ATMS"); 231 357 ATMS.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/ATMSEval.png"))); // NOI18N 232 ATMS.addActionListener(new java.awt.event.ActionListener() 233 { 234 public void actionPerformed(java.awt.event.ActionEvent evt) 235 { 358 ATMS.addActionListener(new java.awt.event.ActionListener() { 359 public void actionPerformed(java.awt.event.ActionEvent evt) { 236 360 multipleChange(evt); 237 361 } … … 242 366 ActivityLog.setText("Activity Log"); 243 367 ActivityLog.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/ActivityLogEval.png"))); // NOI18N 244 ActivityLog.addActionListener(new java.awt.event.ActionListener() 245 { 246 public void actionPerformed(java.awt.event.ActionEvent evt) 247 { 368 ActivityLog.addActionListener(new java.awt.event.ActionListener() { 369 public void actionPerformed(java.awt.event.ActionEvent evt) { 248 370 multipleChange(evt); 249 371 } … … 254 376 CAD.setText("CAD"); 255 377 CAD.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/CADEval.png"))); // NOI18N 256 CAD.addActionListener(new java.awt.event.ActionListener() 257 { 258 public void actionPerformed(java.awt.event.ActionEvent evt) 259 { 378 CAD.addActionListener(new java.awt.event.ActionListener() { 379 public void actionPerformed(java.awt.event.ActionEvent evt) { 260 380 multipleChange(evt); 261 381 } … … 266 386 CMS.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/CMSEval.png"))); // NOI18N 267 387 CMS.setText("CMS"); 268 CMS.addMouseListener(new java.awt.event.MouseAdapter() 269 { 270 public void mouseClicked(java.awt.event.MouseEvent evt) 271 { 388 CMS.addMouseListener(new java.awt.event.MouseAdapter() { 389 public void mouseClicked(java.awt.event.MouseEvent evt) { 272 390 multipleChangeListener(evt); 273 391 } 274 392 }); 275 CMS.addActionListener(new java.awt.event.ActionListener() 276 { 277 public void actionPerformed(java.awt.event.ActionEvent evt) 278 { 393 CMS.addActionListener(new java.awt.event.ActionListener() { 394 public void actionPerformed(java.awt.event.ActionEvent evt) { 279 395 multipleChange(evt); 280 396 } … … 285 401 Facilitator.setText("Facilitator"); 286 402 Facilitator.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/FacilitatorEval.png"))); // NOI18N 287 Facilitator.addActionListener(new java.awt.event.ActionListener() 288 { 289 public void actionPerformed(java.awt.event.ActionEvent evt) 290 { 403 Facilitator.addActionListener(new java.awt.event.ActionListener() { 404 public void actionPerformed(java.awt.event.ActionEvent evt) { 291 405 optionalChange(evt); 292 406 } … … 297 411 Radio.setText("Radio"); 298 412 Radio.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/RadioEval.png"))); // NOI18N 299 Radio.addActionListener(new java.awt.event.ActionListener() 300 { 301 public void actionPerformed(java.awt.event.ActionEvent evt) 302 { 413 Radio.addActionListener(new java.awt.event.ActionListener() { 414 public void actionPerformed(java.awt.event.ActionEvent evt) { 303 415 optionalChange(evt); 304 416 } … … 313 425 MaintenanceRadio.setText("Maintenance Radio"); 314 426 MaintenanceRadio.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/MaintenanceRadio.png"))); // NOI18N 315 MaintenanceRadio.addActionListener(new java.awt.event.ActionListener() 316 { 317 public void actionPerformed(java.awt.event.ActionEvent evt) 318 { 427 MaintenanceRadio.addActionListener(new java.awt.event.ActionListener() { 428 public void actionPerformed(java.awt.event.ActionEvent evt) { 319 429 optionalChange(evt); 320 430 } … … 325 435 TMTRadio.setText("TMT Radio"); 326 436 TMTRadio.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/TMTRadio.png"))); // NOI18N 327 TMTRadio.addActionListener(new java.awt.event.ActionListener() 328 { 329 public void actionPerformed(java.awt.event.ActionEvent evt) 330 { 437 TMTRadio.addActionListener(new java.awt.event.ActionListener() { 438 public void actionPerformed(java.awt.event.ActionEvent evt) { 331 439 optionalChange(evt); 332 440 } … … 337 445 Telephone.setText("Telephone"); 338 446 Telephone.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Telephone.png"))); // NOI18N 339 Telephone.addActionListener(new java.awt.event.ActionListener() 340 { 341 public void actionPerformed(java.awt.event.ActionEvent evt) 342 { 447 Telephone.addActionListener(new java.awt.event.ActionListener() { 448 public void actionPerformed(java.awt.event.ActionEvent evt) { 343 449 optionalChange(evt); 344 450 } … … 353 459 Audio.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Audio.png"))); // NOI18N 354 460 Audio.setText("Audio"); 355 Audio.addActionListener(new java.awt.event.ActionListener() 356 { 357 public void actionPerformed(java.awt.event.ActionEvent evt) 358 { 461 Audio.addActionListener(new java.awt.event.ActionListener() { 462 public void actionPerformed(java.awt.event.ActionEvent evt) { 359 463 AudioActionPerformed(evt); 360 464 } … … 375 479 CHPRadio.setText("CHP Radio"); 376 480 CHPRadio.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/CHPRadio.png"))); // NOI18N 377 CHPRadio.addActionListener(new java.awt.event.ActionListener() 378 { 379 public void actionPerformed(java.awt.event.ActionEvent evt) 380 { 481 CHPRadio.addActionListener(new java.awt.event.ActionListener() { 482 public void actionPerformed(java.awt.event.ActionEvent evt) { 381 483 optionalChange(evt); 382 484 } … … 417 519 .add(txtEventStart, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 418 520 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 521 .add(jLabel1) 522 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 523 .add(timeHourComboSelector, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 524 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 525 .add(jLabel2) 526 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 527 .add(timeMinuteComboSelector, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 528 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 529 .add(jLabel3) 530 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 531 .add(timeSecondComboSelector, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 532 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 419 533 .add(bottomFramePanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 420 534 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 421 535 .add(btnRemoveCurrentEvent, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 226, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 536 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 537 .add(saveCloseBtn) 422 538 .addContainerGap()) 423 539 ); … … 426 542 .add(layout.createSequentialGroup() 427 543 .addContainerGap() 428 .add(eventTabsPane, org.jdesktop.layout.GroupLayout. DEFAULT_SIZE, 534, Short.MAX_VALUE)544 .add(eventTabsPane, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 523, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 429 545 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 430 546 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 431 547 .add(bottomFramePanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 432 .add(txtEventStart, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 433 .add(btnRemoveCurrentEvent))) 548 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 549 .add(txtEventStart, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 550 .add(timeSecondComboSelector, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 551 .add(timeMinuteComboSelector, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 552 .add(timeHourComboSelector, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 553 .add(jLabel1) 554 .add(jLabel2) 555 .add(jLabel3)) 556 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 557 .add(saveCloseBtn) 558 .add(btnRemoveCurrentEvent)))) 434 559 ); 435 560 … … 471 596 }//GEN-LAST:event_AudioActionPerformed 472 597 598 private void saveCloseBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveCloseBtnActionPerformed 599 // TODO add your handling code here: 600 //closes the current frame 601 602 //updateEventTime(); 603 if(!txtEventStart.getText().equals("")) 604 { 605 updateEventTime(); 606 } 607 model.closePanels(); 608 closeWindow(); 609 //this.dispatchEvent(new WindowEvent(this,WindowEvent.WINDOW_CLOSING)); 610 }//GEN-LAST:event_saveCloseBtnActionPerformed 611 612 private void timeSecondComboSelectorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timeSecondComboSelectorActionPerformed 613 // TODO add your handling code here: 614 }//GEN-LAST:event_timeSecondComboSelectorActionPerformed 615 616 private void timeMinuteComboSelectorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timeMinuteComboSelectorActionPerformed 617 // TODO add your handling code here: 618 }//GEN-LAST:event_timeMinuteComboSelectorActionPerformed 619 620 private void txtEventStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtEventStartActionPerformed 621 // TODO add your handling code here: 622 }//GEN-LAST:event_txtEventStartActionPerformed 623 473 624 private void updateEventTime() 474 625 { 475 String[] tokens = txtEventStart.getText().split(":"); 476 477 int hrs = Integer.parseInt(tokens[0]); 478 int mins = Integer.parseInt(tokens[1]); 479 int secs = Integer.parseInt(tokens[2]); 626 627 // String[] tokens = txtEventStart.getText().split(":"); 628 // 629 // int hrs = Integer.parseInt(tokens[0]); 630 // int mins = Integer.parseInt(tokens[1]); 631 // int secs = Integer.parseInt(tokens[2]); 632 int hrs = Integer.parseInt(timeHourComboSelector.getSelectedItem().toString()); 633 int mins = Integer.parseInt(timeMinuteComboSelector.getSelectedItem().toString()); 634 int secs = Integer.parseInt(timeSecondComboSelector.getSelectedItem().toString()); 635 480 636 481 637 int newTime = (3600 * hrs) + (60 * mins) + secs; … … 493 649 494 650 } 495 SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss");496 df.setTimeZone(TimeZone.getTimeZone("GMT"));497 String eventTime = df.format(new Date(slice.getTime() * 1000));498 txtEventStart.setText(eventTime);651 // SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss"); 652 // df.setTimeZone(TimeZone.getTimeZone("GMT")); 653 // String eventTime = df.format(new Date(slice.getTime() * 1000)); 654 // txtEventStart.setText(eventTime); 499 655 } 500 656 } … … 538 694 private javax.swing.JMenuBar editorMenuBar; 539 695 private javax.swing.JTabbedPane eventTabsPane; 696 private javax.swing.JLabel jLabel1; 697 private javax.swing.JLabel jLabel2; 698 private javax.swing.JLabel jLabel3; 540 699 private javax.swing.JMenu menuAutoData; 541 700 private javax.swing.JMenu menuEvaluations; 542 701 private javax.swing.JMenu menuInstructor; 702 private javax.swing.JButton saveCloseBtn; 703 private javax.swing.JComboBox<String> timeHourComboSelector; 704 private javax.swing.JComboBox<String> timeMinuteComboSelector; 705 private javax.swing.JComboBox<String> timeSecondComboSelector; 543 706 private javax.swing.JTextField txtEventStart; 544 707 // End of variables declaration//GEN-END:variables -
trunk/src/event/editor/frame/PropertyModel.java
r134 r145 70 70 try 71 71 { 72 //todo: this is where there are problems with initializing the unit window 72 73 JPanel panel = (JPanel) classMap.get(property).newInstance(); 73 74 … … 82 83 { 83 84 System.err.println("Could not create panel of type \"" + property + "\""); 84 } 85 } 85 86 } 86 87 -
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.
