Warning: Can't use blame annotator:
svn blame failed on trunk/src/event/editor/TMTRadioPanel.java: ("Can't find a temporary directory: Internal error", 20014)

source: tmcsimulator-scriptbuilder/trunk/src/event/editor/TMTRadioPanel.java @ 130

Revision 130, 3.1 KB checked in by bmcguffin, 9 years ago (diff)

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.

RevLine 
1package event.editor;
2
3import java.awt.event.*;
4import java.util.Observable;
5import scriptbuilder.structures.events.*;
6
7/**
8 *
9 * @author nathaniellehrer
10 */
11public class TMTRadioPanel extends javax.swing.JPanel implements I_ScriptEventEditorPanel
12{
13
14    private ActionListener removeListener;
15    private TMTRadioEvent event;
16
17    /**
18     * Creates new form TMTRadio
19     */
20    public TMTRadioPanel()
21    {
22        initComponents();
23    }
24
25    public void getEventObject(I_ScriptEvent sei)
26    {
27        event = (TMTRadioEvent) sei;
28        jTextArea1.setText(event.message);
29    }
30
31    public void update(Observable o, Object arg)
32    {
33        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
34    }
35   
36    @Override
37    public boolean removeAssociatedEvent()
38    {
39        ((I_ScriptEvent)event).removeThis();
40        event = null;
41        return true;
42    }
43
44    @Override
45    public void uponClose()
46    {
47        event.message = jTextArea1.getText();
48    }
49
50    /**
51     * This method is called from within the constructor to initialize the form.
52     * WARNING: Do NOT modify this code. The content of this method is always
53     * regenerated by the Form Editor.
54     */
55    @SuppressWarnings("unchecked")
56    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
57    private void initComponents() {
58
59        jLabel1 = new javax.swing.JLabel();
60        jScrollPane1 = new javax.swing.JScrollPane();
61        jTextArea1 = new javax.swing.JTextArea();
62
63        jLabel1.setText("Transmission:");
64
65        jTextArea1.setColumns(20);
66        jTextArea1.setRows(5);
67        jTextArea1.setToolTipText("The radio transmission");
68        jScrollPane1.setViewportView(jTextArea1);
69
70        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
71        this.setLayout(layout);
72        layout.setHorizontalGroup(
73            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
74            .add(layout.createSequentialGroup()
75                .addContainerGap()
76                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
77                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 487, Short.MAX_VALUE)
78                    .add(jLabel1))
79                .addContainerGap())
80        );
81        layout.setVerticalGroup(
82            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
83            .add(layout.createSequentialGroup()
84                .addContainerGap()
85                .add(jLabel1)
86                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
87                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
88                .addContainerGap())
89        );
90    }// </editor-fold>//GEN-END:initComponents
91
92
93    // Variables declaration - do not modify//GEN-BEGIN:variables
94    private javax.swing.JLabel jLabel1;
95    private javax.swing.JScrollPane jScrollPane1;
96    private javax.swing.JTextArea jTextArea1;
97    // End of variables declaration//GEN-END:variables
98
99}
Note: See TracBrowser for help on using the repository browser.