Changeset 145 in tmcsimulator-scriptbuilder for trunk/src/event/editor


Ignore:
Timestamp:
11/04/2019 08:14:32 AM (7 years ago)
Author:
sdanthin
Message:

Move from Git to Svn (LARGE COMMIT)

Location:
trunk/src/event/editor
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/event/editor/TelephonePanel.form

    r1 r145  
    8484        <Property name="toolTipText" type="java.lang.String" value="Deletes the selected row in the table"/> 
    8585      </Properties> 
     86      <Events> 
     87        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="deleteSelectedButtonActionPerformed"/> 
     88      </Events> 
    8689    </Component> 
    8790    <Component class="javax.swing.JButton" name="addInstructorButton"> 
     
    9093        <Property name="toolTipText" type="java.lang.String" value="Adds a row for instructor dialog in the table"/> 
    9194      </Properties> 
     95      <Events> 
     96        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addInstructorButtonActionPerformed"/> 
     97      </Events> 
    9298    </Component> 
    9399    <Component class="javax.swing.JTextField" name="txtInstructorRole"> 
     
    108114      <Events> 
    109115        <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"/> 
    110117      </Events> 
    111118    </Component> 
  • trunk/src/event/editor/TelephonePanel.java

    r130 r145  
    5353            public void keyPressed(KeyEvent e) 
    5454            { 
     55                //this needs to be changed to add the instructor role when a new line is created 
    5556                if (e.getKeyCode() == KeyEvent.VK_ENTER) 
    5657                { 
     
    6970            public void actionPerformed(ActionEvent e) 
    7071            { 
    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(""); 
    7476            } 
    7577        }); 
     
    129131    @SuppressWarnings("unchecked") 
    130132    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents 
    131     private void initComponents() 
    132     { 
     133    private void initComponents() { 
    133134 
    134135        addStudentButton = new javax.swing.JButton(); 
     
    147148        deleteSelectedButton.setText("Delete Selected Line"); 
    148149        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        }); 
    149155 
    150156        addInstructorButton.setText("Add Instructor Line"); 
    151157        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        }); 
    152163 
    153164        txtInstructorRole.setToolTipText("Specifies the role the instructor plays"); 
     
    157168        removeButton.setText("Remove"); 
    158169        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) { 
    163172                removeThisProperty(evt); 
     173            } 
     174        }); 
     175        removeButton.addActionListener(new java.awt.event.ActionListener() { 
     176            public void actionPerformed(java.awt.event.ActionEvent evt) { 
     177                removeButtonActionPerformed(evt); 
    164178            } 
    165179        }); 
     
    208222 
    209223    private void removeThisProperty(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_removeThisProperty 
     224        //linked to remove button - removes the current buton 
    210225        if (removeListener != null) 
    211226        { 
     
    213228        } 
    214229    }//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 
    215246 
    216247 
  • trunk/src/event/editor/UnitPanel.form

    r92 r145  
    2323                  <Group type="102" alignment="0" attributes="0"> 
    2424                      <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"> 
    3625                          <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/> 
    3726                          <Component id="jLabel4" alignment="0" min="-2" max="-2" attributes="0"/> 
     
    4130                          <Component id="ActiveDropdown" alignment="0" pref="475" max="32767" attributes="0"/> 
    4231                          <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> 
    4349                      </Group> 
    4450                  </Group> 
     
    5157      <Group type="103" groupAlignment="0" attributes="0"> 
    5258          <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"/> 
    5460              <Group type="103" groupAlignment="3" attributes="0"> 
    55                   <Component id="jLabel1" 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"/> 
    5763              </Group> 
    58               <EmptySpace type="unrelated" max="-2" attributes="0"/> 
     64              <EmptySpace max="-2" attributes="0"/> 
    5965              <Group type="103" groupAlignment="3" attributes="0"> 
    6066                  <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> 
     
    7177                  <Component id="ActiveDropdown" alignment="3" min="-2" max="-2" attributes="0"/> 
    7278              </Group> 
    73               <EmptySpace pref="128" max="32767" attributes="0"/> 
     79              <EmptySpace pref="100" max="32767" attributes="0"/> 
    7480              <Component id="help" min="-2" pref="20" max="-2" attributes="0"/> 
    7581              <EmptySpace max="-2" attributes="0"/> 
     
    7985  </Layout> 
    8086  <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> 
    9287    <Component class="javax.swing.JLabel" name="jLabel2"> 
    9388      <Properties> 
     
    138133    <Component class="javax.swing.JLabel" name="help"> 
    139134    </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="&lt;String&gt;"/> 
     153      </AuxValues> 
     154    </Component> 
    140155  </SubComponents> 
    141156</Form> 
  • trunk/src/event/editor/UnitPanel.java

    r140 r145  
    33import java.awt.event.*; 
    44import java.util.Observable; 
     5import java.util.List; 
     6import java.util.ArrayList; 
     7import javax.swing.DefaultComboBoxModel; 
     8import javax.swing.ComboBoxModel; 
    59import scriptbuilder.structures.events.I_ScriptEvent; 
     10import scriptbuilder.structures.units.Unit; 
    611import scriptbuilder.structures.events.UnitEvent; 
    712 
     
    914 * 
    1015 * @author nathaniellehrer 
     16 *  
     17 *  
    1118 */ 
    1219public class UnitPanel extends javax.swing.JPanel implements I_ScriptEventEditorPanel 
     
    1522    private ActionListener removeListener; 
    1623    private UnitEvent event; 
    17  
     24    private List<Unit> units; 
     25     
     26    List<String> names = new ArrayList<String>(); 
    1827    /** 
    1928     * Creates new form UnitPanel 
     
    2231    { 
    2332        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     */ 
    4142    @Override 
    4243    public void getEventObject(I_ScriptEvent sei) 
    4344    { 
     45         
    4446        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(); 
    4649        for (int i = 0; i < ActiveDropdown.getItemCount(); i++) 
    4750        { 
     
    4952            { 
    5053                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                 
    5167            } 
    5268        } 
     
    8096    public void update(Observable o, Object arg) 
    8197    { 
     98        //todo: make supported 
    8299        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 
    83100    } 
     
    90107        return true; 
    91108    } 
     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    } 
    92149 
    93150    @Override 
     151    /** 
     152     * when window is closed, these values are set. 
     153     */ 
    94154    public void uponClose() 
    95155    { 
    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(); 
    99160            event.unitActive = ActiveDropdown.getSelectedItem().toString(); 
    100161            event.unitPrimary = PrimaryDropdown.getSelectedItem().toString(); 
    101162            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             
    102179        } 
    103180    } 
     
    110187    @SuppressWarnings("unchecked") 
    111188    // <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 
    117191        jLabel2 = new javax.swing.JLabel(); 
    118192        StatusDropdown = new javax.swing.JComboBox(); 
     
    122196        ActiveDropdown = new javax.swing.JComboBox(); 
    123197        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<>(); 
    129200 
    130201        jLabel2.setText("Status"); 
     
    139210 
    140211        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        }); 
    141234 
    142235        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); 
     
    150243                    .add(layout.createSequentialGroup() 
    151244                        .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) 
    160245                            .add(jLabel3) 
    161246                            .add(jLabel4)) 
     
    163248                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 
    164249                            .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))))) 
    166263                .addContainerGap()) 
    167264        ); 
     
    169266            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 
    170267            .add(layout.createSequentialGroup() 
    171                 .add(47, 47, 47) 
     268                .add(82, 82, 82) 
    172269                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 
    173                     .add(jLabel1) 
    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) 
    176273                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 
    177274                    .add(jLabel2) 
     
    185282                    .add(jLabel4) 
    186283                    .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, 128, Short.MAX_VALUE) 
     284                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 100, Short.MAX_VALUE) 
    188285                .add(help, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 
    189286                .addContainerGap()) 
    190287        ); 
    191288    }// </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 
    192302 
    193303 
     
    197307    private javax.swing.JComboBox StatusDropdown; 
    198308    private javax.swing.JLabel help; 
    199     private javax.swing.JLabel jLabel1; 
    200309    private javax.swing.JLabel jLabel2; 
    201310    private javax.swing.JLabel jLabel3; 
    202311    private javax.swing.JLabel jLabel4; 
    203     private javax.swing.JFormattedTextField txtUnitNumber; 
     312    private javax.swing.JLabel jLabel5; 
     313    private javax.swing.JComboBox<String> unitSelector; 
    204314    // End of variables declaration//GEN-END:variables 
    205315 
  • trunk/src/event/editor/WitnessPanel.form

    r92 r145  
    103103          <Format format="(###)###-####" subtype="-1" type="0"/> 
    104104        </Property> 
     105        <Property name="focusLostBehavior" type="int" value="3"/> 
    105106      </Properties> 
     107      <Events> 
     108        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="txtPhoneNumberActionPerformed"/> 
     109      </Events> 
    106110    </Component> 
    107111  </SubComponents> 
  • trunk/src/event/editor/WitnessPanel.java

    r140 r145  
    4242 
    4343        txtPhoneNumber.setText("" + event.witnessNum); 
     44        System.out.println("you just loaded a new witness event into the editor"); 
    4445 
    4546        txtAddress.setText(event.witnessAddress); 
     
    7980    @SuppressWarnings("unchecked") 
    8081    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents 
    81     private void initComponents() 
    82     { 
     82    private void initComponents() { 
    8383 
    8484        jLabel1 = new javax.swing.JLabel(); 
     
    100100 
    101101        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        }); 
    102108 
    103109        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); 
     
    147153    }// </editor-fold>//GEN-END:initComponents 
    148154 
     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 
    149159 
    150160    // Variables declaration - do not modify//GEN-BEGIN:variables 
  • trunk/src/event/editor/frame/Editor.form

    r134 r145  
    251251  </NonVisualComponents> 
    252252  <Properties> 
    253     <Property name="defaultCloseOperation" type="int" value="2"/> 
     253    <Property name="defaultCloseOperation" type="int" value="0"/> 
    254254    <Property name="title" type="java.lang.String" value="Event Editor"/> 
    255255  </Properties> 
     
    279279              <Component id="txtEventStart" min="-2" max="-2" attributes="0"/> 
    280280              <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"/> 
    281293              <Component id="bottomFramePanel" max="32767" attributes="0"/> 
    282294              <EmptySpace max="-2" attributes="0"/> 
    283295              <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"/> 
    284298              <EmptySpace max="-2" attributes="0"/> 
    285299          </Group> 
     
    290304          <Group type="102" alignment="0" attributes="0"> 
    291305              <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"/> 
    293307              <EmptySpace max="-2" attributes="0"/> 
    294308              <Group type="103" groupAlignment="0" attributes="0"> 
    295309                  <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> 
    298323              </Group> 
    299324          </Group> 
     
    311336        <DimensionLayout dim="0"> 
    312337          <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"/> 
    314339          </Group> 
    315340        </DimensionLayout> 
    316341        <DimensionLayout dim="1"> 
    317342          <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"/> 
    319344          </Group> 
    320345        </DimensionLayout> 
     
    325350        <Property name="text" type="java.lang.String" value="00:00:00"/> 
    326351      </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> 
    327363    </Component> 
    328364    <Component class="javax.swing.JButton" name="btnRemoveCurrentEvent"> 
     
    334370      </Events> 
    335371    </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="&lt;String&gt;"/> 
     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="&lt;String&gt;"/> 
     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="&lt;String&gt;"/> 
     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> 
    336429  </SubComponents> 
    337430</Form> 
  • trunk/src/event/editor/frame/Editor.java

    r134 r145  
    1111import scriptbuilder.gui.IncidentEditorFrame; 
    1212import scriptbuilder.gui.ScriptBuilderFrame; 
     13import scriptbuilder.gui.ScriptBuilderGuiConstants; 
    1314import scriptbuilder.gui.panels.IncidentTimelinePanel; 
    1415import scriptbuilder.structures.ScriptEvent; 
     
    3233        model.addEventPanel(property, se); 
    3334    } 
    34  
     35    /** 
     36     * adds all of the events from the timeslice to the incidentTimelinePanel 
     37     * @param ts the timeslice to be added 
     38     */ 
    3539    public void setSlice(TimeSlice ts) 
    3640    { 
     
    4246            for (I_ScriptEvent se : slice.events) 
    4347            { 
    44  
     48                 
    4549                this.addEvent(IncidentTimelinePanel.eventTypeToPropertyMap.get(se.getScriptEventType()), se); 
    4650 
     
    5256            System.out.println("[" + eventTime + "]"); 
    5357            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); 
    5467        } 
    5568 
    5669    } 
     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     
    57120 
    58121    private ActionListener optionalChangeListener = new ActionListener() 
     
    123186 
    124187        } 
    125  
     188        //this eventTime might need to be initialized to the correct time 
    126189        String eventTime = ""; 
    127190 
     
    159222                //If we deleted the first event(s), this will add the offsets, 
    160223                //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(); 
    164252    } 
    165253 
     
    171259    @SuppressWarnings("unchecked") 
    172260    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents 
    173     private void initComponents() 
    174     { 
     261    private void initComponents() { 
    175262 
    176263        eventTabsPane = new javax.swing.JTabbedPane(); 
    177264        bottomFramePanel = new javax.swing.JPanel(); 
    178265        txtEventStart = new javax.swing.JTextField(); 
     266        saveCloseBtn = new javax.swing.JButton(); 
    179267        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(); 
    180274        editorMenuBar = new javax.swing.JMenuBar(); 
    181275        menuEvaluations = new javax.swing.JMenu(); 
     
    200294        Witness = new javax.swing.JMenuItem(); 
    201295 
    202         setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); 
     296        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); 
    203297        setTitle("Event Editor"); 
    204298 
     
    207301        bottomFramePanelLayout.setHorizontalGroup( 
    208302            bottomFramePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 
    209             .add(0, 613, Short.MAX_VALUE) 
     303            .add(0, 70, Short.MAX_VALUE) 
    210304        ); 
    211305        bottomFramePanelLayout.setVerticalGroup( 
    212306            bottomFramePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 
    213             .add(0, 34, Short.MAX_VALUE) 
     307            .add(0, 45, Short.MAX_VALUE) 
    214308        ); 
    215309 
    216310        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        }); 
    217323 
    218324        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) { 
    223327                btnRemoveCurrentEventActionPerformed(evt); 
    224328            } 
    225329        }); 
     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"); 
    226352 
    227353        menuEvaluations.setText("Evaluations"); 
     
    230356        ATMS.setText("ATMS"); 
    231357        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) { 
    236360                multipleChange(evt); 
    237361            } 
     
    242366        ActivityLog.setText("Activity Log"); 
    243367        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) { 
    248370                multipleChange(evt); 
    249371            } 
     
    254376        CAD.setText("CAD"); 
    255377        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) { 
    260380                multipleChange(evt); 
    261381            } 
     
    266386        CMS.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/CMSEval.png"))); // NOI18N 
    267387        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) { 
    272390                multipleChangeListener(evt); 
    273391            } 
    274392        }); 
    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) { 
    279395                multipleChange(evt); 
    280396            } 
     
    285401        Facilitator.setText("Facilitator"); 
    286402        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) { 
    291405                optionalChange(evt); 
    292406            } 
     
    297411        Radio.setText("Radio"); 
    298412        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) { 
    303415                optionalChange(evt); 
    304416            } 
     
    313425        MaintenanceRadio.setText("Maintenance Radio"); 
    314426        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) { 
    319429                optionalChange(evt); 
    320430            } 
     
    325435        TMTRadio.setText("TMT Radio"); 
    326436        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) { 
    331439                optionalChange(evt); 
    332440            } 
     
    337445        Telephone.setText("Telephone"); 
    338446        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) { 
    343449                optionalChange(evt); 
    344450            } 
     
    353459        Audio.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Audio.png"))); // NOI18N 
    354460        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) { 
    359463                AudioActionPerformed(evt); 
    360464            } 
     
    375479        CHPRadio.setText("CHP Radio"); 
    376480        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) { 
    381483                optionalChange(evt); 
    382484            } 
     
    417519                .add(txtEventStart, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 
    418520                .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) 
    419533                .add(bottomFramePanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 
    420534                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 
    421535                .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) 
    422538                .addContainerGap()) 
    423539        ); 
     
    426542            .add(layout.createSequentialGroup() 
    427543                .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) 
    429545                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 
    430546                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 
    431547                    .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)))) 
    434559        ); 
    435560 
     
    471596    }//GEN-LAST:event_AudioActionPerformed 
    472597 
     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 
    473624    private void updateEventTime() 
    474625    { 
    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         
    480636 
    481637        int newTime = (3600 * hrs) + (60 * mins) + secs; 
     
    493649 
    494650            } 
    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); 
    499655        } 
    500656    } 
     
    538694    private javax.swing.JMenuBar editorMenuBar; 
    539695    private javax.swing.JTabbedPane eventTabsPane; 
     696    private javax.swing.JLabel jLabel1; 
     697    private javax.swing.JLabel jLabel2; 
     698    private javax.swing.JLabel jLabel3; 
    540699    private javax.swing.JMenu menuAutoData; 
    541700    private javax.swing.JMenu menuEvaluations; 
    542701    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; 
    543706    private javax.swing.JTextField txtEventStart; 
    544707    // End of variables declaration//GEN-END:variables 
  • trunk/src/event/editor/frame/PropertyModel.java

    r134 r145  
    7070        try 
    7171        { 
     72            //todo: this is where there are problems with initializing the unit window 
    7273            JPanel panel = (JPanel) classMap.get(property).newInstance(); 
    7374 
     
    8283        { 
    8384            System.err.println("Could not create panel of type \"" + property + "\""); 
    84         } 
     85        }             
    8586    } 
    8687     
Note: See TracChangeset for help on using the changeset viewer.