Changeset 85 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder


Ignore:
Timestamp:
08/27/2017 01:04:49 PM (9 years ago)
Author:
jdalbey
Message:

ScriptBuilderFrame? - added explanatory comments in incidentOkButtonActionPerformed method.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/scriptbuilder/gui/ScriptBuilderFrame.java

    r83 r85  
    14651465            boolean found = false; 
    14661466            int indx = 0; 
    1467             for (ScriptIncident i : script.incidents) 
    1468             { 
    1469                 if (i == null) 
     1467            // ALERT: Wacky logic follows 
     1468            // Examine all the incidents contained in this script 
     1469            for (ScriptIncident inci : script.incidents) 
     1470            { 
     1471                // If this spot in the list of incidents hasn't been assigned yet 
     1472                if (inci == null) 
    14701473                { 
    14711474                    found = true; 
     
    14731476                } 
    14741477                ++indx; 
    1475                 if (i.number == (Integer) addIncidentNumber.getValue()) 
     1478                // Does the new incident number match an existing one? 
     1479                if (inci.number == (Integer) addIncidentNumber.getValue()) 
    14761480                { 
    14771481                    JOptionPane.showMessageDialog(this, "Incident number already in use.", 
     
    14811485                } 
    14821486            } 
     1487            // We examined all incidents and there wasn't an empty slot 
    14831488            if (!found) 
    14841489            { 
     
    14861491                        "Unable to Create Incident", JOptionPane.ERROR_MESSAGE); 
    14871492                incidentFrame.setVisible(true); 
     1493                // ALERT: exit from middle of method 
    14881494                return; 
    14891495            } 
    14901496 
    1491             script.incidents.remove(indx); 
     1497            // We found a spot for the new incident 
     1498            script.incidents.remove(indx); // remove the null incident placeholder 
    14921499            SimulationScript.incidentColors[indx] = selectedColor; 
     1500            // Add the new incident to the list 
    14931501            script.incidents.add(indx, 
    14941502                    new ScriptIncident(SimulationScript.incidentColors[indx], 
Note: See TracChangeset for help on using the changeset viewer.