source: tmcsimulator-scriptbuilder/trunk/src/event/editor/frame/PropertyModel.java @ 101

Revision 101, 3.3 KB checked in by bmcguffin, 9 years ago (diff)

Added text field, txtEventStart, to bottom of event editor screen. This text field by default displays the time that the event starts. Altering this field will change the start time of the selected event to the new value.

Line 
1package event.editor.frame;
2
3import event.editor.AudioPanel;
4import event.editor.CADLogPanel;
5import event.editor.CCTVPanel;
6import event.editor.CHPRadioPanel;
7import event.editor.CMSEvaluationPanel;
8import event.editor.GenericEvaluationPanel;
9import event.editor.I_ScriptEventEditorPanel;
10import event.editor.MaintenanceRadioPanel;
11import event.editor.ParamicsPanel;
12import event.editor.TMTRadioPanel;
13import event.editor.TelephonePanel;
14import event.editor.TowPanel;
15import event.editor.UnitPanel;
16import event.editor.WitnessPanel;
17import java.awt.event.ActionEvent;
18import java.awt.event.ActionListener;
19import java.util.EnumMap;
20import java.util.HashMap;
21import java.util.Observable;
22import java.util.Observer;
23import java.util.TreeMap;
24import javax.swing.JPanel;
25import scriptbuilder.structures.events.I_ScriptEvent;
26
27/**
28 *
29 * @author Bryan McGuffin
30 */
31public class PropertyModel extends Observable implements Observer
32{
33
34    PropertyPanels properties = new PropertyPanels();
35
36    private EnumMap<Properties, Class> classMap
37            = new EnumMap<Properties, Class>(Properties.class);
38   
39    public HashMap<JPanel, I_ScriptEvent> eventMap = new HashMap<JPanel, I_ScriptEvent>();
40
41    public PropertyModel()
42    {
43        classMap.put(Properties.ATMS, GenericEvaluationPanel.class);
44        classMap.put(Properties.ActivityLog, GenericEvaluationPanel.class);
45        classMap.put(Properties.CAD, GenericEvaluationPanel.class);
46        classMap.put(Properties.Facilitator, GenericEvaluationPanel.class);
47        classMap.put(Properties.Radio, GenericEvaluationPanel.class);
48
49        classMap.put(Properties.MaintenanceRadio, MaintenanceRadioPanel.class);
50        classMap.put(Properties.TMTRadio, TMTRadioPanel.class);
51        classMap.put(Properties.CHPRadio, CHPRadioPanel.class);
52        classMap.put(Properties.Telephone, TelephonePanel.class);
53
54        classMap.put(Properties.Audio, AudioPanel.class);
55        classMap.put(Properties.CADLog, CADLogPanel.class);
56        classMap.put(Properties.CCTV, CCTVPanel.class);
57        classMap.put(Properties.CMS, CMSEvaluationPanel.class);
58        classMap.put(Properties.Paramics, ParamicsPanel.class);
59        classMap.put(Properties.Tow, TowPanel.class);
60        classMap.put(Properties.Unit, UnitPanel.class);
61        classMap.put(Properties.Witness, WitnessPanel.class);
62
63        properties.addObserver(this);
64    }
65
66    public void addEventPanel(Properties property, I_ScriptEvent se)
67    {
68        try
69        {
70            JPanel panel = (JPanel) classMap.get(property).newInstance();
71
72            final PropertyPanel propertyPanel = properties.addPropertyPanel(property, panel);
73            if (panel instanceof I_ScriptEventEditorPanel)
74            {
75                eventMap.put(panel, se);
76                ((I_ScriptEventEditorPanel) panel).getEventObject(se);
77            }
78        }
79        catch (Exception e)
80        {
81            System.err.println("Could not create panel of type \"" + property + "\"");
82        }
83    }
84
85    public void removeProperty(Properties property)
86    {
87        properties.removeProperty(property);
88    }
89
90    public void update(Observable o, Object arg)
91    {
92        setChanged();
93        notifyObservers(arg);
94    }
95
96    /*
97     public Vector<PropertyPanel> getPropertyPanels()
98     {
99     return properties.getProperties();
100     }
101     */
102}
Note: See TracBrowser for help on using the repository browser.