Changeset 130 in tmcsimulator-scriptbuilder for trunk/src/event/editor/ParamicsPanel.java


Ignore:
Timestamp:
10/23/2017 08:58:34 AM (9 years ago)
Author:
bmcguffin
Message:

Changed implementation of save function for event editor panels. Instead of updating their model objects whenever the enter key is pressed, panels are now notified when the window is closed and update their information then.

File:
1 edited

Legend:

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

    r92 r130  
    1717    private ActionListener removeListener; 
    1818    private ParamicsEvent event; 
     19    ArrayList<JCheckBox> lanes = new ArrayList<JCheckBox>(); 
    1920 
    2021    /** 
     
    4546            LocationDropdown.setSelectedItem(LocationDropdown.getItemCount() - 1); 
    4647        } 
    47         LocationDropdown.addActionListener(new ActionListener() 
    48         { 
    49  
    50             @Override 
    51             public void actionPerformed(ActionEvent e) 
    52             { 
    53                 event.locationID = LocationDropdown.getSelectedItem().toString(); 
    54             } 
    55         }); 
     48 
    5649        for (int i = 0; i < StatusDropdown.getItemCount(); i++) 
    5750        { 
     
    6154            } 
    6255        } 
    63         StatusDropdown.addActionListener(new ActionListener() 
    64         { 
    65  
    66             @Override 
    67             public void actionPerformed(ActionEvent e) 
    68             { 
    69                 event.status = StatusDropdown.getSelectedItem().toString(); 
    70             } 
    71         }); 
     56 
    7257        for (int i = 0; i < TypeDropdown.getItemCount(); i++) 
    7358        { 
     
    7762            } 
    7863        } 
    79         TypeDropdown.addActionListener(new ActionListener() 
    80         { 
    81  
    82             @Override 
    83             public void actionPerformed(ActionEvent e) 
    84             { 
    85                 event.type = TypeDropdown.getSelectedItem().toString(); 
    86             } 
    87         }); 
    88         ArrayList<JCheckBox> lanes = new ArrayList<JCheckBox>(); 
     64 
    8965        lanes.add(jCheckBox1); 
    9066        lanes.add(jCheckBox2); 
     
    10884        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 
    10985    } 
    110      
     86 
    11187    @Override 
    11288    public boolean removeAssociatedEvent() 
     
    11591        event = null; 
    11692        return true; 
     93    } 
     94 
     95    @Override 
     96    public void uponClose() 
     97    { 
     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")); 
     104        } 
    117105    } 
    118106 
Note: See TracChangeset for help on using the changeset viewer.