Changeset 180 in tmcsimulator-scriptbuilder for trunk/src


Ignore:
Timestamp:
12/23/2019 08:57:26 AM (6 years ago)
Author:
sdanthin
Message:

PropertyPanels?.java added a function to get properties from a certain jPanel.
Editor.java used above function to auto-close the editor window when it has no more events contained.
AudioPanel?.java modified to NOT allow audioEvents in the Event Editor to be deleted.

Location:
trunk/src/event/editor
Files:
3 edited

Legend:

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

    r171 r180  
    4242    public boolean removeAssociatedEvent() 
    4343    { 
    44         event.removeThis(); 
    45         event = null; 
    46         return true; 
     44        //this makes it not possible to remove an AudioEvent from the script without deleting its respective I_AudioEvent. 
     45//        event.removeThis(); 
     46//        event = null; 
     47        return false; 
    4748    } 
    4849 
  • trunk/src/event/editor/frame/Editor.java

    r173 r180  
    549549 
    550550        int index = eventTabsPane.getSelectedIndex(); 
    551  
     551        //checks if there is a component at the tab selected, if so, then remove the associated event from the data model, 
     552        //and if it is removed, then remove the associated editor window. 
    552553        if (index >= 0 && eventTabsPane.getTabComponentAt(index) != null) 
    553554        { 
    554555            JPanel removable = (JPanel) eventTabsPane 
    555556                    .getSelectedComponent(); 
    556             PropertyPanel update = this.model.properties.removeProperty(removable); 
    557  
    558             ((I_ScriptEventEditorPanel) update.getPanel()).removeAssociatedEvent(); 
    559  
     557            PropertyPanel removedProperty = this.model.properties.getProperty(removable); 
     558             
     559            if(((I_ScriptEventEditorPanel) removedProperty.getPanel()).removeAssociatedEvent()) 
     560            { 
     561                this.model.properties.removeProperty(removable); 
     562            } 
     563 
     564        } 
     565         
     566        //prevents an "empty editor" from appearing 
     567        if(eventTabsPane.getSelectedComponent() == null) 
     568        { 
     569            updateEventTime(); 
     570            this.closeWindow(); 
    560571        } 
    561572 
  • trunk/src/event/editor/frame/PropertyPanels.java

    r119 r180  
    198198        return removed; 
    199199    } 
     200    /** 
     201     * returns a corresponding PropertyPanel from a jPanel 
     202     * @param jPanel 
     203     * @return  
     204     */ 
     205    public PropertyPanel getProperty(JPanel jPanel) 
     206    { 
     207        PropertyPanel returnable = null; 
     208 
     209        for (PropertyPanel panel : properties) 
     210        { 
     211            if (panel.getPanel() == jPanel) 
     212            { 
     213                returnable = panel; 
     214            } 
     215        } 
     216        return returnable; 
     217    } 
    200218 
    201219    public PropertyPanel removeProperty(String title) 
Note: See TracChangeset for help on using the changeset viewer.