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

source: tmcsimulator-scriptbuilder/trunk/src/event/editor/CADLogPanel.java @ 140

Revision 140, 3.5 KB checked in by bmcguffin, 8 years ago (diff)

Fixed defect #67. Removing an event and then closing the event editor window no longer causes the program to hang; a null check for the event is encountered before taking action upon close of the window.

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