| 1 | package event.editor; |
|---|
| 2 | |
|---|
| 3 | import java.awt.event.*; |
|---|
| 4 | import java.util.Observable; |
|---|
| 5 | import scriptbuilder.structures.events.CADEvent; |
|---|
| 6 | import scriptbuilder.structures.events.I_ScriptEvent; |
|---|
| 7 | |
|---|
| 8 | /** |
|---|
| 9 | * |
|---|
| 10 | * @author nathaniellehrer |
|---|
| 11 | */ |
|---|
| 12 | public 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 | jLabel1 = new javax.swing.JLabel(); |
|---|
| 71 | jScrollPane1 = new javax.swing.JScrollPane(); |
|---|
| 72 | CadTextField = new javax.swing.JTextArea(); |
|---|
| 73 | |
|---|
| 74 | jLabel1.setText("Cad Log Detail Text"); |
|---|
| 75 | |
|---|
| 76 | CadTextField.setColumns(20); |
|---|
| 77 | CadTextField.setRows(5); |
|---|
| 78 | jScrollPane1.setViewportView(CadTextField); |
|---|
| 79 | |
|---|
| 80 | org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); |
|---|
| 81 | this.setLayout(layout); |
|---|
| 82 | layout.setHorizontalGroup( |
|---|
| 83 | layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
|---|
| 84 | .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() |
|---|
| 85 | .addContainerGap() |
|---|
| 86 | .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) |
|---|
| 87 | .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 506, Short.MAX_VALUE) |
|---|
| 88 | .add(layout.createSequentialGroup() |
|---|
| 89 | .add(jLabel1) |
|---|
| 90 | .add(0, 0, Short.MAX_VALUE))) |
|---|
| 91 | .addContainerGap()) |
|---|
| 92 | ); |
|---|
| 93 | layout.setVerticalGroup( |
|---|
| 94 | layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
|---|
| 95 | .add(layout.createSequentialGroup() |
|---|
| 96 | .add(19, 19, 19) |
|---|
| 97 | .add(jLabel1) |
|---|
| 98 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
|---|
| 99 | .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE) |
|---|
| 100 | .addContainerGap()) |
|---|
| 101 | ); |
|---|
| 102 | }// </editor-fold>//GEN-END:initComponents |
|---|
| 103 | |
|---|
| 104 | |
|---|
| 105 | // Variables declaration - do not modify//GEN-BEGIN:variables |
|---|
| 106 | private javax.swing.JTextArea CadTextField; |
|---|
| 107 | private javax.swing.JLabel jLabel1; |
|---|
| 108 | private javax.swing.JScrollPane jScrollPane1; |
|---|
| 109 | // End of variables declaration//GEN-END:variables |
|---|
| 110 | |
|---|
| 111 | } |
|---|