Changeset 145 in tmcsimulator-scriptbuilder for trunk/src/event/editor
- Timestamp:
- 11/04/2019 08:14:32 AM (7 years ago)
- Location:
- trunk/src/event/editor
- Files:
-
- 9 edited
-
TelephonePanel.form (modified) (3 diffs)
-
TelephonePanel.java (modified) (7 diffs)
-
UnitPanel.form (modified) (6 diffs)
-
UnitPanel.java (modified) (15 diffs)
-
WitnessPanel.form (modified) (1 diff)
-
WitnessPanel.java (modified) (4 diffs)
-
frame/Editor.form (modified) (6 diffs)
-
frame/Editor.java (modified) (25 diffs)
-
frame/PropertyModel.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.
