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


Ignore:
Timestamp:
12/22/2017 02:05:13 PM (8 years ago)
Author:
bmcguffin
Message:

Fixed defect #67. Removing an event and then closing the event editor window no longer causes the program to hang; a null check for the event is encountered before taking action upon close of the window.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/event/editor/AudioPanel.java

    r130 r140  
    5050    public void uponClose() 
    5151    { 
    52         event.audioPath = audioFileText.getText(); 
    53         try 
     52        if (event != null) 
    5453        { 
    55             event.audioLength = Integer.parseInt(audioLengthText.getText()); 
    56         } 
    57         catch (Exception ex) 
    58         { 
     54            event.audioPath = audioFileText.getText(); 
     55            try 
     56            { 
     57                event.audioLength = Integer.parseInt(audioLengthText.getText()); 
     58            } 
     59            catch (Exception ex) 
     60            { 
    5961 
     62            } 
    6063        } 
    6164    } 
  • trunk/src/event/editor/CADLogPanel.java

    r130 r140  
    2323        initComponents(); 
    2424    } 
     25 
    2526    /** 
    2627     * Load the script event associated with this editor panel. 
     
    5253    public void uponClose() 
    5354    { 
    54         event.detail = CadTextField.getText(); 
     55        if (event != null) 
     56        { 
     57            event.detail = CadTextField.getText(); 
     58        } 
    5559    } 
    5660 
  • trunk/src/event/editor/CHPRadioPanel.java

    r130 r140  
    3636        event = (CHPRadioEvent) sei; 
    3737        audioText.setText(event.radioFile); 
    38          
     38 
    3939        for (int i = 0; i < event.lines.size(); i++) 
    4040        { 
    4141            ((MyTableModel) dialogTable.getModel()).addRow(event.roles.get(i), event.lines.get(i)); 
    4242        } 
    43         addDispatchButton.addActionListener(new ActionListener() { 
     43        addDispatchButton.addActionListener(new ActionListener() 
     44        { 
    4445 
    4546            public void actionPerformed(ActionEvent e) 
     
    5051            } 
    5152        }); 
    52         addFieldButton.addActionListener(new ActionListener() { 
     53        addFieldButton.addActionListener(new ActionListener() 
     54        { 
    5355 
    5456            public void actionPerformed(ActionEvent e) 
     
    6971                    event.lines.set(e.getLastRow(), dialogTable.getModel().getValueAt(e.getLastRow(), 1).toString()); 
    7072                } 
    71                 if(e.getType() == TableModelEvent.DELETE) 
     73                if (e.getType() == TableModelEvent.DELETE) 
    7274                { 
    7375                    event.roles.remove(e.getLastRow()); 
     
    7678            } 
    7779        }); 
    78          
     80 
    7981    } 
    8082 
     
    8385        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 
    8486    } 
    85      
     87 
    8688    @Override 
    8789    public boolean removeAssociatedEvent() 
    8890    { 
    89         ((I_ScriptEvent)event).removeThis(); 
     91        ((I_ScriptEvent) event).removeThis(); 
    9092        event = null; 
    9193        return true; 
     
    9597    public void uponClose() 
    9698    { 
    97         event.radioFile = audioText.getText(); 
     99        if (event != null) 
     100        { 
     101            event.radioFile = audioText.getText(); 
     102        } 
    98103    } 
    99104 
  • trunk/src/event/editor/CMSEvaluationPanel.java

    r130 r140  
    3535        event = (CMSEvaluationEvent) sei; 
    3636        txtID.setText(event.cmsID); 
    37          
     37 
    3838        txtLocation.setText(event.location); 
    39          
     39 
    4040        txtMessage.setText(""); 
    4141        for (int i = 0; i < event.message.size(); i++) 
     
    5050            } 
    5151        } 
    52          
     52 
    5353        addButton.addActionListener(new ActionListener() 
    5454        { 
     
    8282        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 
    8383    } 
    84      
     84 
    8585    @Override 
    8686    public boolean removeAssociatedEvent() 
     
    9494    public void uponClose() 
    9595    { 
    96         event.cmsID = txtID.getText(); 
    97         event.location = txtLocation.getText(); 
    98         event.cmsType = TypeDropdown.getSelectedItem().toString(); 
     96        if (event != null) 
     97        { 
     98            event.cmsID = txtID.getText(); 
     99            event.location = txtLocation.getText(); 
     100            event.cmsType = TypeDropdown.getSelectedItem().toString(); 
     101        } 
    99102    } 
    100103 
  • trunk/src/event/editor/MaintenanceRadioPanel.java

    r130 r140  
    4545    public void uponClose() 
    4646    { 
    47         event.message = jTextArea1.getText(); 
     47        if (event != null) 
     48        { 
     49            event.message = jTextArea1.getText(); 
     50        } 
    4851    } 
    4952 
  • trunk/src/event/editor/ParamicsPanel.java

    r130 r140  
    9696    public void uponClose() 
    9797    { 
    98         event.locationID = LocationDropdown.getSelectedItem().toString(); 
    99         event.status = StatusDropdown.getSelectedItem().toString(); 
    100         event.type = TypeDropdown.getSelectedItem().toString(); 
    101         for (JCheckBox lane : lanes) 
    102         { 
    103             lane.getActionListeners()[0].actionPerformed(new ActionEvent(lane, 0, "record")); 
     98        if (event != null) 
     99        { 
     100            event.locationID = LocationDropdown.getSelectedItem().toString(); 
     101            event.status = StatusDropdown.getSelectedItem().toString(); 
     102            event.type = TypeDropdown.getSelectedItem().toString(); 
     103            for (JCheckBox lane : lanes) 
     104            { 
     105                lane.getActionListeners()[0].actionPerformed(new ActionEvent(lane, 0, "record")); 
     106            } 
    104107        } 
    105108    } 
  • trunk/src/event/editor/TMTRadioPanel.java

    r130 r140  
    3333        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 
    3434    } 
    35      
     35 
    3636    @Override 
    3737    public boolean removeAssociatedEvent() 
    3838    { 
    39         ((I_ScriptEvent)event).removeThis(); 
     39        ((I_ScriptEvent) event).removeThis(); 
    4040        event = null; 
    4141        return true; 
     
    4545    public void uponClose() 
    4646    { 
    47         event.message = jTextArea1.getText(); 
     47        if (event != null) 
     48        { 
     49            event.message = jTextArea1.getText(); 
     50        } 
    4851    } 
    4952 
  • trunk/src/event/editor/TowPanel.java

    r130 r140  
    8686    public void uponClose() 
    8787    { 
    88         event.towCompany = txtCompany.getText(); 
    89         event.towBeat = txtBeat.getText(); 
    90         event.towConfNum = txtConfirmationNumber.getText(); 
    91         event.towPubNum = txtPublicNumber.getText(); 
     88        if (event != null) 
     89        { 
     90            event.towCompany = txtCompany.getText(); 
     91            event.towBeat = txtBeat.getText(); 
     92            event.towConfNum = txtConfirmationNumber.getText(); 
     93            event.towPubNum = txtPublicNumber.getText(); 
     94        } 
    9295    } 
    9396 
  • trunk/src/event/editor/UnitPanel.java

    r130 r140  
    9494    public void uponClose() 
    9595    { 
    96         event.unitNum = txtUnitNumber.getText(); 
    97         event.unitActive = ActiveDropdown.getSelectedItem().toString(); 
    98         event.unitPrimary = PrimaryDropdown.getSelectedItem().toString(); 
    99         event.unitStatus = StatusDropdown.getSelectedItem().toString(); 
     96        if (event != null) 
     97        { 
     98            event.unitNum = txtUnitNumber.getText(); 
     99            event.unitActive = ActiveDropdown.getSelectedItem().toString(); 
     100            event.unitPrimary = PrimaryDropdown.getSelectedItem().toString(); 
     101            event.unitStatus = StatusDropdown.getSelectedItem().toString(); 
     102        } 
    100103    } 
    101104 
  • trunk/src/event/editor/WitnessPanel.java

    r130 r140  
    6464    public void uponClose() 
    6565    { 
    66         event.witnessName = txtFirstName.getText() + " " + txtLastName.getText(); 
    67         event.witnessNum = txtPhoneNumber.getText(); 
    68         event.witnessAddress = txtAddress.getText(); 
     66        if (event != null) 
     67        { 
     68            event.witnessName = txtFirstName.getText() + " " + txtLastName.getText(); 
     69            event.witnessNum = txtPhoneNumber.getText(); 
     70            event.witnessAddress = txtAddress.getText(); 
     71        } 
    6972    } 
    7073 
Note: See TracChangeset for help on using the changeset viewer.