Changeset 130 in tmcsimulator-scriptbuilder for trunk/src/event/editor/CMSEvaluationPanel.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/CMSEvaluationPanel.java

    r92 r130  
    3535        event = (CMSEvaluationEvent) sei; 
    3636        txtID.setText(event.cmsID); 
    37         txtID.addKeyListener(new KeyListener() 
    38         { 
    39  
    40             @Override 
    41             public void keyTyped(KeyEvent e) 
    42             { 
    43             } 
    44  
    45             @Override 
    46             public void keyPressed(KeyEvent e) 
    47             { 
    48                 if (e.getKeyCode() == KeyEvent.VK_ENTER) 
    49                 { 
    50                     event.cmsID = txtID.getText(); 
    51                 } 
    52             } 
    53  
    54             @Override 
    55             public void keyReleased(KeyEvent e) 
    56             { 
    57             } 
    58         }); 
     37         
    5938        txtLocation.setText(event.location); 
    60         txtLocation.addKeyListener(new KeyListener() 
    61         { 
    62  
    63             @Override 
    64             public void keyTyped(KeyEvent e) 
    65             { 
    66             } 
    67  
    68             @Override 
    69             public void keyPressed(KeyEvent e) 
    70             { 
    71                 if (e.getKeyCode() == KeyEvent.VK_ENTER) 
    72                 { 
    73                     event.location = txtLocation.getText(); 
    74                 } 
    75             } 
    76  
    77             @Override 
    78             public void keyReleased(KeyEvent e) 
    79             { 
    80             } 
    81         }); 
     39         
    8240        txtMessage.setText(""); 
    8341        for (int i = 0; i < event.message.size(); i++) 
     
    9250            } 
    9351        } 
    94         TypeDropdown.addActionListener(new ActionListener() 
    95         { 
    96  
    97             @Override 
    98             public void actionPerformed(ActionEvent e) 
    99             { 
    100                 event.cmsType = TypeDropdown.getSelectedItem().toString(); 
    101             } 
    102         }); 
     52         
    10353        addButton.addActionListener(new ActionListener() 
    10454        { 
     
    13989        event = null; 
    14090        return true; 
     91    } 
     92 
     93    @Override 
     94    public void uponClose() 
     95    { 
     96        event.cmsID = txtID.getText(); 
     97        event.location = txtLocation.getText(); 
     98        event.cmsType = TypeDropdown.getSelectedItem().toString(); 
    14199    } 
    142100 
Note: See TracChangeset for help on using the changeset viewer.