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

    r92 r130  
    6060        event = (TowEvent) sei; 
    6161        txtCompany.setText(event.towCompany); 
    62         txtCompany.addKeyListener(new KeyListener() 
    63         { 
    64             public void keyTyped(KeyEvent e) 
    65             { 
    66             } 
    67             public void keyPressed(KeyEvent e) 
    68             { 
    69                 if (e.getKeyCode() == KeyEvent.VK_ENTER) 
    70                 { 
    71                     event.towCompany = txtCompany.getText(); 
    72                 } 
    73             } 
    74             public void keyReleased(KeyEvent e) 
    75             { 
    76             } 
    77         }); 
     62 
    7863        txtBeat.setText(event.towBeat); 
    79         txtBeat.addKeyListener(new KeyListener() 
    80         { 
    81             public void keyTyped(KeyEvent e) 
    82             { 
    83             } 
    84             public void keyPressed(KeyEvent e) 
    85             { 
    86                 if (e.getKeyCode() == KeyEvent.VK_ENTER) 
    87                 { 
    88                     event.towBeat = txtBeat.getText(); 
    89                 } 
    90             } 
    91             public void keyReleased(KeyEvent e) 
    92             { 
    93             } 
    94         }); 
     64 
    9565        txtConfirmationNumber.setText("" + event.towConfNum); 
    96         txtConfirmationNumber.addKeyListener(new KeyListener() 
    97         { 
    98             public void keyTyped(KeyEvent e) 
    99             { 
    100             } 
    101             public void keyPressed(KeyEvent e) 
    102             { 
    103                 if (e.getKeyCode() == KeyEvent.VK_ENTER) 
    104                 { 
    105                     event.towConfNum = txtConfirmationNumber.getText(); 
    106                 } 
    107             } 
    108             public void keyReleased(KeyEvent e) 
    109             { 
    110             } 
    111         }); 
     66 
    11267        txtPublicNumber.setText("" + event.towPubNum); 
    113         txtPublicNumber.addKeyListener(new KeyListener() 
    114         { 
    115             public void keyTyped(KeyEvent e) 
    116             { 
    117             } 
    118             public void keyPressed(KeyEvent e) 
    119             { 
    120                 if (e.getKeyCode() == KeyEvent.VK_ENTER) 
    121                 { 
    122                     event.towPubNum = txtPublicNumber.getText(); 
    123                 } 
    124             } 
    125             public void keyReleased(KeyEvent e) 
    126             { 
    127             } 
    128         }); 
     68 
    12969    } 
    13070 
     
    13474        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 
    13575    } 
    136      
     76 
    13777    @Override 
    13878    public boolean removeAssociatedEvent() 
     
    14181        event = null; 
    14282        return true; 
     83    } 
     84 
     85    @Override 
     86    public void uponClose() 
     87    { 
     88        event.towCompany = txtCompany.getText(); 
     89        event.towBeat = txtBeat.getText(); 
     90        event.towConfNum = txtConfirmationNumber.getText(); 
     91        event.towPubNum = txtPublicNumber.getText(); 
    14392    } 
    14493 
Note: See TracChangeset for help on using the changeset viewer.