| 1 | package event.editor; |
|---|
| 2 | |
|---|
| 3 | import java.awt.event.*; |
|---|
| 4 | import java.util.Observable; |
|---|
| 5 | import scriptbuilder.structures.events.CCTVEvent; |
|---|
| 6 | import scriptbuilder.structures.events.I_ScriptEvent; |
|---|
| 7 | |
|---|
| 8 | /** |
|---|
| 9 | * |
|---|
| 10 | * @author nathaniellehrer |
|---|
| 11 | */ |
|---|
| 12 | public class CCTVPanel extends javax.swing.JPanel implements RemoveablePanel, ScriptEventEditorPanel |
|---|
| 13 | { |
|---|
| 14 | |
|---|
| 15 | private ActionListener removeListener; |
|---|
| 16 | private CCTVEvent event; |
|---|
| 17 | |
|---|
| 18 | /** |
|---|
| 19 | * Creates new form CCTVInfoPanel |
|---|
| 20 | */ |
|---|
| 21 | public CCTVPanel() |
|---|
| 22 | { |
|---|
| 23 | initComponents(); |
|---|
| 24 | |
|---|
| 25 | txtDirField.addFocusListener(new FocusListener() |
|---|
| 26 | { |
|---|
| 27 | |
|---|
| 28 | public void focusGained(FocusEvent e) |
|---|
| 29 | { |
|---|
| 30 | help.setText("Dir is an integer or decimal"); |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | public void focusLost(FocusEvent e) |
|---|
| 34 | { |
|---|
| 35 | help.setText(""); |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | }); |
|---|
| 39 | |
|---|
| 40 | txtToggleField.addFocusListener(new FocusListener() |
|---|
| 41 | { |
|---|
| 42 | |
|---|
| 43 | public void focusGained(FocusEvent e) |
|---|
| 44 | { |
|---|
| 45 | help.setText("toggle is an integer or decimal"); |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | public void focusLost(FocusEvent e) |
|---|
| 49 | { |
|---|
| 50 | help.setText(""); |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | }); |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | @Override |
|---|
| 57 | public void setRemoveListener(ActionListener listener) |
|---|
| 58 | { |
|---|
| 59 | removeListener = listener; |
|---|
| 60 | } |
|---|
| 61 | |
|---|
| 62 | @Override |
|---|
| 63 | public void getEventObject(I_ScriptEvent sei) |
|---|
| 64 | { |
|---|
| 65 | event = (CCTVEvent) sei; |
|---|
| 66 | txtIDField.setText("NOT CURRENTLY IMPLEMENTED. NO EFFECT."); |
|---|
| 67 | txtDirField.setText("NOT CURRENTLY IMPLEMENTED. NO EFFECT."); |
|---|
| 68 | txtToggleField.setText("NOT CURRENTLY IMPLEMENTED. NO EFFECT."); |
|---|
| 69 | //TODO: Add listeners for text fields |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 72 | @Override |
|---|
| 73 | public void update(Observable o, Object arg) |
|---|
| 74 | { |
|---|
| 75 | throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. |
|---|
| 76 | } |
|---|
| 77 | |
|---|
| 78 | /** |
|---|
| 79 | * This method is called from within the constructor to initialize the form. |
|---|
| 80 | * WARNING: Do NOT modify this code. The content of this method is always |
|---|
| 81 | * regenerated by the Form Editor. |
|---|
| 82 | */ |
|---|
| 83 | @SuppressWarnings("unchecked") |
|---|
| 84 | // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
|---|
| 85 | private void initComponents() |
|---|
| 86 | { |
|---|
| 87 | |
|---|
| 88 | removeButton = new javax.swing.JButton(); |
|---|
| 89 | jLabel1 = new javax.swing.JLabel(); |
|---|
| 90 | txtDirField = new javax.swing.JFormattedTextField(); |
|---|
| 91 | jLabel3 = new javax.swing.JLabel(); |
|---|
| 92 | txtIDField = new javax.swing.JTextField(); |
|---|
| 93 | jLabel2 = new javax.swing.JLabel(); |
|---|
| 94 | txtToggleField = new javax.swing.JFormattedTextField(); |
|---|
| 95 | help = new javax.swing.JLabel(); |
|---|
| 96 | |
|---|
| 97 | removeButton.setText("Remove"); |
|---|
| 98 | removeButton.addMouseListener(new java.awt.event.MouseAdapter() |
|---|
| 99 | { |
|---|
| 100 | public void mouseClicked(java.awt.event.MouseEvent evt) |
|---|
| 101 | { |
|---|
| 102 | removeButtonremoveThisProperty(evt); |
|---|
| 103 | } |
|---|
| 104 | }); |
|---|
| 105 | removeButton.addActionListener(new java.awt.event.ActionListener() |
|---|
| 106 | { |
|---|
| 107 | public void actionPerformed(java.awt.event.ActionEvent evt) |
|---|
| 108 | { |
|---|
| 109 | removeButtonActionPerformed(evt); |
|---|
| 110 | } |
|---|
| 111 | }); |
|---|
| 112 | |
|---|
| 113 | jLabel1.setText("ID"); |
|---|
| 114 | |
|---|
| 115 | txtDirField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter())); |
|---|
| 116 | |
|---|
| 117 | jLabel3.setText("Toggle"); |
|---|
| 118 | |
|---|
| 119 | jLabel2.setText("Dir"); |
|---|
| 120 | |
|---|
| 121 | txtToggleField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter())); |
|---|
| 122 | |
|---|
| 123 | org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); |
|---|
| 124 | this.setLayout(layout); |
|---|
| 125 | layout.setHorizontalGroup( |
|---|
| 126 | layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
|---|
| 127 | .add(layout.createSequentialGroup() |
|---|
| 128 | .addContainerGap() |
|---|
| 129 | .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
|---|
| 130 | .add(org.jdesktop.layout.GroupLayout.TRAILING, help, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 540, Short.MAX_VALUE) |
|---|
| 131 | .add(org.jdesktop.layout.GroupLayout.TRAILING, removeButton) |
|---|
| 132 | .add(layout.createSequentialGroup() |
|---|
| 133 | .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
|---|
| 134 | .add(jLabel1) |
|---|
| 135 | .add(jLabel2) |
|---|
| 136 | .add(jLabel3)) |
|---|
| 137 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
|---|
| 138 | .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
|---|
| 139 | .add(txtIDField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 487, Short.MAX_VALUE) |
|---|
| 140 | .add(txtDirField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 487, Short.MAX_VALUE) |
|---|
| 141 | .add(txtToggleField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 487, Short.MAX_VALUE)))) |
|---|
| 142 | .addContainerGap()) |
|---|
| 143 | ); |
|---|
| 144 | layout.setVerticalGroup( |
|---|
| 145 | layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
|---|
| 146 | .add(layout.createSequentialGroup() |
|---|
| 147 | .addContainerGap() |
|---|
| 148 | .add(removeButton) |
|---|
| 149 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) |
|---|
| 150 | .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
|---|
| 151 | .add(jLabel1) |
|---|
| 152 | .add(txtIDField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
|---|
| 153 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
|---|
| 154 | .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
|---|
| 155 | .add(jLabel2) |
|---|
| 156 | .add(txtDirField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
|---|
| 157 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
|---|
| 158 | .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
|---|
| 159 | .add(jLabel3) |
|---|
| 160 | .add(txtToggleField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
|---|
| 161 | .add(48, 48, 48) |
|---|
| 162 | .add(help, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 13, Short.MAX_VALUE) |
|---|
| 163 | .addContainerGap()) |
|---|
| 164 | ); |
|---|
| 165 | }// </editor-fold>//GEN-END:initComponents |
|---|
| 166 | |
|---|
| 167 | private void removeButtonremoveThisProperty(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_removeButtonremoveThisProperty |
|---|
| 168 | if (removeListener != null) |
|---|
| 169 | { |
|---|
| 170 | removeListener.actionPerformed(new ActionEvent(this, 0, "")); |
|---|
| 171 | } |
|---|
| 172 | }//GEN-LAST:event_removeButtonremoveThisProperty |
|---|
| 173 | |
|---|
| 174 | private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeButtonActionPerformed |
|---|
| 175 | // TODO add your handling code here: |
|---|
| 176 | }//GEN-LAST:event_removeButtonActionPerformed |
|---|
| 177 | |
|---|
| 178 | |
|---|
| 179 | // Variables declaration - do not modify//GEN-BEGIN:variables |
|---|
| 180 | private javax.swing.JLabel help; |
|---|
| 181 | private javax.swing.JLabel jLabel1; |
|---|
| 182 | private javax.swing.JLabel jLabel2; |
|---|
| 183 | private javax.swing.JLabel jLabel3; |
|---|
| 184 | private javax.swing.JButton removeButton; |
|---|
| 185 | private javax.swing.JFormattedTextField txtDirField; |
|---|
| 186 | private javax.swing.JTextField txtIDField; |
|---|
| 187 | private javax.swing.JFormattedTextField txtToggleField; |
|---|
| 188 | // End of variables declaration//GEN-END:variables |
|---|
| 189 | |
|---|
| 190 | } |
|---|