Changeset 134 in tmcsimulator-scriptbuilder for trunk/src/event/editor


Ignore:
Timestamp:
10/23/2017 05:27:01 PM (9 years ago)
Author:
bmcguffin
Message:

The event-add dropdown menus in the event editor window now function correctly. Clicking on an event in the dropdown list adds it to that timeslice.

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

Legend:

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

    r119 r134  
    161161                <Property name="text" type="java.lang.String" value="Audio"/> 
    162162              </Properties> 
     163              <Events> 
     164                <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="AudioActionPerformed"/> 
     165              </Events> 
    163166            </MenuItem> 
    164167            <MenuItem class="javax.swing.JMenuItem" name="CADLog"> 
  • trunk/src/event/editor/frame/Editor.java

    r130 r134  
    2828    private PropertyModel model = new PropertyModel(); 
    2929 
    30 //    public PropertyModel getPropertyModel() 
    31 //    { 
    32 //        return model; 
    33 //    } 
    3430    public void addEvent(Properties property, I_ScriptEvent se) 
    3531    { 
     
    6965            if (src.isSelected()) 
    7066            { 
    71                 model.addEventPanel(property, new CCTVEvent()); 
     67                model.addEventFromDropdown(property, incident, slice); 
    7268            } 
    7369            else 
     
    8379        { 
    8480            JMenuItem src = (JMenuItem) evt.getSource(); 
    85             model.addEventPanel(Properties.valueOf(src.getText().replaceAll(" ", "")), new CCTVEvent()); 
     81            Properties property = Properties.valueOf(src.getText().replaceAll(" ", "")); 
     82            model.addEventFromDropdown(property, incident, slice); 
    8683        } 
    8784    }; 
     
    356353        Audio.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Audio.png"))); // NOI18N 
    357354        Audio.setText("Audio"); 
     355        Audio.addActionListener(new java.awt.event.ActionListener() 
     356        { 
     357            public void actionPerformed(java.awt.event.ActionEvent evt) 
     358            { 
     359                AudioActionPerformed(evt); 
     360            } 
     361        }); 
    358362        menuAutoData.add(Audio); 
    359363 
     
    461465 
    462466    }//GEN-LAST:event_btnRemoveCurrentEventActionPerformed 
     467 
     468    private void AudioActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_AudioActionPerformed 
     469    {//GEN-HEADEREND:event_AudioActionPerformed 
     470        // TODO add your handling code here: 
     471    }//GEN-LAST:event_AudioActionPerformed 
    463472 
    464473    private void updateEventTime() 
  • trunk/src/event/editor/frame/Properties.java

    r93 r134  
    66import java.awt.Image; 
    77import java.awt.image.BufferedImage; 
     8import scriptbuilder.structures.ScriptEvent; 
     9import scriptbuilder.structures.ScriptEvent; 
     10import scriptbuilder.structures.events.*; 
     11import scriptbuilder.structures.events.I_ScriptEvent; 
    812 
    913public enum Properties 
    1014{ 
    1115    ATMS                ("ATMS", PropertyTypes.Optional, 
    12         loadImage(Images.getImage("ATMSEval.png"))), 
     16        loadImage(Images.getImage("ATMSEval.png")), new ATMSEvaluationEvent()), 
    1317    ActivityLog         ("Activity Log", PropertyTypes.Optional, 
    14         loadImage(Images.getImage("ActivityLogEval.png"))), 
     18        loadImage(Images.getImage("ActivityLogEval.png")), new ActivityLogEvaluationEvent()), 
    1519    CAD                 ("CAD", PropertyTypes.Optional, 
    16         loadImage(Images.getImage("CADEval.png"))), 
     20        loadImage(Images.getImage("CADEval.png")), new CADEvaluationEvent()), 
    1721    Facilitator         ("Faciliatator", PropertyTypes.Optional, 
    18         loadImage(Images.getImage("FacilitatorEval.png"))), 
     22        loadImage(Images.getImage("FacilitatorEval.png")), new FacilitatorEvaluationEvent()), 
    1923    Radio               ("Radio", PropertyTypes.Optional, 
    20         loadImage(Images.getImage("RadioEval.png"))), 
     24        loadImage(Images.getImage("RadioEval.png")), new RadioEvaluationEvent()), 
    2125    MaintenanceRadio    ("Maintenance Radio", PropertyTypes.Optional, 
    22         loadImage(Images.getImage("MaintenanceRadio.png"))), 
     26        loadImage(Images.getImage("MaintenanceRadio.png")), new MaintenanceRadioEvent()), 
    2327    TMTRadio            ("TMT Radio", PropertyTypes.Optional, 
    24         loadImage(Images.getImage("TMTRadio.png"))), 
     28        loadImage(Images.getImage("TMTRadio.png")), new TMTRadioEvent()), 
    2529    Telephone           ("Telephone", PropertyTypes.Optional, 
    26         loadImage(Images.getImage("Telephone.png"))), 
     30        loadImage(Images.getImage("Telephone.png")), new TelephoneEvent()), 
    2731    CHPRadio            ("CHP Radio",PropertyTypes.Optional, 
    28         loadImage(Images.getImage("CHPRadio.png"))), 
     32        loadImage(Images.getImage("CHPRadio.png")), new CHPRadioEvent()), 
    2933    CMS                 ("CMS", PropertyTypes.Multiple, 
    30         loadImage(Images.getImage("CMSEval.png"))), 
     34        loadImage(Images.getImage("CMSEval.png")), new CMSEvaluationEvent()), 
    3135    Audio               ("Audio", PropertyTypes.Multiple, 
    32         loadImage(Images.getImage("Audio.png"))), 
     36        loadImage(Images.getImage("Audio.png")), new AudioEvent()), 
    3337    CCTV                ("CCTV", PropertyTypes.Multiple, 
    34         loadImage(Images.getImage("CCTV.png"))), 
     38        loadImage(Images.getImage("CCTV.png")), new CCTVEvent()), 
    3539    CADLog              ("CAD Log", PropertyTypes.Multiple, 
    36         loadImage(Images.getImage("CAD.png"))), 
     40        loadImage(Images.getImage("CAD.png")), new CADEvent()), 
    3741    Paramics            ("Paramics", PropertyTypes.Multiple, 
    38         loadImage(Images.getImage("Paramics.png"))), 
     42        loadImage(Images.getImage("Paramics.png")), new ParamicsEvent()), 
    3943    Tow                 ("Tow", PropertyTypes.Multiple, 
    40         loadImage(Images.getImage("Tow.png"))), 
     44        loadImage(Images.getImage("Tow.png")), new TowEvent()), 
    4145    Unit                ("Unit", PropertyTypes.Multiple, 
    42         loadImage(Images.getImage("Unit.png"))), 
     46        loadImage(Images.getImage("Unit.png")), new UnitEvent()), 
    4347    Witness             ("Witness", PropertyTypes.Multiple, 
    44         loadImage(Images.getImage("Witness.png"))); 
     48        loadImage(Images.getImage("Witness.png")), new WitnessEvent()); 
    4549 
    4650    private String title; 
    4751    private PropertyTypes type; 
    4852    private ImageIcon image; 
     53    private I_ScriptEvent sevt; 
    4954 
    50     private Properties(String theTitle, PropertyTypes theType, ImageIcon theImage) 
     55    private Properties(String theTitle, PropertyTypes theType, ImageIcon theImage, I_ScriptEvent se) 
    5156    { 
    5257        title = theTitle; 
    5358        type = theType; 
    5459        image = theImage; 
     60        sevt = se; 
    5561    } 
    5662 
     
    5864    { 
    5965        return title; 
     66    } 
     67     
     68    public I_ScriptEvent getEvent() 
     69    { 
     70        return ScriptEvent.factoryByType(sevt.getScriptEventType()); 
    6071    } 
    6172 
  • trunk/src/event/editor/frame/PropertyModel.java

    r130 r134  
    2323import java.util.TreeMap; 
    2424import javax.swing.JPanel; 
     25import scriptbuilder.structures.ScriptIncident; 
     26import scriptbuilder.structures.TimeSlice; 
    2527import scriptbuilder.structures.events.I_ScriptEvent; 
    2628 
     
    8284        } 
    8385    } 
     86     
     87    public void addEventFromDropdown(Properties property, ScriptIncident inc, TimeSlice ts) 
     88    { 
     89        try 
     90        { 
     91            I_ScriptEvent se = property.getEvent(); 
     92             
     93            inc.addNewEvent(se, ts.getTime()); 
     94             
     95            JPanel panel = (JPanel) classMap.get(property).newInstance(); 
     96 
     97            final PropertyPanel propertyPanel = properties.addPropertyPanel(property, panel); 
     98            if (panel instanceof I_ScriptEventEditorPanel) 
     99            { 
     100                eventMap.put(panel, se); 
     101                ((I_ScriptEventEditorPanel) panel).getEventObject(se); 
     102            } 
     103        } 
     104        catch (Exception e) 
     105        { 
     106            System.err.println("Could not create panel of type \"" + property + "\""); 
     107        } 
     108    } 
    84109 
    85110    public void removeProperty(Properties property) 
Note: See TracChangeset for help on using the changeset viewer.