Changeset 130 in tmcsimulator-scriptbuilder for trunk/src/event/editor/frame


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.

Location:
trunk/src/event/editor/frame
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/event/editor/frame/Editor.java

    r119 r130  
    124124                } 
    125125            } 
     126 
    126127        } 
    127128 
     
    150151            public void keyReleased(KeyEvent e) 
    151152            { 
     153            } 
     154        }); 
     155        this.addWindowListener(new WindowAdapter() 
     156        { 
     157            @Override 
     158            public void windowClosing(WindowEvent e) 
     159            { 
     160                //Add previous offset back in 
     161                //If we didn't adjust the offset, this will just set it to the old value 
     162                //If we deleted the first event(s), this will add the offsets, 
     163                //to ensure that events stay at the correct times 
     164                model.closePanels(); 
    152165            } 
    153166        }); 
  • trunk/src/event/editor/frame/PropertyModel.java

    r101 r130  
    9393        notifyObservers(arg); 
    9494    } 
     95     
     96    /** 
     97     * Propagate the window closure. 
     98     */ 
     99    public void closePanels() 
     100    { 
     101        for(JPanel panel : eventMap.keySet()) 
     102        { 
     103            if(panel instanceof I_ScriptEventEditorPanel) 
     104            { 
     105                ((I_ScriptEventEditorPanel) panel).uponClose(); 
     106            } 
     107        } 
     108    } 
    95109 
    96110    /* 
Note: See TracChangeset for help on using the changeset viewer.